修改升级程序在查询进程信息时候的使用的权限

This commit is contained in:
luoliangyi 2022-08-18 17:11:25 +08:00
parent 4fbe5577db
commit 952aaaa4c2
2 changed files with 4 additions and 4 deletions

View File

@ -5,6 +5,7 @@
#if defined(HG_CMP_MSC)
#include <shellapi.h>
#include <tlhelp32.h>
#include <psapi.h>
#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);
}

View File

@ -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