- Initialize the window station object before calling ObInsertObject, since the object will be deleted in case of failure.
CORE-11124
svn path=/trunk/; revision=71164
+ /* Initialize the window station */
+ RtlZeroMemory(WindowStationObject, sizeof(WINSTATION_OBJECT));
+
+ InitializeListHead(&WindowStationObject->DesktopListHead);
+ Status = RtlCreateAtomTable(37, &WindowStationObject->AtomTable);
+ WindowStationObject->Name = WindowStationName;
+ WindowStationObject->dwSessionId = NtCurrentPeb()->SessionId;
+
Status = ObInsertObject((PVOID)WindowStationObject,
NULL,
dwDesiredAccess,
Status = ObInsertObject((PVOID)WindowStationObject,
NULL,
dwDesiredAccess,
if (!NT_SUCCESS(Status))
{
ERR("ObInsertObject failed for window station %wZ\n", &WindowStationName);
if (!NT_SUCCESS(Status))
{
ERR("ObInsertObject failed for window station %wZ\n", &WindowStationName);
- ExFreePoolWithTag(WindowStationName.Buffer, TAG_STRING);
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
- ObDereferenceObject(WindowStationObject);
- /* Initialize the window station */
- RtlZeroMemory(WindowStationObject, sizeof(WINSTATION_OBJECT));
-
- InitializeListHead(&WindowStationObject->DesktopListHead);
- Status = RtlCreateAtomTable(37, &WindowStationObject->AtomTable);
- WindowStationObject->Name = WindowStationName;
- WindowStationObject->dwSessionId = NtCurrentPeb()->SessionId;
-
if (InputWindowStation == NULL)
{
ERR("Initializing input window station\n");
if (InputWindowStation == NULL)
{
ERR("Initializing input window station\n");