Permalink
Browse files

Fixed compatibility with Windows 10 on VirtualBox

  • Loading branch information...
sysprogs committed Sep 30, 2015
1 parent 50ea7f6 commit 895f4e607cdc8b8a77f7ec8594dd5e7cf69a9e32
Showing with 23 additions and 12 deletions.
  1. +6 −12 kdclient/kdclient.vcxproj
  2. +17 −0 kdvm/kdvm.cpp
View
@@ -147,8 +147,7 @@
<AdditionalDependencies>$(WDK7PATH)\lib\wnet\i386\ntdll.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>
</Command>
<Command>$(SIGN_RELEASE_BINARY) $(TargetPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -174,8 +173,7 @@
<AdditionalDependencies>$(WDK7PATH)\lib\wlh\amd64\ntdll.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>
</Command>
<Command>$(SIGN_RELEASE_BINARY) $(TargetPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -200,8 +198,7 @@
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
</Link>
<PostBuildEvent>
<Command>
</Command>
<Command>$(SIGN_RELEASE_BINARY) $(TargetPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -230,8 +227,7 @@
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
</Link>
<PostBuildEvent>
<Command>
</Command>
<Command>$(SIGN_RELEASE_BINARY) $(TargetPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug (Proxy mode)|Win32'">
@@ -253,8 +249,7 @@
<AdditionalDependencies>$(WDK7PATH)\lib\wnet\i386\ntdll.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>
</Command>
<Command>$(SIGN_RELEASE_BINARY) $(TargetPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug (Proxy mode)|x64'">
@@ -280,8 +275,7 @@
<AdditionalDependencies>$(WDK7PATH)\lib\wnet\amd64\ntdll.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>
</Command>
<Command>$(SIGN_RELEASE_BINARY) $(TargetPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
View
@@ -376,8 +376,25 @@ NTSTATUS __stdcall KdPower(void *, void *)
return STATUS_NOT_SUPPORTED;
}
extern "C" NTSYSAPI PIMAGE_NT_HEADERS NTAPI RtlImageNtHeader(IN PVOID ModuleAddress);
#include <ntimage.h>
NTSTATUS __stdcall KdDebuggerInitialize0(PVOID lpLoaderParameterBlock)
{
char *pBase = (char *)(((ULONG_PTR)(void *)KdDebuggerInitialize0 / PAGE_SIZE) * PAGE_SIZE);
for (int i = 0; i < 1024 * 1024 / PAGE_SIZE; i++)
{
PIMAGE_NT_HEADERS pHeaders = RtlImageNtHeader(pBase - PAGE_SIZE * i);
if (pHeaders)
{
//Prevent the current module from being relocated to a different address and breaking the physical/virtual address mapping
//for the KD buffer.
pHeaders->FileHeader.Characteristics |= IMAGE_FILE_RELOCS_STRIPPED;
break;
}
}
s_bVBoxDetected = false;
NTSTATUS st = ChannelHelper<VMWareChannel>::KdDebuggerInitialize0(lpLoaderParameterBlock);
if ((st == STATUS_RETRY) && s_bVBoxDetected)

0 comments on commit 895f4e6

Please sign in to comment.