Author: ion
Date: Mon Sep 3 01:12:58 2012
New Revision: 57227
URL:
http://svn.reactos.org/svn/reactos?rev=57227&view=rev
Log:
[NTOSKRNL]: Make executive init functions fail if something didn't work, intstead of
silently failing.
[NTOSKRNL]: Fix Win32k object initialization, fixes boot.
Modified:
trunk/reactos/ntoskrnl/ex/event.c
trunk/reactos/ntoskrnl/ex/evtpair.c
trunk/reactos/ntoskrnl/ex/init.c
trunk/reactos/ntoskrnl/ex/keyedevt.c
trunk/reactos/ntoskrnl/ex/mutant.c
trunk/reactos/ntoskrnl/ex/profile.c
trunk/reactos/ntoskrnl/ex/sem.c
trunk/reactos/ntoskrnl/ex/timer.c
trunk/reactos/ntoskrnl/ex/win32k.c
trunk/reactos/ntoskrnl/include/internal/ex.h
Modified: trunk/reactos/ntoskrnl/ex/event.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/event.c?rev=57…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/event.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/event.c [iso-8859-1] Mon Sep 3 01:12:58 2012
@@ -37,13 +37,14 @@
/* FUNCTIONS *****************************************************************/
-VOID
+BOOLEAN
INIT_FUNCTION
NTAPI
ExpInitializeEventImplementation(VOID)
{
OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
UNICODE_STRING Name;
+ NTSTATUS Status;
DPRINT("Creating Event Object Type\n");
/* Create the Event Object Type */
@@ -55,7 +56,9 @@
ObjectTypeInitializer.PoolType = NonPagedPool;
ObjectTypeInitializer.ValidAccessMask = EVENT_ALL_ACCESS;
ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
- ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ExEventObjectType);
+ Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ExEventObjectType);
+ if (!NT_SUCCESS(Status)) return FALSE;
+ return TRUE;
}
/*
Modified: trunk/reactos/ntoskrnl/ex/evtpair.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/evtpair.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/evtpair.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/evtpair.c [iso-8859-1] Mon Sep 3 01:12:58 2012
@@ -31,13 +31,14 @@
/* FUNCTIONS *****************************************************************/
-VOID
+BOOLEAN
INIT_FUNCTION
NTAPI
ExpInitializeEventPairImplementation(VOID)
{
OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
UNICODE_STRING Name;
+ NTSTATUS Status;
DPRINT("Creating Event Pair Object Type\n");
/* Create the Event Pair Object Type */
@@ -50,7 +51,9 @@
ObjectTypeInitializer.ValidAccessMask = EVENT_PAIR_ALL_ACCESS;
ObjectTypeInitializer.UseDefaultObject = TRUE;
ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
- ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ExEventPairObjectType);
+ Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ExEventPairObjectType);
+ if (!NT_SUCCESS(Status)) return FALSE;
+ return TRUE;
}
NTSTATUS
Modified: trunk/reactos/ntoskrnl/ex/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/init.c?rev=572…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/init.c [iso-8859-1] Mon Sep 3 01:12:58 2012
@@ -662,32 +662,68 @@
ExpInitializePushLocks();
/* Initialize events and event pairs */
- ExpInitializeEventImplementation();
- ExpInitializeEventPairImplementation();
+ if (ExpInitializeEventImplementation() == FALSE)
+ {
+ DPRINT1("Executive: Event initialization failed\n");
+ return FALSE;
+ }
+ if (ExpInitializeEventPairImplementation() == FALSE)
+ {
+ DPRINT1("Executive: Event Pair initialization failed\n");
+ return FALSE;
+ }
/* Initialize mutants */
- ExpInitializeMutantImplementation();
+ if (ExpInitializeMutantImplementation() == FALSE)
+ {
+ DPRINT1("Executive: Mutant initialization failed\n");
+ return FALSE;
+ }
/* Initialize callbacks */
- ExpInitializeCallbacks();
-
+ if (ExpInitializeCallbacks() == FALSE)
+ {
+ DPRINT1("Executive: Callback initialization failed\n");
+ return FALSE;
+ }
+
/* Initialize semaphores */
- ExpInitializeSemaphoreImplementation();
-
+ if (ExpInitializeSemaphoreImplementation() == FALSE)
+ {
+ DPRINT1("Executive: Semaphore initialization failed\n");
+ return FALSE;
+ }
+
/* Initialize timers */
- ExpInitializeTimerImplementation();
-
+ if (ExpInitializeTimerImplementation() == FALSE)
+ {
+ DPRINT1("Executive: Timer initialization failed\n");
+ return FALSE;
+ }
+
/* Initialize profiling */
- ExpInitializeProfileImplementation();
-
+ if (ExpInitializeProfileImplementation() == FALSE)
+ {
+ DPRINT1("Executive: Profile initialization failed\n");
+ return FALSE;
+ }
+
/* Initialize UUIDs */
ExpInitUuids();
/* Initialize keyed events */
- ExpInitializeKeyedEventImplementation();
-
+ if (ExpInitializeKeyedEventImplementation() == FALSE)
+ {
+ DPRINT1("Executive: Keyed event initialization failed\n");
+ return FALSE;
+ }
+
/* Initialize Win32K */
- ExpWin32kInit();
+ if (ExpWin32kInit() == FALSE)
+ {
+ DPRINT1("Executive: Win32 initialization failed\n");
+ return FALSE;
+ }
return TRUE;
}
Modified: trunk/reactos/ntoskrnl/ex/keyedevt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/keyedevt.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/keyedevt.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/keyedevt.c [iso-8859-1] Mon Sep 3 01:12:58 2012
@@ -32,7 +32,7 @@
_In_ ACCESS_MASK AccessMask,
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
_In_ ULONG Flags);
-
+
#define KeGetCurrentProcess() ((PKPROCESS)PsGetCurrentProcess())
/* GLOBALS *******************************************************************/
@@ -51,7 +51,8 @@
/* FUNCTIONS *****************************************************************/
-VOID
+BOOLEAN
+INIT_FUNCTION
NTAPI
ExpInitializeKeyedEventImplementation(VOID)
{
@@ -74,7 +75,7 @@
&ObjectTypeInitializer,
NULL,
&ExKeyedEventObjectType);
- if (!NT_SUCCESS(Status)) return;
+ if (!NT_SUCCESS(Status)) return FALSE;
/* Create the out of memory event for critical sections */
InitializeObjectAttributes(&ObjectAttributes, &Name, OBJ_PERMANENT, NULL,
NULL);
@@ -92,11 +93,10 @@
(PVOID*)&ExpCritSecOutOfMemoryEvent,
NULL);
ZwClose(EventHandle);
- }
- else
- {
- DPRINT1("Failed to create keyed event: %lx\n", Status);
- }
+ return TRUE;
+ }
+
+ return FALSE;
}
VOID
Modified: trunk/reactos/ntoskrnl/ex/mutant.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/mutant.c?rev=5…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/mutant.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/mutant.c [iso-8859-1] Mon Sep 3 01:12:58 2012
@@ -50,13 +50,14 @@
FALSE);
}
-VOID
+BOOLEAN
INIT_FUNCTION
NTAPI
ExpInitializeMutantImplementation(VOID)
{
OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
UNICODE_STRING Name;
+ NTSTATUS Status;
DPRINT("Creating Mutant Object Type\n");
/* Create the Event Pair Object Type */
@@ -68,7 +69,9 @@
ObjectTypeInitializer.PoolType = NonPagedPool;
ObjectTypeInitializer.DeleteProcedure = ExpDeleteMutant;
ObjectTypeInitializer.ValidAccessMask = MUTANT_ALL_ACCESS;
- ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ExMutantObjectType);
+ Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ExMutantObjectType);
+ if (!NT_SUCCESS(Status)) return FALSE;
+ return TRUE;
}
/*
Modified: trunk/reactos/ntoskrnl/ex/profile.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/profile.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/profile.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/profile.c [iso-8859-1] Mon Sep 3 01:12:58 2012
@@ -61,13 +61,14 @@
if (Profile->Process) ObDereferenceObject(Profile->Process);
}
-VOID
+BOOLEAN
INIT_FUNCTION
NTAPI
ExpInitializeProfileImplementation(VOID)
{
OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
UNICODE_STRING Name;
+ NTSTATUS Status;
DPRINT("Creating Profile Object Type\n");
/* Initialize the Mutex to lock the States */
@@ -83,7 +84,9 @@
ObjectTypeInitializer.DeleteProcedure = ExpDeleteProfile;
ObjectTypeInitializer.ValidAccessMask = PROFILE_ALL_ACCESS;
ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
- ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ExProfileObjectType);
+ Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ExProfileObjectType);
+ if (!NT_SUCCESS(Status)) return FALSE;
+ return TRUE;
}
NTSTATUS
Modified: trunk/reactos/ntoskrnl/ex/sem.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/sem.c?rev=5722…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/sem.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/sem.c [iso-8859-1] Mon Sep 3 01:12:58 2012
@@ -37,13 +37,14 @@
/* FUNCTIONS *****************************************************************/
-VOID
+BOOLEAN
INIT_FUNCTION
NTAPI
ExpInitializeSemaphoreImplementation(VOID)
{
OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
UNICODE_STRING Name;
+ NTSTATUS Status;
DPRINT("Creating Semaphore Object Type\n");
/* Create the Event Pair Object Type */
@@ -55,7 +56,9 @@
ObjectTypeInitializer.PoolType = NonPagedPool;
ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
ObjectTypeInitializer.ValidAccessMask = SEMAPHORE_ALL_ACCESS;
- ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ExSemaphoreObjectType);
+ Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ExSemaphoreObjectType);
+ if (!NT_SUCCESS(Status)) return FALSE;
+ return TRUE;
}
/*
Modified: trunk/reactos/ntoskrnl/ex/timer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/timer.c?rev=57…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/timer.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/timer.c [iso-8859-1] Mon Sep 3 01:12:58 2012
@@ -216,13 +216,14 @@
ObDereferenceObjectEx(Timer, DerefsToDo);
}
-VOID
+BOOLEAN
INIT_FUNCTION
NTAPI
ExpInitializeTimerImplementation(VOID)
{
OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
UNICODE_STRING Name;
+ NTSTATUS Status;
/* Create the Timer Object Type */
RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
@@ -234,11 +235,13 @@
ObjectTypeInitializer.PoolType = NonPagedPool;
ObjectTypeInitializer.ValidAccessMask = TIMER_ALL_ACCESS;
ObjectTypeInitializer.DeleteProcedure = ExpDeleteTimer;
- ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ExTimerType);
+ Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL,
&ExTimerType);
+ if (!NT_SUCCESS(Status)) return FALSE;
/* Initialize the Wait List and Lock */
KeInitializeSpinLock(&ExpWakeListLock);
InitializeListHead(&ExpWakeList);
+ return TRUE;
}
/* PUBLIC FUNCTIONS **********************************************************/
Modified: trunk/reactos/ntoskrnl/ex/win32k.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/win32k.c?rev=5…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/win32k.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/win32k.c [iso-8859-1] Mon Sep 3 01:12:58 2012
@@ -133,13 +133,14 @@
ExpDesktopObjectDelete(&Parameters);
}
-VOID
+BOOLEAN
INIT_FUNCTION
NTAPI
ExpWin32kInit(VOID)
{
OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
UNICODE_STRING Name;
+ NTSTATUS Status;
DPRINT("Creating Win32 Object Types\n");
/* Create the window station Object Type */
@@ -151,16 +152,17 @@
ObjectTypeInitializer.DeleteProcedure = ExpWinStaObjectDelete;
ObjectTypeInitializer.ParseProcedure = ExpWinStaObjectParse;
ObjectTypeInitializer.OkayToCloseProcedure = ExpWindowStationOkToClose;
- ObjectTypeInitializer.MaintainHandleCount = TRUE;
ObjectTypeInitializer.SecurityRequired = TRUE;
ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK |
OBJ_PERMANENT |
OBJ_EXCLUSIVE;
- ObCreateObjectType(&Name,
- &ObjectTypeInitializer,
- NULL,
- &ExWindowStationObjectType);
-
+ ObjectTypeInitializer.ValidAccessMask = STANDARD_RIGHTS_REQUIRED;
+ Status = ObCreateObjectType(&Name,
+ &ObjectTypeInitializer,
+ NULL,
+ &ExWindowStationObjectType);
+ if (!NT_SUCCESS(Status)) return FALSE;
+
/* Create desktop object type */
RtlInitUnicodeString(&Name, L"Desktop");
ObjectTypeInitializer.GenericMapping = ExpDesktopMapping;
@@ -171,6 +173,9 @@
&ObjectTypeInitializer,
NULL,
&ExDesktopObjectType);
+ if (!NT_SUCCESS(Status)) return FALSE;
+
+ return TRUE;
}
/* EOF */
Modified: trunk/reactos/ntoskrnl/include/internal/ex.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ex.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/ex.h [iso-8859-1] Mon Sep 3 01:12:58 2012
@@ -140,7 +140,7 @@
/* INITIALIZATION FUNCTIONS *************************************************/
-VOID
+BOOLEAN
NTAPI
ExpWin32kInit(VOID);
@@ -202,31 +202,31 @@
IN PLOADER_PARAMETER_BLOCK LoaderBlock
);
-VOID
+BOOLEAN
NTAPI
ExpInitializeEventImplementation(VOID);
-VOID
+BOOLEAN
NTAPI
ExpInitializeKeyedEventImplementation(VOID);
-VOID
+BOOLEAN
NTAPI
ExpInitializeEventPairImplementation(VOID);
-VOID
+BOOLEAN
NTAPI
ExpInitializeSemaphoreImplementation(VOID);
-VOID
+BOOLEAN
NTAPI
ExpInitializeMutantImplementation(VOID);
-VOID
+BOOLEAN
NTAPI
ExpInitializeTimerImplementation(VOID);
-VOID
+BOOLEAN
NTAPI
ExpInitializeProfileImplementation(VOID);