diff --git a/reactos/ntoskrnl/ob/obinit.c b/reactos/ntoskrnl/ob/obinit.c index 978888ad0ea..f34fcfd33ff 100644 --- a/reactos/ntoskrnl/ob/obinit.c +++ b/reactos/ntoskrnl/ob/obinit.c @@ -12,11 +12,9 @@ #include #define NDEBUG -#include +#include -#if defined (ALLOC_PRAGMA) -#pragma alloc_text(INIT, ObInit) -#endif +/* GLOBALS *******************************************************************/ GENERIC_MAPPING ObpTypeMapping = { @@ -280,6 +278,10 @@ ObPostPhase0: Status = NtClose(Handle); if (!NT_SUCCESS(Status)) return FALSE; + Context.Object = NULL; + Context.Directory = ObpTypeDirectoryObject; + Context.DirectoryLocked = TRUE; + /* Loop the object types */ ListHead = &ObTypeObjectType->TypeList; NextEntry = ListHead->Flink; @@ -297,10 +299,6 @@ ObPostPhase0: /* Make sure we have a name, and aren't inserted yet */ if ((NameInfo) && !(NameInfo->Directory)) { - /* Set up the context for the insert */ - Context.Directory = ObpTypeDirectoryObject; - Context.DirectoryLocked = TRUE; - /* Do the initial lookup to setup the context */ if (!ObpLookupEntryDirectory(ObpTypeDirectoryObject, &NameInfo->Name, @@ -319,6 +317,8 @@ ObPostPhase0: NextEntry = NextEntry->Flink; } + Context.Object = NULL; + /* Initialize DOS Devices Directory and related Symbolic Links */ Status = ObpCreateDosDevicesDirectory(); if (!NT_SUCCESS(Status)) return FALSE;