Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions src/install-helper/install-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,50 @@ DWORD StopXenbusMonitor()
return status;
}

/*
* Automatically accept the prompt for installing test-signed drivers.
*/
DWORD ApproveTestSign(void* param)
{
while (TRUE)
{
HWND window = FindWindow(NULL, L"Windows Security");
if (window)
{
DWORD fg_tid = GetWindowThreadProcessId(GetForegroundWindow(), NULL);
DWORD tid = GetCurrentThreadId();
// Without this, focus-stealing mitigations can prevent activating the target window.
if (tid != fg_tid)
AttachThreadInput(fg_tid, tid, TRUE);

BringWindowToTop(window);
ShowWindow(window, SW_SHOW);

while (GetForegroundWindow() != window)
Sleep(100);

INPUT inputs[2];
inputs[0].type = INPUT_KEYBOARD;
inputs[0].ki.wVk = 'i';
inputs[1].type = INPUT_KEYBOARD;
inputs[1].ki.dwFlags = KEYEVENTF_KEYUP;
inputs[1].ki.wVk = 'i';
SendInput(ARRAYSIZE(inputs), inputs, sizeof(INPUT));
break;
}
else
{
Sleep(100);
}
}
return 0;
}

int WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nShowCmd)
{
(void)AddSymlinkRightToUsers();
HANDLE thread = CreateThread(NULL, 0, ApproveTestSign, NULL, 0, NULL);
if (WaitForSingleObject(thread, 1800000) == WAIT_TIMEOUT)
TerminateThread(thread, 0);
return (int)StopXenbusMonitor();
}
23 changes: 19 additions & 4 deletions vs2022/installer/CoreComponents.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@
/>
</Property>

<Property Id="DPF_SET">
<RegistrySearch
Root="HKLM"
Key="SYSTEM\CurrentControlSet\Control\Session Manager\Debug Print Filter"
Name="IHVDRIVER"
Type="raw"
/>
</Property>

<ComponentGroup Id="CoreComponents">

<?if $(env.TEST_SIGN) ?>
Expand Down Expand Up @@ -132,6 +141,16 @@
</RegistryKey>
</Component>

<Component
Guid="{CD253E87-10A2-4BAA-AFA5-6AF0A87DCFAB}"
Id="DebugPrintFilter"
Condition="NOT DPF_SET"
Directory="INSTALL_DIR">
<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Control\Session Manager\Debug Print Filter">
<RegistryValue Name="IHVDRIVER" Type="integer" Value="3" />
</RegistryKey>
</Component>

<Component
Guid="{C824195C-F828-4FF5-BFCA-3143F0D89916}"
Id="SystemSettings"
Expand All @@ -144,10 +163,6 @@
</RegistryValue>
</RegistryKey>

<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Control\Session Manager\Debug Print Filter">
<RegistryValue Name="IHVDRIVER" Type="integer" Value="3" />
</RegistryKey>

<!-- Enable paths longer than MAX_PATH for FS APIs by default -->
<RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Control\FileSystem">
<RegistryValue Name="LongPathsEnabled" Type="integer" Value="1" />
Expand Down