Author: tkreuzer Date: Thu May 22 13:40:23 2014 New Revision: 63409
URL: http://svn.reactos.org/svn/reactos?rev=63409&view=rev Log: [WIN32K] 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
Modified: trunk/reactos/win32ss/user/ntuser/desktop.c
Modified: trunk/reactos/win32ss/user/ntuser/desktop.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/desktop... ============================================================================== --- trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/desktop.c [iso-8859-1] Thu May 22 13:40:23 2014 @@ -51,7 +51,7 @@ OBJECT_ATTRIBUTES ObjectAttributes; PLIST_ENTRY NextEntry, ListHead; PWINSTATION_OBJECT WinStaObject = (PWINSTATION_OBJECT)ParseObject; - PUNICODE_STRING DesktopName; + UNICODE_STRING DesktopName; PBOOLEAN pContext = (PBOOLEAN) Context;
if(pContext) @@ -65,43 +65,40 @@ /* Get the current desktop */ Desktop = CONTAINING_RECORD(NextEntry, DESKTOP, ListEntry);
- /// @todo Don't mess around with the object headers! - /* Get its name */ - _PRAGMA_WARNING_SUPPRESS(__WARNING_DEREF_NULL_PTR) - DesktopName = GET_DESKTOP_NAME(Desktop); - if (DesktopName) + /* Get the desktop name */ + ASSERT(Desktop->pDeskInfo != NULL); + RtlInitUnicodeString(&DesktopName, Desktop->pDeskInfo->szDesktopName); + + /* Compare the name */ + if (RtlEqualUnicodeString(RemainingName, + &DesktopName, + (Attributes & OBJ_CASE_INSENSITIVE))) { - /* Compare the name */ - if (RtlEqualUnicodeString(RemainingName, - DesktopName, - (Attributes & OBJ_CASE_INSENSITIVE))) + /* We found a match. Did this come from a create? */ + if (Context) { - /* We found a match. Did this come from a create? */ - if (Context) + /* Unless OPEN_IF was given, fail with an error */ + if (!(Attributes & OBJ_OPENIF)) { - /* Unless OPEN_IF was given, fail with an error */ - if (!(Attributes & OBJ_OPENIF)) - { - /* Name collision */ - return STATUS_OBJECT_NAME_COLLISION; - } - else - { - /* Otherwise, return with a warning only */ - Status = STATUS_OBJECT_NAME_EXISTS; - } + /* Name collision */ + return STATUS_OBJECT_NAME_COLLISION; } else { - /* This was a real open, so this is OK */ - Status = STATUS_SUCCESS; + /* Otherwise, return with a warning only */ + 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 */ @@ -522,7 +519,7 @@ { gpqForeground = pdo->ActiveMessageQueue; } - else + else { gpqForeground = NULL; ERR("ptiLastInput is CLEARED!!\n");