Permalink
Browse files

Added support for Windows 10

  • Loading branch information...
sysprogs committed Sep 29, 2015
1 parent 8186e92 commit 50ea7f6f5ca454d9e8945e04505cdb61e98274ce
View
@@ -0,0 +1,63 @@
+# Compiled Object files
+*.slo
+*.lo
+*.o
+*.obj
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Compiled Dynamic libraries
+*.so
+*.dylib
+*.dll
+
+# Fortran module files
+*.mod
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+*.lib
+
+# Executables
+*.exe
+*.out
+*.app
+*.pdb
+*.exp
+Debug
+Release
+x64
+Debug (user-mode)
+Release (user-mode)
+DebugPS
+ReleasePS
+_distr/app
+_distr/drivers
+ipch
+*.sdf
+*.suo
+/VirtualAutorunDisabler/VirtualAutorunDisabler_i.c
+/VirtualAutorunDisabler/VirtualAutorunDisabler_i.h
+/VirtualAutorunDisabler/VirtualAutorunDisabler_p32.c
+/VirtualAutorunDisabler/VirtualAutorunDisabler_p64.c
+/WinCDEmuContextMenu/WinCDEmuContextMenu_i.c
+/WinCDEmuContextMenu/WinCDEmuContextMenu_i.h
+/WinCDEmuContextMenu/WinCDEmuContextMenu_p32.c
+/WinCDEmuContextMenu/WinCDEmuContextMenu_p64.c
+/AllModules
+/_distr/_drvinst.bzz
+/_distr/_drvinst.bzz.stat
+/_distr/drivers.bzz
+/_distr/drivers.bzz.stat
+/_distr/main.bzz
+/_distr/main.bzz.stat
+/vmnt/vmnt.lng
+/vmnt/vmnt_lng.cpp
+/vmnt/vmnt_lng.h
+/BUNDLE/target
+/*.opensdf
+/vminstall/*.aps
View
@@ -0,0 +1 @@
+@echo Warning: SIGN_RELEASE_BINARY not defined. %1 will not be signed.
View
@@ -0,0 +1 @@
+"%WDKPATH%\bin\x86\signtool.exe" sign /i Testsigning /t http://timestamp.verisign.com/scripts/timstamp.dll %1
View
@@ -146,6 +146,10 @@
<TargetMachine>MachineX86</TargetMachine>
<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>
+ </PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
@@ -169,6 +173,10 @@
<TargetMachine>MachineX64</TargetMachine>
<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>
+ </PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@@ -191,6 +199,10 @@
<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>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
</Link>
+ <PostBuildEvent>
+ <Command>
+ </Command>
+ </PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
@@ -217,6 +229,10 @@
<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>
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
</Link>
+ <PostBuildEvent>
+ <Command>
+ </Command>
+ </PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug (Proxy mode)|Win32'">
<ClCompile>
@@ -236,6 +252,10 @@
<TargetMachine>MachineX86</TargetMachine>
<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>
+ </PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug (Proxy mode)|x64'">
<Midl>
@@ -259,6 +279,10 @@
<TargetMachine>MachineX64</TargetMachine>
<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>
+ </PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="32to64.cpp" />
View
@@ -18,8 +18,8 @@ extern "C"
DEFINE_EMPTYFUNC1(KdRestore)
DEFINE_EMPTYFUNC1(KdSave)
- NTSTATUS KdSetHiberRange()
+ NTSTATUS KdSetHiberRange(void *)
{
- return 0x0C00000BB; //As in KDCOM.DLL
+ return STATUS_NOT_SUPPORTED; //As in KDCOM.DLL
}
}
View
@@ -363,6 +363,19 @@ template <class DefaultRPCChannel> class ChannelHelper
}
};
+NTSTATUS __stdcall KdInitialize(int mode, PVOID lpLoaderParameterBlock, void *)
+{
+ if (mode == 0)
+ return KdDebuggerInitialize0(lpLoaderParameterBlock);
+ else
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS __stdcall KdPower(void *, void *)
+{
+ return STATUS_NOT_SUPPORTED;
+}
+
NTSTATUS __stdcall KdDebuggerInitialize0(PVOID lpLoaderParameterBlock)
{
s_bVBoxDetected = false;
View
@@ -10,5 +10,7 @@ EXPORTS
KdSave
KdSendPacket
KdSetHiberRange
+ KdPower
+ KdInitialize
KdVMGetActiveCallCount
View
@@ -3,6 +3,9 @@
<PropertyGroup Condition="'$(SIGN_RELEASE_BINARY)' == ''">
<SIGN_RELEASE_BINARY>$(ProjectDir)..\dummysign.bat</SIGN_RELEASE_BINARY>
</PropertyGroup>
+ <PropertyGroup Condition="'$(TESTSIGN_BINARY)' == ''">
+ <TESTSIGN_BINARY>$(ProjectDir)..\TestSign.bat</TESTSIGN_BINARY>
+ </PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
@@ -120,7 +123,7 @@
<AdditionalLibraryDirectories>$(WDK7PATH)\lib\WXP\i386;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
- <Command>$(SIGN_RELEASE_BINARY) $(TargetPath)</Command>
+ <Command>$(TESTSIGN_BINARY) $(TargetPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -158,7 +161,7 @@
<AdditionalLibraryDirectories>$(WDK7PATH)\lib\WNET\amd64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
- <Command>$(SIGN_RELEASE_BINARY) $(TargetPath)</Command>
+ <Command>$(TESTSIGN_BINARY) $(TargetPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -201,7 +204,7 @@
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
</Link>
<PostBuildEvent>
- <Command>$(SIGN_RELEASE_BINARY) $(TargetPath)</Command>
+ <Command>$(TESTSIGN_BINARY) $(TargetPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -246,7 +249,7 @@
<ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
</Link>
<PostBuildEvent>
- <Command>$(SIGN_RELEASE_BINARY) $(TargetPath)</Command>
+ <Command>$(TESTSIGN_BINARY) $(TargetPath)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
View
@@ -1,6 +1,5 @@
-REM @echo off
-
call "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat"
+echo on
msbuild /m VirtualKD.sln /property:Platform=Win32 /property:Configuration="Release (Kernel-mode)" || goto error
msbuild /m VirtualKD.sln /property:Platform=x64 /property:Configuration="Release (Kernel-mode)" || goto error
msbuild /m VirtualKD.sln /property:Platform=Win32 /property:Configuration="Release (User-mode)" || goto error
View
@@ -69,6 +69,7 @@ LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam
m_ExistingEntryName = pEntry->GetDescription();
SetDlgItemText(IDC_REUSEENTRY, String::sFormat(_T("Use existing entry (%s)"), m_ExistingEntryName.c_str()).c_str());
SendDlgItemMessage(IDC_SETDEFAULT, BM_SETCHECK, BST_CHECKED);
+ SendDlgItemMessage(IDC_KDCOM, BM_SETCHECK, BST_CHECKED);
SendDlgItemMessage(bAlreadyInstalled ? IDC_REUSEENTRY : IDC_NEWENTRY, BM_SETCHECK, BST_CHECKED);
::EnableWindow(GetDlgItem(IDC_ENTRYNAME), !bAlreadyInstalled);
@@ -144,15 +145,20 @@ static ActionStatus SaveResourceToFile(const String &filePath, LPCTSTR lpResType
return MAKE_STATUS(Success);
}
+ActionStatus TakeOwnership(LPTSTR lpszOwnFile);
+
LRESULT CMainDlg::OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
- bool createNewEntry = false, setDefault = false;
+ bool createNewEntry = false, setDefault = false, replaceKdcom = false;
String entryName, monitorLocation;
unsigned timeout = -1;
if (SendDlgItemMessage(IDC_SETDEFAULT, BM_GETCHECK) == BST_CHECKED)
setDefault = true, timeout = GetDlgItemInt(IDC_TIMEOUT);
+ if (SendDlgItemMessage(IDC_KDCOM, BM_GETCHECK) == BST_CHECKED)
+ replaceKdcom = true;
+
if (SendDlgItemMessage(IDC_NEWENTRY, BM_GETCHECK) == BST_CHECKED)
{
size_t len = ::GetWindowTextLength(GetDlgItem(IDC_ENTRYNAME));
@@ -175,7 +181,7 @@ LRESULT CMainDlg::OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /
#endif
{
- String fp = Path::Combine(Path::GetSpecialDirectoryLocation(dirSystem), ConstString(_T("kdbazis.dll")));
+ String fp = Path::Combine(Path::GetSpecialDirectoryLocation(dirSystem), replaceKdcom ? ConstString(_T("kdcom.dll")) : ConstString(_T("kdbazis.dll")));
#ifdef _WIN64
bool is64Bit = true;
@@ -187,6 +193,51 @@ LRESULT CMainDlg::OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /
{
WOW64FSRedirHolder holder;
+ if (replaceKdcom)
+ {
+ String kdcomBackup = Path::Combine(Path::GetSpecialDirectoryLocation(dirSystem), ConstString(_T("kdcom_old.dll")));
+ if (!File::Exists(kdcomBackup))
+ {
+ st = TakeOwnership(const_cast<LPTSTR>(String(fp).c_str()));
+ if (!st.Successful())
+ {
+ ::MessageBox(HWND_DESKTOP,
+ String::sFormat(_T("Cannot replace owner on kdcom.dll: %s"), st.GetMostInformativeText().c_str()).c_str(),
+ NULL,
+ MB_ICONERROR);
+ return 0;
+ }
+
+ Win32::Security::TranslatedAcl dacl = File::GetDACLForPath(fp, &st);
+ if (!st.Successful())
+ {
+ ::MessageBox(HWND_DESKTOP,
+ String::sFormat(_T("Cannot query permissions on kdcom.dll: %s"), st.GetMostInformativeText().c_str()).c_str(),
+ NULL,
+ MB_ICONERROR);
+ return 0;
+ }
+ dacl.AddAllowingAce(STANDARD_RIGHTS_ALL | SPECIFIC_RIGHTS_ALL, BazisLib::Win32::Security::Sid::CurrentUserSid());
+ st = File::SetDACLForPath(fp, dacl);
+ if (!st.Successful())
+ {
+ ::MessageBox(HWND_DESKTOP,
+ String::sFormat(_T("Cannot set permissions on kdcom.dll: %s"), st.GetMostInformativeText().c_str()).c_str(),
+ NULL,
+ MB_ICONERROR);
+ return 0;
+ }
+
+ if (!MoveFile(fp.c_str(), kdcomBackup.c_str()))
+ {
+ ::MessageBox(HWND_DESKTOP,
+ String::sFormat(_T("Cannot rename old kdcom.dll: %s"), MAKE_STATUS(ActionStatus::FromLastError()).GetMostInformativeText().c_str()).c_str(),
+ NULL,
+ MB_ICONERROR);
+ return 0;
+ }
+ }
+ }
st = SaveResourceToFile(fp, _T("KDVMDLL"), is64Bit ? IDR_KDVM64 : IDR_KDVM32);
}
if (!st.Successful())
@@ -227,7 +278,7 @@ LRESULT CMainDlg::OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /
}
}
- ActionStatus st = CreateVirtualKDBootEntry(createNewEntry, setDefault, entryName.c_str(), timeout);
+ ActionStatus st = CreateVirtualKDBootEntry(createNewEntry, setDefault, entryName.c_str(), timeout, replaceKdcom);
if (!st.Successful())
{
::MessageBox(HWND_DESKTOP,
Oops, something went wrong.

0 comments on commit 50ea7f6

Please sign in to comment.