[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r1245: Minor tweak to the last patch so we don't leave a handle ope (trunk/src/util)
Author: edmanm
Date: 2006-09-26 22:57:13 -0400 (Tue, 26 Sep 2006)
New Revision: 1245
Modified:
trunk/src/util/win32.cpp
Log:
Minor tweak to the last patch so we don't leave a handle open if Process32First() fails.
Modified: trunk/src/util/win32.cpp
===================================================================
--- trunk/src/util/win32.cpp 2006-09-27 02:32:47 UTC (rev 1244)
+++ trunk/src/util/win32.cpp 2006-09-27 02:57:13 UTC (rev 1245)
@@ -161,19 +161,18 @@
proc.dwSize = sizeof(PROCESSENTRY32);
/* Iterate through all the processes in the snapshot */
- if (!Process32First(hSnapshot, &proc)) {
- return procList;
+ if (Process32First(hSnapshot, &proc)) {
+ do {
+ /* Extract the PID and exe filename from the process record */
+ pid = (quint64)proc.th32ProcessID;
+ QT_WA(
+ exeFile = QString::fromUtf16((const ushort *)proc.szExeFile);,
+ exeFile = QString::fromAscii((const char *)proc.szExeFile);
+ )
+ /* Add this process to our list */
+ procList.insert(pid, exeFile);
+ } while (Process32Next(hSnapshot, &proc));
}
- do {
- /* Extract the PID and exe filename from the process record */
- pid = (quint64)proc.th32ProcessID;
- QT_WA(
- exeFile = QString::fromUtf16((const ushort *)proc.szExeFile);,
- exeFile = QString::fromAscii((const char *)proc.szExeFile);
- )
- /* Add this process to our list */
- procList.insert(pid, exeFile);
- } while (Process32Next(hSnapshot, &proc));
CloseHandle(hSnapshot);
}
return procList;