Signal the ReactOSInitDone event like smss.exe does,
prevents bugcheck when usetup is done in less than 120 sec
Modified: trunk/reactos/subsys/system/usetup/usetup.c

Modified: trunk/reactos/subsys/system/usetup/usetup.c
--- trunk/reactos/subsys/system/usetup/usetup.c	2005-01-09 04:40:01 UTC (rev 12903)
+++ trunk/reactos/subsys/system/usetup/usetup.c	2005-01-09 08:20:28 UTC (rev 12904)
@@ -31,6 +31,7 @@
 
 #include <ntos/minmax.h>
 #include <reactos/resource.h>
+#include <rosrtl/string.h>
 
 #include "usetup.h"
 #include "console.h"
@@ -3691,6 +3692,43 @@
 }
 
 
+static VOID
+SignalInitEvent()
+{
+  NTSTATUS Status;
+  OBJECT_ATTRIBUTES ObjectAttributes;
+  UNICODE_STRING UnicodeString;
+  HANDLE ReactOSInitEvent;
+
+  RtlRosInitUnicodeStringFromLiteral(&UnicodeString, L"\\ReactOSInitDone");
+  InitializeObjectAttributes(&ObjectAttributes,
+    &UnicodeString,
+    EVENT_ALL_ACCESS,
+    0,
+    NULL);
+  Status = NtOpenEvent(&ReactOSInitEvent,
+    EVENT_ALL_ACCESS,
+    &ObjectAttributes);
+  if (NT_SUCCESS(Status))
+    {
+      LARGE_INTEGER Timeout;
+      /* This will cause the boot screen image to go away (if displayed) */
+      NtPulseEvent(ReactOSInitEvent, NULL);
+
+      /* Wait for the display mode to be changed (if in graphics mode) */
+      Timeout.QuadPart = -50000000LL;  /* 5 second timeout */
+      NtWaitForSingleObject(ReactOSInitEvent, FALSE, &Timeout);
+
+      NtClose(ReactOSInitEvent);
+    }
+  else
+    {
+      /* We don't really care if this fails */
+      DPRINT1("USETUP: Failed to open ReactOS init notification event\n");
+    }
+}
+
+
 VOID STDCALL
 NtProcessStartup(PPEB Peb)
 {
@@ -3702,6 +3740,8 @@
 
   ProcessHeap = Peb->ProcessHeap;
 
+  SignalInitEvent();
+
   Status = AllocConsole();
   if (!NT_SUCCESS(Status))
     {