Correct implementation of GetWindowThreadProcessId().

This commit is contained in:
Ulrich Weigand 1999-05-04 15:57:27 +00:00 committed by Alexandre Julliard
parent 73496798e0
commit 279d1174fd
1 changed files with 12 additions and 8 deletions

View File

@ -1357,18 +1357,22 @@ HTASK16 WINAPI GetWindowTask16( HWND16 hwnd )
*/ */
DWORD WINAPI GetWindowThreadProcessId( HWND hwnd, LPDWORD process ) DWORD WINAPI GetWindowThreadProcessId( HWND hwnd, LPDWORD process )
{ {
HTASK16 htask; DWORD retvalue;
TDB *tdb; MESSAGEQUEUE *queue;
WND *wndPtr = WIN_FindWndPtr( hwnd ); WND *wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return 0; if (!wndPtr) return 0;
htask=QUEUE_GetQueueTask( wndPtr->hmemTaskQ );
queue = QUEUE_Lock( wndPtr->hmemTaskQ );
WIN_ReleaseWndPtr(wndPtr); WIN_ReleaseWndPtr(wndPtr);
tdb = (TDB*)GlobalLock16(htask);
if (!tdb || !tdb->thdb) return 0; if (!queue) return 0;
if (process) *process = (DWORD)tdb->thdb->process->server_pid;
return (DWORD)tdb->thdb->server_tid; if ( process ) *process = (DWORD)queue->thdb->process->server_pid;
retvalue = (DWORD)queue->thdb->server_tid;
QUEUE_Unlock( queue );
return retvalue;
} }