diff options
| author | Tannin <devnull@localhost> | 2014-09-29 20:35:35 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2014-09-29 20:35:35 +0200 |
| commit | db0e278817cf5a36e15f1945c52e73726598e8d9 (patch) | |
| tree | d11067e844c680a3f1c907cfd624a39dd731e290 /src/mainwindow.cpp | |
| parent | 2ce135e0bf7ce2c801b1a8d57fe10b099b9007aa (diff) | |
- moved the hook-recursion-protection to tls
- some code cleanup and consolidation
- hook.dll will now report all of its own exceptions
- some more logging during startup
- changed the way urls are encoded for download requests
- now displaying (one of the) process name(s) while waiting for a program to end
- bugfix: spawned processes were forced to leave the job
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 19be758e..17743312 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1410,6 +1410,15 @@ HANDLE MainWindow::spawnBinaryDirect(const QFileInfo &binary, const QString &arg }
}
+std::wstring getProcessName(DWORD processId)
+{
+ HANDLE process = ::OpenProcess(PROCESS_QUERY_INFORMATION, false, processId);
+
+ DWORD value = MAX_PATH;
+ wchar_t buffer[MAX_PATH];
+ ::QueryFullProcessImageNameW(process, 0, buffer, &value);
+ return buffer;
+}
void MainWindow::spawnBinary(const QFileInfo &binary, const QString &arguments, const QDir ¤tDirectory, bool closeAfterStart, const QString &steamAppID)
{
@@ -1432,6 +1441,7 @@ void MainWindow::spawnBinary(const QFileInfo &binary, const QString &arguments, JOBOBJECT_BASIC_PROCESS_ID_LIST info;
{
+ DWORD currentProcess = 0UL;
bool isJobHandle = true;
DWORD res = ::MsgWaitForMultipleObjects(1, &processHandle, false, 1000, QS_KEY | QS_MOUSE);
@@ -1439,6 +1449,11 @@ void MainWindow::spawnBinary(const QFileInfo &binary, const QString &arguments, if (isJobHandle) {
if (::QueryInformationJobObject(processHandle, JobObjectBasicProcessIdList, &info, sizeof(info), &retLen) > 0) {
if (info.NumberOfProcessIdsInList == 0) {
+ } else {
+ if (info.ProcessIdList[0] != currentProcess) {
+ currentProcess = info.ProcessIdList[0];
+ dialog->setProcessName(ToQString(getProcessName(currentProcess)));
+ }
break;
}
} else {
|
