fix Win 11 SDK build error

This commit is contained in:
SinaKarvandi 2021-11-04 12:20:46 +03:30
parent 340a2f68ff
commit d8536bf550
12 changed files with 37 additions and 128 deletions

View file

@ -432,7 +432,7 @@ SetPrivilege(HANDLE hToken, // access token handle
if (GetLastError() == ERROR_NOT_ALL_ASSIGNED)
{
ShowMessages("err, the token does not have the specified privilege\n");
ShowMessages("err, the token does not have the specified privilege (ACCESS DENIED!)\n");
ShowMessages("make sure to run it with administrator privileges\n");
return FALSE;
}

View file

@ -162,7 +162,7 @@ CommandSympath(vector<string> SplittedCommand, string Command)
// Show the message
//
ShowMessages("symbol server/path is configured successfully\n");
ShowMessages("use '.sym load', '.sym reload', or '.sym download' to load pdb files\n");
ShowMessages("use '.sym reload' or '.sym download' to load pdb files\n");
}
else
{

View file

@ -50,7 +50,7 @@ ShowErrorMessage(UINT32 Error)
break;
case DEBUGEER_ERROR_EVENT_TYPE_IS_INVALID:
ShowMessages("err, the event type is invalid (%x)\n", Error);
ShowMessages("err, event type is invalid (%x)\n", Error);
break;
case DEBUGEER_ERROR_UNABLE_TO_CREATE_EVENT:
@ -114,7 +114,7 @@ ShowErrorMessage(UINT32 Error)
case DEBUGGER_ERROR_STEPPINGS_EITHER_THREAD_NOT_FOUND_OR_DISABLED:
ShowMessages(
"err, the target thread not found or the thread is disabled (%x)\n",
"err, target thread not found or the thread is disabled (%x)\n",
Error);
break;
@ -131,11 +131,11 @@ ShowErrorMessage(UINT32 Error)
break;
case DEBUGGER_ERROR_PREPARING_DEBUGGEE_UNABLE_TO_SWITCH_TO_NEW_PROCESS:
ShowMessages("err, unable to switch to the new process (%x)\n", Error);
ShowMessages("err, unable to switch to new process (%x)\n", Error);
break;
case DEBUGGER_ERROR_PREPARING_DEBUGGEE_TO_RUN_SCRIPT:
ShowMessages("err, unable to run the script on remote debuggee (%x)\n", Error);
ShowMessages("err, unable to run script on remote debuggee (%x)\n", Error);
break;
case DEBUGGER_ERROR_INVALID_REGISTER_NUMBER:
@ -169,13 +169,11 @@ ShowErrorMessage(UINT32 Error)
break;
case DEBUGGER_ERROR_MEMORY_TYPE_INVALID:
ShowMessages("err, the memory type is invalid (%x)\n", Error);
ShowMessages("err, memory type is invalid (%x)\n", Error);
break;
case DEBUGEER_ERROR_INVALID_PROCESS_ID:
ShowMessages("err, the process id is invalid, make sure to enter the "
"process id in hex format (%x)\n",
Error);
ShowMessages("err, process id is invalid (%x)\n", Error);
break;
case DEBUGEER_ERROR_EVENT_IS_NOT_APPLIED:

View file

@ -1833,24 +1833,6 @@ DebuggerParseEventFromUsermode(PDEBUGGER_GENERAL_EVENT_DETAIL EventDetails, UINT
}
}
//
// Check if process id is valid or not, we won't touch process id here
// because some of the events use the exact value of DEBUGGER_EVENT_APPLY_TO_ALL_PROCESSES
//
if (EventDetails->ProcessId != DEBUGGER_EVENT_APPLY_TO_ALL_PROCESSES &&
EventDetails->ProcessId != 0)
{
//
// The used specified a special pid, let's check if it's valid or not
//
if (!IsProcessExist(EventDetails->ProcessId))
{
ResultsToReturnUsermode->IsSuccessful = FALSE;
ResultsToReturnUsermode->Error = DEBUGEER_ERROR_INVALID_PROCESS_ID;
return FALSE;
}
}
if (EventDetails->EventType == EXCEPTION_OCCURRED)
{
//
@ -2019,7 +2001,7 @@ DebuggerParseEventFromUsermode(PDEBUGGER_GENERAL_EVENT_DETAIL EventDetails, UINT
{
//
// Check if process id is equal to DEBUGGER_EVENT_APPLY_TO_ALL_PROCESSES
// or if process id is 0 then we use the cr3 of current process
// or if process id is 0 then we use the cr32 of current process
//
if (EventDetails->ProcessId == DEBUGGER_EVENT_APPLY_TO_ALL_PROCESSES ||
EventDetails->ProcessId == 0)

View file

@ -726,7 +726,7 @@ KdSwitchToNewProcessDpc(PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1,
//
// Pid is invalid
//
LogInfo("Err, the process id is invalid (unable to switch)");
LogInfo("Err, process id is invalid (unable to switch)");
//
// Trigger a breakpoint to be managed by HyperDbg as sign of failure

View file

@ -1,86 +0,0 @@
;
; hprdbghv.inf
;
[Version]
Signature="$WINDOWS NT$"
Class=Sample ; TODO: edit Class
ClassGuid={78A1C341-4539-11d3-B88D-00C04FAD5171} ; TODO: edit ClassGuid
Provider=%ManufacturerName%
CatalogFile=hprdbghv.cat
DriverVer= ; TODO: set DriverVer in stampinf property pages
[DestinationDirs]
DefaultDestDir = 12
MyHypervisorDriver_Device_CoInstaller_CopyFiles = 11
; ================= Class section =====================
[ClassInstall32]
Addreg=SampleClassReg
[SampleClassReg]
HKR,,,0,%ClassName%
HKR,,Icon,,-5
[SourceDisksNames]
1 = %DiskName%,,,""
[SourceDisksFiles]
hprdbghv.sys = 1,,
WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll=1 ; make sure the number matches with SourceDisksNames
;*****************************************
; Install Section
;*****************************************
[Manufacturer]
%ManufacturerName%=Standard,NT$ARCH$
[Standard.NT$ARCH$]
%hprdbghv.DeviceDesc%=MyHypervisorDriver_Device, Root\hprdbghv ; TODO: edit hw-id
[MyHypervisorDriver_Device.NT]
CopyFiles=Drivers_Dir
[Drivers_Dir]
hprdbghv.sys
;-------------- Service installation
[MyHypervisorDriver_Device.NT.Services]
AddService = hprdbghv,%SPSVCINST_ASSOCSERVICE%, MyHypervisorDriver_Service_Inst
; -------------- hprdbghv driver install sections
[MyHypervisorDriver_Service_Inst]
DisplayName = %hprdbghv.SVCDESC%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\hprdbghv.sys
;
;--- hprdbghv_Device Coinstaller installation ------
;
[hprdbghv_Device.NT.CoInstallers]
AddReg=hprdbghv_Device_CoInstaller_AddReg
CopyFiles=MyHypervisorDriver_Device_CoInstaller_CopyFiles
[hprdbghv_Device_CoInstaller_AddReg]
HKR,,CoInstallers32,0x00010000, "WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll,WdfCoInstaller"
[hprdbghv_Device_CoInstaller_CopyFiles]
WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll
[hprdbghv_Device.NT.Wdf]
KmdfService = hprdbghv, MyHypervisorDriver_wdfsect
[hprdbghv_wdfsect]
KmdfLibraryVersion = $KMDFVERSION$
[Strings]
SPSVCINST_ASSOCSERVICE= 0x00000002
ManufacturerName="HyperDbg Debugger Community" ;TODO: Replace with your manufacturer name
ClassName="HyperDbg" ; TODO: edit ClassName
DiskName = "hprdbghv Installation Disk"
hprdbghv.DeviceDesc = "hprdbghv Device"
hprdbghv.SVCDESC = "hprdbghv Service"

View file

@ -97,9 +97,6 @@
<Optimization>Disabled</Optimization>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<Inf Include="hprdbghv.inf" />
</ItemGroup>
<ItemGroup>
<FilesToPackage Include="$(TargetPath)" />
</ItemGroup>

View file

@ -1,10 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="driver">
<UniqueIdentifier>{8E41214B-6785-4CFE-B992-037D68949A14}</UniqueIdentifier>
<Extensions>inf;inv;inx;mof;mc;</Extensions>
</Filter>
<Filter Include="header">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
@ -119,11 +115,6 @@
<UniqueIdentifier>{7d72077e-4c3d-471b-8465-c235fc9b9488}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<Inf Include="hprdbghv.inf">
<Filter>driver</Filter>
</Inf>
</ItemGroup>
<ItemGroup>
<ClCompile Include="code\common\Common.c">
<Filter>code\common</Filter>

View file

@ -15,3 +15,4 @@ Abstract:
#include <ntdef.h>
#include "uart.h"
#include "uartp.h"
#include "win11sdk.h"

View file

@ -7,6 +7,10 @@ EXPORTS
KdSetHiberRange
KdPower
HviGetDebugDeviceOptions
HviGetHypervisorFeatures
HviIsHypervisorVendorMicrosoft
KdHyperDbgTest
KdHyperDbgPrepareDebuggeeConnectionPort
KdHyperDbgSendByte

View file

@ -36,6 +36,7 @@
<ClInclude Include="uart.h" />
<ClInclude Include="uartp.h" />
<ClInclude Include="common.h" />
<ClInclude Include="win11sdk.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{2D988267-CC53-41E3-936A-48CEF9049DF5}</ProjectGuid>

View file

@ -0,0 +1,21 @@
#pragma once
__declspec(dllexport) void HviGetDebugDeviceOptions();
__declspec(dllexport) void HviGetHypervisorFeatures();
__declspec(dllexport) void HviIsHypervisorVendorMicrosoft();
inline void
HviGetDebugDeviceOptions()
{
return;
}
inline void
HviGetHypervisorFeatures()
{
return;
}
inline void
HviIsHypervisorVendorMicrosoft()
{
return;
}