mirror of
https://github.com/reactos/reactos.git
synced 2024-07-04 03:34:16 +00:00
[SYSSETUP]
- Move the hotkey loop to its own thread to make it work when modal dialogs are open, and also during device installation CORE-9428 svn path=/trunk/; revision=66914
This commit is contained in:
parent
6a983b9dd4
commit
c73e3e5aa4
|
@ -763,7 +763,7 @@ InstallLiveCD(IN HINSTANCE hInstance)
|
||||||
|
|
||||||
if (!CommonInstall())
|
if (!CommonInstall())
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Register components */
|
/* Register components */
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
|
@ -782,7 +782,7 @@ InstallLiveCD(IN HINSTANCE hInstance)
|
||||||
DPRINT1("Catching exception\n");
|
DPRINT1("Catching exception\n");
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
|
|
||||||
SetupCloseInfFile(hSysSetupInf);
|
SetupCloseInfFile(hSysSetupInf);
|
||||||
|
|
||||||
/* Run the shell */
|
/* Run the shell */
|
||||||
|
@ -911,6 +911,53 @@ cleanup:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DWORD CALLBACK
|
||||||
|
HotkeyThread(LPVOID Parameter)
|
||||||
|
{
|
||||||
|
ATOM hotkey;
|
||||||
|
MSG msg;
|
||||||
|
|
||||||
|
DPRINT("HotkeyThread start\n");
|
||||||
|
|
||||||
|
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 (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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UnregisterHotKey(NULL, hotkey);
|
||||||
|
GlobalDeleteAtom(hotkey);
|
||||||
|
|
||||||
|
DPRINT("HotkeyThread terminate\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
DWORD WINAPI
|
DWORD WINAPI
|
||||||
InstallReactOS(HINSTANCE hInstance)
|
InstallReactOS(HINSTANCE hInstance)
|
||||||
|
@ -920,6 +967,7 @@ InstallReactOS(HINSTANCE hInstance)
|
||||||
TOKEN_PRIVILEGES privs;
|
TOKEN_PRIVILEGES privs;
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
HINF hShortcutsInf;
|
HINF hShortcutsInf;
|
||||||
|
HANDLE hHotkeyThread;
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
InitializeSetupActionLog(FALSE);
|
InitializeSetupActionLog(FALSE);
|
||||||
|
@ -964,6 +1012,8 @@ InstallReactOS(HINSTANCE hInstance)
|
||||||
CreateDirectory(szBuffer, NULL);
|
CreateDirectory(szBuffer, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hHotkeyThread = CreateThread(NULL, 0, HotkeyThread, NULL, 0, NULL);
|
||||||
|
|
||||||
/* Hack: Install TCP/IP protocol driver */
|
/* Hack: Install TCP/IP protocol driver */
|
||||||
ret = InstallInfSection(NULL,
|
ret = InstallInfSection(NULL,
|
||||||
L"nettcpip.inf",
|
L"nettcpip.inf",
|
||||||
|
@ -973,7 +1023,7 @@ InstallReactOS(HINSTANCE hInstance)
|
||||||
{
|
{
|
||||||
DPRINT("InstallInfSection() failed with error 0x%lx\n", GetLastError());
|
DPRINT("InstallInfSection() failed with error 0x%lx\n", GetLastError());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Start the TCP/IP protocol driver */
|
/* Start the TCP/IP protocol driver */
|
||||||
SetupStartService(L"Tcpip", FALSE);
|
SetupStartService(L"Tcpip", FALSE);
|
||||||
|
@ -993,7 +1043,7 @@ InstallReactOS(HINSTANCE hInstance)
|
||||||
NULL,
|
NULL,
|
||||||
INF_STYLE_WIN4,
|
INF_STYLE_WIN4,
|
||||||
NULL);
|
NULL);
|
||||||
if (hShortcutsInf == INVALID_HANDLE_VALUE)
|
if (hShortcutsInf == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
FatalError("Failed to open shortcuts.inf");
|
FatalError("Failed to open shortcuts.inf");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1045,6 +1095,12 @@ InstallReactOS(HINSTANCE hInstance)
|
||||||
SetupCloseInfFile(hSysSetupInf);
|
SetupCloseInfFile(hSysSetupInf);
|
||||||
SetSetupType(0);
|
SetSetupType(0);
|
||||||
|
|
||||||
|
if (hHotkeyThread)
|
||||||
|
{
|
||||||
|
PostThreadMessage(GetThreadId(hHotkeyThread), WM_QUIT, 0, 0);
|
||||||
|
CloseHandle(hHotkeyThread);
|
||||||
|
}
|
||||||
|
|
||||||
LogItem(SYSSETUP_SEVERITY_INFORMATION, L"Installing ReactOS done");
|
LogItem(SYSSETUP_SEVERITY_INFORMATION, L"Installing ReactOS done");
|
||||||
TerminateSetupActionLog();
|
TerminateSetupActionLog();
|
||||||
|
|
||||||
|
|
|
@ -2317,7 +2317,6 @@ InstallWizard(VOID)
|
||||||
UINT nPages = 0;
|
UINT nPages = 0;
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
MSG msg;
|
MSG msg;
|
||||||
ATOM hotkey;
|
|
||||||
|
|
||||||
/* Clear setup data */
|
/* Clear setup data */
|
||||||
ZeroMemory(&SetupData, sizeof(SETUPDATA));
|
ZeroMemory(&SetupData, sizeof(SETUPDATA));
|
||||||
|
@ -2409,43 +2408,14 @@ InstallWizard(VOID)
|
||||||
hWnd = (HWND)PropertySheet(&psh);
|
hWnd = (HWND)PropertySheet(&psh);
|
||||||
ShowWindow(hWnd, SW_SHOW);
|
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))
|
while (GetMessage(&msg, NULL, 0, 0))
|
||||||
{
|
{
|
||||||
if (msg.hwnd == NULL && msg.message == WM_HOTKEY && msg.wParam == hotkey)
|
if (!IsDialogMessage(hWnd, &msg))
|
||||||
{
|
|
||||||
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);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UnregisterHotKey(NULL, hotkey);
|
|
||||||
GlobalDeleteAtom(hotkey);
|
|
||||||
|
|
||||||
DeleteObject(SetupData.hTitleFont);
|
DeleteObject(SetupData.hTitleFont);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue