NTSTATUS
NTAPI
-UserCreateWinstaDirectory()
+UserCreateWinstaDirectory(VOID)
{
PPEB Peb;
NTSTATUS Status;
/* Setup the icons */
co_IntSetWndIcons();
+ /* Setup Menu */
+ MenuInit();
+
/* Show the desktop */
pdesk = IntGetActiveDesktop();
ASSERT(pdesk);
if (InputWindowStation == NULL)
{
- ERR("Initializeing input window station\n");
+ ERR("Initializing input window station\n");
InputWindowStation = WindowStationObject;
WindowStationObject->Flags &= ~WSS_NOIO;
DWORD nLength,
PDWORD nLengthNeeded)
{
- PWINSTATION_OBJECT WinStaObject = NULL;
+ PWINSTATION_OBJECT WinStaObject;
PDESKTOP DesktopObject = NULL;
NTSTATUS Status;
PVOID pvData = NULL;
{
/* try desktop */
TRACE("Trying to open desktop %p\n", hObject);
+ WinStaObject = NULL;
Status = IntValidateDesktopHandle(
hObject,
UserMode,
ppi->prpwinsta = NewWinSta;
ppi->hwinsta = hWindowStation;
ppi->amwinsta = hWindowStation != NULL ? ObjectHandleInfo.GrantedAccess : 0;
- TRACE("WS : Granted Access %p\n",ppi->amwinsta);
+ TRACE("WS : Granted Access 0x%08lx\n",ppi->amwinsta);
if (RtlAreAllAccessesGranted(ppi->amwinsta, WINSTA_READSCREEN))
{
InitializeObjectAttributes(
&ObjectAttributes,
&gustrWindowStationsDir,
- OBJ_CASE_INSENSITIVE,
+ OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
NULL,
NULL);
/* Need a larger buffer, check how large exactly */
Status = ZwQueryDirectoryObject(DirectoryHandle, NULL, 0, FALSE, TRUE, &Context,
&ReturnLength);
- if (STATUS_BUFFER_TOO_SMALL == Status)
+ if (!NT_SUCCESS(Status))
{
- ObDereferenceObject(DirectoryHandle);
- return STATUS_NO_MEMORY;
+ ERR("ZwQueryDirectoryObject failed\n");
+ ZwClose(DirectoryHandle);
+ return Status;
}
BufferSize = ReturnLength;
Buffer = ExAllocatePoolWithTag(PagedPool, BufferSize, TAG_WINSTA);
if (NULL == Buffer)
{
- ObDereferenceObject(DirectoryHandle);
+ ZwClose(DirectoryHandle);
return STATUS_NO_MEMORY;
}
{
/* Something went wrong, maybe someone added a directory entry? Just give up. */
ExFreePoolWithTag(Buffer, TAG_WINSTA);
- ObDereferenceObject(DirectoryHandle);
+ ZwClose(DirectoryHandle);
return NT_SUCCESS(Status) ? STATUS_INTERNAL_ERROR : Status;
}
}
* Size of buffer passed by caller.
*
* lpBuffer
- * Buffer passed by caller. If the function succedes, the buffer is
+ * Buffer passed by caller. If the function succeeds, the buffer is
* filled with window station/desktop count (in first DWORD) and
* NULL-terminated window station/desktop names.
*
* pRequiredSize
- * If the function suceedes, this is the number of bytes copied.
+ * If the function succeeds, this is the number of bytes copied.
* Otherwise it's size of buffer needed for function to succeed.
*
* Status
if (!NT_SUCCESS(Status))
{
- ExFreePoolWithTag(WindowStation->psidUser, 0);
+ ExFreePoolWithTag(WindowStation->psidUser, USERTAG_SECURITY);
WindowStation->psidUser = 0;
goto Leave;
}