From: Mike McCormack Date: Fri, 29 Oct 2004 21:26:33 +0000 (+0000) Subject: Kill all wine processes when doing ExitWindowsEx. X-Git-Tag: wine-20041201~230 X-Git-Url: http://git.etersoft.ru/projects/?a=commitdiff_plain;h=e1d1d34c9d1992db4c98b6a8ba5502f2c949cac4;p=wine%2Feterwine.git Kill all wine processes when doing ExitWindowsEx. --- diff --git a/windows/user.c b/windows/user.c index 85d5227fc5..4e57bdf04c 100644 --- a/windows/user.c +++ b/windows/user.c @@ -30,6 +30,7 @@ #include "wine/winuser16.h" #include "winreg.h" #include "winternl.h" +#include "tlhelp32.h" #include "user.h" #include "win.h" #include "controls.h" @@ -293,6 +294,124 @@ BOOL16 WINAPI ExitWindowsExec16( LPCSTR lpszExe, LPCSTR lpszParams ) } +/*********************************************************************** + * USER_GetProcessHandleList(Internal) + */ +static HANDLE *USER_GetProcessHandleList(void) +{ + DWORD count, i, n; + HANDLE *list; + PROCESSENTRY32 pe; + HANDLE hSnapshot; + BOOL r; + + hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 ); + if (!hSnapshot) + { + ERR("cannot create snapshot\n"); + return FALSE; + } + + /* count the number of processes plus one */ + for (count=0; ;count++) + { + pe.dwSize = sizeof pe; + if (count) + r = Process32Next( hSnapshot, &pe ); + else + r = Process32First( hSnapshot, &pe ); + if (!r) + break; + } + + /* allocate memory make a list of the process handles */ + list = HeapAlloc( GetProcessHeap(), 0, (count+1)*sizeof(HANDLE) ); + n=0; + for (i=0; iMAXIMUM_WAIT_OBJECTS) ? MAXIMUM_WAIT_OBJECTS : (n-i); + r = WaitForMultipleObjects( n_objs, &handles[i], TRUE, dwShutdownTimeout ); + if (r==WAIT_TIMEOUT) + ERR("wait failed!\n"); + } + + /* close the handles */ + for (i=0; i