From 952aaaa4c2123f63ca0f0b84496464e412d67097 Mon Sep 17 00:00:00 2001 From: luoliangyi <87842688@qq.com> Date: Thu, 18 Aug 2022 17:11:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=87=E7=BA=A7=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E5=9C=A8=E6=9F=A5=E8=AF=A2=E8=BF=9B=E7=A8=8B=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=97=B6=E5=80=99=E7=9A=84=E4=BD=BF=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/upgrade/HGUpgrade.cpp | 6 +++--- build-qt/HGSolution/HGUpgrade/HGUpgrade.pro | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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