Don't access the object header of a kernel object from win32k. Instead get the desktop name from the desktop info structure. CORE-6818 #resolve

svn path=/trunk/; revision=63409
This commit is contained in:
Timo Kreuzer 2014-05-22 13:40:23 +00:00
parent 02851fb0e2
commit 17be1062a2

View file

@ -51,7 +51,7 @@ IntDesktopObjectParse(IN PVOID ParseObject,
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;
PLIST_ENTRY NextEntry, ListHead; PLIST_ENTRY NextEntry, ListHead;
PWINSTATION_OBJECT WinStaObject = (PWINSTATION_OBJECT)ParseObject; PWINSTATION_OBJECT WinStaObject = (PWINSTATION_OBJECT)ParseObject;
PUNICODE_STRING DesktopName; UNICODE_STRING DesktopName;
PBOOLEAN pContext = (PBOOLEAN) Context; PBOOLEAN pContext = (PBOOLEAN) Context;
if(pContext) if(pContext)
@ -65,43 +65,40 @@ IntDesktopObjectParse(IN PVOID ParseObject,
/* Get the current desktop */ /* Get the current desktop */
Desktop = CONTAINING_RECORD(NextEntry, DESKTOP, ListEntry); Desktop = CONTAINING_RECORD(NextEntry, DESKTOP, ListEntry);
/// @todo Don't mess around with the object headers! /* Get the desktop name */
/* Get its name */ ASSERT(Desktop->pDeskInfo != NULL);
_PRAGMA_WARNING_SUPPRESS(__WARNING_DEREF_NULL_PTR) RtlInitUnicodeString(&DesktopName, Desktop->pDeskInfo->szDesktopName);
DesktopName = GET_DESKTOP_NAME(Desktop);
if (DesktopName) /* Compare the name */
if (RtlEqualUnicodeString(RemainingName,
&DesktopName,
(Attributes & OBJ_CASE_INSENSITIVE)))
{ {
/* Compare the name */ /* We found a match. Did this come from a create? */
if (RtlEqualUnicodeString(RemainingName, if (Context)
DesktopName,
(Attributes & OBJ_CASE_INSENSITIVE)))
{ {
/* We found a match. Did this come from a create? */ /* Unless OPEN_IF was given, fail with an error */
if (Context) if (!(Attributes & OBJ_OPENIF))
{ {
/* Unless OPEN_IF was given, fail with an error */ /* Name collision */
if (!(Attributes & OBJ_OPENIF)) return STATUS_OBJECT_NAME_COLLISION;
{
/* Name collision */
return STATUS_OBJECT_NAME_COLLISION;
}
else
{
/* Otherwise, return with a warning only */
Status = STATUS_OBJECT_NAME_EXISTS;
}
} }
else else
{ {
/* This was a real open, so this is OK */ /* Otherwise, return with a warning only */
Status = STATUS_SUCCESS; Status = STATUS_OBJECT_NAME_EXISTS;
} }
/* Reference the desktop and return it */
ObReferenceObject(Desktop);
*Object = Desktop;
return Status;
} }
else
{
/* This was a real open, so this is OK */
Status = STATUS_SUCCESS;
}
/* Reference the desktop and return it */
ObReferenceObject(Desktop);
*Object = Desktop;
return Status;
} }
/* Go to the next desktop */ /* Go to the next desktop */
@ -522,7 +519,7 @@ IntSetFocusMessageQueue(PUSER_MESSAGE_QUEUE NewQueue)
{ {
gpqForeground = pdo->ActiveMessageQueue; gpqForeground = pdo->ActiveMessageQueue;
} }
else else
{ {
gpqForeground = NULL; gpqForeground = NULL;
ERR("ptiLastInput is CLEARED!!\n"); ERR("ptiLastInput is CLEARED!!\n");