USER32: start the reboot process in ExitWindowsEx

Mike McCormack mike at codeweavers.com
Sun Oct 31 21:11:35 CST 2004


Not sure what name to use for the registry key holding the name of the 
boot process... feel free to change it.

Mike


ChangeLog:
* start the reboot process in ExitWindowsEx
-------------- next part --------------
Index: windows/user.c
===================================================================
RCS file: /home/wine/wine/windows/user.c,v
retrieving revision 1.102
diff -u -r1.102 user.c
--- windows/user.c	29 Oct 2004 21:26:33 -0000	1.102
+++ windows/user.c	1 Nov 2004 03:02:18 -0000
@@ -413,6 +413,46 @@
 }
  
 /***********************************************************************
+ *		USER_StartRebootProcess (Internal)
+ */
+static BOOL USER_StartRebootProcess(void)
+{
+    HKEY hkey;
+    CHAR szBootProcess[MAX_PATH];
+    DWORD type, count = sizeof szBootProcess;
+    BOOL r = FALSE;
+
+    if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine\\Wine\\Config\\restart", &hkey))
+        return FALSE;
+
+    if (!RegQueryValueExA(hkey, "Boot", 0, &type, szBootProcess, &count))
+    {
+        if (type == REG_SZ)
+        {
+            PROCESS_INFORMATION pi;
+            STARTUPINFOA si;
+
+            MESSAGE("Executing boot process %s\n",szBootProcess);
+
+            memset( &si, 0, sizeof si );
+            si.cb = sizeof si;
+ 
+            r = CreateProcessA( NULL, szBootProcess, NULL, NULL, FALSE,
+                                0, NULL, NULL, &si, &pi );
+            if (r)
+            {
+                CloseHandle( pi.hProcess );
+                CloseHandle( pi.hThread );
+            }
+            else
+                MESSAGE("Failed to start boot process %s\n",szBootProcess);
+        }
+    }
+    RegCloseKey(hkey);
+    return r;
+}
+
+/***********************************************************************
  *		ExitWindowsEx (USER32.@)
  */
 BOOL WINAPI ExitWindowsEx( UINT flags, DWORD reserved )
@@ -446,6 +486,9 @@
 
     /* USER_DoShutdown will kill all processes except the current process */
     USER_DoShutdown();
+
+    if (flags & EWX_REBOOT)
+        USER_StartRebootProcess();
  
     if (result) ExitKernel16();
     return TRUE;


More information about the wine-patches mailing list