Mercurial > trustbridge
annotate ui/processhelp_win.cpp @ 1152:46f025a1450c
Added hint that the installer can be quit with C-c after finishing.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Thu, 18 Sep 2014 15:44:21 +0200 |
parents | 20ca94680003 |
children |
rev | line source |
---|---|
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
3 * |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=2) |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
6 * See LICENSE.txt for details. */ |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
7 |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
8 #ifdef WIN32 |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
9 #include "processhelp.h" |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
10 #include "strhelp.h" |
670
175370634226
Move getProcessOwner to util and use it to skip the current user in locate other hives
Andre Heinecke <andre.heinecke@intevation.de>
parents:
608
diff
changeset
|
11 #include "util.h" |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
12 |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
13 #include <windows.h> |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
14 #include <tlhelp32.h> |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
15 #include <psapi.h> |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
16 #include <unistd.h> |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
17 |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
18 #include <QDebug> |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
19 |
606
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
20 struct EnumWindowsStruct { |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
21 EnumWindowsStruct() : windowId(0) {} |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
22 DWORD pid; |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
23 HWND windowId; |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
24 }; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
25 |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
26 BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
27 { |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
28 if (GetWindowLong(hwnd, GWL_STYLE) & WS_VISIBLE) { |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
29 |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
30 DWORD pidwin; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
31 |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
32 GetWindowThreadProcessId(hwnd, &pidwin); |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
33 if (pidwin == ((EnumWindowsStruct *)lParam)->pid) { |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
34 ((EnumWindowsStruct *)lParam)->windowId = hwnd; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
35 return FALSE; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
36 } |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
37 } |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
38 return TRUE; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
39 } |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
40 |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
41 static HANDLE getProcessHandle(int processID) |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
42 { |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
43 return OpenProcess(SYNCHRONIZE | |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
44 PROCESS_QUERY_INFORMATION | |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
45 PROCESS_VM_READ | |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
46 PROCESS_TERMINATE, |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
47 false, processID); |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
48 } |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
49 |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
50 const QList<int> ProcessHelp::getProcessesIdForName(const QString &processName) |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
51 { |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
52 HANDLE h; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
53 PROCESSENTRY32 pe32; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
54 QList <int> pids; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
55 |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
56 h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
57 if (h == INVALID_HANDLE_VALUE) { |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
58 return pids; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
59 } |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
60 |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
61 pe32.dwSize = sizeof(PROCESSENTRY32); // Necessary according to MSDN |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
62 if (!Process32First(h, &pe32)) { |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
63 return pids; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
64 } |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
65 |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
66 pids.clear(); |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
67 |
608
81a44b93229e
Be more permissive with process names. Case insenstive and with suffix or not.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
606
diff
changeset
|
68 const QString processNameLower = processName.toLower().replace(".exe", ""); |
81a44b93229e
Be more permissive with process names. Case insenstive and with suffix or not.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
606
diff
changeset
|
69 const QString processNameExe = processNameLower + ".exe"; |
81a44b93229e
Be more permissive with process names. Case insenstive and with suffix or not.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
606
diff
changeset
|
70 |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
71 do { |
608
81a44b93229e
Be more permissive with process names. Case insenstive and with suffix or not.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
606
diff
changeset
|
72 const QString exeFile = QString::fromWCharArray(pe32.szExeFile).toLower(); |
81a44b93229e
Be more permissive with process names. Case insenstive and with suffix or not.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
606
diff
changeset
|
73 if (exeFile == processNameLower || exeFile == processNameExe) { |
670
175370634226
Move getProcessOwner to util and use it to skip the current user in locate other hives
Andre Heinecke <andre.heinecke@intevation.de>
parents:
608
diff
changeset
|
74 PSID user_sid = get_process_owner(GetCurrentProcess()); |
606
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
75 if (user_sid) { |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
76 // Also check that we are the owner of that process |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
77 HANDLE hProcess = getProcessHandle(pe32.th32ProcessID); |
606
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
78 if (!hProcess) { |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
79 continue; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
80 } |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
81 |
670
175370634226
Move getProcessOwner to util and use it to skip the current user in locate other hives
Andre Heinecke <andre.heinecke@intevation.de>
parents:
608
diff
changeset
|
82 PSID sid = get_process_owner(hProcess); |
175370634226
Move getProcessOwner to util and use it to skip the current user in locate other hives
Andre Heinecke <andre.heinecke@intevation.de>
parents:
608
diff
changeset
|
83 PSID userSid = get_process_owner(GetCurrentProcess()); |
606
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
84 if (!sid || (userSid && !EqualSid(userSid, sid))) { |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
85 free(sid); |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
86 continue; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
87 } |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
88 } |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
89 pids.append((int)pe32.th32ProcessID); |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
90 qDebug() << "found PID: " << (int)pe32.th32ProcessID; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
91 } |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
92 } while (Process32Next(h, &pe32)); |
606
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
93 CloseHandle(h); |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
94 return pids; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
95 } |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
96 |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
97 bool ProcessHelp::otherProcessesExist(const QString &processName) |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
98 { |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
99 const QList<int> pids = getProcessesIdForName(processName); |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
100 int myPid = getpid(); |
606
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
101 foreach(int pid, pids) { |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
102 if (myPid != pid) { |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
103 qDebug() << "Found another process with id: " << pid; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
104 return true; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
105 } |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
106 } |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
107 return false; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
108 } |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
109 |
606
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
110 void ProcessHelp::activateWindowForProcess(const QString &executableName) |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
111 { |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
112 const QList<int> pids = getProcessesIdForName(executableName); |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
113 int myPid = getpid(); |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
114 int foundPid = 0; |
606
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
115 foreach(int pid, pids) { |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
116 if (myPid != pid) { |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
117 qDebug() << "activateWindowForProcess(): PID to activate:" << pid; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
118 foundPid = pid; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
119 break; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
120 } |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
121 } |
606
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
122 if (foundPid == 0) { |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
123 return; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
124 } |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
125 EnumWindowsStruct winStruct; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
126 winStruct.pid = foundPid; |
606
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
127 EnumWindows(EnumWindowsProc, (LPARAM)&winStruct); |
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
128 if (winStruct.windowId == 0) { |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
129 return; |
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
130 } |
606
91dd38a71783
Style: run astyle on processhelp
Andre Heinecke <andre.heinecke@intevation.de>
parents:
603
diff
changeset
|
131 SetForegroundWindow(winStruct.windowId); |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
132 } |
782
20ca94680003
Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
670
diff
changeset
|
133 |
20ca94680003
Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
670
diff
changeset
|
134 void ProcessHelp::cleanUp() { |
20ca94680003
Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
670
diff
changeset
|
135 // Nothing to do on Windows. |
20ca94680003
Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
670
diff
changeset
|
136 return; |
20ca94680003
Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
670
diff
changeset
|
137 } |
20ca94680003
Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
670
diff
changeset
|
138 |
603
cfef809b890d
Add Process Management functions and ther implementation for windows.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
139 #endif // WIN32 |