Now that CSRSS is getting unloaded we must unregister the primitive message queue when it's about to be destroyed.

svn path=/trunk/; revision=14159
This commit is contained in:
Filip Navara 2005-03-17 13:07:28 +00:00
parent cd4a8585a8
commit 643a182dd0
3 changed files with 24 additions and 7 deletions

View file

@ -8,6 +8,7 @@ InitInputImpl(VOID);
NTSTATUS FASTCALL
InitKeyboardImpl(VOID);
PUSER_MESSAGE_QUEUE W32kGetPrimitiveMessageQueue(VOID);
VOID W32kUnregisterPrimitiveMessageQueue(VOID);
PKBDTABLES W32kGetDefaultKeyLayout(VOID);
VOID FASTCALL W32kKeyProcessMessage(LPMSG Msg, PKBDTABLES KeyLayout);
BOOL FASTCALL IntBlockInput(PW32THREAD W32Thread, BOOL BlockIt);

View file

@ -17,13 +17,15 @@
/* registered Logon process */
PW32PROCESS LogonProcess = NULL;
void W32kRegisterPrimitiveMessageQueue() {
VOID W32kRegisterPrimitiveMessageQueue(VOID)
{
extern PUSER_MESSAGE_QUEUE pmPrimitiveMessageQueue;
if( !pmPrimitiveMessageQueue ) {
PW32THREAD pThread;
pThread = PsGetWin32Thread();
if( pThread && pThread->MessageQueue ) {
pmPrimitiveMessageQueue = pThread->MessageQueue;
IntReferenceMessageQueue(pmPrimitiveMessageQueue);
DPRINT( "Installed primitive input queue.\n" );
}
} else {
@ -31,7 +33,15 @@ void W32kRegisterPrimitiveMessageQueue() {
}
}
PUSER_MESSAGE_QUEUE W32kGetPrimitiveMessageQueue() {
VOID W32kUnregisterPrimitiveMessageQueue(VOID)
{
extern PUSER_MESSAGE_QUEUE pmPrimitiveMessageQueue;
IntDereferenceMessageQueue(pmPrimitiveMessageQueue);
pmPrimitiveMessageQueue = NULL;
}
PUSER_MESSAGE_QUEUE W32kGetPrimitiveMessageQueue()
{
extern PUSER_MESSAGE_QUEUE pmPrimitiveMessageQueue;
return pmPrimitiveMessageQueue;
}

View file

@ -1413,15 +1413,21 @@ VOID FASTCALL
MsqDestroyMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
{
PDESKTOP_OBJECT desk;
/* remove the message queue from any desktops */
if((desk = (PDESKTOP_OBJECT)InterlockedExchange((LONG*)&MessageQueue->Desktop, 0)))
{
InterlockedExchange((LONG*)&desk->ActiveMessageQueue, 0);
IntDereferenceMessageQueue(MessageQueue);
}
if ((desk = (PDESKTOP_OBJECT)InterlockedExchange((LONG*)&MessageQueue->Desktop, 0)))
{
InterlockedExchange((LONG*)&desk->ActiveMessageQueue, 0);
IntDereferenceMessageQueue(MessageQueue);
}
/* if this is the primitive message queue, deregister it */
if (MessageQueue == W32kGetPrimitiveMessageQueue())
W32kUnregisterPrimitiveMessageQueue();
/* clean it up */
MsqCleanupMessageQueue(MessageQueue);
/* decrease the reference counter, if it hits zero, the queue will be freed */
IntDereferenceMessageQueue(MessageQueue);
}