Author: tfaber
Date: Fri Mar 27 11:21:40 2015
New Revision: 66913

URL: http://svn.reactos.org/svn/reactos?rev=66913&view=rev
Log:
[SYSSETUP]
- Open a command prompt if Shift+F10 is pressed during GUI setup, as Windows 
does.
CORE-9428 #resolve

Modified:
    trunk/reactos/dll/win32/syssetup/wizard.c

Modified: trunk/reactos/dll/win32/syssetup/wizard.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/wizard.c?rev=66913&r1=66912&r2=66913&view=diff
==============================================================================
--- trunk/reactos/dll/win32/syssetup/wizard.c   [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/syssetup/wizard.c   [iso-8859-1] Fri Mar 27 
11:21:40 2015
@@ -2317,6 +2317,7 @@
     UINT nPages = 0;
     HWND hWnd;
     MSG msg;
+    ATOM hotkey;
 
     /* Clear setup data */
     ZeroMemory(&SetupData, sizeof(SETUPDATA));
@@ -2408,14 +2409,43 @@
     hWnd = (HWND)PropertySheet(&psh);
     ShowWindow(hWnd, SW_SHOW);
 
+    hotkey = GlobalAddAtomW(L"Setup Shift+F10 Hotkey");
+    if (!RegisterHotKey(NULL, hotkey, MOD_SHIFT, VK_F10))
+        DPRINT1("RegisterHotKey failed with %lu\n", GetLastError());
     while (GetMessage(&msg, NULL, 0, 0))
     {
-        if(!IsDialogMessage(hWnd, &msg))
+        if (msg.hwnd == NULL && msg.message == WM_HOTKEY && msg.wParam == 
hotkey)
+        {
+            STARTUPINFOW si = { sizeof(si) };
+            PROCESS_INFORMATION pi;
+
+            if (CreateProcessW(L"cmd.exe",
+                               NULL,
+                               NULL,
+                               NULL,
+                               FALSE,
+                               CREATE_NEW_CONSOLE,
+                               NULL,
+                               NULL,
+                               &si,
+                               &pi))
+            {
+                CloseHandle(pi.hProcess);
+                CloseHandle(pi.hThread);
+            }
+            else
+            {
+                DPRINT1("Failed to launch command prompt: %lu\n", 
GetLastError());
+            }
+        }
+        else if (!IsDialogMessage(hWnd, &msg))
         {
             TranslateMessage(&msg);
             DispatchMessage(&msg);
         }
     }
+    UnregisterHotKey(NULL, hotkey);
+    GlobalDeleteAtom(hotkey);
 
     DeleteObject(SetupData.hTitleFont);
 }


Reply via email to