mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
As soon as `ObCreateObject()` is successfully invoked, zero-out the winsta and desktop object buffers and assign them the current process session ID (into their first `dwSessionId` member). Only then, continue with regular initialization. It's done in this systematic way in order to ensure that, in case the regular initialization of these objects fails and `ObDereferenceObject()` is invoked, the `nt!ExpWin32SessionCallout()` routine (in `ntoskrnl/ex/win32k.c`) that is executed as part of the Win32 "delete" object callback registered by win32k.sys with the Object Manager, correctly finds a valid initialized `SessionId` value in the "common header" of either the window station or the desktop object being deleted. As a side-result, other parts of win32k can directly refer to `pdesk->dwSessionId` instead of `pdesk->rpwinstaParent->dwSessionId` for a given desktop.