From 5819b6dd3900aab9461f4ec5752e9a051db20902 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sun, 8 Apr 2018 16:13:28 +0800 Subject: [PATCH] Use Unicode version of InitiateSystemShutdown --- src/base/utils/misc.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/base/utils/misc.cpp b/src/base/utils/misc.cpp index 3309bccdd..b09ab07c1 100644 --- a/src/base/utils/misc.cpp +++ b/src/base/utils/misc.cpp @@ -124,7 +124,10 @@ void Utils::Misc::shutdownComputer(const ShutdownDialogAction &action) setSuspendState(true, false, false); } else { - InitiateSystemShutdownA(0, QCoreApplication::translate("misc", "qBittorrent will shutdown the computer now because all downloads are complete.").toLocal8Bit().data(), 10, true, false); + const QString msg = QCoreApplication::translate("misc", "qBittorrent will shutdown the computer now because all downloads are complete."); + std::unique_ptr msgWchar(new wchar_t[msg.length() + 1] {}); + msg.toWCharArray(msgWchar.get()); + ::InitiateSystemShutdownW(nullptr, msgWchar.get(), 10, true, false); } // Disable shutdown privilege.