From 53896e66f113519253892903404264b4e49ab8a6 Mon Sep 17 00:00:00 2001 From: Tannin Date: Tue, 11 Nov 2014 23:48:22 +0100 Subject: - updated staging script to use qt5 and to fetch translations from transifex - removed call to function unavailable in Windows XP --- src/mainwindow.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d6d4ebe3..024e2510 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -226,8 +226,8 @@ MainWindow::MainWindow(const QString &exeName, QSettings &initSettings, QWidget ui->modList->header()->restoreState(initSettings.value("mod_list_state").toByteArray()); // hack: force the resize-signal to be triggered because restoreState doesn't seem to do that - ui->modList->header()->resizeSection(ModList::COL_CONTENT, sectionSize + 1); - ui->modList->header()->resizeSection(ModList::COL_CONTENT, sectionSize - 1); + ui->modList->header()->resizeSection(ModList::COL_CONTENT, ui->modList->header()->sectionSize(ModList::COL_CONTENT) + 1); + ui->modList->header()->resizeSection(ModList::COL_CONTENT, ui->modList->header()->sectionSize(ModList::COL_CONTENT) - 1); } else { // hide these columns by default ui->modList->header()->setSectionHidden(ModList::COL_CONTENT, true); @@ -1425,10 +1425,18 @@ 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; + if (::GetProcessImageFileNameW(process, buffer, MAX_PATH) != 0) { + wchar_t *fileName = wcsrchr(buffer, L'\\'); + if (fileName == nullptr) { + fileName = buffer; + } else { + fileName += 1; + } + return fileName; + } else { + return std::wstring(L"unknown"); + } } void MainWindow::spawnBinary(const QFileInfo &binary, const QString &arguments, const QDir ¤tDirectory, bool closeAfterStart, const QString &steamAppID) @@ -1460,12 +1468,12 @@ void MainWindow::spawnBinary(const QFileInfo &binary, const QString &arguments, if (isJobHandle) { if (::QueryInformationJobObject(processHandle, JobObjectBasicProcessIdList, &info, sizeof(info), &retLen) > 0) { if (info.NumberOfProcessIdsInList == 0) { + break; } else { if (info.ProcessIdList[0] != currentProcess) { currentProcess = info.ProcessIdList[0]; dialog->setProcessName(ToQString(getProcessName(currentProcess))); } - break; } } else { // the info-object I passed only provides space for 1 process id. but since this code only cares about whether there -- cgit v1.3.1