/* Initialize the window station */
RtlZeroMemory(WindowStationObject, sizeof(WINSTATION_OBJECT));
-#ifdef USE_WINSTA_LOCK
- KeInitializeSpinLock(&WindowStationObject->Lock);
-#endif
InitializeListHead(&WindowStationObject->DesktopListHead);
Status = RtlCreateAtomTable(37, &WindowStationObject->AtomTable);
WindowStationObject->Name = WindowStationName;
{
NTSTATUS Status;
PWINSTATION_OBJECT WindowStation;
-#ifdef USE_WINSTA_LOCK
- KIRQL OldLevel;
-#endif
PLIST_ENTRY DesktopEntry;
PDESKTOP DesktopObject;
DWORD EntryCount;
return Status;
}
-#ifdef USE_WINSTA_LOCK
- KeAcquireSpinLock(&WindowStation->Lock, &OldLevel);
-#endif
-
/*
* Count the required size of buffer.
*/
Status = MmCopyToCaller(pRequiredSize, &ReturnLength, sizeof(ULONG));
if (! NT_SUCCESS(Status))
{
-#ifdef USE_WINSTA_LOCK
- KeReleaseSpinLock(&WindowStation->Lock, OldLevel);
-#endif
ObDereferenceObject(WindowStation);
return STATUS_BUFFER_TOO_SMALL;
}
*/
if (dwSize < ReturnLength)
{
-#ifdef USE_WINSTA_LOCK
- KeReleaseSpinLock(&WindowStation->Lock, OldLevel);
-#endif
ObDereferenceObject(WindowStation);
return STATUS_BUFFER_TOO_SMALL;
}
Status = MmCopyToCaller(lpBuffer, &EntryCount, sizeof(DWORD));
if (! NT_SUCCESS(Status))
{
-#ifdef USE_WINSTA_LOCK
- KeReleaseSpinLock(&WindowStation->Lock, OldLevel);
-#endif
ObDereferenceObject(WindowStation);
return Status;
}
Status = MmCopyToCaller(lpBuffer, DesktopName.Buffer, DesktopName.Length);
if (! NT_SUCCESS(Status))
{
-#ifdef USE_WINSTA_LOCK
- KeReleaseSpinLock(&WindowStation->Lock, OldLevel);
-#endif
ObDereferenceObject(WindowStation);
return Status;
}
Status = MmCopyToCaller(lpBuffer, &NullWchar, sizeof(WCHAR));
if (! NT_SUCCESS(Status))
{
-#ifdef USE_WINSTA_LOCK
- KeReleaseSpinLock(&WindowStation->Lock, OldLevel);
-#endif
ObDereferenceObject(WindowStation);
return Status;
}
}
/*
- * Clean up
+ * Clean up and return
*/
-#ifdef USE_WINSTA_LOCK
- KeReleaseSpinLock(&WindowStation->Lock, OldLevel);
-#endif
ObDereferenceObject(WindowStation);
-
return STATUS_SUCCESS;
}