Author: gadamopoulos Date: Thu Mar 17 13:19:18 2011 New Revision: 51082
URL: http://svn.reactos.org/svn/reactos?rev=51082&view=rev Log: [win32k] - Improve the definition and simplify NtUserCreateDesktop, NtUserOpenDesktop, NtUserCreateWindowStation, NtUserOpenWindowStation
Modified: trunk/reactos/dll/win32/user32/misc/desktop.c trunk/reactos/dll/win32/user32/misc/winsta.c trunk/reactos/include/reactos/win32k/ntuser.h trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c
Modified: trunk/reactos/dll/win32/user32/misc/desktop.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/deskt... ============================================================================== --- trunk/reactos/dll/win32/user32/misc/desktop.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/desktop.c [iso-8859-1] Thu Mar 17 13:19:18 2011 @@ -564,13 +564,22 @@ ACCESS_MASK dwDesiredAccess) { UNICODE_STRING DesktopName; + OBJECT_ATTRIBUTES ObjectAttributes;
RtlInitUnicodeString(&DesktopName, lpszDesktop);
- return NtUserOpenDesktop( - &DesktopName, - dwFlags, - dwDesiredAccess); + InitializeObjectAttributes(&ObjectAttributes, + &DesktopName, + OBJ_CASE_INSENSITIVE, + GetProcessWindowStation(), + 0); + + if( fInherit == TRUE ) + { + ObjectAttributes.Attributes |= OBJ_INHERIT; + } + + return NtUserOpenDesktop(&ObjectAttributes, dwFlags, dwDesiredAccess); }
Modified: trunk/reactos/dll/win32/user32/misc/winsta.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/winst... ============================================================================== --- trunk/reactos/dll/win32/user32/misc/winsta.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/winsta.c [iso-8859-1] Thu Mar 17 13:19:18 2011 @@ -12,6 +12,7 @@ #include <user32.h>
#include <wine/debug.h> +WINE_DEFAULT_DEBUG_CHANNEL(winsta);
/* @@ -58,12 +59,50 @@ LPSECURITY_ATTRIBUTES lpsa) { UNICODE_STRING WindowStationName; + UNICODE_STRING WindowStationsDir = RTL_CONSTANT_STRING(L"\Windows\WindowStations"); + OBJECT_ATTRIBUTES ObjectAttributes; + HANDLE hWindowStationsDir; + NTSTATUS Status; + HWINSTA hwinsta; + + /* Open WindowStations directory */ + InitializeObjectAttributes(&ObjectAttributes, + &WindowStationsDir, + OBJ_CASE_INSENSITIVE, + 0, + 0); + + Status = NtOpenDirectoryObject(&hWindowStationsDir, + DIRECTORY_CREATE_OBJECT, + &ObjectAttributes); + if(!NT_SUCCESS(Status)) + { + ERR("Failed to open WindowStations directory\n"); + return NULL; + }
RtlInitUnicodeString(&WindowStationName, lpwinsta);
- return NtUserCreateWindowStation(&WindowStationName, - dwDesiredAccess, - lpsa, 0, 0, 0, 0); + /* Create the window station object */ + InitializeObjectAttributes(&ObjectAttributes, + &WindowStationName, + OBJ_CASE_INSENSITIVE, + hWindowStationsDir, + 0); + + /* Check if the handle should be inheritable */ + if (lpsa && lpsa->bInheritHandle) + { + ObjectAttributes.Attributes |= OBJ_INHERIT; + } + + hwinsta = NtUserCreateWindowStation(&ObjectAttributes, + dwDesiredAccess, + 0, 0, 0, 0, 0); + + NtClose(hWindowStationsDir); + + return hwinsta; }
/* @@ -299,14 +338,51 @@ */ HWINSTA WINAPI OpenWindowStationW(LPCWSTR lpszWinSta, - BOOL fInherit, - ACCESS_MASK dwDesiredAccess) + BOOL fInherit, + ACCESS_MASK dwDesiredAccess) { UNICODE_STRING WindowStationName; - + UNICODE_STRING WindowStationsDir = RTL_CONSTANT_STRING(L"\Windows\WindowStations"); + OBJECT_ATTRIBUTES ObjectAttributes; + HANDLE hWindowStationsDir; + NTSTATUS Status; + HWINSTA hwinsta; + + /* Open WindowStations directory */ + InitializeObjectAttributes(&ObjectAttributes, + &WindowStationsDir, + OBJ_CASE_INSENSITIVE, + 0, + 0); + + Status = NtOpenDirectoryObject(&hWindowStationsDir, + DIRECTORY_TRAVERSE, + &ObjectAttributes); + if(!NT_SUCCESS(Status)) + { + ERR("Failed to open WindowStations directory\n"); + return NULL; + } + + /* Open the window station object */ RtlInitUnicodeString(&WindowStationName, lpszWinSta);
- return NtUserOpenWindowStation(&WindowStationName, dwDesiredAccess); + InitializeObjectAttributes(&ObjectAttributes, + &WindowStationName, + OBJ_CASE_INSENSITIVE, + hWindowStationsDir, + 0); + + if( fInherit == TRUE ) + { + ObjectAttributes.Attributes |= OBJ_INHERIT; + } + + hwinsta = NtUserOpenWindowStation(&ObjectAttributes, dwDesiredAccess); + + NtClose(hWindowStationsDir); + + return hwinsta; }
Modified: trunk/reactos/include/reactos/win32k/ntuser.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntus... ============================================================================== --- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Thu Mar 17 13:19:18 2011 @@ -1462,7 +1462,7 @@ HWND NTAPI NtUserCreateWindowEx( - DWORD dwExStyle, // |= 0x80000000 == Ansi used to set WNDS_ANSICREATOR + DWORD dwExStyle, PLARGE_STRING plstrClassName, PLARGE_STRING plstrClsVersion, PLARGE_STRING plstrWindowName, @@ -1481,9 +1481,9 @@ HWINSTA NTAPI NtUserCreateWindowStation( - PUNICODE_STRING lpszWindowStationName, + POBJECT_ATTRIBUTES ObjectAttributes, ACCESS_MASK dwDesiredAccess, - LPSECURITY_ATTRIBUTES lpSecurity, + DWORD Unknown2, DWORD Unknown3, DWORD Unknown4, DWORD Unknown5, @@ -2301,9 +2301,9 @@ HDESK NTAPI NtUserOpenDesktop( - PUNICODE_STRING lpszDesktopName, - DWORD dwFlags, - ACCESS_MASK dwDesiredAccess); + POBJECT_ATTRIBUTES ObjectAttributes, + DWORD dwFlags, + ACCESS_MASK dwDesiredAccess);
HDESK NTAPI @@ -2315,7 +2315,7 @@ HWINSTA NTAPI NtUserOpenWindowStation( - PUNICODE_STRING lpszWindowStationName, + POBJECT_ATTRIBUTES ObjectAttributes, ACCESS_MASK dwDesiredAccess);
BOOL
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] Thu Mar 17 13:19:18 2011 @@ -859,15 +859,12 @@
HDESK APIENTRY NtUserCreateDesktop( - POBJECT_ATTRIBUTES poa, + POBJECT_ATTRIBUTES ObjectAttributes, PUNICODE_STRING lpszDesktopDevice, LPDEVMODEW lpdmw, DWORD dwFlags, ACCESS_MASK dwDesiredAccess) { - OBJECT_ATTRIBUTES ObjectAttributes; - PTHREADINFO W32Thread; - PWINSTATION_OBJECT WinStaObject; PDESKTOP DesktopObject; UNICODE_STRING DesktopName; NTSTATUS Status = STATUS_SUCCESS; @@ -875,12 +872,9 @@ CSR_API_MESSAGE Request; PVOID DesktopHeapSystemBase = NULL; SIZE_T DesktopInfoSize; - UNICODE_STRING SafeDesktopName; ULONG DummyContext; ULONG_PTR HeapSize = 4 * 1024 * 1024; /* FIXME */ - HWINSTA hWindowStation = NULL ; - PUNICODE_STRING lpszDesktopName = NULL; - UNICODE_STRING ClassName, MenuName; + UNICODE_STRING ClassName; LARGE_STRING WindowName; BOOL NoHooks = FALSE; PWND pWnd = NULL; @@ -889,7 +883,7 @@ PTHREADINFO ptiCurrent; DECLARE_RETURN(HDESK);
- DPRINT("Enter NtUserCreateDesktop: %wZ\n", lpszDesktopName); + DPRINT("Enter NtUserCreateDesktop\n"); UserEnterExclusive();
ptiCurrent = PsGetCurrentThreadWin32Thread(); @@ -899,68 +893,7 @@ NoHooks = (ptiCurrent->TIF_flags & TIF_DISABLEHOOKS); ptiCurrent->TIF_flags |= TIF_DISABLEHOOKS; } - - _SEH2_TRY - { - ProbeForRead( poa, - sizeof(OBJECT_ATTRIBUTES), - 1); - - hWindowStation = poa->RootDirectory; - lpszDesktopName = poa->ObjectName; - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status =_SEH2_GetExceptionCode(); - } - _SEH2_END - - if (! NT_SUCCESS(Status)) - { - DPRINT1("Failed reading Object Attributes from user space.\n"); - SetLastNtError(Status); - RETURN( NULL); - } - - Status = IntValidateWindowStationHandle( - hWindowStation, - KernelMode, - 0, /* FIXME - WINSTA_CREATEDESKTOP */ - &WinStaObject); - - if (! NT_SUCCESS(Status)) - { - DPRINT1("Failed validation of window station handle (0x%X), cannot create desktop %wZ\n", - hWindowStation, lpszDesktopName); - SetLastNtError(Status); - RETURN( NULL); - } - if(lpszDesktopName != NULL) - { - Status = IntSafeCopyUnicodeString(&SafeDesktopName, lpszDesktopName); - if(!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - RETURN( NULL); - } - } - else - { - RtlInitUnicodeString(&SafeDesktopName, NULL); - } - - if (! IntGetFullWindowStationName(&DesktopName, &WinStaObject->Name, - &SafeDesktopName)) - { - SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); - ObDereferenceObject(WinStaObject); - if (lpszDesktopName) - ExFreePoolWithTag(SafeDesktopName.Buffer, TAG_STRING); - RETURN( NULL); - } - if (lpszDesktopName) - ExFreePoolWithTag(SafeDesktopName.Buffer, TAG_STRING); - ObDereferenceObject(WinStaObject); + DesktopName.Buffer = NULL;
/* * Try to open already existing desktop @@ -968,18 +901,10 @@
DPRINT("Trying to open desktop (%wZ)\n", &DesktopName);
- /* Initialize ObjectAttributes for the desktop object */ - InitializeObjectAttributes( - &ObjectAttributes, - &DesktopName, - 0, - NULL, - NULL); - Status = ObOpenObjectByName( - &ObjectAttributes, + ObjectAttributes, ExDesktopObjectType, - KernelMode, + UserMode, NULL, dwDesiredAccess, (PVOID)&DummyContext, @@ -987,8 +912,27 @@ if (!NT_SUCCESS(Status)) RETURN(NULL); if (Status == STATUS_OBJECT_NAME_EXISTS) { - ExFreePoolWithTag(DesktopName.Buffer, TAG_STRING); RETURN( Desktop); + } + + /* Capture desktop name */ + _SEH2_TRY + { + ProbeForRead( ObjectAttributes, sizeof(OBJECT_ATTRIBUTES), 1); + + Status = IntSafeCopyUnicodeString(&DesktopName, ObjectAttributes->ObjectName); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END + + if (! NT_SUCCESS(Status)) + { + DPRINT1("Failed reading Object Attributes from user space.\n"); + SetLastNtError(Status); + RETURN( NULL); }
/* Reference the desktop */ @@ -1011,12 +955,11 @@ RETURN(NULL); }
- DesktopInfoSize = FIELD_OFFSET(DESKTOPINFO, - szDesktopName[(lpszDesktopName->Length / sizeof(WCHAR)) + 1]); + DesktopInfoSize = sizeof(DESKTOPINFO) + DesktopName.Length;
DesktopObject->pDeskInfo = RtlAllocateHeap(DesktopObject->pheapDesktop, - HEAP_NO_SERIALIZE, - DesktopInfoSize); + HEAP_NO_SERIALIZE, + DesktopInfoSize);
if (DesktopObject->pDeskInfo == NULL) { @@ -1031,8 +974,8 @@ DesktopObject->pDeskInfo->pvDesktopBase = DesktopHeapSystemBase; DesktopObject->pDeskInfo->pvDesktopLimit = (PVOID)((ULONG_PTR)DesktopHeapSystemBase + HeapSize); RtlCopyMemory(DesktopObject->pDeskInfo->szDesktopName, - lpszDesktopName->Buffer, - lpszDesktopName->Length); + DesktopName.Buffer, + DesktopName.Length);
/* Initialize some local (to win32k) desktop state. */ InitializeListHead(&DesktopObject->PtiList); @@ -1042,7 +985,6 @@ { InitializeListHead(&DesktopObject->pDeskInfo->aphkStart[i]); } - ExFreePoolWithTag(DesktopName.Buffer, TAG_STRING);
//// why is this here? #if 0 @@ -1090,7 +1032,6 @@ // ClassName.Buffer = ((PWSTR)((ULONG_PTR)(WORD)(gpsi->atomSysClass[ICLS_DESKTOP]))); ClassName.Length = 0; - RtlZeroMemory(&MenuName, sizeof(MenuName)); RtlZeroMemory(&WindowName, sizeof(WindowName));
RtlZeroMemory(&Cs, sizeof(Cs)); @@ -1113,9 +1054,8 @@ DesktopObject->pDeskInfo->spwnd = pWndDesktop; } #endif - W32Thread = PsGetCurrentThreadWin32Thread(); - - if (!W32Thread->rpdesk) IntSetThreadDesktop(DesktopObject,FALSE); + + if (!ptiCurrent->rpdesk) IntSetThreadDesktop(DesktopObject,FALSE);
/* Based on wine/server/window.c in get_desktop_window. @@ -1123,7 +1063,6 @@
ClassName.Buffer = ((PWSTR)((ULONG_PTR)(WORD)(gpsi->atomSysClass[ICLS_HWNDMESSAGE]))); ClassName.Length = 0; - RtlZeroMemory(&MenuName, sizeof(MenuName)); RtlZeroMemory(&WindowName, sizeof(WindowName));
RtlZeroMemory(&Cs, sizeof(Cs)); @@ -1154,6 +1093,10 @@ RETURN( Desktop);
CLEANUP: + if(DesktopName.Buffer != NULL) + { + ExFreePoolWithTag(DesktopName.Buffer, TAG_STRING); + } if (!NoHooks && ptiCurrent) ptiCurrent->TIF_flags &= ~TIF_DISABLEHOOKS; DPRINT("Leave NtUserCreateDesktop, ret=%i\n",_ret_); UserLeave(); @@ -1184,85 +1127,17 @@
HDESK APIENTRY NtUserOpenDesktop( - PUNICODE_STRING lpszDesktopName, + POBJECT_ATTRIBUTES ObjectAttributes, DWORD dwFlags, ACCESS_MASK dwDesiredAccess) { - OBJECT_ATTRIBUTES ObjectAttributes; - HWINSTA WinSta; - PWINSTATION_OBJECT WinStaObject; - UNICODE_STRING DesktopName; - UNICODE_STRING SafeDesktopName; NTSTATUS Status; HDESK Desktop; - BOOL Result; - DECLARE_RETURN(HDESK); - - DPRINT("Enter NtUserOpenDesktop: %wZ\n", lpszDesktopName); - UserEnterExclusive(); - - /* - * Validate the window station handle and compose the fully - * qualified desktop name - */ - - WinSta = UserGetProcessWindowStation(); - Status = IntValidateWindowStationHandle( - WinSta, - KernelMode, - 0, - &WinStaObject); - - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed validation of window station handle (0x%X)\n", WinSta); - SetLastNtError(Status); - RETURN( 0); - } - - if(lpszDesktopName != NULL) - { - Status = IntSafeCopyUnicodeString(&SafeDesktopName, lpszDesktopName); - if(!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - RETURN( NULL); - } - } - else - { - RtlInitUnicodeString(&SafeDesktopName, NULL); - } - - Result = IntGetFullWindowStationName(&DesktopName, &WinStaObject->Name, - &SafeDesktopName); - - if (lpszDesktopName) - ExFreePoolWithTag(SafeDesktopName.Buffer, TAG_STRING); - ObDereferenceObject(WinStaObject); - - - if (!Result) - { - SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); - RETURN( 0); - } - - - DPRINT("Trying to open desktop (%wZ)\n", &DesktopName); - - /* Initialize ObjectAttributes for the desktop object */ - InitializeObjectAttributes( - &ObjectAttributes, - &DesktopName, - 0, - NULL, - NULL);
Status = ObOpenObjectByName( - &ObjectAttributes, + ObjectAttributes, ExDesktopObjectType, - KernelMode, + UserMode, NULL, dwDesiredAccess, NULL, @@ -1271,19 +1146,10 @@ if (!NT_SUCCESS(Status)) { SetLastNtError(Status); - ExFreePool(DesktopName.Buffer); - RETURN( 0); - } - - DPRINT("Successfully opened desktop (%wZ)\n", &DesktopName); - ExFreePool(DesktopName.Buffer); - - RETURN( Desktop); - -CLEANUP: - DPRINT("Leave NtUserOpenDesktop, ret=%i\n",_ret_); - UserLeave(); - END_CLEANUP; + return 0; + } + + return Desktop; }
/*
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/winsta.c [iso-8859-1] Thu Mar 17 13:19:18 2011 @@ -392,61 +392,23 @@
HWINSTA APIENTRY NtUserCreateWindowStation( - PUNICODE_STRING lpszWindowStationName, + POBJECT_ATTRIBUTES ObjectAttributes, ACCESS_MASK dwDesiredAccess, - LPSECURITY_ATTRIBUTES lpSecurity, + DWORD Unknown2, DWORD Unknown3, DWORD Unknown4, DWORD Unknown5, DWORD Unknown6) { UNICODE_STRING WindowStationName; - UNICODE_STRING FullWindowStationName; PWINSTATION_OBJECT WindowStationObject; HWINSTA WindowStation; - OBJECT_ATTRIBUTES ObjectAttributes; NTSTATUS Status;
- /* - * Generate full window station name - */ - Status = ProbeAndCaptureUnicodeString(&WindowStationName, - UserMode, - lpszWindowStationName); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to capture window station name (status 0x%08x)\n", - Status); - SetLastNtError(Status); - return 0; - } - if (!IntGetFullWindowStationName(&FullWindowStationName, - &WindowStationName, - NULL)) - { - ReleaseCapturedUnicodeString(&WindowStationName, UserMode); - SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); - return 0; - } - - /* - * Try to open already existing window station - */ - - DPRINT("Trying to open window station (%wZ)\n", &FullWindowStationName); - - /* Initialize ObjectAttributes for the window station object */ - InitializeObjectAttributes( - &ObjectAttributes, - &FullWindowStationName, - 0, - NULL, - NULL); - Status = ObOpenObjectByName( - &ObjectAttributes, + ObjectAttributes, ExWindowStationObjectType, - KernelMode, + UserMode, NULL, dwDesiredAccess, NULL, @@ -454,24 +416,39 @@
if (NT_SUCCESS(Status)) { - DPRINT("Successfully opened window station (%wZ)\n", - FullWindowStationName); - ExFreePool(FullWindowStationName.Buffer); - ReleaseCapturedUnicodeString(&WindowStationName, UserMode); return (HWINSTA)WindowStation; } +
/* * No existing window station found, try to create new one */ - - DPRINT("Creating window station (%wZ)\n", &FullWindowStationName); - + + /* Capture window station name */ + _SEH2_TRY + { + ProbeForRead( ObjectAttributes, sizeof(OBJECT_ATTRIBUTES), 1); + Status = IntSafeCopyUnicodeString(&WindowStationName, ObjectAttributes->ObjectName); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status =_SEH2_GetExceptionCode(); + } + _SEH2_END + + if (! NT_SUCCESS(Status)) + { + DPRINT1("Failed reading capturing window station name\n"); + SetLastNtError(Status); + return NULL; + } + + /* Create the window station object */ Status = ObCreateObject( - KernelMode, + UserMode, ExWindowStationObjectType, - &ObjectAttributes, - ExGetPreviousMode(), + ObjectAttributes, + UserMode, NULL, sizeof(WINSTATION_OBJECT), 0, @@ -480,25 +457,10 @@
if (!NT_SUCCESS(Status)) { - DPRINT1("Failed creating window station (%wZ)\n", &FullWindowStationName); - ExFreePool(FullWindowStationName.Buffer); - ReleaseCapturedUnicodeString(&WindowStationName, UserMode); + ExFreePoolWithTag(WindowStationName.Buffer, TAG_STRING); SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); return 0; } - - /* Zero out the buffer */ - RtlZeroMemory(WindowStationObject, sizeof(WINSTATION_OBJECT)); - - KeInitializeSpinLock(&WindowStationObject->Lock); - - InitializeListHead(&WindowStationObject->DesktopListHead); - - WindowStationObject->AtomTable = NULL; - Status = RtlCreateAtomTable(37, &WindowStationObject->AtomTable); - WindowStationObject->SystemMenuTemplate = (HANDLE)0; - - WindowStationObject->Name = WindowStationName;
Status = ObInsertObject( (PVOID)WindowStationObject, @@ -510,20 +472,21 @@
if (!NT_SUCCESS(Status)) { - DPRINT1("Failed creating window station (%wZ)\n", &FullWindowStationName); - ExFreePool(FullWindowStationName.Buffer); - ExFreePool(WindowStationName.Buffer); + ExFreePoolWithTag(WindowStationName.Buffer, TAG_STRING); SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); ObDereferenceObject(WindowStationObject); return 0; }
- /* - * Initialize the new window station object - */ - + /* Initialize the window station */ + RtlZeroMemory(WindowStationObject, sizeof(WINSTATION_OBJECT)); + + KeInitializeSpinLock(&WindowStationObject->Lock); + InitializeListHead(&WindowStationObject->DesktopListHead); + Status = RtlCreateAtomTable(37, &WindowStationObject->AtomTable); + WindowStationObject->SystemMenuTemplate = (HANDLE)0; + WindowStationObject->Name = WindowStationName; WindowStationObject->ScreenSaverRunning = FALSE; - WindowStationObject->FlatMenu = FALSE;
if (!IntSetupClipboard(WindowStationObject)) @@ -538,8 +501,6 @@ InitCursorImpl(); }
- DPRINT("Window station successfully created (%wZ)\n", &FullWindowStationName); - ExFreePool(FullWindowStationName.Buffer); return WindowStation; }
@@ -569,39 +530,16 @@
HWINSTA APIENTRY NtUserOpenWindowStation( - PUNICODE_STRING lpszWindowStationName, + POBJECT_ATTRIBUTES ObjectAttributes, ACCESS_MASK dwDesiredAccess) { - UNICODE_STRING WindowStationName; HWINSTA WindowStation; - OBJECT_ATTRIBUTES ObjectAttributes; NTSTATUS Status;
- /* - * Generate full window station name - */ - - if (!IntGetFullWindowStationName(&WindowStationName, lpszWindowStationName, - NULL)) - { - SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); - return 0; - } - - DPRINT("Trying to open window station (%wZ)\n", &WindowStationName); - - /* Initialize ObjectAttributes for the window station object */ - InitializeObjectAttributes( - &ObjectAttributes, - &WindowStationName, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - Status = ObOpenObjectByName( - &ObjectAttributes, + ObjectAttributes, ExWindowStationObjectType, - KernelMode, + UserMode, NULL, dwDesiredAccess, NULL, @@ -610,12 +548,8 @@ if (!NT_SUCCESS(Status)) { SetLastNtError(Status); - ExFreePool(WindowStationName.Buffer); return 0; } - - DPRINT("Successfully opened window station (%wZ)\n", &WindowStationName); - ExFreePool(WindowStationName.Buffer);
return WindowStation; }