Skip to content

Commit

Permalink
Interim code release
Browse files Browse the repository at this point in the history
  • Loading branch information
vxiiduu committed Apr 18, 2022
1 parent 27a488d commit 8f35178
Show file tree
Hide file tree
Showing 38 changed files with 1,001 additions and 205 deletions.
42 changes: 42 additions & 0 deletions AppSpecificHacks.txt
@@ -0,0 +1,42 @@
This file details all the application-specific compatibility workarounds contained in VxKex.
If you add a new workaround, you MUST document it and its reason for existence in this file.
Otherwise, the hacks will accumulate and become unmaintainable.
Furthermore, in the source code, you must include a comment with the word "APPSPECIFICHACK"
in it, to facilitate textual search and location of these compatibility workarounds. As
soon as VxKex contains sufficient functionality to no longer require a hack it should be
removed.

Application Name: Autodesk Maya
Executable Name: MAYA.EXE, MAYABATCH.EXE
Executable Version: all
Architecture: x86 and x64
Added Version: 0.0.0.2
Removed Version: N/A
Description:
In VXKEXLDR.EXE, the user-friendly bitness mismatch error box is disabled because the
Autodesk licensing executable AdskLicensingAgent.exe is a 32-bit executable
intentionally loaded into the 64-bit application, and is not actually an error.

Application Name: OneDrive Installer
Executable Name: ONEDRIVESETUP.EXE
Executable Version: all
Architecture: x86 and x64
Added Version: 0.0.0.2
Removed Version: N/A
Description:
In VXKEXLDR.EXE, the Windows version spoof functionality is disabled because this
setup application checks the Windows version and calls extra incompatible APIs (which
will cause a crash) if it is higher than Windows 7.
In KERNEL33.DLL, the function VerifyVersionInfoW will always return TRUE, since the
setup application will call this specific function to display its error dialog.

