mirror of
https://github.com/reactos/reactos.git
synced 2024-07-01 02:10:07 +00:00
[NtUser] - Prevent a crash when Tcb.Win32Thread NULL.
svn path=/trunk/; revision=57082
This commit is contained in:
parent
92544fb525
commit
bf76d98310
|
@ -490,9 +490,9 @@ UserDestroyThreadInfo(struct _ETHREAD *Thread)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free the message queue */
|
/* Free the message queue */
|
||||||
if(ptiCurrent->MessageQueue)
|
if (ptiCurrent->MessageQueue)
|
||||||
{
|
{
|
||||||
MsqDestroyMessageQueue(ptiCurrent->MessageQueue);
|
MsqDestroyMessageQueue(ptiCurrent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the THREADINFO in the PROCESSINFO's list */
|
/* Find the THREADINFO in the PROCESSINFO's list */
|
||||||
|
|
|
@ -1902,15 +1902,14 @@ MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQu
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
|
MsqCleanupMessageQueue(PTHREADINFO pti)
|
||||||
{
|
{
|
||||||
|
PUSER_MESSAGE_QUEUE MessageQueue;
|
||||||
PLIST_ENTRY CurrentEntry;
|
PLIST_ENTRY CurrentEntry;
|
||||||
PUSER_MESSAGE CurrentMessage;
|
PUSER_MESSAGE CurrentMessage;
|
||||||
PUSER_SENT_MESSAGE CurrentSentMessage;
|
PUSER_SENT_MESSAGE CurrentSentMessage;
|
||||||
PTHREADINFO pti;
|
|
||||||
|
|
||||||
pti = MessageQueue->Thread->Tcb.Win32Thread;
|
|
||||||
|
|
||||||
|
MessageQueue = pti->MessageQueue;
|
||||||
|
|
||||||
/* cleanup posted messages */
|
/* cleanup posted messages */
|
||||||
while (!IsListEmpty(&MessageQueue->PostedMessagesListHead))
|
while (!IsListEmpty(&MessageQueue->PostedMessagesListHead))
|
||||||
|
@ -2026,7 +2025,7 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear it all out.
|
// Clear it all out.
|
||||||
if(pti->pcti)
|
if (pti->pcti)
|
||||||
{
|
{
|
||||||
pti->pcti->fsWakeBits = 0;
|
pti->pcti->fsWakeBits = 0;
|
||||||
pti->pcti->fsChangeBits = 0;
|
pti->pcti->fsChangeBits = 0;
|
||||||
|
@ -2059,7 +2058,6 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
|
||||||
|
|
||||||
UserDereferenceObject(pCursor);
|
UserDereferenceObject(pCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PUSER_MESSAGE_QUEUE FASTCALL
|
PUSER_MESSAGE_QUEUE FASTCALL
|
||||||
|
@ -2090,9 +2088,10 @@ MsqCreateMessageQueue(struct _ETHREAD *Thread)
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
MsqDestroyMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
|
MsqDestroyMessageQueue(PTHREADINFO pti)
|
||||||
{
|
{
|
||||||
PDESKTOP desk;
|
PDESKTOP desk;
|
||||||
|
PUSER_MESSAGE_QUEUE MessageQueue = pti->MessageQueue;
|
||||||
|
|
||||||
MessageQueue->QF_flags |= QF_INDESTROY;
|
MessageQueue->QF_flags |= QF_INDESTROY;
|
||||||
|
|
||||||
|
@ -2104,7 +2103,7 @@ MsqDestroyMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clean it up */
|
/* clean it up */
|
||||||
MsqCleanupMessageQueue(MessageQueue);
|
MsqCleanupMessageQueue(pti);
|
||||||
|
|
||||||
if (MessageQueue->NewMessagesHandle != NULL)
|
if (MessageQueue->NewMessagesHandle != NULL)
|
||||||
ZwClose(MessageQueue->NewMessagesHandle);
|
ZwClose(MessageQueue->NewMessagesHandle);
|
||||||
|
|
|
@ -50,6 +50,7 @@ typedef struct _USER_MESSAGE_QUEUE
|
||||||
/* Reference counter, only access this variable with interlocked functions! */
|
/* Reference counter, only access this variable with interlocked functions! */
|
||||||
LONG References;
|
LONG References;
|
||||||
|
|
||||||
|
PTHREADINFO ptiSysLock;
|
||||||
/* Owner of the message queue */
|
/* Owner of the message queue */
|
||||||
struct _ETHREAD *Thread;
|
struct _ETHREAD *Thread;
|
||||||
/* Queue of messages sent to the queue. */
|
/* Queue of messages sent to the queue. */
|
||||||
|
@ -182,7 +183,7 @@ co_MsqPeekMouseMove(IN PUSER_MESSAGE_QUEUE MessageQueue,
|
||||||
OUT MSG* pMsg);
|
OUT MSG* pMsg);
|
||||||
BOOLEAN FASTCALL MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQueue);
|
BOOLEAN FASTCALL MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQueue);
|
||||||
PUSER_MESSAGE_QUEUE FASTCALL MsqCreateMessageQueue(struct _ETHREAD *Thread);
|
PUSER_MESSAGE_QUEUE FASTCALL MsqCreateMessageQueue(struct _ETHREAD *Thread);
|
||||||
VOID FASTCALL MsqDestroyMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue);
|
VOID FASTCALL MsqDestroyMessageQueue(PTHREADINFO);
|
||||||
INIT_FUNCTION NTSTATUS NTAPI MsqInitializeImpl(VOID);
|
INIT_FUNCTION NTSTATUS NTAPI MsqInitializeImpl(VOID);
|
||||||
BOOLEAN FASTCALL co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue);
|
BOOLEAN FASTCALL co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue);
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
|
|
Loading…
Reference in a new issue