Avoid using GetFastQueue16 from USER.
This commit is contained in:
parent
188b32b73f
commit
8afe6628f8
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "ts_xlib.h"
|
||||
|
||||
#include "wine/winuser16.h"
|
||||
#include "win.h"
|
||||
#include "x11drv.h"
|
||||
#include "debugtools.h"
|
||||
|
@ -54,7 +55,7 @@ static DWORD CALLBACK desktop_thread( LPVOID driver_data )
|
|||
|
||||
/* patch the desktop window queue to point to our queue */
|
||||
win = WIN_FindWndPtr( hwnd );
|
||||
win->hmemTaskQ = GetFastQueue16();
|
||||
win->hmemTaskQ = InitThreadInput16( 0, 0 );
|
||||
X11DRV_register_window( display, hwnd, win->pDriverData );
|
||||
WIN_ReleaseWndPtr( win );
|
||||
|
||||
|
|
|
@ -63,14 +63,13 @@ HWND PERQDATA_GetCaptureWnd( INT *hittest );
|
|||
HWND PERQDATA_SetCaptureWnd( HWND hWndCapture, INT hittest );
|
||||
|
||||
/* Message queue management methods */
|
||||
extern MESSAGEQUEUE *QUEUE_Current(void);
|
||||
extern MESSAGEQUEUE *QUEUE_Lock( HQUEUE16 hQueue );
|
||||
extern void QUEUE_Unlock( MESSAGEQUEUE *queue );
|
||||
extern BOOL QUEUE_IsExitingQueue( HQUEUE16 hQueue );
|
||||
extern void QUEUE_SetExitingQueue( HQUEUE16 hQueue );
|
||||
extern BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue );
|
||||
extern void QUEUE_DeleteMsgQueue(void);
|
||||
extern HTASK16 QUEUE_GetQueueTask( HQUEUE16 hQueue );
|
||||
extern void QUEUE_CleanupWindow( HWND hwnd );
|
||||
|
||||
extern HQUEUE16 WINAPI InitThreadInput16( WORD unknown, WORD flags );
|
||||
|
||||
#endif /* __WINE_QUEUE_H */
|
||||
|
|
|
@ -783,6 +783,7 @@ VOID WINAPI HideCaret16(HWND16);
|
|||
BOOL16 WINAPI HiliteMenuItem16(HWND16,HMENU16,UINT16,UINT16);
|
||||
DWORD WINAPI IconSize16(void);
|
||||
void WINAPI InflateRect16(LPRECT16,INT16,INT16);
|
||||
HQUEUE16 WINAPI InitThreadInput16(WORD,WORD);
|
||||
BOOL16 WINAPI InSendMessage16(void);
|
||||
BOOL16 WINAPI InsertMenu16(HMENU16,UINT16,UINT16,UINT16,SEGPTR);
|
||||
BOOL16 WINAPI InsertMenuItem16(HMENU16,UINT16,BOOL16,const MENUITEMINFO16*);
|
||||
|
|
|
@ -131,7 +131,7 @@ BOOL CLIPBOARD_IsLocked()
|
|||
* clipboard in order to update data in response to this message.
|
||||
*/
|
||||
#if 0
|
||||
MESSAGEQUEUE *queue = QUEUE_Lock( GetFastQueue16() );
|
||||
MESSAGEQUEUE *queue = QUEUE_Current();
|
||||
|
||||
if ( queue
|
||||
&& queue->smWaiting
|
||||
|
@ -139,8 +139,6 @@ BOOL CLIPBOARD_IsLocked()
|
|||
&& queue->smWaiting->hSrcQueue
|
||||
)
|
||||
bIsLocked = FALSE;
|
||||
|
||||
QUEUE_Unlock( queue );
|
||||
#else
|
||||
/* FIXME: queue check no longer possible */
|
||||
bIsLocked = FALSE;
|
||||
|
|
|
@ -64,7 +64,7 @@ HWND WINAPI SetFocus( HWND hwnd )
|
|||
BOOL16 bRet = 0;
|
||||
|
||||
/* Get the messageQ for the current thread */
|
||||
if (!(pCurMsgQ = (MESSAGEQUEUE *)QUEUE_Lock( GetFastQueue16() )))
|
||||
if (!(pCurMsgQ = QUEUE_Current()))
|
||||
{
|
||||
WARN("\tCurrent message queue not found. Exiting!\n" );
|
||||
goto CLEANUP;
|
||||
|
@ -149,8 +149,6 @@ CLEANUP:
|
|||
/* Unlock the queues before returning */
|
||||
if ( pMsgQ )
|
||||
QUEUE_Unlock( pMsgQ );
|
||||
if ( pCurMsgQ )
|
||||
QUEUE_Unlock( pCurMsgQ );
|
||||
|
||||
WIN_ReleaseWndPtr(wndPtr);
|
||||
return bRet ? hWndFocus : 0;
|
||||
|
@ -172,19 +170,14 @@ HWND16 WINAPI GetFocus16(void)
|
|||
HWND WINAPI GetFocus(void)
|
||||
{
|
||||
MESSAGEQUEUE *pCurMsgQ = 0;
|
||||
HWND hwndFocus = 0;
|
||||
|
||||
/* Get the messageQ for the current thread */
|
||||
if (!(pCurMsgQ = (MESSAGEQUEUE *)QUEUE_Lock( GetFastQueue16() )))
|
||||
if (!(pCurMsgQ = QUEUE_Current()))
|
||||
{
|
||||
WARN("\tCurrent message queue not found. Exiting!\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get the current focus from the perQ data of the current message Q */
|
||||
hwndFocus = PERQDATA_GetFocusWnd( pCurMsgQ->pQData );
|
||||
|
||||
QUEUE_Unlock( pCurMsgQ );
|
||||
|
||||
return hwndFocus;
|
||||
return PERQDATA_GetFocusWnd( pCurMsgQ->pQData );
|
||||
}
|
||||
|
|
|
@ -835,16 +835,14 @@ static HANDLE16 HOOK_GetNextHook( HANDLE16 hook )
|
|||
*
|
||||
* Get the first hook for a given type.
|
||||
*/
|
||||
static HANDLE16 HOOK_GetHook( INT16 id, HQUEUE16 hQueue )
|
||||
static HANDLE16 HOOK_GetHook( INT16 id )
|
||||
{
|
||||
MESSAGEQUEUE *queue;
|
||||
HANDLE16 hook = 0;
|
||||
|
||||
if ((queue = (MESSAGEQUEUE *)QUEUE_Lock( hQueue )) != NULL)
|
||||
if ((queue = QUEUE_Current()) != NULL)
|
||||
hook = queue->hooks[id - WH_MINHOOK];
|
||||
if (!hook) hook = HOOK_systemHooks[id - WH_MINHOOK];
|
||||
|
||||
QUEUE_Unlock( queue );
|
||||
return hook;
|
||||
}
|
||||
|
||||
|
@ -870,7 +868,7 @@ static HHOOK HOOK_SetHook( INT16 id, LPVOID proc, INT type,
|
|||
id, (UINT)proc, hModule, dwThreadId );
|
||||
|
||||
/* Create task queue if none present */
|
||||
GetFastQueue16();
|
||||
InitThreadInput16( 0, 0 );
|
||||
|
||||
if (id == WH_JOURNALPLAYBACK) EnableHardwareInput16(FALSE);
|
||||
|
||||
|
@ -1018,7 +1016,7 @@ static LRESULT HOOK_CallHook( HANDLE16 hook, INT fromtype, INT code,
|
|||
|
||||
/* Now call it */
|
||||
|
||||
if (!(queue = (MESSAGEQUEUE *)QUEUE_Lock( GetFastQueue16() ))) return 0;
|
||||
if (!(queue = QUEUE_Current())) return 0;
|
||||
prevHook = queue->hCurHook;
|
||||
queue->hCurHook = hook;
|
||||
data->flags |= HOOK_INUSE;
|
||||
|
@ -1047,8 +1045,6 @@ static LRESULT HOOK_CallHook( HANDLE16 hook, INT fromtype, INT code,
|
|||
data->flags &= ~HOOK_INUSE;
|
||||
queue->hCurHook = prevHook;
|
||||
|
||||
QUEUE_Unlock( queue );
|
||||
|
||||
if (UnMapFunc)
|
||||
UnMapFunc( data->id, code, wParamOrig, lParamOrig, wParam, lParam );
|
||||
|
||||
|
@ -1068,10 +1064,7 @@ static LRESULT HOOK_CallHook( HANDLE16 hook, INT fromtype, INT code,
|
|||
*/
|
||||
BOOL HOOK_IsHooked( INT16 id )
|
||||
{
|
||||
/* Hmmm. Use GetThreadQueue(0) instead of GetFastQueue() here to
|
||||
avoid queue being created if someone wants to merely check ... */
|
||||
|
||||
return HOOK_GetHook( id, GetThreadQueue16(0) ) != 0;
|
||||
return HOOK_GetHook( id ) != 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1085,7 +1078,7 @@ LRESULT HOOK_CallHooks16( INT16 id, INT16 code, WPARAM16 wParam,
|
|||
{
|
||||
HANDLE16 hook;
|
||||
|
||||
if (!(hook = HOOK_GetHook( id, GetFastQueue16() ))) return 0;
|
||||
if (!(hook = HOOK_GetHook( id ))) return 0;
|
||||
if (!(hook = HOOK_FindValidHook(hook))) return 0;
|
||||
return HOOK_CallHook( hook, HOOK_WIN16, code, wParam, lParam );
|
||||
}
|
||||
|
@ -1100,7 +1093,7 @@ LRESULT HOOK_CallHooksA( INT id, INT code, WPARAM wParam,
|
|||
{
|
||||
HANDLE16 hook;
|
||||
|
||||
if (!(hook = HOOK_GetHook( id, GetFastQueue16() ))) return 0;
|
||||
if (!(hook = HOOK_GetHook( id ))) return 0;
|
||||
if (!(hook = HOOK_FindValidHook(hook))) return 0;
|
||||
return HOOK_CallHook( hook, HOOK_WIN32A, code, wParam, lParam );
|
||||
}
|
||||
|
@ -1115,42 +1108,13 @@ LRESULT HOOK_CallHooksW( INT id, INT code, WPARAM wParam,
|
|||
{
|
||||
HANDLE16 hook;
|
||||
|
||||
if (!(hook = HOOK_GetHook( id, GetFastQueue16() ))) return 0;
|
||||
if (!(hook = HOOK_GetHook( id ))) return 0;
|
||||
if (!(hook = HOOK_FindValidHook(hook))) return 0;
|
||||
return HOOK_CallHook( hook, HOOK_WIN32W, code, wParam,
|
||||
lParam );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HOOK_ResetQueueHooks
|
||||
*/
|
||||
void HOOK_ResetQueueHooks( HQUEUE16 hQueue )
|
||||
{
|
||||
MESSAGEQUEUE *queue;
|
||||
|
||||
if ((queue = (MESSAGEQUEUE *)QUEUE_Lock( hQueue )) != NULL)
|
||||
{
|
||||
HOOKDATA* data;
|
||||
HHOOK hook;
|
||||
int id;
|
||||
for( id = WH_MINHOOK; id <= WH_MAXHOOK; id++ )
|
||||
{
|
||||
hook = queue->hooks[id - WH_MINHOOK];
|
||||
while( hook )
|
||||
{
|
||||
if( (data = (HOOKDATA *)USER_HEAP_LIN_ADDR(hook)) )
|
||||
{
|
||||
data->ownerQueue = hQueue;
|
||||
hook = data->next;
|
||||
} else break;
|
||||
}
|
||||
}
|
||||
|
||||
QUEUE_Unlock( queue );
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* HOOK_FreeModuleHooks
|
||||
*/
|
||||
|
@ -1183,9 +1147,9 @@ void HOOK_FreeModuleHooks( HMODULE16 hModule )
|
|||
/***********************************************************************
|
||||
* HOOK_FreeQueueHooks
|
||||
*/
|
||||
void HOOK_FreeQueueHooks( HQUEUE16 hQueue )
|
||||
void HOOK_FreeQueueHooks(void)
|
||||
{
|
||||
/* remove all hooks registered by this queue */
|
||||
/* remove all hooks registered by the current queue */
|
||||
|
||||
HOOKDATA* hptr = NULL;
|
||||
HHOOK hook, next;
|
||||
|
@ -1193,13 +1157,13 @@ void HOOK_FreeQueueHooks( HQUEUE16 hQueue )
|
|||
|
||||
for( id = WH_MINHOOK; id <= WH_MAXHOOK; id++ )
|
||||
{
|
||||
hook = HOOK_GetHook( id, hQueue );
|
||||
hook = HOOK_GetHook( id );
|
||||
while( hook )
|
||||
{
|
||||
next = HOOK_GetNextHook(hook);
|
||||
|
||||
hptr = (HOOKDATA *)USER_HEAP_LIN_ADDR(hook);
|
||||
if( hptr && hptr->ownerQueue == hQueue )
|
||||
if( hptr && hptr->ownerQueue )
|
||||
{
|
||||
hptr->flags &= HOOK_MAPTYPE;
|
||||
HOOK_RemoveHook(hook);
|
||||
|
@ -1287,7 +1251,7 @@ BOOL16 WINAPI UnhookWindowsHook16( INT16 id, HOOKPROC16 proc )
|
|||
*/
|
||||
BOOL WINAPI UnhookWindowsHook( INT id, HOOKPROC proc )
|
||||
{
|
||||
HANDLE16 hook = HOOK_GetHook( id, GetFastQueue16() );
|
||||
HANDLE16 hook = HOOK_GetHook( id );
|
||||
|
||||
TRACE("%d %08lx\n", id, (DWORD)proc );
|
||||
|
||||
|
@ -1373,12 +1337,9 @@ LRESULT WINAPI DefHookProc16( INT16 code, WPARAM16 wParam, LPARAM lParam,
|
|||
/* Note: the *hhook parameter is never used, since we rely on the
|
||||
* current hook value from the task queue to find the next hook. */
|
||||
MESSAGEQUEUE *queue;
|
||||
LRESULT ret;
|
||||
|
||||
if (!(queue = (MESSAGEQUEUE *)QUEUE_Lock( GetFastQueue16() ))) return 0;
|
||||
ret = CallNextHookEx16( queue->hCurHook, code, wParam, lParam );
|
||||
QUEUE_Unlock( queue );
|
||||
return ret;
|
||||
if (!(queue = QUEUE_Current())) return 0;
|
||||
return CallNextHookEx16( queue->hCurHook, code, wParam, lParam );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -499,7 +499,7 @@ HWND EVENT_Capture(HWND hwnd, INT16 ht)
|
|||
}
|
||||
|
||||
/* Get the messageQ for the current thread */
|
||||
if (!(pCurMsgQ = (MESSAGEQUEUE *)QUEUE_Lock( GetFastQueue16() )))
|
||||
if (!(pCurMsgQ = QUEUE_Current()))
|
||||
{
|
||||
WARN_(win)("\tCurrent message queue not found. Exiting!\n" );
|
||||
goto CLEANUP;
|
||||
|
@ -533,9 +533,7 @@ CLEANUP:
|
|||
/* Unlock the queues before returning */
|
||||
if ( pMsgQ )
|
||||
QUEUE_Unlock( pMsgQ );
|
||||
if ( pCurMsgQ )
|
||||
QUEUE_Unlock( pCurMsgQ );
|
||||
|
||||
|
||||
WIN_ReleaseWndPtr(wndPtr);
|
||||
return capturePrev;
|
||||
}
|
||||
|
|
|
@ -684,7 +684,7 @@ static BOOL process_cooked_hardware_message( MSG *msg, BOOL remove )
|
|||
static void handle_sent_message( MSG *msg, int type, ULONG_PTR extra_info )
|
||||
{
|
||||
LRESULT result = 0;
|
||||
MESSAGEQUEUE *queue = QUEUE_Lock( GetFastQueue16() );
|
||||
MESSAGEQUEUE *queue = QUEUE_Current();
|
||||
ULONG_PTR old_extra_info = queue->GetMessageExtraInfoVal; /* save ExtraInfo */
|
||||
WND *wndPtr = WIN_FindWndPtr( msg->hwnd );
|
||||
|
||||
|
@ -716,7 +716,6 @@ static void handle_sent_message( MSG *msg, int type, ULONG_PTR extra_info )
|
|||
|
||||
queue->GetMessageExtraInfoVal = old_extra_info; /* Restore extra info */
|
||||
WIN_ReleaseWndPtr(wndPtr);
|
||||
QUEUE_Unlock( queue );
|
||||
|
||||
SERVER_START_REQ( reply_message )
|
||||
{
|
||||
|
@ -861,12 +860,10 @@ static BOOL peek_message( HWND hwnd, UINT first, UINT last, int flags, int type,
|
|||
static int wait_queue_bits( WORD bits, DWORD timeout )
|
||||
{
|
||||
MESSAGEQUEUE *queue;
|
||||
HQUEUE16 hQueue;
|
||||
|
||||
TRACE_(msg)("q %04x waiting for %04x\n", GetFastQueue16(), bits);
|
||||
if (!(queue = QUEUE_Current())) return 0;
|
||||
|
||||
hQueue = GetFastQueue16();
|
||||
if (!(queue = QUEUE_Lock( hQueue ))) return 0;
|
||||
TRACE("q %04x waiting for %04x\n", queue->self, bits);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
@ -889,7 +886,6 @@ static int wait_queue_bits( WORD bits, DWORD timeout )
|
|||
if (changed_bits & bits)
|
||||
{
|
||||
/* One of the bits is set; we can return */
|
||||
QUEUE_Unlock( queue );
|
||||
return 1;
|
||||
}
|
||||
if (wake_bits & QS_SENDMESSAGE)
|
||||
|
@ -1179,12 +1175,11 @@ static BOOL MSG_PeekMessage( int type, LPMSG msg_out, HWND hwnd,
|
|||
|
||||
WIN_RestoreWndsLock(iWndsLocks);
|
||||
|
||||
if ((msgQueue = QUEUE_Lock( GetFastQueue16() )))
|
||||
if ((msgQueue = QUEUE_Current()))
|
||||
{
|
||||
msgQueue->GetMessageTimeVal = msg.time;
|
||||
msgQueue->GetMessagePosVal = MAKELONG( msg.pt.x, msg.pt.y );
|
||||
msgQueue->GetMessageExtraInfoVal = extra_info;
|
||||
QUEUE_Unlock( msgQueue );
|
||||
}
|
||||
|
||||
/* We got a message */
|
||||
|
@ -1953,7 +1948,6 @@ DWORD WINAPI MsgWaitForMultipleObjectsEx( DWORD count, CONST HANDLE *pHandles,
|
|||
{
|
||||
HANDLE handles[MAXIMUM_WAIT_OBJECTS];
|
||||
DWORD i, ret;
|
||||
HQUEUE16 hQueue = GetFastQueue16();
|
||||
MESSAGEQUEUE *msgQueue;
|
||||
|
||||
if (count > MAXIMUM_WAIT_OBJECTS-1)
|
||||
|
@ -1962,7 +1956,7 @@ DWORD WINAPI MsgWaitForMultipleObjectsEx( DWORD count, CONST HANDLE *pHandles,
|
|||
return WAIT_FAILED;
|
||||
}
|
||||
|
||||
if (!(msgQueue = QUEUE_Lock( hQueue ))) return WAIT_FAILED;
|
||||
if (!(msgQueue = QUEUE_Current())) return WAIT_FAILED;
|
||||
|
||||
/* set the queue mask */
|
||||
SERVER_START_REQ( set_queue_mask )
|
||||
|
@ -1987,7 +1981,6 @@ DWORD WINAPI MsgWaitForMultipleObjectsEx( DWORD count, CONST HANDLE *pHandles,
|
|||
else
|
||||
ret = WaitForMultipleObjectsEx( count+1, handles, flags & MWMO_WAITALL,
|
||||
timeout, flags & MWMO_ALERTABLE );
|
||||
QUEUE_Unlock( msgQueue );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -214,15 +214,13 @@ HWND PERQDATA_GetCaptureWnd( INT *hittest )
|
|||
PERQUEUEDATA *pQData;
|
||||
HWND hWndCapture;
|
||||
|
||||
if (!(queue = QUEUE_Lock( GetFastQueue16() ))) return 0;
|
||||
if (!(queue = QUEUE_Current())) return 0;
|
||||
pQData = queue->pQData;
|
||||
|
||||
EnterCriticalSection( &pQData->cSection );
|
||||
hWndCapture = pQData->hWndCapture;
|
||||
*hittest = pQData->nCaptureHT;
|
||||
LeaveCriticalSection( &pQData->cSection );
|
||||
|
||||
QUEUE_Unlock( queue );
|
||||
return hWndCapture;
|
||||
}
|
||||
|
||||
|
@ -238,7 +236,7 @@ HWND PERQDATA_SetCaptureWnd( HWND hWndCapture, INT hittest )
|
|||
PERQUEUEDATA *pQData;
|
||||
HWND hWndCapturePrv;
|
||||
|
||||
if (!(queue = QUEUE_Lock( GetFastQueue16() ))) return 0;
|
||||
if (!(queue = QUEUE_Current())) return 0;
|
||||
pQData = queue->pQData;
|
||||
|
||||
EnterCriticalSection( &pQData->cSection );
|
||||
|
@ -246,8 +244,6 @@ HWND PERQDATA_SetCaptureWnd( HWND hWndCapture, INT hittest )
|
|||
pQData->hWndCapture = hWndCapture;
|
||||
pQData->nCaptureHT = hittest;
|
||||
LeaveCriticalSection( &pQData->cSection );
|
||||
|
||||
QUEUE_Unlock( queue );
|
||||
return hWndCapturePrv;
|
||||
}
|
||||
|
||||
|
@ -279,6 +275,31 @@ MESSAGEQUEUE *QUEUE_Lock( HQUEUE16 hQueue )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_Current
|
||||
*
|
||||
* Get the current thread queue, creating it if required.
|
||||
* QUEUE_Unlock is not needed since the queue can only be deleted by
|
||||
* the current thread anyway.
|
||||
*/
|
||||
MESSAGEQUEUE *QUEUE_Current(void)
|
||||
{
|
||||
MESSAGEQUEUE *queue;
|
||||
HQUEUE16 hQueue;
|
||||
|
||||
if (!(hQueue = GetThreadQueue16(0)))
|
||||
{
|
||||
if (!(hQueue = InitThreadInput16( 0, 0 ))) return NULL;
|
||||
}
|
||||
|
||||
if ((queue = GlobalLock16( hQueue )))
|
||||
{
|
||||
if (queue->magic != QUEUE_MAGIC) queue = NULL;
|
||||
}
|
||||
return queue;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* QUEUE_Unlock
|
||||
*
|
||||
|
@ -378,16 +399,19 @@ static HQUEUE16 QUEUE_CreateMsgQueue( BOOL16 bCreatePerQData )
|
|||
* Note: We need to mask asynchronous events to make sure PostMessage works
|
||||
* even in the signal handler.
|
||||
*/
|
||||
BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue )
|
||||
void QUEUE_DeleteMsgQueue(void)
|
||||
{
|
||||
MESSAGEQUEUE * msgQueue = QUEUE_Lock(hQueue);
|
||||
HQUEUE16 hQueue = GetThreadQueue16(0);
|
||||
MESSAGEQUEUE * msgQueue;
|
||||
|
||||
TRACE_(msg)("(): Deleting message queue %04x\n", hQueue);
|
||||
if (!hQueue) return; /* thread doesn't have a queue */
|
||||
|
||||
if (!hQueue || !msgQueue)
|
||||
TRACE("(): Deleting message queue %04x\n", hQueue);
|
||||
|
||||
if (!(msgQueue = QUEUE_Lock(hQueue)))
|
||||
{
|
||||
ERR_(msg)("invalid argument.\n");
|
||||
return 0;
|
||||
ERR("invalid thread queue\n");
|
||||
return;
|
||||
}
|
||||
|
||||
msgQueue->magic = 0;
|
||||
|
@ -407,12 +431,11 @@ BOOL QUEUE_DeleteMsgQueue( HQUEUE16 hQueue )
|
|||
msgQueue->self = 0;
|
||||
|
||||
HeapUnlock( GetProcessHeap() );
|
||||
SetThreadQueue16( 0, 0 );
|
||||
|
||||
/* free up resource used by MESSAGEQUEUE structure */
|
||||
msgQueue->lockCount--;
|
||||
QUEUE_Unlock( msgQueue );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -534,10 +557,6 @@ BOOL WINAPI SetMessageQueue( INT size )
|
|||
{
|
||||
/* now obsolete the message queue will be expanded dynamically
|
||||
as necessary */
|
||||
|
||||
/* access the queue to create it if it's not existing */
|
||||
GetFastQueue16();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -546,16 +565,9 @@ BOOL WINAPI SetMessageQueue( INT size )
|
|||
*/
|
||||
HQUEUE16 WINAPI InitThreadInput16( WORD unknown, WORD flags )
|
||||
{
|
||||
HQUEUE16 hQueue;
|
||||
MESSAGEQUEUE *queuePtr;
|
||||
HQUEUE16 hQueue = NtCurrentTeb()->queue;
|
||||
|
||||
TEB *teb = NtCurrentTeb();
|
||||
|
||||
if (!teb)
|
||||
return 0;
|
||||
|
||||
hQueue = teb->queue;
|
||||
|
||||
if ( !hQueue )
|
||||
{
|
||||
/* Create thread message queue */
|
||||
|
@ -571,7 +583,7 @@ HQUEUE16 WINAPI InitThreadInput16( WORD unknown, WORD flags )
|
|||
|
||||
HeapLock( GetProcessHeap() ); /* FIXME: a bit overkill */
|
||||
SetThreadQueue16( 0, hQueue );
|
||||
teb->queue = hQueue;
|
||||
NtCurrentTeb()->queue = hQueue;
|
||||
HeapUnlock( GetProcessHeap() );
|
||||
|
||||
QUEUE_Unlock( queuePtr );
|
||||
|
@ -656,13 +668,9 @@ BOOL WINAPI GetInputState(void)
|
|||
DWORD WINAPI GetMessagePos(void)
|
||||
{
|
||||
MESSAGEQUEUE *queue;
|
||||
DWORD ret;
|
||||
|
||||
if (!(queue = QUEUE_Lock( GetFastQueue16() ))) return 0;
|
||||
ret = queue->GetMessagePosVal;
|
||||
QUEUE_Unlock( queue );
|
||||
|
||||
return ret;
|
||||
if (!(queue = QUEUE_Current())) return 0;
|
||||
return queue->GetMessagePosVal;
|
||||
}
|
||||
|
||||
|
||||
|
@ -689,13 +697,9 @@ DWORD WINAPI GetMessagePos(void)
|
|||
LONG WINAPI GetMessageTime(void)
|
||||
{
|
||||
MESSAGEQUEUE *queue;
|
||||
LONG ret;
|
||||
|
||||
if (!(queue = QUEUE_Lock( GetFastQueue16() ))) return 0;
|
||||
ret = queue->GetMessageTimeVal;
|
||||
QUEUE_Unlock( queue );
|
||||
|
||||
return ret;
|
||||
if (!(queue = QUEUE_Current())) return 0;
|
||||
return queue->GetMessageTimeVal;
|
||||
}
|
||||
|
||||
|
||||
|
@ -706,13 +710,9 @@ LONG WINAPI GetMessageTime(void)
|
|||
LONG WINAPI GetMessageExtraInfo(void)
|
||||
{
|
||||
MESSAGEQUEUE *queue;
|
||||
LONG ret;
|
||||
|
||||
if (!(queue = QUEUE_Lock( GetFastQueue16() ))) return 0;
|
||||
ret = queue->GetMessageExtraInfoVal;
|
||||
QUEUE_Unlock( queue );
|
||||
|
||||
return ret;
|
||||
if (!(queue = QUEUE_Current())) return 0;
|
||||
return queue->GetMessageExtraInfoVal;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ static UINT TIMER_SetTimer( HWND hwnd, UINT id, UINT timeout,
|
|||
/* Add the timer */
|
||||
|
||||
pTimer->hwnd = hwnd;
|
||||
pTimer->hq = GetFastQueue16();
|
||||
pTimer->hq = InitThreadInput16( 0, 0 );
|
||||
pTimer->msg = sys ? WM_SYSTIMER : WM_TIMER;
|
||||
pTimer->id = id;
|
||||
pTimer->timeout = timeout;
|
||||
|
|
|
@ -83,7 +83,7 @@ INT16 WINAPI InitApp16( HINSTANCE16 hInstance )
|
|||
INT_SetPMHandler( 0, INT_GetPMHandler( 0xff ) );
|
||||
|
||||
/* Create task message queue */
|
||||
if ( !GetFastQueue16() ) return 0;
|
||||
if ( !InitThreadInput16( 0, 0 ) ) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -769,7 +769,7 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
|
|||
wndPtr->hwndSelf = hwnd;
|
||||
wndPtr->hInstance = cs->hInstance;
|
||||
wndPtr->text = NULL;
|
||||
wndPtr->hmemTaskQ = GetFastQueue16();
|
||||
wndPtr->hmemTaskQ = InitThreadInput16( 0, 0 );
|
||||
wndPtr->hrgnUpdate = 0;
|
||||
wndPtr->hrgnWnd = 0;
|
||||
wndPtr->hwndLastActive = hwnd;
|
||||
|
|
|
@ -772,20 +772,16 @@ HWND16 WINAPI GetActiveWindow16(void)
|
|||
HWND WINAPI GetActiveWindow(void)
|
||||
{
|
||||
MESSAGEQUEUE *pCurMsgQ = 0;
|
||||
HWND hwndActive = 0;
|
||||
|
||||
/* Get the messageQ for the current thread */
|
||||
if (!(pCurMsgQ = (MESSAGEQUEUE *)QUEUE_Lock( GetFastQueue16() )))
|
||||
if (!(pCurMsgQ = QUEUE_Current()))
|
||||
{
|
||||
WARN("\tCurrent message queue not found. Exiting!\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return the current active window from the perQ data of the current message Q */
|
||||
hwndActive = PERQDATA_GetActiveWnd( pCurMsgQ->pQData );
|
||||
|
||||
QUEUE_Unlock( pCurMsgQ );
|
||||
return hwndActive;
|
||||
return PERQDATA_GetActiveWnd( pCurMsgQ->pQData );
|
||||
}
|
||||
|
||||
|
||||
|
@ -825,7 +821,7 @@ HWND WINAPI SetActiveWindow( HWND hwnd )
|
|||
}
|
||||
|
||||
/* Get the messageQ for the current thread */
|
||||
if (!(pCurMsgQ = (MESSAGEQUEUE *)QUEUE_Lock( GetFastQueue16() )))
|
||||
if (!(pCurMsgQ = QUEUE_Current()))
|
||||
{
|
||||
WARN("\tCurrent message queue not found. Exiting!\n" );
|
||||
goto CLEANUP;
|
||||
|
@ -855,8 +851,6 @@ CLEANUP:
|
|||
/* Unlock the queues before returning */
|
||||
if ( pMsgQ )
|
||||
QUEUE_Unlock( pMsgQ );
|
||||
if ( pCurMsgQ )
|
||||
QUEUE_Unlock( pCurMsgQ );
|
||||
|
||||
end:
|
||||
WIN_ReleaseWndPtr(wndPtr);
|
||||
|
|
Loading…
Reference in New Issue