Application Name: KeyMouse
Executable Name: KEYMOUSE.EXE
Executable Version: all
Architecture: x86 and x64
Added Version: 0.0.0.1
Removed Version: N/A
Description:
In USER33.DLL, the function SetWindowsHookExW is disabled, because the hooks that
KeyMouse installs cause Explorer to crash on Windows 7. Disabling hooks for this
application has no severe detrimental effects, AFAICT.
Binary file modified ChangeLog.txt
Binary file not shown.
8 changes: 4 additions & 4 deletions CmdSus/CmdSus.vcxproj
Expand Up @@ -84,7 +84,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;CMDSUS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NONLS;NOSERVICE;NOSOUND;NOTEXTMETRIC;NOCOMM;NOKANJI;NOPROFILER;NOMCX;WIN32_LEAN_AND_MEAN;_DEBUG;_WINDOWS;_USRDLL;CMDSUS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand All @@ -108,7 +108,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;CMDSUS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NONLS;NOSERVICE;NOSOUND;NOTEXTMETRIC;NOCOMM;NOKANJI;NOPROFILER;NOMCX;WIN32_LEAN_AND_MEAN;_DEBUG;_WINDOWS;_USRDLL;CMDSUS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand All @@ -135,7 +135,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CMDSUS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NONLS;NOSERVICE;NOSOUND;NOTEXTMETRIC;NOCOMM;NOKANJI;NOPROFILER;NOMCX;WIN32_LEAN_AND_MEAN;NDEBUG;_WINDOWS;_USRDLL;CMDSUS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down Expand Up @@ -163,7 +163,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CMDSUS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NONLS;NOSERVICE;NOSOUND;NOTEXTMETRIC;NOCOMM;NOKANJI;NOPROFILER;NOMCX;WIN32_LEAN_AND_MEAN;NDEBUG;_WINDOWS;_USRDLL;CMDSUS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
Expand Down
4 changes: 2 additions & 2 deletions CmdSusExe32/CmdSusExe32.vcxproj
Expand Up @@ -51,7 +51,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NONLS;NOSERVICE;NOSOUND;NOTEXTMETRIC;NOCOMM;NOKANJI;NOPROFILER;NOMCX;WIN32_LEAN_AND_MEAN;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<BufferSecurityCheck>false</BufferSecurityCheck>
Expand All @@ -76,7 +76,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NONLS;NOSERVICE;NOSOUND;NOTEXTMETRIC;NOCOMM;NOKANJI;NOPROFILER;NOMCX;WIN32_LEAN_AND_MEAN;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<BufferSecurityCheck>false</BufferSecurityCheck>
Expand Down
7 changes: 2 additions & 5 deletions CompatList.txt
Expand Up @@ -9,11 +9,8 @@ Bespoke Synth (https://github.com/BespokeSynth)
Blender 3.1.2 (portable version only - installer does not work)
Commander Wars (https://github.com/Robosturm/Commander_Wars)
KeyMouse (https://github.com/iscooool/KeyMouse)
OneDrive installer
Python 3.10.4 (portable version, or "embeddable package" only - installer does not work)
QBittorrent qt6 (https://www.qbittorrent.org/download.php)
SBCL (Steel Bank Common Lisp)
TerraFirma (https://github.com/mrkite/TerraFirma)

Support will be added for the following applications in the near future:

Microsoft OneDrive installer
TerraFirma (https://github.com/mrkite/TerraFirma)
7 changes: 4 additions & 3 deletions KexCfg/KexCfg.c
Expand Up @@ -54,7 +54,7 @@ INT APIENTRY wWinMain(
WCHAR szExePath[MAX_PATH];
WCHAR szExeName[MAX_PATH];
WCHAR szWinVerSpoof[6];
WCHAR szVxKexLdrPath[MAX_PATH];
WCHAR szVxKexLdrPath[MAX_PATH + 2] = L"\"";
WCHAR szIfeoKey[74 + MAX_PATH] = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\";
WCHAR szKexIfeoKey[54 + MAX_PATH] = L"SOFTWARE\\VXsoft\\VxKexLdr\\Image File Execution Options\\";
WCHAR szSystem32Path[MAX_PATH];
Expand Down Expand Up @@ -91,8 +91,9 @@ INT APIENTRY wWinMain(
PathStripPath(szExeName);
wcscat_s(szIfeoKey, ARRAYSIZE(szIfeoKey), szExeName);
wcscat_s(szKexIfeoKey, ARRAYSIZE(szKexIfeoKey), szExePath);
CHECKED(RegReadSz(HKEY_LOCAL_MACHINE, L"SOFTWARE\\VXsoft\\VxKexLdr", L"KexDir", szVxKexLdrPath, ARRAYSIZE(szVxKexLdrPath)));
wcscat_s(szVxKexLdrPath, ARRAYSIZE(szVxKexLdrPath), L"\\VxKexLdr.exe");
CHECKED(RegReadSz(HKEY_LOCAL_MACHINE, L"SOFTWARE\\VXsoft\\VxKexLdr", L"KexDir",
szVxKexLdrPath + 1, ARRAYSIZE(szVxKexLdrPath) - 2));
wcscat_s(szVxKexLdrPath, ARRAYSIZE(szVxKexLdrPath), L"\\VxKexLdr.exe\"");
CHECKED(GetSystemDirectory(szSystem32Path, ARRAYSIZE(szSystem32Path)));
bRetryAsAdminOnFailure = TRUE;

Expand Down
19 changes: 16 additions & 3 deletions KexComm.h
@@ -1,6 +1,10 @@
#pragma once
#pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

//
// VxKex Common Components
//

#include <VxKex.h>
#include <Windows.h>
#include <tchar.h>
Expand Down Expand Up @@ -48,7 +52,7 @@ EXTERN_C LPCWSTR GetLastErrorAsString(
VOID);

EXTERN_C VOID MessageBoxV(
IN UINT uType OPTIONAL,
IN UINT uType OPTIONAL,
IN LPCWSTR lpszFmt,
IN va_list ap);

Expand All @@ -58,6 +62,9 @@ EXTERN_C VOID ErrorBoxF(
EXTERN_C NORETURN VOID CriticalErrorBoxF(
IN LPCWSTR lpszFmt, ...);

EXTERN_C VOID WarningBoxF(
IN LPCWSTR lpszFmt, ...);

EXTERN_C VOID InfoBoxF(
IN LPCWSTR lpszFmt, ...);

Expand Down Expand Up @@ -104,6 +111,12 @@ BOOL WriteFileWF(
IN HANDLE hFile,
IN LPCWSTR lpszFmt, ...);

LPWSTR ConvertDeviceHarddiskToDosPath(
IN LPWSTR lpszPath);

LPWSTR GetFilePathFromHandle(
IN HANDLE hFile);

LPVOID __AutoHeapAllocHelper(
IN SIZE_T cb);

Expand Down Expand Up @@ -144,7 +157,7 @@ FORCEINLINE LPVOID DefHeapReAlloc(
#define AutoFree(lpv) do { __AutoFreeHelper(lpv); lpv = NULL; } while(0)

#ifdef UNICODE
#define WriteFileF WriteFileWF
# define WriteFileF WriteFileWF
#else
#define WriteFileF WriteFileAF
# define WriteFileF WriteFileAF
#endif
77 changes: 77 additions & 0 deletions KexComm/File.c
@@ -1,6 +1,8 @@
#include <Windows.h>
#include <Psapi.h>
#include <KexComm.h>
#include <NtDll.h>
#include <BaseDll.h>

VOID PrintF(
IN LPCWSTR lpszFmt, ...)
Expand Down Expand Up @@ -56,4 +58,79 @@ BOOL WriteFileWF(
va_end(ap);
SetLastError(dwError);
return bResult;
}

LPWSTR ConvertDeviceHarddiskToDosPath(
IN LPWSTR lpszPath)
{
NTSTATUS st;
WORD wBit = 25;
DWORD dwLogicalDrives;
PROCESS_DEVICEMAP_INFORMATION pdi;
DWORD dwSize = sizeof(pdi);

st = NtQueryInformationProcess(
GetCurrentProcess(),
ProcessDeviceMap,
&pdi,
sizeof(pdi),
NULL);

if (!NT_SUCCESS(st)) {
BaseSetLastNTError(st);
return NULL;
}

dwLogicalDrives = pdi.Query.DriveMap;

do {
if (dwLogicalDrives & (1 << wBit)) {
WCHAR szNtDevice[64];
WCHAR szDosDevice[3] = {'A' + wBit, ':', '\0'};
SIZE_T cchNtDevice;

if (QueryDosDevice(szDosDevice, szNtDevice, ARRAYSIZE(szNtDevice))) {
cchNtDevice = wcslen(szNtDevice);

if (!wcsnicmp(szNtDevice, lpszPath, cchNtDevice)) {
LPWSTR lpszDosPath = lpszPath + (cchNtDevice - 2);
lpszDosPath[0] = szDosDevice[0];
lpszDosPath[1] = szDosDevice[1];
return lpszDosPath;
}
}
}

wBit--;
} until (wBit is 0);

return NULL;
}

LPWSTR GetFilePathFromHandle(
IN HANDLE hFile)
{
HANDLE hMapping = NULL;
LPVOID lpMapping = NULL;
STATIC WCHAR szPath[MAX_PATH + 32];

CHECKED(hMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 1, NULL));
CHECKED(lpMapping = MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, 1));
CHECKED(GetMappedFileName(GetCurrentProcess(), lpMapping, szPath, ARRAYSIZE(szPath)));

// At this point, szPath contains a path like \Device\HarddiskVolume7\Windows\system32\ntdll.dll
// It must be converted into a normal path like C:\Windows\system32\ntdll.dll

return ConvertDeviceHarddiskToDosPath(szPath);

Error:
if (lpMapping) {
UnmapViewOfFile(lpMapping);
}

if (hMapping) {
NtClose(hMapping);
}

return NULL;
}
24 changes: 20 additions & 4 deletions KexComm/KexComm.vcxproj
Expand Up @@ -79,37 +79,45 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NONLS;NOSERVICE;NOSOUND;NOTEXTMETRIC;NOCOMM;NOKANJI;NOPROFILER;NOMCX;WIN32_LEAN_AND_MEAN;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<SmallerTypeCheck>false</SmallerTypeCheck>
<CompileAs>CompileAsC</CompileAs>
<AdditionalIncludeDirectories>$(SolutionDir)</AdditionalIncludeDirectories>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<BufferSecurityCheck>false</BufferSecurityCheck>
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib>
<AdditionalDependencies>psapi.lib</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NONLS;NOSERVICE;NOSOUND;NOTEXTMETRIC;NOCOMM;NOKANJI;NOPROFILER;NOMCX;WIN32_LEAN_AND_MEAN;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<SmallerTypeCheck>false</SmallerTypeCheck>
<CompileAs>CompileAsC</CompileAs>
<AdditionalIncludeDirectories>$(SolutionDir)</AdditionalIncludeDirectories>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<BufferSecurityCheck>false</BufferSecurityCheck>
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib>
<AdditionalDependencies>psapi.lib</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
Expand All @@ -119,7 +127,7 @@
<Optimization>MinSpace</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NONLS;NOSERVICE;NOSOUND;NOTEXTMETRIC;NOCOMM;NOKANJI;NOPROFILER;NOMCX;WIN32_LEAN_AND_MEAN;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
Expand All @@ -130,13 +138,17 @@
<AdditionalIncludeDirectories>$(SolutionDir)</AdditionalIncludeDirectories>
<SmallerTypeCheck>false</SmallerTypeCheck>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<AdditionalDependencies>psapi.lib</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
Expand All @@ -146,7 +158,7 @@
<Optimization>MinSpace</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NONLS;NOSERVICE;NOSOUND;NOTEXTMETRIC;NOCOMM;NOKANJI;NOPROFILER;NOMCX;WIN32_LEAN_AND_MEAN;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
Expand All @@ -157,13 +169,17 @@
<AdditionalIncludeDirectories>$(SolutionDir)</AdditionalIncludeDirectories>
<SmallerTypeCheck>false</SmallerTypeCheck>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<AdditionalDependencies>psapi.lib</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
9 changes: 9 additions & 0 deletions KexComm/Msgbox.c
Expand Up @@ -55,6 +55,15 @@ NORETURN VOID CriticalErrorBoxF(
ExitProcess(0);
}

VOID WarningBoxF(
IN LPCWSTR lpszFmt, ...)
{
va_list ap;
va_start(ap, lpszFmt);
MessageBoxV(MB_ICONWARNING | MB_OK, lpszFmt, ap);
va_end(ap);
}

VOID InfoBoxF(
IN LPCWSTR lpszFmt, ...)
{
Expand Down

0 comments on commit 8f35178

Please sign in to comment.