diff --git a/app/upgrade/HGUpgrade.cpp b/app/upgrade/HGUpgrade.cpp index 89c40948..e17e3f3a 100644 --- a/app/upgrade/HGUpgrade.cpp +++ b/app/upgrade/HGUpgrade.cpp @@ -5,6 +5,7 @@ #if defined(HG_CMP_MSC) #include #include +#include #endif bool AppIsRun(const std::string& appName) @@ -54,11 +55,10 @@ bool AppIsRun(const std::string& appName) do { WCHAR exeFullPath[1024] = { 0 }; - HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe.th32ProcessID); + HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pe.th32ProcessID); if (nullptr != hProcess) { - DWORD bufferLen = 1024; - ::QueryFullProcessImageName(hProcess, 0, exeFullPath, &bufferLen); + ::GetProcessImageFileNameW(hProcess, exeFullPath, 1024); ::CloseHandle(hProcess); } diff --git a/build-qt/HGSolution/HGUpgrade/HGUpgrade.pro b/build-qt/HGSolution/HGUpgrade/HGUpgrade.pro index e9e152fd..ebcbd142 100644 --- a/build-qt/HGSolution/HGUpgrade/HGUpgrade.pro +++ b/build-qt/HGSolution/HGUpgrade/HGUpgrade.pro @@ -24,7 +24,7 @@ TARGET = HGUpgradeApp win32 { DEFINES += _CRT_SECURE_NO_WARNINGS - LIBS += -ladvapi32 + LIBS += -ladvapi32 -lpsapi contains(QT_ARCH, i386) { LIBS += -L../../../../sdk/lib/win/x86/Release -lHGBase -lHGVersion