Fix MinGW valgrind build

QueryFullProcessImageName is only available on Windows >= Vista.
iSetting _WIN32_WINNT fixes availability on MinGW and moving the
functionality to winutils avoids code duplication.

Change-Id: I0ff1a12a1c092b1ad9cde75b636b52c5b959ce7d
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Oliver Wolff
2018-02-05 12:15:57 +01:00
parent 88a889d45a
commit 74d718c001
4 changed files with 26 additions and 46 deletions

View File

@@ -98,6 +98,8 @@
#include <QStandardPaths>
#include <QWinEventNotifier>
#include <utils/winutils.h>
#include <windows.h>
#endif
@@ -1503,15 +1505,7 @@ void HeobData::processFinished()
debugger->setStartMode(AttachExternal);
debugger->setCloseMode(DetachAtClose);
debugger->setContinueAfterAttach(true);
HANDLE p = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, m_data[1]);
if (p != NULL) {
wchar_t path[MAX_PATH];
DWORD pathLen = MAX_PATH;
if (QueryFullProcessImageName(p, 0, path, &pathLen))
debugger->setInferiorExecutable(QString::fromWCharArray(path));
CloseHandle(p);
}
debugger->setInferiorExecutable(Utils::imageName(m_data[1]));
connect(m_runControl, &RunControl::started, this, &HeobData::debugStarted);
connect(m_runControl, &RunControl::stopped, this, &HeobData::debugStopped);