├── .github └── ISSUE_TEMPLATE │ └── -x--app-doesn-t-work-with-vxkex-.md ├── 00-Common Headers ├── KexAssert.h ├── KexComm.h ├── KexComp.h ├── KexCpu.h ├── KexDll.h ├── KexGui.h ├── KexLnk.h ├── KexPathCch.h ├── KexStrSafe.h ├── KexTypes.h ├── KexVer.h ├── KexW32ML.h ├── KseGuid.h ├── KxBase.h ├── KxCfgHlp.h ├── KxCom.h ├── KxDx.h ├── KxMi.h ├── KxUser.h ├── NtDll.h ├── NtKrnl.h ├── NtStrSafe.h ├── SafeAlloc.h └── vautogen.h ├── 00-Documentation ├── Application Compatibility List.docx ├── Changelog.txt ├── Debugging KexDll.txt ├── KexSetup responsibilities.txt ├── Notes on IFEO.txt ├── NtQuerySystemInformation doc and examples.txt ├── Source File Header.txt ├── VxKex Registry Keys (Legacy).txt ├── VxKex Registry Keys.docx └── ~$Kex Registry Keys.docx ├── 00-Import Libraries ├── cfgmgr32_x64.lib ├── cfgmgr32_x86.lib ├── dxgi_x64.lib ├── dxgi_x86.lib ├── kernel32_x64.lib ├── kernel32_x86.lib ├── kernelbase_x64.lib ├── kernelbase_x86.lib ├── msvcrt_x64.lib ├── msvcrt_x86.lib ├── ntdll_x64.lib ├── ntdll_x86.lib ├── ntoskrnl_x64.lib ├── ntoskrnl_x86.lib ├── ntstrsafe_x64.lib ├── ntstrsafe_x86.lib ├── seh32.lib ├── user32_x64.lib └── user32_x86.lib ├── 01-Development Utilities ├── 7zSfx │ ├── 7zS2.sfx │ ├── 7zr.exe │ ├── makesfx.bat │ ├── vtrplnt.exe │ └── vtrplnt.pdb ├── KexExprt │ ├── KexExprt.rc │ ├── KexExprt.vcxproj │ ├── KexExprt.vcxproj.filters │ ├── buildcfg.h │ ├── dump.c │ ├── kexexprt.c │ ├── kexexprt.h │ └── resource.h └── vautogen │ ├── vautogen.exe │ ├── vautogen.ini │ └── vautogen.pdb ├── 01-Extended DLLs ├── KxAdvapi │ ├── KxAdvapi.vcxproj │ ├── KxAdvapi.vcxproj.filters │ ├── buildcfg.h │ ├── dllmain.c │ ├── forwards.c │ ├── kxadvapi.def │ └── kxadvapi.rc ├── KxBase │ ├── KxBase.rc │ ├── appmodel.c │ ├── buildcfg.h │ ├── cfgmgr.c │ ├── dllmain.c │ ├── file.c │ ├── forwards.c │ ├── geoname.c │ ├── heap.c │ ├── kxbase.def │ ├── kxbase.vcxproj │ ├── kxbase.vcxproj.filters │ ├── kxbasep.h │ ├── misc.c │ ├── module.c │ ├── process.c │ ├── pssapi.c │ ├── security.c │ ├── stubs.c │ ├── support.c │ ├── synch.c │ ├── thread.c │ ├── time.c │ ├── token.c │ ├── verspoof.c │ ├── vmem.c │ └── wow64.c ├── KxCom │ ├── KxCom.rc │ ├── KxCom.vcxproj │ ├── KxCom.vcxproj.filters │ ├── actfact.c │ ├── buildcfg.h │ ├── dllmain.c │ ├── forwards.c │ ├── glprstat.c │ ├── kxcom.def │ ├── kxcomp.h │ ├── launcher.c │ ├── mta.c │ ├── roapi.c │ ├── robuffer.c │ ├── roerror.c │ ├── rofactry.c │ ├── roinit.c │ ├── uisettings.c │ ├── uiview.c │ ├── uri.c │ └── winrt.c ├── KxCrt │ ├── KxCrt.rc │ ├── KxCrt.vcxproj │ ├── KxCrt.vcxproj.filters │ ├── buildcfg.h │ ├── dllmain.c │ ├── forwards.c │ ├── kxcrt.def │ └── wcsftime.c ├── KxCryp │ ├── KxCryp.vcxproj │ ├── KxCryp.vcxproj.filters │ ├── bcrypt.c │ ├── buildcfg.h │ ├── dllmain.c │ ├── forwards.c │ ├── kxcryp.def │ ├── kxcryp.rc │ ├── kxcrypp.h │ ├── rng.c │ └── schannel.c ├── KxDx │ ├── KxDx.rc │ ├── KxDx.vcxproj │ ├── KxDx.vcxproj.filters │ ├── buildcfg.h │ ├── dcmpstub.c │ ├── dllmain.c │ ├── dx12stub.c │ ├── factory.c │ ├── forwards.c │ ├── iid.c │ ├── kxdx.def │ └── kxdxp.h ├── KxMi │ ├── KxMi.vcxproj │ ├── KxMi.vcxproj.filters │ ├── buildcfg.h │ ├── dllmain.c │ ├── forwards.c │ ├── kxmi.def │ ├── kxmi.rc │ ├── kxmip.h │ ├── powrprof.c │ ├── userenv.c │ ├── verspoof.c │ └── wldp.c ├── KxNet │ ├── KxNet.vcxproj │ ├── KxNet.vcxproj.filters │ ├── buildcfg.h │ ├── dllmain.c │ ├── dns.c │ ├── forwards.c │ ├── kxnet.def │ ├── kxnet.rc │ ├── kxnetp.h │ ├── winhttp.c │ └── winsock.c ├── KxNt │ ├── KxNt.rc │ ├── KxNt.vcxproj │ ├── KxNt.vcxproj.filters │ ├── buildcfg.h │ ├── dllmain.c │ ├── forwards.c │ └── kxnt.def └── KxUser │ ├── KxUser.rc │ ├── KxUser.vcxproj │ ├── KxUser.vcxproj.filters │ ├── autorot.c │ ├── blutooth.c │ ├── buildcfg.h │ ├── dllmain.c │ ├── forwards.c │ ├── kxuser.def │ ├── kxuserp.h │ ├── misc.c │ ├── pointer.c │ ├── pwrnotfy.c │ ├── scaling.c │ ├── sysmetrc.c │ └── timer.c ├── 01-Tests └── loggingtest │ ├── loggingtest.vcxproj │ ├── loggingtest.vcxproj.filters │ └── test.c ├── 02-Prebuilt DLLs ├── Readme.txt ├── d12ms.dll ├── d12ms.pdb ├── x64 │ ├── dwrw10.dll │ ├── mfdevmgr.dll │ └── ucrtbase.dll └── x86 │ ├── dwrw10.dll │ ├── mshtmlmedia.dll │ └── ucrtbase.dll ├── CpiwBypa ├── CpiwBypa.rc ├── CpiwBypa.vcxproj ├── CpiwBypa.vcxproj.filters ├── buildcfg.h └── dllmain.c ├── KexCfg ├── KexCfg.ico ├── KexCfg.rc ├── KexCfg.vcxproj ├── KexCfg.vcxproj.filters ├── buildcfg.h ├── cmdline.c ├── gui.c ├── kexcfg.h ├── main.c ├── resource.h └── util.c ├── KexDll ├── KexDll.def ├── KexDll.rc ├── KexDll.vcxproj ├── KexDll.vcxproj.filters ├── apiset.c ├── ash.c ├── ashcrsup.c ├── ashselec.c ├── avrf.c ├── buildcfg.h ├── cpiwbypa.c ├── dllmain.c ├── dllnotif.c ├── dllpath.c ├── dllrewrt.c ├── dload.c ├── etw.c ├── except.c ├── kexdata.c ├── kexdllp.h ├── kexhe.c ├── kexhk.c ├── kexldr.c ├── kexrtl.c ├── logging.c ├── ntjob.c ├── ntpriv.c ├── ntps.c ├── ntreg.c ├── ntsect.c ├── ntthread.c ├── propagte.c ├── redirects.h ├── rtlrng.c ├── rtlwoa.c ├── rtlwow64.c ├── status.c ├── strmap.c ├── syscal32.c ├── syscal64.asm ├── verspoof.c ├── vxlopcl.c ├── vxlpriv.c ├── vxlquery.c ├── vxlread.c ├── vxlsever.c └── vxlwrite.c ├── KexGui ├── KexGui.vcxproj ├── KexGui.vcxproj.filters ├── buildcfg.h ├── ctlsx.c ├── dpi.c ├── fldrpkr.c ├── kexgui.c ├── locale.c ├── msgbox.c ├── shprops.c ├── window.c └── wndx.c ├── KexKMSD ├── KexKMSD.rc ├── KexKMSD.vcxproj ├── KexKMSD.vcxproj.filters ├── buildcfg.h └── drventry.c ├── KexPathCch ├── KexPathCch.vcxproj ├── KexPathCch.vcxproj.filters ├── buildcfg.h └── pathcch.c ├── KexSetup ├── KexSetup.ico ├── KexSetup.manifest ├── KexSetup.rc ├── KexSetup.vcxproj ├── KexSetup.vcxproj.filters ├── buildcfg.h ├── cmdline.c ├── gui.c ├── kexsetup.h ├── main.c ├── perform.c ├── prereq.c ├── resource.h ├── util.c └── version.c ├── KexShlEx ├── KexShlEx.def ├── KexShlEx.h ├── KexShlEx.rc ├── KexShlEx.vcxproj ├── KexShlEx.vcxproj.filters ├── buildcfg.h ├── ckxshlex.c ├── clsfctry.c ├── dllmain.c ├── gui.c ├── lnkfile.c └── resource.h ├── KexW32ML ├── KexW32ML.vcxproj ├── KexW32ML.vcxproj.filters ├── buildcfg.h ├── file.c ├── kexw32ml.c ├── registry.c └── txapi.c ├── KxCfgHlp ├── KxCfgHlp.vcxproj ├── KxCfgHlp.vcxproj.filters ├── buildcfg.h ├── cpiwbypa.c ├── ctxmenu.c ├── delcfg.c ├── dskclnup.c ├── elevate.c ├── getcfg.c ├── kexdir.c ├── kxcfgp.c ├── logging.c ├── msisup.c ├── openkey.c └── setcfg.c ├── README.md ├── VxKex.sln ├── VxKex.suo ├── VxKexLdr.opensdf ├── VxKexLdr ├── VxKexLdr.rc ├── VxKexLdr.vcxproj ├── VxKexLdr.vcxproj.filters ├── buildcfg.h ├── creaproc.c ├── gui.c ├── main.c ├── resource.h ├── vxkexldr.h └── vxkexldr.ico ├── VxlView ├── VxlView.rc ├── VxlView.vcxproj ├── VxlView.vcxproj.filters ├── backend.c ├── backendp.c ├── backendp.h ├── buildcfg.h ├── config.c ├── details.c ├── filters.c ├── globals.c ├── goto.c ├── helpabout.c ├── listview.c ├── resource.h ├── statusbar.c ├── vxlfile.ico ├── vxlview.c ├── vxlview.h └── vxlview.ico └── example-screenshot.png /00-Common Headers/KexComp.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // KexComp.h 6 | // 7 | // Abstract: 8 | // 9 | // Defines compiler settings for VxKex projects. 10 | // 11 | // Author: 12 | // 13 | // vxiiduu (30-Sep-2022) 14 | // 15 | // Revision History: 16 | // 17 | // vxiiduu 30-Sep-2022 Initial creation. 18 | // 19 | /////////////////////////////////////////////////////////////////////////////// 20 | 21 | #pragma once 22 | 23 | #ifdef _DEBUG 24 | # pragma optimize("", off) 25 | #else 26 | # pragma optimize("y", off) 27 | # pragma optimize("gs", on) 28 | #endif 29 | 30 | // 31 | // We can use stack checking in VxKex because NTDLL exports the __chkstk 32 | // symbol in both x86 and x64. 33 | // 34 | #ifdef _DEBUG 35 | # pragma check_stack(on) 36 | #else 37 | # pragma check_stack(off) 38 | #endif 39 | 40 | // 41 | // Disable runtime checking. These features require the CRT, 42 | // which we do not use. 43 | // 44 | #pragma runtime_checks("", off) 45 | 46 | // 47 | // Note: You still need to disable /GS (buffer security check) in the project 48 | // configuration, because unfortunately, there is no pragma which can do this. 49 | // -------------------------------------------------------------------------------- /00-Common Headers/KexCpu.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // KexCpu.h 6 | // 7 | // Abstract: 8 | // 9 | // Contains structure definitions for CPU-related bit flags and 10 | // registers. 11 | // 12 | // Author: 13 | // 14 | // vxiiduu (30-Sep-2022) 15 | // 16 | // Environment: 17 | // 18 | // Any environment. 19 | // 20 | // Revision History: 21 | // 22 | // vxiiduu 30-Sep-2022 Initial creation. 23 | // 24 | /////////////////////////////////////////////////////////////////////////////// 25 | 26 | #pragma once 27 | #include 28 | 29 | // Debug Status register 30 | typedef struct _DR6 { 31 | union { 32 | ULONG_PTR Entire; 33 | 34 | struct { 35 | UCHAR B0 : 1; 36 | UCHAR B1 : 1; 37 | UCHAR B2 : 1; 38 | UCHAR B3 : 1; 39 | USHORT Reserved1 : 9; 40 | UCHAR BD : 1; 41 | UCHAR BS : 1; 42 | UCHAR BT : 1; 43 | UCHAR RTM : 1; 44 | USHORT Reserved2 : 15; 45 | #ifdef _M_X64 46 | ULONG Reserved3 : 32; 47 | #endif 48 | }; 49 | }; 50 | } DR6; 51 | 52 | // Debug Control register 53 | typedef struct _DR7 { 54 | union { 55 | ULONG_PTR Entire; 56 | 57 | struct { 58 | UCHAR L0 : 1; 59 | UCHAR G0 : 1; 60 | UCHAR L1 : 1; 61 | UCHAR G1 : 1; 62 | UCHAR L2 : 1; 63 | UCHAR G2 : 1; 64 | UCHAR L3 : 1; 65 | UCHAR G3 : 1; 66 | UCHAR LE : 1; 67 | UCHAR GE : 1; 68 | UCHAR Reserved1 : 1; // set to 1 69 | UCHAR RTM : 1; 70 | UCHAR Reserved2 : 1; // set to 0 71 | UCHAR GD : 1; 72 | UCHAR Reserved3 : 2; // both set to 0 73 | UCHAR RW0 : 2; 74 | UCHAR LEN0 : 2; 75 | UCHAR RW1 : 2; 76 | UCHAR LEN1 : 2; 77 | UCHAR RW2 : 2; 78 | UCHAR LEN2 : 2; 79 | UCHAR RW3 : 2; 80 | UCHAR LEN3 : 2; 81 | #ifdef _M_X64 82 | ULONG Reserved4 : 32; 83 | #endif 84 | }; 85 | }; 86 | } DR7; -------------------------------------------------------------------------------- /00-Common Headers/KexLnk.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // NtDll.h 6 | // 7 | // Abstract: 8 | // 9 | // Defines linker settings for VxKex projects. 10 | // 11 | // Author: 12 | // 13 | // vxiiduu (30-Sep-2022) 14 | // 15 | // Revision History: 16 | // 17 | // vxiiduu 30-Sep-2022 Initial creation. 18 | // vxiiduu 31-Oct-2022 Fix 32-bit SEH. 19 | // 20 | /////////////////////////////////////////////////////////////////////////////// 21 | 22 | #pragma once 23 | 24 | // 25 | // Disable CRT across the board. It is not used in VxKex. 26 | // 27 | #pragma comment(linker, "/NODEFAULTLIB:LIBCMT.LIB") 28 | #pragma comment(linker, "/NODEFAULTLIB:LIBCMTD.LIB") 29 | #pragma comment(linker, "/NODEFAULTLIB:MSVCRT.LIB") 30 | #pragma comment(linker, "/NODEFAULTLIB:MSVCRTD.LIB") 31 | 32 | #ifdef KEX_ENV_WIN32 33 | # pragma comment(linker, "/SUBSYSTEM:WINDOWS") 34 | #else 35 | # pragma comment(linker, "/SUBSYSTEM:NATIVE") 36 | #endif 37 | 38 | // 39 | // Set appropriate entry point. 40 | // 41 | #if defined(KEX_TARGET_TYPE_EXE) 42 | # pragma comment(linker, "/ENTRY:EntryPoint") 43 | #elif defined(KEX_TARGET_TYPE_DLL) 44 | # pragma comment(linker, "/ENTRY:DllMain") 45 | #elif defined(KEX_TARGET_TYPE_SYS) 46 | # pragma comment(linker, "/ENTRY:DriverEntry") 47 | #elif !defined(KEX_TARGET_TYPE_LIB) 48 | // Did you forget to include buildcfg.h? 49 | # error You must specify a target file type (EXE, DLL or LIB) for this project by defining a KEX_TARGET_TYPE_* macro before including KexLnk.h or KexComm.h. 50 | #endif 51 | 52 | #pragma region Library Inputs 53 | #if defined(KEX_TARGET_TYPE_EXE) || defined(KEX_TARGET_TYPE_DLL) 54 | # ifdef KEX_ENV_WIN32 55 | # if defined(KEX_TARGET_TYPE_EXE) || defined(KEX_TARGET_TYPE_DLL) 56 | # ifdef _M_X64 57 | # pragma comment(lib, "kernel32_x64.lib") 58 | # pragma comment(lib, "kernelbase_x64.lib") 59 | # else 60 | # pragma comment(lib, "kernel32_x86.lib") 61 | # pragma comment(lib, "kernelbase_x86.lib") 62 | # endif 63 | # pragma comment(lib, "ole32.lib") 64 | # endif 65 | # endif 66 | #elif defined(KEX_TARGET_TYPE_SYS) 67 | # ifdef _M_X64 68 | # pragma comment(lib, "ntoskrnl_x64.lib") 69 | # pragma comment(lib, "ntstrsafe_x64.lib") 70 | # else 71 | # pragma comment(lib, "ntoskrnl_x86.lib") 72 | # pragma comment(lib, "ntstrsafe_x86.lib") 73 | # endif 74 | #endif 75 | 76 | #ifdef KEX_ARCH_X86 77 | # pragma comment(lib, "seh32.lib") 78 | #endif 79 | #pragma endregion -------------------------------------------------------------------------------- /00-Common Headers/KexTypes.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // KexTypes.h 6 | // 7 | // Abstract: 8 | // 9 | // Type definitions and associated macros. 10 | // 11 | // Author: 12 | // 13 | // vxiiduu (26-Sep-2022) 14 | // 15 | // Environment: 16 | // 17 | // Any environment. 18 | // 19 | // Revision History: 20 | // 21 | // vxiiduu 26-Sep-2022 Initial creation. 22 | // 23 | /////////////////////////////////////////////////////////////////////////////// 24 | 25 | #pragma once 26 | 27 | #include 28 | 29 | #undef CDECL 30 | #define CDECL __cdecl 31 | #define NORETURN __declspec(noreturn) 32 | #define DECLSPEC_EXPORT __declspec(dllexport) 33 | #define INLINE __inline 34 | #define NOINLINE __declspec(noinline) 35 | #define STATIC static 36 | #define VOLATILE volatile 37 | #define EXTERN extern 38 | 39 | typedef PSTR *PPSTR; 40 | typedef PCSTR *PPCSTR; 41 | typedef PWSTR *PPWSTR; 42 | typedef PCWSTR *PPCWSTR; 43 | typedef va_list ARGLIST; 44 | typedef ULONGLONG QWORD; 45 | typedef LONG NTSTATUS; 46 | 47 | #define GEN_STD_TYPEDEFS(Type) \ 48 | typedef Type *P##Type; \ 49 | typedef Type **PP##Type; \ 50 | typedef CONST Type *PC##Type; \ 51 | typedef CONST Type **PPC##Type 52 | 53 | #define TYPEDEF_TYPE_NAME(Type) Type; GEN_STD_TYPEDEFS(Type) 54 | 55 | // PCVOID, PPVOID, PPCVOID etc 56 | GEN_STD_TYPEDEFS(VOID); 57 | GEN_STD_TYPEDEFS(NTSTATUS); 58 | GEN_STD_TYPEDEFS(BYTE); 59 | GEN_STD_TYPEDEFS(WORD); 60 | GEN_STD_TYPEDEFS(DWORD); 61 | GEN_STD_TYPEDEFS(QWORD); 62 | GEN_STD_TYPEDEFS(ULONGLONG); 63 | GEN_STD_TYPEDEFS(ULONG); 64 | GEN_STD_TYPEDEFS(USHORT); 65 | GEN_STD_TYPEDEFS(UCHAR); 66 | GEN_STD_TYPEDEFS(HMODULE); -------------------------------------------------------------------------------- /00-Common Headers/KexVer.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // KexVer.h 6 | // 7 | // Abstract: 8 | // 9 | // Contains version information and other strings/constants for file 10 | // metadata across many VxKex components. 11 | // 12 | // Author: 13 | // 14 | // vxiiduu (26-Sep-2022) 15 | // 16 | // Environment: 17 | // 18 | // N/A 19 | // 20 | // Revision History: 21 | // 22 | // vxiiduu 26-Sep-2022 Initial creation 23 | // vxiiduu 04-Feb-2024 Implement autoincrement build number 24 | // 25 | /////////////////////////////////////////////////////////////////////////////// 26 | 27 | #pragma once 28 | 29 | // vautogen is a utility in 01-Development Utilities\vautogen. 30 | // The INI-file controls the major, minor and patch numbers. 31 | // vautogen automatically increments the version number each time it is 32 | // called, and creates a header file containing the definitions: 33 | // KEX_VERSION_DW (written to registry as InstalledVersion) 34 | // KEX_VERSION_FV (placed in version resources, see .rc files) 35 | // KEX_VERSION_STR (displayed to users) 36 | // 37 | // Since KexVer.h is included in basically every VxKex project (and the build 38 | // number auto-increments), allowing vautogen.h to be included all the time 39 | // would cause builds to be longer and more annoying. Therefore it is only 40 | // included in resource files (where version resources are defined) and in 41 | // specific .c files that need it (define NEED_VERSION_DEFS before the inclusion 42 | // of any headers). 43 | 44 | #if defined(RC_INVOKED) || defined(NEED_VERSION_DEFS) 45 | # include 46 | #endif 47 | 48 | #define KEX_WEB_STR "https://github.com/vxiiduu/VxKex" 49 | #define KEX_BUGREPORT_STR "https://github.com/vxiiduu/VxKex/issues/new/choose" 50 | 51 | // You must keep the following line blank or RC will screech. 52 | -------------------------------------------------------------------------------- /00-Common Headers/KexW32ML.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // KexW32ML.h 6 | // 7 | // Abstract: 8 | // 9 | // VxKex Win32-mode General Library Header file 10 | // 11 | // Author: 12 | // 13 | // vxiiduu (02-Oct-2022) 14 | // 15 | // Environment: 16 | // 17 | // This header is automatically included in EXE targets. 18 | // It may be used in DLLs which are to be loaded in kex processes. 19 | // Do not use in native DLLs. 20 | // 21 | // Revision History: 22 | // 23 | // vxiiduu 02-Oct-2022 Initial creation. 24 | // 25 | /////////////////////////////////////////////////////////////////////////////// 26 | 27 | #pragma once 28 | 29 | #ifdef KEX_ENV_NATIVE 30 | # error This header file cannot be used in a native mode project. 31 | #endif 32 | 33 | #ifndef KW32MLDECLSPEC 34 | # define KW32MLDECLSPEC 35 | # pragma comment(lib, "KexW32ML.lib") 36 | #endif 37 | 38 | #define KW32MLAPI WINAPI 39 | 40 | #define GetLastErrorAsString() Win32ErrorAsString(GetLastError()) 41 | #define NtStatusAsString(Status) Win32ErrorAsString(RtlNtStatusToDosErrorNoTeb(Status)) 42 | 43 | // Use CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE) instead 44 | #pragma deprecated(CoInitialize) 45 | 46 | KW32MLDECLSPEC LONGLONG KW32MLAPI CompareFileTimes( 47 | IN FILETIME FileTime1, 48 | IN FILETIME FileTime2); 49 | 50 | KW32MLDECLSPEC PWSTR KW32MLAPI GetCommandLineWithoutImageName( 51 | VOID); 52 | 53 | KW32MLDECLSPEC BOOLEAN KW32MLAPI PathReplaceIllegalCharacters( 54 | IN PWSTR Path, 55 | IN WCHAR ReplacementCharacter, 56 | IN BOOLEAN AllowPathSeparators); 57 | 58 | KW32MLDECLSPEC PCWSTR KW32MLAPI Win32ErrorAsString( 59 | IN ULONG Win32ErrorCode); 60 | 61 | KW32MLDECLSPEC ULONG KW32MLAPI RegReadI32( 62 | IN HKEY Key, 63 | IN PCWSTR SubKey OPTIONAL, 64 | IN PCWSTR ValueName OPTIONAL, 65 | OUT PULONG Data); 66 | 67 | KW32MLDECLSPEC ULONG KW32MLAPI RegWriteI32( 68 | IN HKEY Key, 69 | IN PCWSTR SubKey OPTIONAL, 70 | IN PCWSTR ValueName OPTIONAL, 71 | IN ULONG Data); 72 | 73 | KW32MLDECLSPEC ULONG KW32MLAPI RegReadString( 74 | IN HKEY Key, 75 | IN PCWSTR SubKey OPTIONAL, 76 | IN PCWSTR ValueName OPTIONAL, 77 | OUT PWSTR Buffer, 78 | IN ULONG BufferCch); 79 | 80 | KW32MLDECLSPEC ULONG KW32MLAPI RegWriteString( 81 | IN HKEY Key, 82 | IN PCWSTR SubKey OPTIONAL, 83 | IN PCWSTR ValueName OPTIONAL, 84 | IN PCWSTR Data); 85 | 86 | KW32MLDECLSPEC BOOLEAN KW32MLAPI RegReOpenKey( 87 | IN OUT PHKEY KeyHandle, 88 | IN ACCESS_MASK NewAccessMask, 89 | IN HANDLE TransactionHandle OPTIONAL); 90 | 91 | KW32MLDECLSPEC EXTERN_C BOOLEAN KW32MLAPI SupersedeFile( 92 | IN PCWSTR SourceFile, 93 | IN PCWSTR TargetFile, 94 | IN HANDLE TransactionHandle OPTIONAL); 95 | 96 | KW32MLDECLSPEC HANDLE KW32MLAPI CreateSimpleTransaction( 97 | IN PCWSTR Description); -------------------------------------------------------------------------------- /00-Common Headers/KseGuid.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define CLSID_STRING_KEXSHLEX L"{9AACA888-A5F5-4C01-852E-8A2005C1D45F}" 4 | #define CLSID_STRING_CPIWBYPA L"{7EF224FC-1840-433C-9BCB-2951DE71DDBD}" -------------------------------------------------------------------------------- /00-Common Headers/KxMi.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #if !defined(KXMIAPI) && defined(KEX_ENV_WIN32) 7 | # define KXMIAPI 8 | # pragma comment(lib, "KxMi.lib") 9 | #endif 10 | 11 | typedef ULONG (CALLBACK *PDEVICE_NOTIFY_CALLBACK_ROUTINE) ( 12 | IN PVOID Context OPTIONAL, 13 | IN ULONG Type, 14 | IN PVOID Setting); 15 | 16 | typedef struct _DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS { 17 | PDEVICE_NOTIFY_CALLBACK_ROUTINE Callback; 18 | PVOID Context; 19 | } TYPEDEF_TYPE_NAME(DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS); 20 | 21 | // 22 | // powrprof.c 23 | // 24 | 25 | KXMIAPI POWER_PLATFORM_ROLE WINAPI PowerDeterminePlatformRoleEx( 26 | IN ULONG Version); 27 | 28 | KXMIAPI ULONG WINAPI PowerRegisterSuspendResumeNotification( 29 | IN ULONG Flags, 30 | IN HANDLE Recipient, 31 | OUT PHPOWERNOTIFY RegistrationHandle); 32 | 33 | KXMIAPI ULONG WINAPI PowerUnregisterSuspendResumeNotification( 34 | IN OUT HPOWERNOTIFY RegistrationHandle); -------------------------------------------------------------------------------- /00-Common Headers/vautogen.h: -------------------------------------------------------------------------------- 1 | // Do not edit this file. It was generated by VAUTOGEN. 2 | #define KEX_VERSION_DW 0x80000595 3 | #define KEX_VERSION_FV 1,1,2,1429 4 | #define KEX_VERSION_STR "1.1.2.1429" 5 | -------------------------------------------------------------------------------- /00-Documentation/Application Compatibility List.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Documentation/Application Compatibility List.docx -------------------------------------------------------------------------------- /00-Documentation/Changelog.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Documentation/Changelog.txt -------------------------------------------------------------------------------- /00-Documentation/Debugging KexDll.txt: -------------------------------------------------------------------------------- 1 | KexDll is not 100% straightforward to debug, since it executes prior to most 2 | other DllMain's and prior to the main exe's entry point. 3 | 4 | However, WinDbg (part of Debugging Tools for Windows, found in the SDK) can 5 | easily debug its code by following these steps: 6 | 7 | 1. Start an application in WinDbg by File->Open Executable. 8 | 2. Type in the command window: "bu KexDll!DllMain" (or any other function) 9 | 3. Re-start the application by Debug->Restart. 10 | 11 | Then, WinDbg will break at any specified function in KexDll and can display 12 | source code, variables, call stack, etc. -------------------------------------------------------------------------------- /00-Documentation/KexSetup responsibilities.txt: -------------------------------------------------------------------------------- 1 | The program which installs VxKex on user computers is called KexSetup and its 2 | source code can be found in the main solution. The responsibilities of this 3 | program include: 4 | 5 | - creating an installation folder inside Program files (or another user 6 | selected location) 7 | 8 | - creating registry keys and values: 9 | 10 | \Registry\Machine\Software\VXsoft\VxKex 11 | InstalledVersion (REG_DWORD) 12 | KexDir (REG_SZ) 13 | LogDir (REG_SZ) 14 | 15 | \Registry\User\Software\VXsoft\VxKex 16 | LogDir (REG_SZ) (overrides the HKLM value, if present) 17 | 18 | - placing KexDll into system32 19 | 20 | - placing auxiliary files and programs, such as the log viewer, the 21 | configuration helper program KexCfg, and the shell extension KexShlEx 22 | into the VxKex installation folder (known as KexDir within the code) 23 | 24 | - placing the system extension DLLs (kxbase, kxuser, etc.) into KexDir 25 | 26 | - registering the VxKex property sheet page shell extension 27 | 28 | - associating .vxl file extension with VxlView 29 | 30 | Of course, the program can also uninstall VxKex and must reverse all the above 31 | procedures when doing so. -------------------------------------------------------------------------------- /00-Documentation/Source File Header.txt: -------------------------------------------------------------------------------- 1 | Copypaste this at the top of new source code files. 2 | 3 | 4 | /////////////////////////////////////////////////////////////////////////////// 5 | // 6 | // Module Name: 7 | // 8 | // file.ext 9 | // 10 | // Abstract: 11 | // 12 | // FILL OUT THIS TEXT 13 | // 14 | // Author: 15 | // 16 | // Author (DD-MMM-YYYY) 17 | // 18 | // Environment: 19 | // 20 | // WHERE CAN THIS PROGRAM/LIBRARY/CODE RUN? 21 | // 22 | // Revision History: 23 | // 24 | // Author DD-MMM-YYYY Initial creation. 25 | // 26 | /////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------------------------- /00-Documentation/VxKex Registry Keys (Legacy).txt: -------------------------------------------------------------------------------- 1 | Legacy versions of VxKex (0.0.0.3 and prior) used the registry in the following manner: 2 | 3 | HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options (key) 4 | (key) 5 | Debugger (REG_SZ) 6 | This string would contain "VxKexLdr.exe" somewhere in it. 7 | 8 | HKLM\Software\VXsoft\VxKexLdr (key) 9 | InstalledVersion (REG_DWORD) 10 | KexDir (REG_SZ) 11 | 12 | HKCU\Software\VXsoft\VxKexLdr (key) 13 | Image File Execution Options (key) 14 | 15 | 16 | In order to remove traces of legacy VxKex from the registry, delete the following keys: 17 | 18 | HKLM\Software\VXsoft\VxKexLdr 19 | HKCU\Software\VXsoft\VxKexLdr 20 | Any IFEO key that contains a "Debugger" value that has VxKexLdr.exe in it -------------------------------------------------------------------------------- /00-Documentation/VxKex Registry Keys.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Documentation/VxKex Registry Keys.docx -------------------------------------------------------------------------------- /00-Documentation/~$Kex Registry Keys.docx: -------------------------------------------------------------------------------- 1 | vxiiduuvxiiduu\APA.XSL Courier New Courier New C -------------------------------------------------------------------------------- /00-Import Libraries/cfgmgr32_x64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/cfgmgr32_x64.lib -------------------------------------------------------------------------------- /00-Import Libraries/cfgmgr32_x86.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/cfgmgr32_x86.lib -------------------------------------------------------------------------------- /00-Import Libraries/dxgi_x64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/dxgi_x64.lib -------------------------------------------------------------------------------- /00-Import Libraries/dxgi_x86.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/dxgi_x86.lib -------------------------------------------------------------------------------- /00-Import Libraries/kernel32_x64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/kernel32_x64.lib -------------------------------------------------------------------------------- /00-Import Libraries/kernel32_x86.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/kernel32_x86.lib -------------------------------------------------------------------------------- /00-Import Libraries/kernelbase_x64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/kernelbase_x64.lib -------------------------------------------------------------------------------- /00-Import Libraries/kernelbase_x86.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/kernelbase_x86.lib -------------------------------------------------------------------------------- /00-Import Libraries/msvcrt_x64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/msvcrt_x64.lib -------------------------------------------------------------------------------- /00-Import Libraries/msvcrt_x86.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/msvcrt_x86.lib -------------------------------------------------------------------------------- /00-Import Libraries/ntdll_x64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/ntdll_x64.lib -------------------------------------------------------------------------------- /00-Import Libraries/ntdll_x86.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/ntdll_x86.lib -------------------------------------------------------------------------------- /00-Import Libraries/ntoskrnl_x64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/ntoskrnl_x64.lib -------------------------------------------------------------------------------- /00-Import Libraries/ntoskrnl_x86.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/ntoskrnl_x86.lib -------------------------------------------------------------------------------- /00-Import Libraries/ntstrsafe_x64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/ntstrsafe_x64.lib -------------------------------------------------------------------------------- /00-Import Libraries/ntstrsafe_x86.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/ntstrsafe_x86.lib -------------------------------------------------------------------------------- /00-Import Libraries/seh32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/seh32.lib -------------------------------------------------------------------------------- /00-Import Libraries/user32_x64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/user32_x64.lib -------------------------------------------------------------------------------- /00-Import Libraries/user32_x86.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/00-Import Libraries/user32_x86.lib -------------------------------------------------------------------------------- /01-Development Utilities/7zSfx/7zS2.sfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/01-Development Utilities/7zSfx/7zS2.sfx -------------------------------------------------------------------------------- /01-Development Utilities/7zSfx/7zr.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/01-Development Utilities/7zSfx/7zr.exe -------------------------------------------------------------------------------- /01-Development Utilities/7zSfx/vtrplnt.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/01-Development Utilities/7zSfx/vtrplnt.exe -------------------------------------------------------------------------------- /01-Development Utilities/7zSfx/vtrplnt.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/01-Development Utilities/7zSfx/vtrplnt.pdb -------------------------------------------------------------------------------- /01-Development Utilities/KexExprt/KexExprt.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/01-Development Utilities/KexExprt/KexExprt.rc -------------------------------------------------------------------------------- /01-Development Utilities/KexExprt/KexExprt.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | 29 | 30 | Resource Files 31 | 32 | 33 | 34 | 35 | Source Files 36 | 37 | 38 | Source Files 39 | 40 | 41 | -------------------------------------------------------------------------------- /01-Development Utilities/KexExprt/buildcfg.h: -------------------------------------------------------------------------------- 1 | #define KEX_ENV_WIN32 2 | #define KEX_TARGET_TYPE_EXE 3 | #define KEX_COMPONENT L"KexExprt" 4 | -------------------------------------------------------------------------------- /01-Development Utilities/KexExprt/kexexprt.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // kexexprt.h 6 | // 7 | // Abstract: 8 | // 9 | // Private header file for KexExprt 10 | // 11 | // Author: 12 | // 13 | // vxiiduu (29-Oct-2022) 14 | // 15 | // Revision History: 16 | // 17 | // vxiiduu 29-Oct-2022 Initial creation. 18 | // 19 | /////////////////////////////////////////////////////////////////////////////// 20 | 21 | #pragma once 22 | #include "buildcfg.h" 23 | #include 24 | 25 | typedef struct _LARGE_UNICODE_STRING { 26 | ULONG Cch; 27 | ULONG MaxCch; 28 | PWCHAR Buffer; 29 | } TYPEDEF_TYPE_NAME(LARGE_UNICODE_STRING); 30 | 31 | typedef enum _KEXEXPRT_GENERATE_STYLE { 32 | GenerateStyleDef, 33 | GenerateStylePragma 34 | } TYPEDEF_TYPE_NAME(KEXEXPRT_GENERATE_STYLE); 35 | 36 | INT_PTR CALLBACK MainWndProc( 37 | IN HWND MainWindow, 38 | IN UINT Message, 39 | IN WPARAM WParam, 40 | IN LPARAM LParam); 41 | 42 | VOID DumpExports( 43 | IN HWND MainWindow, 44 | IN PCWSTR DllPath, 45 | IN KEXEXPRT_GENERATE_STYLE Style, 46 | IN BOOLEAN IncludeOrdinals); -------------------------------------------------------------------------------- /01-Development Utilities/KexExprt/resource.h: -------------------------------------------------------------------------------- 1 | #define MAINWND_WIDTH 400 2 | #define MAINWND_HEIGHT 300 3 | 4 | #define IDD_MAINWND 101 5 | #define IDC_GUIDETEXT 102 6 | #define IDC_LOCATION 103 7 | #define IDC_FILEPATH 104 8 | #define IDC_BROWSE 105 9 | #define IDC_STYLESEL 106 10 | #define IDC_RBDEF 107 11 | #define IDC_RBPRAGMA 108 12 | #define IDC_RESULT 109 13 | #define IDC_INCLUDEORDINALS 110 14 | 15 | #define IDA_ACCELERATORS 120 16 | #define M_SELECTALL 121 17 | -------------------------------------------------------------------------------- /01-Development Utilities/vautogen/vautogen.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/01-Development Utilities/vautogen/vautogen.exe -------------------------------------------------------------------------------- /01-Development Utilities/vautogen/vautogen.ini: -------------------------------------------------------------------------------- 1 | [vautogen] 2 | HeaderFile=..\..\00-Common Headers\vautogen.h 3 | MajorVersion=1 4 | MinorVersion=1 5 | PatchLevel=2 6 | BuildNumber=1429 7 | -------------------------------------------------------------------------------- /01-Development Utilities/vautogen/vautogen.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/01-Development Utilities/vautogen/vautogen.pdb -------------------------------------------------------------------------------- /01-Extended DLLs/KxAdvapi/KxAdvapi.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | 31 | 32 | Resource Files 33 | 34 | 35 | 36 | 37 | Source Files 38 | 39 | 40 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxAdvapi/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #define NOGDICAPMASKS 5 | #define NOVIRTUALKEYCODES 6 | #define NOWINSTYLES 7 | #define NOSYSMETRICS 8 | #define NOMENUS 9 | #define NOICONS 10 | #define NOKEYSTATES 11 | #define NOSYSCOMMANDS 12 | #define NORASTEROPS 13 | #define NOSHOWWINDOW 14 | #define NOATOM 15 | #define NOCLIPBOARD 16 | #define NOCOLOR 17 | #define NODRAWTEXT 18 | #define NOGDI 19 | #define NOKERNEL 20 | #define NOMB 21 | #define NOMEMMGR 22 | #define NOOPENFILE 23 | #define NOSCROLL 24 | #define NOTEXTMETRIC 25 | #define NOWH 26 | #define NOWINOFFSETS 27 | #define NOCOMM 28 | #define NOKANJI 29 | #define NOHELP 30 | #define NOPROFILER 31 | #define NODEFERWINDOWPOS 32 | #define NOMCX 33 | #define NOCRYPT 34 | #define NOMETAFILE 35 | #define NOSERVICE 36 | #define NOSOUND 37 | #define _UXTHEME_H_ 38 | 39 | #pragma comment(lib, "KexDll.lib") 40 | 41 | #define KEX_COMPONENT L"KxAdvapi" 42 | #define KEX_ENV_WIN32 43 | #define KEX_TARGET_TYPE_DLL 44 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxAdvapi/dllmain.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | 4 | BOOL WINAPI DllMain( 5 | IN HMODULE DllHandle, 6 | IN ULONG Reason, 7 | IN PCONTEXT Context) 8 | { 9 | if (Reason == DLL_PROCESS_ATTACH) { 10 | LdrDisableThreadCalloutsForDll(DllHandle); 11 | } 12 | 13 | return TRUE; 14 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxAdvapi/kxadvapi.def: -------------------------------------------------------------------------------- 1 | LIBRARY KxAdvapi 2 | EXPORTS 3 | ;; Forwarders to KexDll 4 | EventSetInformation = KexDll.KexEtwEventSetInformation 5 | 6 | ;; Forwarders to KxBase 7 | CreateWellKnownSid = KxBase.CreateWellKnownSid -------------------------------------------------------------------------------- /01-Extended DLLs/KxAdvapi/kxadvapi.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/01-Extended DLLs/KxAdvapi/kxadvapi.rc -------------------------------------------------------------------------------- /01-Extended DLLs/KxBase/KxBase.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/01-Extended DLLs/KxBase/KxBase.rc -------------------------------------------------------------------------------- /01-Extended DLLs/KxBase/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #define NOGDICAPMASKS 5 | #define NOVIRTUALKEYCODES 6 | #define NOWINSTYLES 7 | #define NOSYSMETRICS 8 | #define NOMENUS 9 | #define NOICONS 10 | #define NOKEYSTATES 11 | #define NOSYSCOMMANDS 12 | #define NORASTEROPS 13 | #define NOSHOWWINDOW 14 | #define NOATOM 15 | #define NOCLIPBOARD 16 | #define NOCOLOR 17 | #define NODRAWTEXT 18 | #define NOGDI 19 | #define NOKERNEL 20 | #define NOMB 21 | #define NOMEMMGR 22 | #define NOOPENFILE 23 | #define NOSCROLL 24 | #define NOTEXTMETRIC 25 | #define NOWH 26 | #define NOWINOFFSETS 27 | #define NOCOMM 28 | #define NOKANJI 29 | #define NOHELP 30 | #define NOPROFILER 31 | #define NODEFERWINDOWPOS 32 | #define NOMCX 33 | #define NOCRYPT 34 | #define NOMETAFILE 35 | #define NOSERVICE 36 | #define NOSOUND 37 | #define _UXTHEME_H_ 38 | 39 | #define KXBASEAPI 40 | 41 | #ifdef _M_X64 42 | # pragma comment(lib, "cfgmgr32_x64.lib") 43 | #else 44 | # pragma comment(lib, "cfgmgr32_x86.lib") 45 | #endif 46 | 47 | #define KEX_COMPONENT L"KxBase" 48 | #define KEX_ENV_WIN32 49 | #define KEX_TARGET_TYPE_DLL 50 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxBase/cfgmgr.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxbasep.h" 3 | 4 | KXBASEAPI CONFIGRET WINAPI CM_Register_Notification( 5 | IN PCM_NOTIFY_FILTER Filter, 6 | IN PVOID Context OPTIONAL, 7 | IN PCM_NOTIFY_CALLBACK Callback, 8 | OUT PHCMNOTIFICATION NotifyContext) 9 | { 10 | KexLogWarningEvent(L"Unimplemented function CM_Register_Notification called"); 11 | KexDebugCheckpoint(); 12 | return CR_CALL_NOT_IMPLEMENTED; 13 | } 14 | 15 | KXBASEAPI CONFIGRET WINAPI CM_Unregister_Notification( 16 | IN HCMNOTIFICATION NotifyContext) 17 | { 18 | KexLogWarningEvent(L"Unimplemented function CM_Unregister_Notification called"); 19 | KexDebugCheckpoint(); 20 | return CR_CALL_NOT_IMPLEMENTED; 21 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxBase/dllmain.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // dllmain.c 6 | // 7 | // Abstract: 8 | // 9 | // Main file for KXBASE. 10 | // The DLLs "kernel32" and "kernelbase" are redirected to this DLL. 11 | // 12 | // Author: 13 | // 14 | // vxiiduu (07-Nov-2022) 15 | // 16 | // Environment: 17 | // 18 | // Win32 mode. 19 | // This module can import from NTDLL, KERNEL32, and KERNELBASE. 20 | // 21 | // Revision History: 22 | // 23 | // vxiiduu 07-Nov-2022 Initial creation. 24 | // vxiiduu 10-Feb-2024 Rename to KXBASE (from kernel33). 25 | // 26 | /////////////////////////////////////////////////////////////////////////////// 27 | 28 | #include "buildcfg.h" 29 | #include "kxbasep.h" 30 | #include 31 | 32 | PKEX_PROCESS_DATA KexData = NULL; 33 | 34 | BOOL WINAPI DllMain( 35 | IN PVOID DllBase, 36 | IN ULONG Reason, 37 | IN PCONTEXT Context) 38 | { 39 | if (Reason == DLL_PROCESS_ATTACH) { 40 | LdrDisableThreadCalloutsForDll(DllBase); 41 | 42 | KexDataInitialize(&KexData); 43 | KexLogDebugEvent(L"DllMain called with DLL_PROCESS_ATTACH"); 44 | 45 | // 46 | // Get the base address of Kernel32 and store it in KexData. 47 | // 48 | 49 | BaseGetBaseDllHandle(); 50 | ASSERT (KexData->BaseDllBase != NULL); 51 | 52 | // 53 | // If we are doing SharedUserData-based version spoofing, we need to 54 | // hook GetSystemTime and GetSystemTimeAsFileTime. 55 | // 56 | 57 | if (KexData->IfeoParameters.StrongVersionSpoof & KEX_STRONGSPOOF_SHAREDUSERDATA) { 58 | KexHkInstallBasicHook(GetSystemTime, KxBasepGetSystemTimeHook, NULL); 59 | KexHkInstallBasicHook(GetSystemTimeAsFileTime, KxBasepGetSystemTimeAsFileTimeHook, NULL); 60 | } 61 | 62 | // 63 | // Patch subsystem version check inside CreateProcessInternalW. 64 | // 65 | 66 | KexPatchCpiwSubsystemVersionCheck(); 67 | 68 | // 69 | // Get base named object directories and put handles to them in KexData. 70 | // 71 | 72 | KexData->BaseNamedObjects = BaseGetNamedObjectDirectory(); 73 | KexData->UntrustedNamedObjects = BaseGetUntrustedNamedObjectDirectory(); 74 | } 75 | 76 | return TRUE; 77 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxBase/geoname.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxbasep.h" 3 | 4 | KXBASEAPI INT WINAPI GetUserDefaultGeoName( 5 | OUT PWSTR Buffer, 6 | IN INT BufferCch) 7 | { 8 | GEOID GeoId; 9 | 10 | // 11 | // Validate parameters. 12 | // 13 | 14 | if (Buffer == NULL && BufferCch != 0) { 15 | RtlSetLastWin32Error(ERROR_INVALID_PARAMETER); 16 | return 0; 17 | } 18 | 19 | // 20 | // Get the user's default GeoID. 21 | // 22 | 23 | GeoId = GetUserGeoID(GEOCLASS_NATION); 24 | 25 | if (GeoId == GEOID_NOT_AVAILABLE) { 26 | GeoId = GetUserGeoID(GEOCLASS_REGION); 27 | } 28 | 29 | ASSERT (GeoId != GEOID_NOT_AVAILABLE); 30 | 31 | if (GeoId == GEOID_NOT_AVAILABLE) { 32 | RtlSetLastWin32Error(ERROR_BADDB); 33 | return 0; 34 | } 35 | 36 | // 37 | // Convert the GeoID into a two-letter ISO country code. 38 | // 39 | 40 | return GetGeoInfo(GeoId, GEO_ISO2, Buffer, BufferCch, 0); 41 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxBase/heap.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxbasep.h" 3 | 4 | KXBASEAPI HANDLE WINAPI Ext_HeapCreate( 5 | IN ULONG Flags, 6 | IN SIZE_T InitialSize, 7 | IN SIZE_T MaximumSize) 8 | { 9 | HANDLE HeapHandle; 10 | 11 | Flags &= HEAP_GENERATE_EXCEPTIONS | HEAP_NO_SERIALIZE | HEAP_CREATE_ENABLE_EXECUTE; 12 | Flags |= HEAP_CLASS_1; 13 | 14 | if (MaximumSize < PAGE_SIZE) { 15 | if (MaximumSize == 0) { 16 | Flags |= HEAP_GROWABLE; 17 | } else { 18 | // Round up to the page size. 19 | MaximumSize = PAGE_SIZE; 20 | } 21 | } 22 | 23 | if (!(Flags & HEAP_GROWABLE) && InitialSize > MaximumSize) { 24 | MaximumSize = InitialSize; 25 | } 26 | 27 | // 28 | // The following line of code is the important part and is the reason why we have 29 | // rewritten the HeapCreate function. 30 | // Adding the following flag prevents RtlCreateHeap from trying to create a 31 | // "debug heap", which causes lots of problems with some applications (and it's 32 | // also slower, I'd presume). 33 | // 34 | 35 | Flags |= HEAP_SKIP_VALIDATION_CHECKS; 36 | 37 | HeapHandle = RtlCreateHeap( 38 | Flags, 39 | NULL, 40 | MaximumSize, 41 | InitialSize, 42 | NULL, 43 | NULL); 44 | 45 | if (HeapHandle == NULL) { 46 | RtlSetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); 47 | } 48 | 49 | return HeapHandle; 50 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxBase/kxbasep.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // kexdllp.h 6 | // 7 | // Abstract: 8 | // 9 | // Private header file for KxBase. 10 | // 11 | // Author: 12 | // 13 | // vxiiduu (07-Nov-2022) 14 | // 15 | // Revision History: 16 | // 17 | // vxiiduu 07-Nov-2022 Initial creation. 18 | // 19 | /////////////////////////////////////////////////////////////////////////////// 20 | 21 | #pragma once 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | EXTERN PKEX_PROCESS_DATA KexData; 28 | EXTERN HANDLE KsecDD; 29 | 30 | // 31 | // module.c 32 | // 33 | 34 | KXBASEAPI HMODULE WINAPI Ext_GetModuleHandleA( 35 | IN PCSTR ModuleName); 36 | 37 | KXBASEAPI HMODULE WINAPI Ext_GetModuleHandleW( 38 | IN PCWSTR ModuleName); 39 | 40 | KXBASEAPI BOOL WINAPI Ext_GetModuleHandleExA( 41 | IN ULONG Flags, 42 | IN PCSTR ModuleName, 43 | OUT HMODULE *ModuleHandleOut); 44 | 45 | KXBASEAPI BOOL WINAPI Ext_GetModuleHandleExW( 46 | IN ULONG Flags, 47 | IN PCWSTR ModuleName, 48 | OUT HMODULE *ModuleHandleOut); 49 | 50 | KXBASEAPI ULONG WINAPI Ext_GetModuleFileNameA( 51 | IN HMODULE ModuleHandle, 52 | OUT PSTR FileName, 53 | IN ULONG FileNameCch); 54 | 55 | KXBASEAPI ULONG WINAPI Ext_GetModuleFileNameW( 56 | IN HMODULE ModuleHandle, 57 | OUT PWSTR FileName, 58 | IN ULONG FileNameCch); 59 | 60 | KXBASEAPI HMODULE WINAPI Ext_LoadLibraryA( 61 | IN PCSTR FileName); 62 | 63 | KXBASEAPI HMODULE WINAPI Ext_LoadLibraryW( 64 | IN PCWSTR FileName); 65 | 66 | KXBASEAPI HMODULE WINAPI Ext_LoadLibraryExA( 67 | IN PCSTR FileName, 68 | IN HANDLE FileHandle, 69 | IN ULONG Flags); 70 | 71 | KXBASEAPI HMODULE WINAPI Ext_LoadLibraryExW( 72 | IN PCWSTR FileName, 73 | IN HANDLE FileHandle, 74 | IN ULONG Flags); 75 | 76 | // 77 | // time.c 78 | // 79 | 80 | KXBASEAPI VOID WINAPI KxBasepGetSystemTimeAsFileTimeHook( 81 | OUT PFILETIME SystemTimeAsFileTime); 82 | 83 | KXBASEAPI VOID WINAPI KxBasepGetSystemTimeHook( 84 | OUT PSYSTEMTIME SystemTime); 85 | 86 | // 87 | // support.c 88 | // 89 | 90 | PLARGE_INTEGER BaseFormatTimeOut( 91 | OUT PLARGE_INTEGER TimeOut, 92 | IN ULONG Milliseconds); 93 | 94 | HANDLE WINAPI BaseGetNamedObjectDirectory( 95 | VOID); 96 | 97 | HANDLE WINAPI BaseGetUntrustedNamedObjectDirectory( 98 | VOID); 99 | 100 | PVOID BaseGetBaseDllHandle( 101 | VOID); 102 | 103 | // 104 | // dllpath.c 105 | // 106 | 107 | VOID KxBaseAddKex3264ToBaseDefaultPath( 108 | VOID); 109 | 110 | // 111 | // crypto.c 112 | // 113 | 114 | NTSTATUS BaseInitializeCrypto( 115 | VOID); -------------------------------------------------------------------------------- /01-Extended DLLs/KxBase/misc.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxbasep.h" 3 | 4 | KXBASEAPI BOOL WINAPI GetOsSafeBootMode( 5 | OUT PBOOL IsSafeBootMode) 6 | { 7 | *IsSafeBootMode = FALSE; 8 | return TRUE; 9 | } 10 | 11 | KXBASEAPI BOOL WINAPI GetFirmwareType( 12 | OUT PFIRMWARE_TYPE FirmwareType) 13 | { 14 | *FirmwareType = FirmwareTypeUnknown; 15 | return TRUE; 16 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxBase/pssapi.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // pssapi.c 6 | // 7 | // Abstract: 8 | // 9 | // This file contains the kxbase-side implementation of the Process 10 | // Snapshots API introduced in Windows 8.1. These APIs are used by Python. 11 | // 12 | // Currently these APIs are all stubs. It is, however, possible to fully 13 | // implement them under Windows 7 if it is found that programs are making 14 | // significant use of them. 15 | // 16 | // As of 15-Mar-2024 the Python issue has been alleviated by this pull 17 | // request I made: https://github.com/python/cpython/issues/116195 18 | // 19 | // Author: 20 | // 21 | // vxiiduu (01-Mar-2024) 22 | // 23 | // Environment: 24 | // 25 | // WHERE CAN THIS PROGRAM/LIBRARY/CODE RUN? 26 | // 27 | // Revision History: 28 | // 29 | // vxiiduu 01-Mar-2024 Initial creation. 30 | // 31 | /////////////////////////////////////////////////////////////////////////////// 32 | 33 | #include "buildcfg.h" 34 | #include "kxbasep.h" 35 | 36 | KXBASEAPI ULONG WINAPI PssCaptureSnapshot( 37 | IN HANDLE ProcessHandle, 38 | IN PSS_CAPTURE_FLAGS CaptureFlags, 39 | IN ULONG ThreadContextFlags OPTIONAL, 40 | OUT PHPSS SnapshotHandle) 41 | { 42 | KexLogWarningEvent(L"Stub API called: PssCaptureSnapshot"); 43 | KexDebugCheckpoint(); 44 | return ERROR_NOT_SUPPORTED; 45 | } 46 | 47 | KXBASEAPI ULONG WINAPI PssFreeSnapshot( 48 | IN HANDLE ProcessHandle, 49 | IN HPSS SnapshotHandle) 50 | { 51 | KexLogWarningEvent(L"Stub API called: PssFreeSnapshot"); 52 | KexDebugCheckpoint(); 53 | return ERROR_NOT_SUPPORTED; 54 | } 55 | 56 | KXBASEAPI ULONG WINAPI PssQuerySnapshot( 57 | IN HPSS SnapshotHandle, 58 | IN PSS_QUERY_INFORMATION_CLASS InformationClass, 59 | OUT PVOID Buffer, 60 | IN ULONG BufferLength) 61 | { 62 | KexLogWarningEvent(L"Stub API called: PssQuerySnapshot"); 63 | KexDebugCheckpoint(); 64 | return ERROR_NOT_SUPPORTED; 65 | } 66 | 67 | KXBASEAPI ULONG WINAPI PssWalkMarkerCreate( 68 | IN PCPSS_ALLOCATOR Allocator, 69 | OUT HPSSWALK WalkMarkerHandle) 70 | { 71 | KexLogWarningEvent(L"Stub API called: PssWalkMarkerCreate"); 72 | KexDebugCheckpoint(); 73 | return ERROR_NOT_SUPPORTED; 74 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxBase/stubs.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // file.ext 6 | // 7 | // Abstract: 8 | // 9 | // Forwarder stubs that do nothing except for calling the original function. 10 | // These exist because some stupid software such as Chromium is not 11 | // compatible with export forwarders. 12 | // 13 | // Author: 14 | // 15 | // vxiiduu (09-Mar-2024) 16 | // 17 | // Environment: 18 | // 19 | // Win32 20 | // 21 | // Revision History: 22 | // 23 | // vxiiduu 09-Mar-2024 Initial creation. 24 | // 25 | /////////////////////////////////////////////////////////////////////////////// 26 | 27 | #include "buildcfg.h" 28 | #include "kxbasep.h" 29 | 30 | KXBASEAPI BOOL WINAPI Ext_DuplicateHandle( 31 | IN HANDLE SourceProcessHandle, 32 | IN HANDLE SourceHandle, 33 | IN HANDLE TargetProcessHandle, 34 | OUT PHANDLE TargetHandle, 35 | IN ACCESS_MASK DesiredAccess, 36 | IN BOOL Inherit, 37 | IN ULONG Options) 38 | { 39 | return DuplicateHandle( 40 | SourceProcessHandle, 41 | SourceHandle, 42 | TargetProcessHandle, 43 | TargetHandle, 44 | DesiredAccess, 45 | Inherit, 46 | Options); 47 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxBase/synch.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // synch.c 6 | // 7 | // Abstract: 8 | // 9 | // Contains functions related to thread synchronization. 10 | // 11 | // Author: 12 | // 13 | // vxiiduu (11-Feb-2022) 14 | // 15 | // Environment: 16 | // 17 | // Win32 mode. 18 | // 19 | // Revision History: 20 | // 21 | // vxiiduu 11-Feb-2022 Initial creation. 22 | // 23 | /////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include "buildcfg.h" 26 | #include "kxbasep.h" 27 | 28 | // 29 | // This function is a wrapper around (Kex)RtlWaitOnAddress. 30 | // 31 | KXBASEAPI BOOL WINAPI WaitOnAddress( 32 | IN VOLATILE VOID *Address, 33 | IN PVOID CompareAddress, 34 | IN SIZE_T AddressSize, 35 | IN DWORD Milliseconds OPTIONAL) 36 | { 37 | NTSTATUS Status; 38 | PLARGE_INTEGER TimeOutPointer; 39 | LARGE_INTEGER TimeOut; 40 | 41 | TimeOutPointer = BaseFormatTimeOut(&TimeOut, Milliseconds); 42 | 43 | Status = KexRtlWaitOnAddress( 44 | Address, 45 | CompareAddress, 46 | AddressSize, 47 | TimeOutPointer); 48 | 49 | BaseSetLastNTError(Status); 50 | 51 | if (NT_SUCCESS(Status) && Status != STATUS_TIMEOUT) { 52 | return TRUE; 53 | } else { 54 | return FALSE; 55 | } 56 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxBase/time.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxbasep.h" 3 | 4 | // 5 | // If strong SharedUserData spoofing is enabled, this function 6 | // supersedes KernelBase!GetSystemTimeAsFileTime because the original 7 | // function reads system time from SharedUserData. 8 | // 9 | KXBASEAPI VOID WINAPI KxBasepGetSystemTimeAsFileTimeHook( 10 | OUT PFILETIME SystemTimeAsFileTime) 11 | { 12 | ASSERT (KexData->IfeoParameters.StrongVersionSpoof & KEX_STRONGSPOOF_SHAREDUSERDATA); 13 | NtQuerySystemTime((PLONGLONG) SystemTimeAsFileTime); 14 | } 15 | 16 | // 17 | // Same as above but this function supersedes GetSystemTime when doing 18 | // SharedUserData-based version spoofing. 19 | // 20 | KXBASEAPI VOID WINAPI KxBasepGetSystemTimeHook( 21 | OUT PSYSTEMTIME SystemTime) 22 | { 23 | LONGLONG Time; 24 | TIME_FIELDS TimeFields; 25 | 26 | ASSERT (KexData->IfeoParameters.StrongVersionSpoof & KEX_STRONGSPOOF_SHAREDUSERDATA); 27 | 28 | NtQuerySystemTime(&Time); 29 | RtlTimeToTimeFields(&Time, &TimeFields); 30 | 31 | // 32 | // Annoyingly, the TIME_FIELDS structure is not directly compatible with 33 | // the SYSTEMTIME structure... 34 | // 35 | 36 | SystemTime->wYear = TimeFields.Year; 37 | SystemTime->wMonth = TimeFields.Month; 38 | SystemTime->wDay = TimeFields.Day; 39 | SystemTime->wDayOfWeek = TimeFields.Weekday; 40 | SystemTime->wHour = TimeFields.Hour; 41 | SystemTime->wMinute = TimeFields.Minute; 42 | SystemTime->wSecond = TimeFields.Second; 43 | SystemTime->wMilliseconds = TimeFields.Milliseconds; 44 | } 45 | 46 | KXBASEAPI VOID WINAPI GetSystemTimePreciseAsFileTime( 47 | OUT PFILETIME SystemTimeAsFileTime) 48 | { 49 | // 50 | // The real NtQuerySystemTime export from NTDLL is actually just a jump to 51 | // RtlQuerySystemTime, which reads from SharedUserData. 52 | // 53 | // However, if we are doing SharedUserData-based version spoofing, we will 54 | // overwrite that stub function with KexNtQuerySystemTime, so it is the best 55 | // of both worlds in terms of speed and actually working. 56 | // 57 | 58 | NtQuerySystemTime((PLONGLONG) SystemTimeAsFileTime); 59 | } 60 | 61 | KXBASEAPI VOID WINAPI QueryUnbiasedInterruptTimePrecise( 62 | OUT PULONGLONG UnbiasedInterruptTimePrecise) 63 | { 64 | QueryUnbiasedInterruptTime(UnbiasedInterruptTimePrecise); 65 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxBase/token.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxbasep.h" 3 | 4 | KXBASEAPI BOOL WINAPI Ext_SetTokenInformation( 5 | IN HANDLE TokenHandle, 6 | IN TOKEN_INFORMATION_CLASS TokenInformationClass, 7 | IN PVOID TokenInformation, 8 | IN ULONG TokenInformationLength) 9 | { 10 | if (TokenInformationClass == TokenIntegrityLevel) { 11 | return TRUE; 12 | } 13 | 14 | return SetTokenInformation( 15 | TokenHandle, 16 | TokenInformationClass, 17 | TokenInformation, 18 | TokenInformationLength); 19 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxBase/verspoof.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxbasep.h" 3 | #include 4 | 5 | // 6 | // Iertutil.dll contains a version check which will end up causing errors (failure 7 | // to open files with ShellExecute including with shell context menus) if the reported 8 | // OS version is higher than 6.1. 9 | // 10 | // This function un-spoofs the OS version for Windows DLLs, and preserves normal behavior 11 | // for all other situations. 12 | // 13 | 14 | KXBASEAPI BOOL WINAPI Ext_GetVersionExA( 15 | IN OUT POSVERSIONINFOA VersionInfo) 16 | { 17 | BOOL Success; 18 | 19 | Success = GetVersionExA(VersionInfo); 20 | 21 | if (Success && AshModuleIsWindowsModule(ReturnAddress())) { 22 | VersionInfo->dwMajorVersion = 6; 23 | VersionInfo->dwMinorVersion = 1; 24 | VersionInfo->dwBuildNumber = 7601; 25 | } 26 | 27 | return Success; 28 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxBase/wow64.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxbasep.h" 3 | 4 | KXBASEAPI BOOL WINAPI IsWow64Process2( 5 | IN HANDLE ProcessHandle, 6 | OUT PUSHORT ProcessMachine, 7 | OUT PUSHORT NativeMachine) 8 | { 9 | NTSTATUS Status; 10 | 11 | Status = KexRtlWow64GetProcessMachines(ProcessHandle, ProcessMachine, NativeMachine); 12 | 13 | if (!NT_SUCCESS(Status)) { 14 | BaseSetLastNTError(Status); 15 | return FALSE; 16 | } 17 | 18 | return TRUE; 19 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxCom/KxCom.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/01-Extended DLLs/KxCom/KxCom.rc -------------------------------------------------------------------------------- /01-Extended DLLs/KxCom/buildcfg.h: -------------------------------------------------------------------------------- 1 | #define KXCOMAPI 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #define NOGDICAPMASKS 5 | #define NOVIRTUALKEYCODES 6 | #define NOWINSTYLES 7 | #define NOMENUS 8 | #define NOICONS 9 | #define NOKEYSTATES 10 | #define NOSYSCOMMANDS 11 | #define NORASTEROPS 12 | #define NOATOM 13 | #define NOCLIPBOARD 14 | #define NODRAWTEXT 15 | #define NOKERNEL 16 | #define NOMB 17 | #define NOMEMMGR 18 | #define NOOPENFILE 19 | #define NOSCROLL 20 | #define NOTEXTMETRIC 21 | #define NOWH 22 | #define NOWINOFFSETS 23 | #define NOCOMM 24 | #define NOKANJI 25 | #define NOHELP 26 | #define NOPROFILER 27 | #define NODEFERWINDOWPOS 28 | #define NOMCX 29 | #define NOCRYPT 30 | #define NOMETAFILE 31 | #define NOSERVICE 32 | #define NOSOUND 33 | #define _UXTHEME_H_ 34 | 35 | #pragma comment(lib, "ole32.lib") 36 | #pragma comment(lib, "oleaut32.lib") 37 | #pragma comment(lib, "urlmon.lib") 38 | 39 | #define KEX_ENV_WIN32 40 | #define KEX_TARGET_TYPE_DLL 41 | #define KEX_COMPONENT L"KxCom" 42 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxCom/dllmain.c: -------------------------------------------------------------------------------- 1 | #define KXCOM_WANT_INITGUID 2 | 3 | #include "buildcfg.h" 4 | #include "kxcomp.h" 5 | 6 | PKEX_PROCESS_DATA KexData; 7 | 8 | BOOL WINAPI DllMain( 9 | IN PVOID DllBase, 10 | IN ULONG Reason, 11 | IN PCONTEXT Context) 12 | { 13 | if (Reason == DLL_PROCESS_ATTACH) { 14 | LdrDisableThreadCalloutsForDll(DllBase); 15 | 16 | KexDataInitialize(&KexData); 17 | KexLogDebugEvent(L"DllMain called with DLL_PROCESS_ATTACH"); 18 | } 19 | 20 | return TRUE; 21 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxCom/kxcom.def: -------------------------------------------------------------------------------- 1 | LIBRARY KxCom 2 | EXPORTS 3 | 4 | CoCreateInstanceFromApp = ole32.CoCreateInstanceEx 5 | 6 | RoInitialize 7 | RoUninitialize 8 | RoGetActivationFactory 9 | RoActivateInstance 10 | RoOriginateError 11 | RoOriginateErrorW 12 | RoTransformError 13 | RoTransformErrorW 14 | RoGetAgileReference 15 | RoOriginateLanguageException 16 | RoGetBufferMarshaler 17 | 18 | GetRestrictedErrorInfo 19 | SetRestrictedErrorInfo 20 | 21 | ;; 22 | ;; mta.c 23 | ;; 24 | 25 | CoIncrementMTAUsage 26 | CoDecrementMTAUsage 27 | 28 | ;; 29 | ;; winrt.c 30 | ;; 31 | 32 | WindowsCompareStringOrdinal 33 | WindowsCreateString 34 | WindowsCreateStringReference 35 | WindowsDeleteString 36 | WindowsDuplicateString 37 | WindowsGetStringLen 38 | WindowsGetStringRawBuffer 39 | WindowsIsStringEmpty 40 | WindowsStringHasEmbeddedNull 41 | WindowsSubstring 42 | WindowsSubstringWithSpecifiedLength 43 | WindowsConcatString 44 | WindowsPreallocateStringBuffer 45 | WindowsDeleteStringBuffer 46 | WindowsPromoteStringBuffer -------------------------------------------------------------------------------- /01-Extended DLLs/KxCom/kxcomp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | EXTERN PKEX_PROCESS_DATA KexData; 8 | 9 | KXCOMAPI HRESULT STDMETHODCALLTYPE CActivationFactory_QueryInterface( 10 | IN IActivationFactory *This, 11 | IN REFIID RefIID, 12 | OUT PPVOID Object); -------------------------------------------------------------------------------- /01-Extended DLLs/KxCom/mta.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxcomp.h" 3 | 4 | // 5 | // Note: The authentic Windows 8+ API uses a structure pointer 6 | // as the cookie rather than a HANDLE. 7 | // 8 | 9 | STATIC DWORD WINAPI KxCompMTAUsageIncrementerThread( 10 | IN PVOID Parameter) 11 | { 12 | CoInitializeEx(NULL, COINIT_MULTITHREADED); 13 | SleepEx(INFINITE, TRUE); 14 | CoUninitialize(); 15 | return 0; 16 | } 17 | 18 | KXCOMAPI HRESULT WINAPI CoIncrementMTAUsage( 19 | OUT PCO_MTA_USAGE_COOKIE Cookie) 20 | { 21 | if (!Cookie) { 22 | return E_INVALIDARG; 23 | } 24 | 25 | *Cookie = CreateThread( 26 | NULL, 27 | 0, 28 | KxCompMTAUsageIncrementerThread, 29 | NULL, 30 | 0, 31 | NULL); 32 | 33 | if (!*Cookie) { 34 | return HRESULT_FROM_WIN32(GetLastError()); 35 | } 36 | 37 | return S_OK; 38 | } 39 | 40 | KXCOMAPI HRESULT WINAPI CoDecrementMTAUsage( 41 | IN CO_MTA_USAGE_COOKIE Cookie) 42 | { 43 | NTSTATUS Status; 44 | 45 | if (!Cookie) { 46 | return E_INVALIDARG; 47 | } 48 | 49 | Status = NtAlertThread(Cookie); 50 | NtClose(Cookie); 51 | 52 | if (NT_SUCCESS(Status)) { 53 | return S_OK; 54 | } else { 55 | return HRESULT_FROM_WIN32(RtlNtStatusToDosError(Status)); 56 | } 57 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxCom/roapi.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxcomp.h" 3 | 4 | KXCOMAPI HRESULT WINAPI RoGetAgileReference( 5 | IN ULONG Options, 6 | IN REFIID RefIID, 7 | IN IUnknown *pUnknown, 8 | OUT IUnknown **AgileReference) 9 | { 10 | KexLogWarningEvent(L"Unimplemented stub function RoGetAgileReference was called"); 11 | return E_NOTIMPL; 12 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxCom/robuffer.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxcomp.h" 3 | 4 | KXCOMAPI HRESULT WINAPI RoGetBufferMarshaler( 5 | OUT IUnknown **BufferMarshaler) 6 | { 7 | return E_NOTIMPL; 8 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxCom/rofactry.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxcomp.h" 3 | 4 | KXCOMAPI HRESULT WINAPI RoGetActivationFactory( 5 | IN HSTRING ActivatableClassId, 6 | IN REFIID RefIID, 7 | OUT PPVOID Factory) 8 | { 9 | LPOLESTR RefIIDAsString; 10 | 11 | StringFromIID(RefIID, &RefIIDAsString); 12 | 13 | KexLogDetailEvent( 14 | L"RoGetActivationFactory called\r\n\r\n" 15 | L"ActivatableClassId: %s\r\n" 16 | L"IID: %s", 17 | WindowsGetStringRawBuffer(ActivatableClassId, NULL), 18 | RefIIDAsString); 19 | 20 | CoTaskMemFree(RefIIDAsString); 21 | 22 | return CActivationFactory_QueryInterface(&CActivationFactory, RefIID, Factory); 23 | } 24 | 25 | KXCOMAPI HRESULT WINAPI RoActivateInstance( 26 | IN HSTRING ActivatableClassId, 27 | OUT IInspectable **Instance) 28 | { 29 | ASSERT (Instance != NULL); 30 | 31 | KexLogDetailEvent( 32 | L"RoActivateInstance called: %s", 33 | WindowsGetStringRawBuffer(ActivatableClassId, NULL)); 34 | 35 | *Instance = (IInspectable *) &CActivationFactory; 36 | return S_OK; 37 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxCom/roinit.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxcomp.h" 3 | 4 | KXCOMAPI HRESULT WINAPI RoInitialize( 5 | IN RO_INIT_TYPE InitType) 6 | { 7 | if (InitType == RO_INIT_SINGLETHREADED) { 8 | return CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); 9 | } else if (InitType == RO_INIT_MULTITHREADED) { 10 | return CoInitializeEx(NULL, COINIT_MULTITHREADED); 11 | } else { 12 | return E_INVALIDARG; 13 | } 14 | } 15 | 16 | KXCOMAPI VOID WINAPI RoUninitialize( 17 | VOID) 18 | { 19 | // yes, this is all it does on win8. 20 | CoUninitialize(); 21 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxCrt/KxCrt.rc: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | #include 4 | 5 | 1 VERSIONINFO 6 | FILEVERSION KEX_VERSION_FV 7 | FILEOS VOS_NT 8 | #if defined(KEX_TARGET_TYPE_EXE) 9 | FILETYPE VFT_APP 10 | #elif defined(KEX_TARGET_TYPE_DLL) 11 | FILETYPE VFT_DLL 12 | #endif 13 | BEGIN 14 | BLOCK "StringFileInfo" 15 | BEGIN 16 | BLOCK "040904B0" 17 | BEGIN 18 | VALUE "LegalCopyright", KEX_WEB_STR 19 | VALUE "FileDescription", "VxKex CRT Extension DLL" 20 | VALUE "FileVersion", KEX_VERSION_STR 21 | VALUE "InternalName", KEX_COMPONENT 22 | VALUE "OriginalFilename", "KXCRT.DLL" 23 | END 24 | END 25 | 26 | BLOCK "VarFileInfo" 27 | BEGIN 28 | VALUE "Translation", 0x0409 0x04B0 29 | END 30 | END -------------------------------------------------------------------------------- /01-Extended DLLs/KxCrt/KxCrt.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | 34 | 35 | Resource Files 36 | 37 | 38 | 39 | 40 | Source Files 41 | 42 | 43 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxCrt/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #define NOGDICAPMASKS 5 | #define NOVIRTUALKEYCODES 6 | #define NOWINMESSAGES 7 | #define NOWINSTYLES 8 | #define NOSYSMETRICS 9 | #define NOMENUS 10 | #define NOICONS 11 | #define NOKEYSTATES 12 | #define NOSYSCOMMANDS 13 | #define NORASTEROPS 14 | #define NOSHOWWINDOW 15 | #define NOATOM 16 | #define NOCLIPBOARD 17 | #define NOCOLOR 18 | #define NOCTLMGR 19 | #define NODRAWTEXT 20 | #define NOGDI 21 | #define NOKERNEL 22 | #define NOUSER 23 | #define NONLS 24 | #define NOMB 25 | #define NOMEMMGR 26 | #define NOMSG 27 | #define NOOPENFILE 28 | #define NOSCROLL 29 | #define NOTEXTMETRIC 30 | #define NOWH 31 | #define NOWINOFFSETS 32 | #define NOCOMM 33 | #define NOKANJI 34 | #define NOHELP 35 | #define NOPROFILER 36 | #define NODEFERWINDOWPOS 37 | #define NOMCX 38 | #define NOCRYPT 39 | #define NOMETAFILE 40 | #define NOSERVICE 41 | #define NOSOUND 42 | #define _UXTHEME_H_ 43 | 44 | #define KXCRTAPI 45 | 46 | #ifdef _M_X64 47 | # pragma comment(lib, "msvcrt_x64.lib") 48 | #else 49 | # pragma comment(lib, "msvcrt_x86.lib") 50 | #endif 51 | 52 | #define KEX_COMPONENT L"KxCrt" 53 | #define KEX_ENV_WIN32 54 | #define KEX_TARGET_TYPE_DLL 55 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxCrt/dllmain.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | 4 | BOOL WINAPI DllMain( 5 | IN HMODULE DllHandle, 6 | IN ULONG Reason, 7 | IN PCONTEXT Context) 8 | { 9 | if (Reason == DLL_PROCESS_ATTACH) { 10 | LdrDisableThreadCalloutsForDll(DllHandle); 11 | } 12 | 13 | return TRUE; 14 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxCrt/kxcrt.def: -------------------------------------------------------------------------------- 1 | LIBRARY KxCrt 2 | EXPORTS 3 | _W_Getdays 4 | _W_Getmonths 5 | _W_Gettnames -------------------------------------------------------------------------------- /01-Extended DLLs/KxCryp/KxCryp.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | 43 | 44 | Resource Files 45 | 46 | 47 | 48 | 49 | Source Files 50 | 51 | 52 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxCryp/bcrypt.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxcrypp.h" 3 | 4 | // 5 | // This is just a convenience function which wraps other functions in bcrypt.dll. 6 | // 7 | 8 | KXCRYPAPI NTSTATUS WINAPI BCryptHash( 9 | IN BCRYPT_ALG_HANDLE Algorithm, 10 | IN PBYTE Secret OPTIONAL, 11 | IN ULONG SecretCb, 12 | IN PBYTE Input, 13 | IN ULONG InputCb, 14 | OUT PBYTE Output, 15 | IN ULONG OutputCb) 16 | { 17 | NTSTATUS Status; 18 | BCRYPT_HASH_HANDLE HashHandle; 19 | 20 | HashHandle = NULL; 21 | 22 | Status = BCryptCreateHash(Algorithm, &HashHandle, 0, 0, Secret, SecretCb, 0); 23 | if (!NT_SUCCESS(Status)) { 24 | goto CleanupExit; 25 | } 26 | 27 | Status = BCryptHashData(HashHandle, Input, InputCb, 0); 28 | if (!NT_SUCCESS(Status)) { 29 | goto CleanupExit; 30 | } 31 | 32 | Status = BCryptFinishHash(HashHandle, Output, OutputCb, 0); 33 | 34 | CleanupExit: 35 | if (HashHandle) { 36 | BCryptDestroyHash(HashHandle); 37 | } 38 | 39 | return Status; 40 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxCryp/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #define NOGDICAPMASKS 5 | #define NOVIRTUALKEYCODES 6 | #define NOWINSTYLES 7 | #define NOSYSMETRICS 8 | #define NOMENUS 9 | #define NOICONS 10 | #define NOKEYSTATES 11 | #define NOSYSCOMMANDS 12 | #define NORASTEROPS 13 | #define NOSHOWWINDOW 14 | #define NOATOM 15 | #define NOCLIPBOARD 16 | #define NOCOLOR 17 | #define NODRAWTEXT 18 | #define NOGDI 19 | #define NOKERNEL 20 | #define NOMB 21 | #define NOMEMMGR 22 | #define NOOPENFILE 23 | #define NOSCROLL 24 | #define NOTEXTMETRIC 25 | #define NOWH 26 | #define NOWINOFFSETS 27 | #define NOCOMM 28 | #define NOKANJI 29 | #define NOHELP 30 | #define NOPROFILER 31 | #define NODEFERWINDOWPOS 32 | #define NOMCX 33 | #define NOCRYPT 34 | #define NOMETAFILE 35 | #define NOSERVICE 36 | #define NOSOUND 37 | #define _UXTHEME_H_ 38 | 39 | #define KXCRYPAPI 40 | 41 | #pragma comment(lib, "bcrypt.lib") 42 | #pragma comment(lib, "secur32.lib") 43 | 44 | #define KEX_COMPONENT L"KxCryp" 45 | #define KEX_ENV_WIN32 46 | #define KEX_TARGET_TYPE_DLL 47 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxCryp/dllmain.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxcrypp.h" 3 | 4 | PKEX_PROCESS_DATA KexData; 5 | 6 | BOOL WINAPI DllMain( 7 | IN HMODULE DllHandle, 8 | IN ULONG Reason, 9 | IN PCONTEXT Context) 10 | { 11 | if (Reason == DLL_PROCESS_ATTACH) { 12 | LdrDisableThreadCalloutsForDll(DllHandle); 13 | KexDataInitialize(&KexData); 14 | } 15 | 16 | return TRUE; 17 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxCryp/kxcryp.def: -------------------------------------------------------------------------------- 1 | LIBRARY KxCryp 2 | EXPORTS 3 | ;; bcrypt.c 4 | BCryptHash 5 | 6 | ;; rng.c 7 | ProcessPrng 8 | 9 | ;; schannel.c 10 | ; AcquireCredentialsHandleA = Ext_AcquireCredentialsHandleA 11 | AcquireCredentialsHandleW = Ext_AcquireCredentialsHandleW -------------------------------------------------------------------------------- /01-Extended DLLs/KxCryp/kxcryp.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/01-Extended DLLs/KxCryp/kxcryp.rc -------------------------------------------------------------------------------- /01-Extended DLLs/KxCryp/rng.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxcrypp.h" 3 | 4 | // 5 | // This function creates random data and places it into the specified 6 | // buffer. 7 | // 8 | 9 | KXCRYPAPI BOOL WINAPI ProcessPrng( 10 | OUT PBYTE Buffer, 11 | IN SIZE_T BufferCb) 12 | { 13 | NTSTATUS Status; 14 | 15 | ASSERT (BufferCb <= ULONG_MAX); 16 | 17 | if (BufferCb > ULONG_MAX) { 18 | return FALSE; 19 | } 20 | 21 | Status = KexRtlGenerateRandomData(Buffer, (ULONG) BufferCb); 22 | ASSERT (NT_SUCCESS(Status)); 23 | 24 | return NT_SUCCESS(Status); 25 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxDx/KxDx.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/01-Extended DLLs/KxDx/KxDx.rc -------------------------------------------------------------------------------- /01-Extended DLLs/KxDx/KxDx.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | 46 | 47 | Source Files 48 | 49 | 50 | 51 | 52 | Resource Files 53 | 54 | 55 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxDx/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #define NOGDICAPMASKS 5 | #define NOVIRTUALKEYCODES 6 | #define NOWINSTYLES 7 | #define NOSYSMETRICS 8 | #define NOMENUS 9 | #define NOICONS 10 | #define NOKEYSTATES 11 | #define NOSYSCOMMANDS 12 | #define NORASTEROPS 13 | #define NOSHOWWINDOW 14 | #define NOATOM 15 | #define NOCLIPBOARD 16 | #define NOCOLOR 17 | #define NODRAWTEXT 18 | #define NOGDI 19 | #define NOKERNEL 20 | #define NONLS 21 | #define NOMB 22 | #define NOMEMMGR 23 | #define NOOPENFILE 24 | #define NOSCROLL 25 | #define NOTEXTMETRIC 26 | #define NOWH 27 | #define NOWINOFFSETS 28 | #define NOCOMM 29 | #define NOKANJI 30 | #define NOHELP 31 | #define NOPROFILER 32 | #define NODEFERWINDOWPOS 33 | #define NOMCX 34 | #define NOCRYPT 35 | #define NOMETAFILE 36 | #define NOSERVICE 37 | #define NOSOUND 38 | #define _UXTHEME_H_ 39 | 40 | #define KXDXAPI 41 | 42 | #pragma comment(lib, "dxgi.lib") 43 | #pragma comment(lib, "oleaut32.lib") 44 | 45 | #define KEX_ENV_WIN32 46 | #define KEX_TARGET_TYPE_DLL 47 | #define KEX_COMPONENT L"KxDx" 48 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxDx/dcmpstub.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxdxp.h" 3 | 4 | KXDXAPI HRESULT WINAPI DCompositionCreateDevice( 5 | IN IDXGIDevice *DXGIDevice OPTIONAL, 6 | IN REFIID RefIID, 7 | OUT PPVOID DCompositionDevice) 8 | { 9 | ASSERT (DCompositionDevice != NULL); 10 | 11 | KexLogWarningEvent(L"Unimplemented function DCompositionCreateDevice called"); 12 | *DCompositionDevice = NULL; 13 | return E_NOINTERFACE; 14 | } 15 | 16 | KXDXAPI HRESULT WINAPI DCompositionCreateDevice2( 17 | IN IUnknown *RenderingDevice OPTIONAL, 18 | IN REFIID RefIID, 19 | OUT PPVOID DCompositionDevice) 20 | { 21 | ASSERT (DCompositionDevice != NULL); 22 | 23 | KexLogWarningEvent(L"Unimplemented function DCompositionCreateDevice2 called"); 24 | *DCompositionDevice = NULL; 25 | return E_NOINTERFACE; 26 | } 27 | 28 | KXDXAPI HRESULT WINAPI DCompositionCreateDevice3( 29 | IN IUnknown *RenderingDevice OPTIONAL, 30 | IN REFIID RefIID, 31 | OUT PPVOID DCompositionDevice) 32 | { 33 | ASSERT (DCompositionDevice != NULL); 34 | 35 | KexLogWarningEvent(L"Unimplemented function DCompositionCreateDevice3 called"); 36 | *DCompositionDevice = NULL; 37 | return E_NOINTERFACE; 38 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxDx/dllmain.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxdxp.h" 3 | 4 | PKEX_PROCESS_DATA KexData = NULL; 5 | 6 | BOOL WINAPI DllMain( 7 | IN PVOID DllBase, 8 | IN ULONG Reason, 9 | IN PCONTEXT Context) 10 | { 11 | if (Reason == DLL_PROCESS_ATTACH) { 12 | LdrDisableThreadCalloutsForDll(DllBase); 13 | 14 | KexDataInitialize(&KexData); 15 | KexLogDebugEvent(L"DllMain called with DLL_PROCESS_ATTACH"); 16 | } 17 | 18 | return TRUE; 19 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxDx/dx12stub.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxdxp.h" 3 | #include 4 | 5 | // 6 | // These stubs are intended for applications that have d3d12.dll in the import table, 7 | // but do not actually call them. (Or for applications that have a fallback in case 8 | // D3D12 is not available.) 9 | // 10 | 11 | KXDXAPI HRESULT WINAPI D3D12CreateDevice( 12 | IN IUnknown *Adapter OPTIONAL, 13 | IN D3D_FEATURE_LEVEL MinimumFeatureLevel, 14 | IN REFIID RefIID, 15 | OUT PPVOID Device OPTIONAL) 16 | { 17 | if (Device) { 18 | *Device = NULL; 19 | } 20 | 21 | return DXGI_ERROR_UNSUPPORTED; 22 | } 23 | 24 | KXDXAPI HRESULT WINAPI D3D12CreateRootSignatureDeserializer( 25 | IN PCVOID SourceData, 26 | IN SIZE_T SourceDataCb, 27 | IN REFIID RefIID, 28 | OUT PPVOID Deserializer) 29 | { 30 | if (Deserializer) { 31 | *Deserializer = NULL; 32 | } 33 | 34 | return DXGI_ERROR_UNSUPPORTED; 35 | } 36 | 37 | KXDXAPI HRESULT WINAPI D3D12CreateVersionedRootSignatureDeserializer( 38 | IN PCVOID SourceData, 39 | IN SIZE_T SourceDataCb, 40 | IN REFIID RefIID, 41 | OUT PPVOID Deserializer) 42 | { 43 | if (Deserializer) { 44 | *Deserializer = NULL; 45 | } 46 | 47 | return DXGI_ERROR_UNSUPPORTED; 48 | } 49 | 50 | KXDXAPI HRESULT WINAPI D3D12EnableExperimentalFeatures( 51 | IN ULONG NumberOfFeatures, 52 | IN REFIID *RefIIDs, 53 | IN PVOID ConfigurationStructs, 54 | IN PULONG ConfigurationStructSizes) 55 | { 56 | return DXGI_ERROR_UNSUPPORTED; 57 | } 58 | 59 | KXDXAPI HRESULT WINAPI D3D12GetDebugInterface( 60 | IN REFIID RefIID, 61 | OUT PPVOID DebugInterface OPTIONAL) 62 | { 63 | if (DebugInterface) { 64 | *DebugInterface = NULL; 65 | } 66 | 67 | return E_NOINTERFACE; 68 | } 69 | 70 | KXDXAPI HRESULT WINAPI D3D12GetInterface( 71 | IN REFCLSID RefCLSID, 72 | IN REFIID RefIID, 73 | OUT PPVOID Interface OPTIONAL) 74 | { 75 | if (Interface) { 76 | *Interface = NULL; 77 | } 78 | 79 | return E_NOINTERFACE; 80 | } 81 | 82 | KXDXAPI HRESULT WINAPI D3D12SerializeRootSignature( 83 | IN PVOID RootSignature, 84 | IN ULONG Version, 85 | OUT PPVOID Blob, 86 | OUT PPVOID ErrorBlob OPTIONAL) 87 | { 88 | *Blob = NULL; 89 | 90 | if (ErrorBlob) { 91 | *ErrorBlob = NULL; 92 | } 93 | 94 | return E_NOTIMPL; 95 | } 96 | 97 | KXDXAPI HRESULT WINAPI D3D12SerializeVersionedRootSignature( 98 | IN PVOID RootSignature, 99 | OUT PPVOID Blob, 100 | OUT PPVOID ErrorBlob OPTIONAL) 101 | { 102 | *Blob = NULL; 103 | 104 | if (ErrorBlob) { 105 | *ErrorBlob = NULL; 106 | } 107 | 108 | return E_NOTIMPL; 109 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxDx/factory.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxdxp.h" 3 | #include 4 | #include 5 | 6 | // 7 | // Function introduced in Windows 8.1. 8 | // The IDXGIFactory2 interface is actually supported in Windows 7 but only with 9 | // Platform Update. 10 | // 11 | HRESULT WINAPI CreateDXGIFactory2( 12 | IN ULONG Flags, 13 | IN REFIID RefIID, 14 | OUT PPVOID Factory) 15 | { 16 | HRESULT Result; 17 | 18 | Result = CreateDXGIFactory1( 19 | RefIID, 20 | Factory); 21 | 22 | if (FAILED(Result)) { 23 | if (IsEqualIID(RefIID, &IID_IDXGIFactory2)) { 24 | KexLogErrorEvent( 25 | L"Failed to create IDXGIFactory2\r\n\r\n" 26 | L"HRESULT error code: 0x%08lx: %s\r\n" 27 | L"This interface is only supported by Windows 7 with Platform Update. " 28 | L"In order to solve this error, install Platform Update.", 29 | Result, Win32ErrorAsString(Result)); 30 | } else { 31 | HRESULT Result2; 32 | BSTR IidAsString; 33 | 34 | // 35 | // TODO: Paint.NET depends on IDXGIFactory7. 36 | // See if we can implement that in a satisfactory way. 37 | // 38 | 39 | Result2 = StringFromIID(RefIID, &IidAsString); 40 | ASSERT (SUCCEEDED(Result2)); 41 | 42 | if (FAILED(Result2)) { 43 | IidAsString = L"{unknown}"; 44 | } 45 | 46 | KexLogErrorEvent( 47 | L"Failed to create DXGI factory: %s\r\n\r\n" 48 | L"HRESULT error code: 0x%08lx: %s", 49 | IidAsString, 50 | Result, Win32ErrorAsString(Result)); 51 | 52 | KexDebugCheckpoint(); 53 | SysFreeString(IidAsString); 54 | } 55 | } 56 | 57 | return Result; 58 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxDx/iid.c: -------------------------------------------------------------------------------- 1 | #include 2 | DEFINE_GUID(IID_IDXGIDisplayControl,0xea9dbf1a,0xc88e,0x4486,0x85,0x4a,0x98,0xaa,0x01,0x38,0xf3,0x0c); 3 | DEFINE_GUID(IID_IDXGIOutputDuplication,0x191cfac3,0xa341,0x470d,0xb2,0x6e,0xa8,0x64,0xf4,0x28,0x31,0x9c); 4 | DEFINE_GUID(IID_IDXGISurface2,0xaba496dd,0xb617,0x4cb8,0xa8,0x66,0xbc,0x44,0xd7,0xeb,0x1f,0xa2); 5 | DEFINE_GUID(IID_IDXGIResource1,0x30961379,0x4609,0x4a41,0x99,0x8e,0x54,0xfe,0x56,0x7e,0xe0,0xc1); 6 | DEFINE_GUID(IID_IDXGIDevice2,0x05008617,0xfbfd,0x4051,0xa7,0x90,0x14,0x48,0x84,0xb4,0xf6,0xa9); 7 | DEFINE_GUID(IID_IDXGISwapChain1,0x790a45f7,0x0d42,0x4876,0x98,0x3a,0x0a,0x55,0xcf,0xe6,0xf4,0xaa); 8 | DEFINE_GUID(IID_IDXGIFactory2,0x50c83a1c,0xe072,0x4c48,0x87,0xb0,0x36,0x30,0xfa,0x36,0xa6,0xd0); 9 | DEFINE_GUID(IID_IDXGIAdapter2,0x0AA1AE0A,0xFA0E,0x4B84,0x86,0x44,0xE0,0x5F,0xF8,0xE5,0xAC,0xB5); 10 | DEFINE_GUID(IID_IDXGIOutput1,0x00cddea8,0x939b,0x4b83,0xa3,0x40,0xa6,0x85,0x22,0x66,0x66,0xcc); -------------------------------------------------------------------------------- /01-Extended DLLs/KxDx/kxdx.def: -------------------------------------------------------------------------------- 1 | LIBRARY KxDx 2 | EXPORTS 3 | ;; factory.c 4 | CreateDXGIFactory2 5 | 6 | ;; dx12stub.c 7 | ;; These must be exported with ordinal. A lot of programs import by ordinal 8 | ;; from d3d12 for some reason. 9 | D3D12CreateDevice @101 10 | D3D12CreateRootSignatureDeserializer @107 11 | D3D12CreateVersionedRootSignatureDeserializer @108 12 | D3D12EnableExperimentalFeatures @110 13 | D3D12GetDebugInterface @102 14 | D3D12GetInterface 15 | D3D12SerializeRootSignature @115 16 | D3D12SerializeVersionedRootSignature @116 17 | 18 | ;; dcmpstub.c 19 | DCompositionCreateDevice 20 | DCompositionCreateDevice2 21 | DCompositionCreateDevice3 -------------------------------------------------------------------------------- /01-Extended DLLs/KxDx/kxdxp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | EXTERN PKEX_PROCESS_DATA KexData; -------------------------------------------------------------------------------- /01-Extended DLLs/KxMi/KxMi.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | 46 | 47 | Resource Files 48 | 49 | 50 | 51 | 52 | Source Files 53 | 54 | 55 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxMi/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #define NOGDICAPMASKS 5 | #define NOVIRTUALKEYCODES 6 | #define NOWINSTYLES 7 | #define NOSYSMETRICS 8 | #define NOMENUS 9 | #define NOICONS 10 | #define NOKEYSTATES 11 | #define NOSYSCOMMANDS 12 | #define NORASTEROPS 13 | #define NOSHOWWINDOW 14 | #define NOATOM 15 | #define NOCLIPBOARD 16 | #define NOCOLOR 17 | #define NODRAWTEXT 18 | #define NOGDI 19 | #define NOKERNEL 20 | #define NOMB 21 | #define NOMEMMGR 22 | #define NOOPENFILE 23 | #define NOSCROLL 24 | #define NOTEXTMETRIC 25 | #define NOWH 26 | #define NOWINOFFSETS 27 | #define NOCOMM 28 | #define NOKANJI 29 | #define NOHELP 30 | #define NOPROFILER 31 | #define NODEFERWINDOWPOS 32 | #define NOMCX 33 | #define NOCRYPT 34 | #define NOMETAFILE 35 | #define NOSERVICE 36 | #define NOSOUND 37 | #define _UXTHEME_H_ 38 | 39 | #define KXMIAPI 40 | 41 | #pragma comment(lib, "version.lib") 42 | #pragma comment(lib, "powrprof.lib") 43 | 44 | #define KEX_COMPONENT L"KxMi" 45 | #define KEX_ENV_WIN32 46 | #define KEX_TARGET_TYPE_DLL 47 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxMi/dllmain.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxmip.h" 3 | 4 | PKEX_PROCESS_DATA KexData = NULL; 5 | 6 | BOOL WINAPI DllMain( 7 | IN HMODULE DllHandle, 8 | IN ULONG Reason, 9 | IN PCONTEXT Context) 10 | { 11 | if (Reason == DLL_PROCESS_ATTACH) { 12 | LdrDisableThreadCalloutsForDll(DllHandle); 13 | KexDataInitialize(&KexData); 14 | } 15 | 16 | return TRUE; 17 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxMi/kxmi.def: -------------------------------------------------------------------------------- 1 | LIBRARY KxMi 2 | EXPORTS 3 | ;; powrprof.c 4 | PowerDeterminePlatformRoleEx 5 | PowerRegisterSuspendResumeNotification 6 | PowerUnregisterSuspendResumeNotification 7 | 8 | ;; userenv.c 9 | CreateAppContainerProfile 10 | DeleteAppContainerProfile 11 | DeriveAppContainerSidFromAppContainerName 12 | GetAppContainerFolderPath 13 | GetAppContainerRegistryLocation 14 | 15 | ;; verspoof.c 16 | GetFileVersionInfoW = Ext_GetFileVersionInfoW 17 | 18 | ;; wldp.c 19 | WldpQueryWindowsLockdownMode -------------------------------------------------------------------------------- /01-Extended DLLs/KxMi/kxmi.rc: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | #include 4 | 5 | 1 VERSIONINFO 6 | FILEVERSION KEX_VERSION_FV 7 | FILEOS VOS_NT 8 | #if defined(KEX_TARGET_TYPE_EXE) 9 | FILETYPE VFT_APP 10 | #elif defined(KEX_TARGET_TYPE_DLL) 11 | FILETYPE VFT_DLL 12 | #endif 13 | BEGIN 14 | BLOCK "StringFileInfo" 15 | BEGIN 16 | BLOCK "040904B0" 17 | BEGIN 18 | VALUE "LegalCopyright", KEX_WEB_STR 19 | VALUE "FileDescription", "VxKex Miscellaneous API Extension DLL" 20 | VALUE "FileVersion", KEX_VERSION_STR 21 | VALUE "InternalName", KEX_COMPONENT 22 | VALUE "OriginalFilename", "KXMI.DLL" 23 | END 24 | END 25 | 26 | BLOCK "VarFileInfo" 27 | BEGIN 28 | VALUE "Translation", 0x0409 0x04B0 29 | END 30 | END -------------------------------------------------------------------------------- /01-Extended DLLs/KxMi/kxmip.h: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | #include 4 | #include 5 | 6 | EXTERN PKEX_PROCESS_DATA KexData; 7 | 8 | typedef enum _WLDP_WINDOWS_LOCKDOWN_MODE { 9 | WLDP_WINDOWS_LOCKDOWN_MODE_UNLOCKED, 10 | WLDP_WINDOWS_LOCKDOWN_MODE_TRIAL, 11 | WLDP_WINDOWS_LOCKDOWN_MODE_LOCKED, 12 | WLDP_WINDOWS_LOCKDOWN_MODE_MAX 13 | } TYPEDEF_TYPE_NAME(WLDP_WINDOWS_LOCKDOWN_MODE); 14 | 15 | typedef struct _VERHEAD { 16 | WORD wTotLen; 17 | WORD wValLen; 18 | WORD wType; 19 | WCHAR szKey[(sizeof("VS_VERSION_INFO") + 3) & ~3]; 20 | VS_FIXEDFILEINFO vsf; 21 | } TYPEDEF_TYPE_NAME(VERHEAD); 22 | 23 | #define DEVICE_NOTIFY_CALLBACK 2 -------------------------------------------------------------------------------- /01-Extended DLLs/KxMi/powrprof.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxmip.h" 3 | 4 | KXMIAPI POWER_PLATFORM_ROLE WINAPI PowerDeterminePlatformRoleEx( 5 | IN ULONG Version) 6 | { 7 | return PowerDeterminePlatformRole(); 8 | } 9 | 10 | // 11 | // Note: It is technically possible to make these work on Windows 7. 12 | // However, it seems unlikely that applications actually use these in a 13 | // useful manner, so they are stubbed for now. 14 | // 15 | 16 | KXMIAPI ULONG WINAPI PowerRegisterSuspendResumeNotification( 17 | IN ULONG Flags, 18 | IN HANDLE Recipient, 19 | OUT PHPOWERNOTIFY RegistrationHandle) 20 | { 21 | KexLogWarningEvent(L"Unimplemented API PowerRegisterSuspendResumeNotification called"); 22 | KexDebugCheckpoint(); 23 | 24 | if (Flags != DEVICE_NOTIFY_CALLBACK) { 25 | return RtlNtStatusToDosError(STATUS_INVALID_PARAMETER); 26 | } 27 | 28 | return RtlNtStatusToDosError(STATUS_NOT_SUPPORTED); 29 | } 30 | 31 | KXMIAPI ULONG WINAPI PowerUnregisterSuspendResumeNotification( 32 | IN OUT HPOWERNOTIFY RegistrationHandle) 33 | { 34 | KexLogWarningEvent(L"Unimplemented API PowerUnregisterSuspendResumeNotification called"); 35 | KexDebugCheckpoint(); 36 | 37 | return RtlNtStatusToDosError(STATUS_NOT_SUPPORTED); 38 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxMi/userenv.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxmip.h" 3 | 4 | KXMIAPI HRESULT WINAPI CreateAppContainerProfile( 5 | IN PCWSTR AppContainerName, 6 | IN PCWSTR DisplayName, 7 | IN PCWSTR Description, 8 | IN PSID_AND_ATTRIBUTES Capabilities, 9 | IN ULONG NumberOfCapabilities, 10 | OUT PSID *AppContainerSid) 11 | { 12 | KexLogWarningEvent( 13 | L"CreateAppContainerProfile called: %s\r\n\r\n" 14 | L"DisplayName: %s\r\n" 15 | L"NumberOfCapabilities: %lu", 16 | AppContainerName, 17 | DisplayName, 18 | Description, 19 | NumberOfCapabilities); 20 | 21 | KexDebugCheckpoint(); 22 | 23 | return E_NOTIMPL; 24 | } 25 | 26 | KXMIAPI HRESULT WINAPI DeleteAppContainerProfile( 27 | IN PCWSTR AppContainerName) 28 | { 29 | KexLogWarningEvent( 30 | L"DeleteAppContainerProfile called: %s", 31 | AppContainerName); 32 | 33 | KexDebugCheckpoint(); 34 | 35 | return S_OK; 36 | } 37 | 38 | KXMIAPI HRESULT WINAPI DeriveAppContainerSidFromAppContainerName( 39 | IN PCWSTR AppContainerName, 40 | OUT PSID *AppContainerSid) 41 | { 42 | KexLogWarningEvent( 43 | L"DeriveAppContainerSidFromAppContainerName called: %s", 44 | AppContainerName); 45 | 46 | KexDebugCheckpoint(); 47 | 48 | return E_NOTIMPL; 49 | } 50 | 51 | KXMIAPI HRESULT WINAPI GetAppContainerFolderPath( 52 | IN PCWSTR AppContainerName, 53 | OUT PPWSTR FolderPath) 54 | { 55 | KexLogWarningEvent( 56 | L"GetAppContainerFolderPath called: %s", 57 | AppContainerName); 58 | 59 | KexDebugCheckpoint(); 60 | 61 | return E_NOTIMPL; 62 | } 63 | 64 | KXMIAPI HRESULT WINAPI GetAppContainerRegistryLocation( 65 | IN REGSAM DesiredAccess, 66 | OUT PHKEY AppContainerKey) 67 | { 68 | KexLogWarningEvent(L"GetAppContainerRegistryLocation called"); 69 | KexDebugCheckpoint(); 70 | return E_NOTIMPL; 71 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxMi/verspoof.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxmip.h" 3 | 4 | // 5 | // Chromium checks the OS version by calling GetFileVersionInfo on kernel32. 6 | // For versions of Chromium above 118, this spoof is necessary to get it to run, 7 | // and on prior versions, this spoof removes the annoying Windows 7 deprecation 8 | // notice. 9 | // 10 | 11 | KXMIAPI BOOL WINAPI Ext_GetFileVersionInfoW( 12 | IN PCWSTR FileName, 13 | IN ULONG Unused, 14 | IN ULONG BufferCb, 15 | OUT PVOID VersionInfo) 16 | { 17 | BOOLEAN Success; 18 | 19 | Success = GetFileVersionInfoW(FileName, Unused, BufferCb, VersionInfo); 20 | 21 | if (!Success) { 22 | return FALSE; 23 | } 24 | 25 | // 26 | // APPSPECIFICHACK: Spoof kernel32.dll version for Chromium. 27 | // 28 | if (KexData->Flags & KEXDATA_FLAG_CHROMIUM) { 29 | ASSERT (FileName != NULL); 30 | 31 | if (StringEqual(FileName, L"kernel32.dll") || StringEqual(FileName, L"kernelbase.dll")) { 32 | PVERHEAD VerHead; 33 | 34 | ASSERT (VersionInfo != NULL); 35 | ASSERT (BufferCb >= sizeof(VERHEAD)); 36 | 37 | if (BufferCb < sizeof(VERHEAD)) { 38 | // bail out and don't do anything 39 | return Success; 40 | } 41 | 42 | VerHead = (PVERHEAD) VersionInfo; 43 | 44 | KexLogDebugEvent( 45 | L"Spoofing Kernel32/Kernelbase file version for Chromium\r\n\r\n" 46 | L"Original dwFileVersionMS = 0x%08lx\r\n" 47 | L"Original dwFileVersionLS = 0x%08lx\r\n", 48 | VerHead->vsf.dwFileVersionMS, 49 | VerHead->vsf.dwFileVersionLS); 50 | 51 | // 10.0.10240.0 (Windows 10 1504, aka "RTM") 52 | VerHead->vsf.dwFileVersionMS = 0x000A0000; 53 | VerHead->vsf.dwFileVersionLS = 0x28000000; 54 | } 55 | } 56 | 57 | return Success; 58 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxMi/wldp.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxmip.h" 3 | 4 | KXMIAPI HRESULT WINAPI WldpQueryWindowsLockdownMode( 5 | OUT PWLDP_WINDOWS_LOCKDOWN_MODE LockdownMode) 6 | { 7 | ASSERT (LockdownMode != NULL); 8 | 9 | *LockdownMode = WLDP_WINDOWS_LOCKDOWN_MODE_UNLOCKED; 10 | return S_OK; 11 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxNet/KxNet.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | 43 | 44 | Resource Files 45 | 46 | 47 | 48 | 49 | Source Files 50 | 51 | 52 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxNet/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #define NOGDICAPMASKS 5 | #define NOVIRTUALKEYCODES 6 | #define NOWINSTYLES 7 | #define NOSYSMETRICS 8 | #define NOMENUS 9 | #define NOICONS 10 | #define NOKEYSTATES 11 | #define NOSYSCOMMANDS 12 | #define NORASTEROPS 13 | #define NOSHOWWINDOW 14 | #define NOATOM 15 | #define NOCLIPBOARD 16 | #define NOCOLOR 17 | #define NODRAWTEXT 18 | #define NOGDI 19 | #define NOKERNEL 20 | #define NOMB 21 | #define NOMEMMGR 22 | #define NOOPENFILE 23 | #define NOSCROLL 24 | #define NOTEXTMETRIC 25 | #define NOWH 26 | #define NOWINOFFSETS 27 | #define NOCOMM 28 | #define NOKANJI 29 | #define NOHELP 30 | #define NOPROFILER 31 | #define NODEFERWINDOWPOS 32 | #define NOMCX 33 | #define NOCRYPT 34 | #define NOMETAFILE 35 | #define NOSERVICE 36 | #define NOSOUND 37 | #define _UXTHEME_H_ 38 | 39 | #pragma comment(lib, "dnsapi.lib") 40 | #pragma comment(lib, "ws2_32.lib") 41 | 42 | #define KXNETAPI 43 | 44 | #define KEX_COMPONENT L"KxNet" 45 | #define KEX_ENV_WIN32 46 | #define KEX_TARGET_TYPE_DLL 47 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxNet/dllmain.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | 4 | PKEX_PROCESS_DATA KexData = NULL; 5 | 6 | BOOL WINAPI DllMain( 7 | IN HMODULE DllHandle, 8 | IN ULONG Reason, 9 | IN PCONTEXT Context) 10 | { 11 | if (Reason == DLL_PROCESS_ATTACH) { 12 | LdrDisableThreadCalloutsForDll(DllHandle); 13 | KexDataInitialize(&KexData); 14 | } 15 | 16 | return TRUE; 17 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxNet/dns.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxnetp.h" 3 | 4 | // 5 | // This DnsQueryEx implementation mainly exists to support Qt6Network. 6 | // It does not support asynchronous queries. If we need to support any 7 | // extra functionality in the future, have a look into DnsQueryExW which 8 | // is present in nt5src - this has the capabilities to do everything we 9 | // want, but requires a lot more effort and research since it's not 10 | // documented. 11 | // 12 | KXNETAPI DNS_STATUS WINAPI DnsQueryEx( 13 | IN PDNS_QUERY_REQUEST Request, 14 | IN OUT PDNS_QUERY_RESULT Result, 15 | IN OUT PDNS_QUERY_CANCEL Cancel OPTIONAL) 16 | { 17 | DNS_STATUS DnsStatus; 18 | 19 | ASSERT (Request != NULL); 20 | ASSERT (Result != NULL); 21 | ASSERT (Cancel == NULL); 22 | ASSERT (Request->Version == 1); 23 | ASSERT (Request->QueryCompletionCallback == NULL); 24 | ASSERT (Result->Version == 1); 25 | 26 | // 27 | // Validate parameters. 28 | // 29 | 30 | if (!Request || !Result) { 31 | return ERROR_INVALID_PARAMETER; 32 | } 33 | 34 | KexLogDebugEvent( 35 | L"DnsQueryEx called\r\n\r\n" 36 | L"Request->Version: %d\r\n" 37 | L"Request->QueryName: %s\r\n" 38 | L"Request->QueryType: %hu\r\n" 39 | L"Request->QueryOptions: 0x%016I64u\r\n" 40 | L"Request->DnsServerList: 0x%p\r\n" 41 | L"Request->InterfaceIndex: %d\r\n" 42 | L"Request->QueryCompletionCallback: 0x%p\r\n" 43 | L"Request->QueryContext: 0x%p", 44 | Request->Version, 45 | Request->QueryName, 46 | Request->QueryType, 47 | Request->QueryOptions, 48 | Request->DnsServerList, 49 | Request->InterfaceIndex, 50 | Request->QueryCompletionCallback, 51 | Request->QueryContext); 52 | 53 | if (Request->Version != 1 || Result->Version != 1) { 54 | // Version could be 3, which is only available in Win11 and above. 55 | KexDebugCheckpoint(); 56 | return ERROR_INVALID_PARAMETER; 57 | } 58 | 59 | if (Request->QueryCompletionCallback) { 60 | KexDebugCheckpoint(); 61 | return DNS_RCODE_NOT_IMPLEMENTED; 62 | } 63 | 64 | if (Cancel) { 65 | KexDebugCheckpoint(); 66 | return DNS_RCODE_NOT_IMPLEMENTED; 67 | } 68 | 69 | // 70 | // Perform the query. 71 | // Note: the current implementation ignores DnsServerList and InterfaceIndex. 72 | // 73 | 74 | DnsStatus = DnsQuery( 75 | Request->QueryName, 76 | Request->QueryType, 77 | (ULONG) Request->QueryOptions, 78 | NULL, 79 | &Result->QueryRecords, 80 | NULL); 81 | 82 | // 83 | // Fill out remaining fields of DNS_QUERY_RESULT. 84 | // 85 | 86 | Result->QueryStatus = DnsStatus; 87 | Result->QueryOptions = Request->QueryOptions; 88 | Result->Reserved = NULL; 89 | 90 | return DnsStatus; 91 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxNet/kxnet.def: -------------------------------------------------------------------------------- 1 | LIBRARY KxNet 2 | EXPORTS 3 | ;; dns.c 4 | DnsQueryEx 5 | 6 | ;; winhttp.c 7 | WinHttpCreateProxyResolver 8 | WinHttpGetProxyForUrlEx 9 | WinHttpGetProxyResult 10 | WinHttpFreeProxyResult 11 | 12 | ;; winsock.c 13 | GetHostNameW 14 | getaddrinfo = Ext_getaddrinfo -------------------------------------------------------------------------------- /01-Extended DLLs/KxNet/kxnet.rc: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | #include 4 | 5 | 1 VERSIONINFO 6 | FILEVERSION KEX_VERSION_FV 7 | FILEOS VOS_NT 8 | #if defined(KEX_TARGET_TYPE_EXE) 9 | FILETYPE VFT_APP 10 | #elif defined(KEX_TARGET_TYPE_DLL) 11 | FILETYPE VFT_DLL 12 | #endif 13 | BEGIN 14 | BLOCK "StringFileInfo" 15 | BEGIN 16 | BLOCK "040904B0" 17 | BEGIN 18 | VALUE "LegalCopyright", KEX_WEB_STR 19 | VALUE "FileDescription", "VxKex Network & Internet API Extension DLL" 20 | VALUE "FileVersion", KEX_VERSION_STR 21 | VALUE "InternalName", KEX_COMPONENT 22 | VALUE "OriginalFilename", "KXNET.DLL" 23 | END 24 | END 25 | 26 | BLOCK "VarFileInfo" 27 | BEGIN 28 | VALUE "Translation", 0x0409 0x04B0 29 | END 30 | END -------------------------------------------------------------------------------- /01-Extended DLLs/KxNet/winhttp.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxnetp.h" 3 | 4 | KXNETAPI ULONG WINAPI WinHttpCreateProxyResolver( 5 | IN HINTERNET SessionHandle, 6 | OUT HINTERNET *Resolver) 7 | { 8 | KexLogWarningEvent(L"Unimplemented WinHTTP function called"); 9 | KexDebugCheckpoint(); 10 | *Resolver = (HINTERNET) 0x12345678; 11 | return ERROR_SUCCESS; 12 | } 13 | 14 | KXNETAPI ULONG WINAPI WinHttpGetProxyForUrlEx( 15 | IN HINTERNET Resolver, 16 | IN PCWSTR Url, 17 | IN PVOID AutoProxyOptions, 18 | IN ULONG_PTR Context) 19 | { 20 | KexLogWarningEvent(L"Unimplemented WinHTTP function called"); 21 | KexDebugCheckpoint(); 22 | return ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT; 23 | } 24 | 25 | KXNETAPI ULONG WINAPI WinHttpGetProxyResult( 26 | IN HINTERNET Resolver, 27 | OUT PVOID ProxyResult) 28 | { 29 | KexLogWarningEvent(L"Unimplemented WinHTTP function called"); 30 | KexDebugCheckpoint(); 31 | return ERROR_WINHTTP_INCORRECT_HANDLE_STATE; 32 | } 33 | 34 | KXNETAPI VOID WINAPI WinHttpFreeProxyResult( 35 | IN OUT PVOID ProxyResult) 36 | { 37 | KexLogWarningEvent(L"Unimplemented WinHTTP function called"); 38 | KexDebugCheckpoint(); 39 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxNet/winsock.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxnetp.h" 3 | #include 4 | 5 | // 6 | // libuv (which is used by some random node.js package that a lot of electron 7 | // apps, such as VSCode, Signal, etc.) depends on GetHostNameW and will shit 8 | // itself if not found. 9 | // 10 | KXNETAPI INT WINAPI GetHostNameW( 11 | OUT PWSTR Name, 12 | IN INT NameCch) 13 | { 14 | INT ReturnValue; 15 | INT ConvertedCch; 16 | PCHAR NameAnsi; 17 | 18 | if (!NameCch) { 19 | WSASetLastError(WSAEFAULT); 20 | return SOCKET_ERROR; 21 | } 22 | 23 | NameAnsi = StackAlloc(CHAR, NameCch); 24 | ReturnValue = gethostname(NameAnsi, NameCch); 25 | 26 | if (ReturnValue == SOCKET_ERROR) { 27 | return ReturnValue; 28 | } 29 | 30 | ConvertedCch = MultiByteToWideChar( 31 | CP_ACP, 32 | 0, 33 | NameAnsi, 34 | -1, 35 | Name, 36 | NameCch); 37 | 38 | if (ConvertedCch == 0) { 39 | WSASetLastError(WSAEFAULT); 40 | return SOCKET_ERROR; 41 | } 42 | 43 | return ReturnValue; 44 | } 45 | 46 | // 47 | // Used for app-specific hack. 48 | // 49 | KXNETAPI INT WINAPI Ext_getaddrinfo( 50 | IN PCSTR NodeName, 51 | IN PCSTR ServerName, 52 | IN const struct addrinfo *Hints, 53 | OUT struct addrinfo **Results) 54 | { 55 | unless (KexData->IfeoParameters.DisableAppSpecific) { 56 | // 57 | // APPSPECIFICHACK: The game "Life is Strange: True Colors" attempts to connect 58 | // to a server and send some telemetry data. On Windows 7, the gathering of this 59 | // telemetry data fails. The error handling code in the game is faulty and will 60 | // cause a crash. 61 | // 62 | // As a workaround, we will simply fail "getaddrinfo" calls coming from the game, to 63 | // simulate the lack of an internet connection. 64 | // 65 | // For reference, the actual module that calls getaddrinfo with the game's 66 | // telemetry server is "osdk.dll", and the host name requested is 67 | // "see-siren.os.eidos.com". 68 | // 69 | 70 | if (AshExeBaseNameIs(L"Siren-Win64-Shipping.exe")) { 71 | return WSANO_DATA; 72 | } 73 | } 74 | 75 | return getaddrinfo(NodeName, ServerName, Hints, Results); 76 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxNt/KxNt.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/01-Extended DLLs/KxNt/KxNt.rc -------------------------------------------------------------------------------- /01-Extended DLLs/KxNt/KxNt.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | 31 | 32 | Source Files 33 | 34 | 35 | 36 | 37 | Resource Files 38 | 39 | 40 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxNt/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #define NOGDICAPMASKS 5 | #define NOVIRTUALKEYCODES 6 | #define NOWINMESSAGES 7 | #define NOWINSTYLES 8 | #define NOSYSMETRICS 9 | #define NOMENUS 10 | #define NOICONS 11 | #define NOKEYSTATES 12 | #define NOSYSCOMMANDS 13 | #define NORASTEROPS 14 | #define NOSHOWWINDOW 15 | #define NOATOM 16 | #define NOCLIPBOARD 17 | #define NOCOLOR 18 | #define NOCTLMGR 19 | #define NODRAWTEXT 20 | #define NOGDI 21 | #define NOKERNEL 22 | #define NOUSER 23 | #define NONLS 24 | #define NOMB 25 | #define NOMEMMGR 26 | #define NOMSG 27 | #define NOOPENFILE 28 | #define NOSCROLL 29 | #define NOTEXTMETRIC 30 | #define NOWH 31 | #define NOWINOFFSETS 32 | #define NOCOMM 33 | #define NOKANJI 34 | #define NOHELP 35 | #define NOPROFILER 36 | #define NODEFERWINDOWPOS 37 | #define NOMCX 38 | #define NOCRYPT 39 | #define NOMETAFILE 40 | #define NOSERVICE 41 | #define NOSOUND 42 | 43 | #define KEX_ENV_NATIVE 44 | #define KEX_TARGET_TYPE_DLL 45 | #define KEX_COMPONENT L"KxNt" 46 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxNt/dllmain.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | 4 | BOOL WINAPI DllMain( 5 | IN PVOID DllBase, 6 | IN ULONG Reason, 7 | IN PCONTEXT Context) 8 | { 9 | if (Reason == DLL_PROCESS_ATTACH) { 10 | LdrDisableThreadCalloutsForDll(DllBase); 11 | } 12 | 13 | return TRUE; 14 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxNt/kxnt.def: -------------------------------------------------------------------------------- 1 | LIBRARY KxNt 2 | EXPORTS 3 | 4 | LdrResolveDelayLoadedAPI = KexDll.KexLdrResolveDelayLoadedAPI 5 | LdrGetDllFullName = KexDll.KexLdrGetDllFullName 6 | 7 | LdrLoadDll = KexDll.KexLdrLoadDll 8 | LdrGetDllHandle = KexDll.KexLdrGetDllHandle 9 | LdrGetDllHandleEx = KexDll.KexLdrGetDllHandleEx 10 | LdrGetProcedureAddress = KexDll.KexLdrGetProcedureAddress 11 | LdrGetProcedureAddressEx = KexDll.KexLdrGetProcedureAddressEx 12 | 13 | RtlWaitOnAddress = KexDll.KexRtlWaitOnAddress 14 | RtlWakeAddressAll = KexDll.KexRtlWakeAddressAll 15 | RtlWakeAddressSingle = KexDll.KexRtlWakeAddressSingle 16 | RtlWow64GetProcessMachines = KexDll.KexRtlWow64GetProcessMachines 17 | RtlSetBit = KexDll.KexRtlSetBit 18 | RtlClearBit = KexDll.KexRtlClearBit 19 | RtlQueryPackageIdentity = KexDll.KexRtlQueryPackageIdentity 20 | RtlQueryPackageIdentityEx = KexDll.KexRtlQueryPackageIdentityEx 21 | RtlCheckPortableOperatingSystem = KexDll.KexRtlCheckPortableOperatingSystem 22 | RtlUnsubscribeWnfStateChangeNotification = KexDll.KexRtlUnsubscribeWnfStateChangeNotification 23 | RtlQueryWnfStateData = KexDll.KexRtlQueryWnfStateData 24 | RtlPublishWnfStateData = KexDll.KexRtlPublishWnfStateData 25 | RtlSubscribeWnfStateChangeNotification = KexDll.KexRtlSubscribeWnfStateChangeNotification 26 | RtlAddGrowableFunctionTable = KexDll.KexRtlAddGrowableFunctionTable 27 | 28 | ApiSetQueryApiSetPresence = KexDll.ApiSetQueryApiSetPresence 29 | 30 | EtwEventSetInformation = KexDll.KexEtwEventSetInformation 31 | 32 | NtQueryInformationThread = KexDll.Ext_NtQueryInformationThread 33 | NtSetInformationThread = KexDll.Ext_NtSetInformationThread 34 | NtQueryInformationProcess = KexDll.Ext_NtQueryInformationProcess 35 | NtNotifyChangeKey = KexDll.Ext_NtNotifyChangeKey 36 | NtNotifyChangeMultipleKeys = KexDll.Ext_NtNotifyChangeMultipleKeys 37 | NtCreateSection = KexDll.Ext_NtCreateSection 38 | NtAssignProcessToJobObject = KexDll.Ext_NtAssignProcessToJobObject 39 | 40 | ZwQueryInformationThread = KexDll.Ext_NtQueryInformationThread 41 | ZwSetInformationThread = KexDll.Ext_NtSetInformationThread 42 | ZwQueryInformationProcess = KexDll.Ext_NtQueryInformationProcess 43 | ZwNotifyChangeKey = KexDll.Ext_NtNotifyChangeKey 44 | ZwNotifyChangeMultipleKeys = KexDll.Ext_NtNotifyChangeMultipleKeys 45 | ZwCreateSection = KexDll.Ext_NtCreateSection 46 | ZwAssignProcessToJobObject = KexDll.Ext_NtAssignProcessToJobObject -------------------------------------------------------------------------------- /01-Extended DLLs/KxUser/KxUser.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/01-Extended DLLs/KxUser/KxUser.rc -------------------------------------------------------------------------------- /01-Extended DLLs/KxUser/KxUser.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | Source Files 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | Source Files 58 | 59 | 60 | 61 | 62 | Source Files 63 | 64 | 65 | 66 | 67 | Resource Files 68 | 69 | 70 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxUser/autorot.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxuserp.h" 3 | 4 | KXUSERAPI BOOL WINAPI SetDisplayAutoRotationPreferences( 5 | IN ORIENTATION_PREFERENCE Orientation) 6 | { 7 | return TRUE; 8 | } 9 | 10 | KXUSERAPI BOOL WINAPI GetDisplayAutoRotationPreferences( 11 | OUT PORIENTATION_PREFERENCE Orientation) 12 | { 13 | *Orientation = ORIENTATION_PREFERENCE_NONE; 14 | return TRUE; 15 | } 16 | 17 | KXUSERAPI BOOL WINAPI GetAutoRotationState( 18 | OUT PAR_STATE AutoRotationState) 19 | { 20 | if (!AutoRotationState) { 21 | SetLastError(ERROR_INVALID_PARAMETER); 22 | return FALSE; 23 | } 24 | 25 | *AutoRotationState = AR_NOSENSOR; 26 | return TRUE; 27 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxUser/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #define NOGDICAPMASKS 5 | #define NOVIRTUALKEYCODES 6 | #define NOWINSTYLES 7 | #define NOMENUS 8 | #define NOICONS 9 | #define NOKEYSTATES 10 | #define NOSYSCOMMANDS 11 | #define NORASTEROPS 12 | #define NOSHOWWINDOW 13 | #define NOATOM 14 | #define NOCLIPBOARD 15 | #define NOCOLOR 16 | #define NODRAWTEXT 17 | #define NOKERNEL 18 | #define NONLS 19 | #define NOMB 20 | #define NOMEMMGR 21 | #define NOOPENFILE 22 | #define NOSCROLL 23 | #define NOTEXTMETRIC 24 | #define NOWH 25 | #define NOWINOFFSETS 26 | #define NOCOMM 27 | #define NOKANJI 28 | #define NOHELP 29 | #define NOPROFILER 30 | #define NODEFERWINDOWPOS 31 | #define NOMCX 32 | #define NOCRYPT 33 | #define NOMETAFILE 34 | #define NOSERVICE 35 | #define NOSOUND 36 | #define _UXTHEME_H_ 37 | 38 | #ifdef _M_X64 39 | # pragma comment(lib, "user32_x64.lib") 40 | #else 41 | # pragma comment(lib, "user32_x86.lib") 42 | #endif 43 | 44 | #pragma comment(lib, "gdi32.lib") 45 | 46 | #define KXUSERAPI 47 | 48 | #define KEX_TARGET_TYPE_DLL 49 | #define KEX_ENV_WIN32 50 | #define KEX_COMPONENT L"KxUser" 51 | -------------------------------------------------------------------------------- /01-Extended DLLs/KxUser/dllmain.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // dllmain.c 6 | // 7 | // Abstract: 8 | // 9 | // Main file for KXBASE. 10 | // 11 | // Author: 12 | // 13 | // vxiiduu (10-Feb-2022) 14 | // 15 | // Environment: 16 | // 17 | // Win32 mode. 18 | // 19 | // Revision History: 20 | // 21 | // vxiiduu 10-Feb-2024 Initial creation. 22 | // 23 | /////////////////////////////////////////////////////////////////////////////// 24 | 25 | #include "buildcfg.h" 26 | #include "kxuserp.h" 27 | 28 | PKEX_PROCESS_DATA KexData = NULL; 29 | 30 | BOOL WINAPI DllMain( 31 | IN PVOID DllBase, 32 | IN ULONG Reason, 33 | IN PCONTEXT Context) 34 | { 35 | if (Reason == DLL_PROCESS_ATTACH) { 36 | LdrDisableThreadCalloutsForDll(DllBase); 37 | 38 | KexDataInitialize(&KexData); 39 | KexLogDebugEvent(L"DllMain called with DLL_PROCESS_ATTACH"); 40 | } 41 | 42 | return TRUE; 43 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxUser/kxuser.def: -------------------------------------------------------------------------------- 1 | LIBRARY KxUser 2 | EXPORTS 3 | ;; 4 | ;; autorot.c 5 | ;; 6 | 7 | SetDisplayAutoRotationPreferences 8 | GetDisplayAutoRotationPreferences 9 | GetAutoRotationState 10 | 11 | ;; 12 | ;; blutooth.c 13 | ;; 14 | 15 | BluetoothGATTAbortReliableWrite 16 | BluetoothGATTBeginReliableWrite 17 | BluetoothGATTEndReliableWrite 18 | BluetoothGATTGetCharacteristics 19 | BluetoothGATTGetCharacteristicValue 20 | BluetoothGATTGetDescriptors 21 | BluetoothGATTGetDescriptorValue 22 | BluetoothGATTGetIncludedServices 23 | BluetoothGATTGetServices 24 | BluetoothGATTRegisterEvent 25 | BluetoothGATTSetCharacteristicValue 26 | BluetoothGATTSetDescriptorValue 27 | BluetoothGATTUnregisterEvent 28 | 29 | ;; 30 | ;; misc.c 31 | ;; 32 | 33 | CreateWindowInBand 34 | GetWindowBand 35 | GetProcessUIContextInformation @2521 NONAME 36 | GetCurrentInputMessageSource 37 | IsImmersiveProcess 38 | 39 | ;; 40 | ;; pointer.c 41 | ;; 42 | 43 | GetPointerDevices 44 | GetPointerType 45 | GetPointerInfo 46 | GetPointerTouchInfo 47 | GetPointerFrameTouchInfo 48 | GetPointerFrameTouchInfoHistory 49 | GetPointerPenInfo 50 | GetPointerPenInfoHistory 51 | SkipPointerFrameMessages 52 | GetPointerDeviceRects 53 | EnableMouseInPointer 54 | 55 | ;; 56 | ;; pwrnotfy.c 57 | ;; 58 | 59 | RegisterSuspendResumeNotification 60 | UnregisterSuspendResumeNotification 61 | 62 | ;; 63 | ;; scaling.c 64 | ;; 65 | 66 | GetDpiForSystem 67 | GetDpiForWindow 68 | GetDpiForMonitor 69 | GetScaleFactorForMonitor 70 | GetProcessDpiAwareness 71 | GetProcessDpiAwarenessInternal 72 | SetProcessDpiAwareness 73 | GetThreadDpiAwarenessContext 74 | SetThreadDpiAwarenessContext 75 | SetProcessDpiAwarenessContext 76 | SetProcessDpiAwarenessInternal 77 | AdjustWindowRectExForDpi 78 | GetAwarenessFromDpiAwarenessContext 79 | GetWindowDpiAwarenessContext 80 | EnableNonClientDpiScaling 81 | AreDpiAwarenessContextsEqual 82 | IsValidDpiAwarenessContext 83 | 84 | ;; 85 | ;; sysmetrc.c 86 | ;; 87 | 88 | GetSystemMetricsForDpi 89 | SystemParametersInfoForDpi 90 | 91 | ;; 92 | ;; timer.c 93 | ;; 94 | 95 | SetCoalescableTimer -------------------------------------------------------------------------------- /01-Extended DLLs/KxUser/kxuserp.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // kxuserp.h 6 | // 7 | // Abstract: 8 | // 9 | // Private header file for KxUser. 10 | // 11 | // Author: 12 | // 13 | // vxiiduu (10-Feb-2022) 14 | // 15 | // Revision History: 16 | // 17 | // vxiiduu 10-Feb-2022 Initial creation. 18 | // 19 | /////////////////////////////////////////////////////////////////////////////// 20 | 21 | #pragma once 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | EXTERN PKEX_PROCESS_DATA KexData; -------------------------------------------------------------------------------- /01-Extended DLLs/KxUser/misc.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxuserp.h" 3 | 4 | KXUSERAPI BOOL WINAPI GetProcessUIContextInformation( 5 | IN HANDLE ProcessHandle, 6 | OUT PPROCESS_UICONTEXT_INFORMATION UIContextInformation) 7 | { 8 | if (!UIContextInformation) { 9 | SetLastError(ERROR_INVALID_PARAMETER); 10 | return FALSE; 11 | } 12 | 13 | UIContextInformation->UIContext = PROCESS_UICONTEXT_DESKTOP; 14 | UIContextInformation->Flags = PROCESS_UIF_NONE; 15 | 16 | return TRUE; 17 | } 18 | 19 | KXUSERAPI HWND WINAPI CreateWindowInBand( 20 | IN DWORD dwExStyle, 21 | IN PCWSTR lpClassName, 22 | IN PCWSTR lpWindowName, 23 | IN DWORD dwStyle, 24 | IN INT X, 25 | IN INT Y, 26 | IN INT nWidth, 27 | IN INT nHeight, 28 | IN HWND hWndParent, 29 | IN HMENU hMenu, 30 | IN HINSTANCE hInstance, 31 | IN PVOID lpParam, 32 | IN ZBID zbid) 33 | { 34 | return CreateWindowExW( 35 | dwExStyle, 36 | lpClassName, 37 | lpWindowName, 38 | dwStyle, 39 | X, 40 | Y, 41 | nWidth, 42 | nHeight, 43 | hWndParent, 44 | hMenu, 45 | hInstance, 46 | lpParam); 47 | } 48 | 49 | KXUSERAPI BOOL WINAPI GetWindowBand( 50 | IN HWND Window, 51 | OUT PZBID Band) 52 | { 53 | if (!IsWindow(Window)) { 54 | SetLastError(ERROR_INVALID_WINDOW_HANDLE); 55 | return FALSE; 56 | } 57 | 58 | if (!Band) { 59 | SetLastError(ERROR_INVALID_PARAMETER); 60 | return FALSE; 61 | } 62 | 63 | if (Window == GetDesktopWindow()) { 64 | *Band = ZBID_DESKTOP; 65 | } else { 66 | *Band = ZBID_DEFAULT; 67 | } 68 | 69 | return TRUE; 70 | } 71 | 72 | KXUSERAPI BOOL WINAPI GetCurrentInputMessageSource( 73 | OUT PINPUT_MESSAGE_SOURCE MessageSource) 74 | { 75 | if (!MessageSource) { 76 | SetLastError(ERROR_INVALID_PARAMETER); 77 | return FALSE; 78 | } 79 | 80 | MessageSource->DeviceType = IMDT_UNAVAILABLE; 81 | MessageSource->OriginId = IMO_UNAVAILABLE; 82 | return TRUE; 83 | } 84 | 85 | KXUSERAPI BOOL WINAPI IsImmersiveProcess( 86 | IN HANDLE ProcessHandle) 87 | { 88 | SetLastError(ERROR_SUCCESS); 89 | return FALSE; 90 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxUser/pwrnotfy.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxuserp.h" 3 | #include 4 | 5 | STATIC ULONG CALLBACK PowerSuspendResumeCallback( 6 | IN PVOID Context OPTIONAL, 7 | IN ULONG Type, 8 | IN PVOID Setting) 9 | { 10 | return 0; 11 | } 12 | 13 | KXUSERAPI BOOL WINAPI RegisterSuspendResumeNotification( 14 | IN HANDLE Recipient, 15 | IN ULONG Flags) 16 | { 17 | ULONG ErrorCode; 18 | HPOWERNOTIFY RegistrationHandle; 19 | DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS NotifySubscribeParameters; 20 | 21 | if (Flags == DEVICE_NOTIFY_WINDOW_HANDLE) { 22 | NotifySubscribeParameters.Callback = PowerSuspendResumeCallback; 23 | NotifySubscribeParameters.Context = (HWND) Recipient; 24 | } else { 25 | NotifySubscribeParameters = *(PDEVICE_NOTIFY_SUBSCRIBE_PARAMETERS) Recipient; 26 | } 27 | 28 | ErrorCode = PowerRegisterSuspendResumeNotification( 29 | Flags, 30 | &NotifySubscribeParameters, 31 | &RegistrationHandle); 32 | 33 | if (ErrorCode != ERROR_SUCCESS) { 34 | SetLastError(ErrorCode); 35 | return FALSE; 36 | } 37 | 38 | return TRUE; 39 | } 40 | 41 | KXUSERAPI BOOL WINAPI UnregisterSuspendResumeNotification( 42 | IN OUT HPOWERNOTIFY Handle) 43 | { 44 | ULONG ErrorCode; 45 | 46 | ErrorCode = PowerUnregisterSuspendResumeNotification(Handle); 47 | 48 | if (ErrorCode != ERROR_SUCCESS) { 49 | SetLastError(ErrorCode); 50 | return FALSE; 51 | } 52 | 53 | return TRUE; 54 | } -------------------------------------------------------------------------------- /01-Extended DLLs/KxUser/timer.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kxuserp.h" 3 | 4 | // 5 | // Coalescable timers are a power-saving feature. They reduce the timer precision 6 | // in exchange for greater energy efficiency, since timers can be "coalesced" and 7 | // batches of timers can be handled at once. This also means that we can just proxy 8 | // it directly to SetTimer() without causing any big problems. 9 | // 10 | // As an aside, on Windows 8, the uToleranceDelay parameter was added to the win32k 11 | // function NtUserSetTimer, and SetCoalescableTimer is directly forwarded to 12 | // NtUserSetTimer. The ordinary SetTimer is just a stub that calls NtUserSetTimer 13 | // with the uToleranceDelay parameter set to zero. 14 | // 15 | // Windows 7 supports coalescable timers with SetWaitableTimerEx, but it is not 16 | // simple to integrate that functionality with the User timers, so we don't bother. 17 | // 18 | 19 | KXUSERAPI UINT_PTR WINAPI SetCoalescableTimer( 20 | IN HWND hwnd, 21 | IN UINT_PTR nIdEvent, 22 | IN UINT uElapse, 23 | IN TIMERPROC lpTimerFunc, 24 | IN ULONG uToleranceDelay) 25 | { 26 | return SetTimer(hwnd, nIdEvent, uElapse, lpTimerFunc); 27 | } -------------------------------------------------------------------------------- /01-Tests/loggingtest/loggingtest.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /02-Prebuilt DLLs/Readme.txt: -------------------------------------------------------------------------------- 1 | These are pre-built DLLs from third party sources. 2 | Most of the time, they are DLLs extracted from newer versions of Windows, 3 | which may or may not have been modified to work with VxKex. 4 | 5 | d12ms.dll is currently not used but is placed here for potential future needs. -------------------------------------------------------------------------------- /02-Prebuilt DLLs/d12ms.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/02-Prebuilt DLLs/d12ms.dll -------------------------------------------------------------------------------- /02-Prebuilt DLLs/d12ms.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/02-Prebuilt DLLs/d12ms.pdb -------------------------------------------------------------------------------- /02-Prebuilt DLLs/x64/dwrw10.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/02-Prebuilt DLLs/x64/dwrw10.dll -------------------------------------------------------------------------------- /02-Prebuilt DLLs/x64/mfdevmgr.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/02-Prebuilt DLLs/x64/mfdevmgr.dll -------------------------------------------------------------------------------- /02-Prebuilt DLLs/x64/ucrtbase.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/02-Prebuilt DLLs/x64/ucrtbase.dll -------------------------------------------------------------------------------- /02-Prebuilt DLLs/x86/dwrw10.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/02-Prebuilt DLLs/x86/dwrw10.dll -------------------------------------------------------------------------------- /02-Prebuilt DLLs/x86/mshtmlmedia.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/02-Prebuilt DLLs/x86/mshtmlmedia.dll -------------------------------------------------------------------------------- /02-Prebuilt DLLs/x86/ucrtbase.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/02-Prebuilt DLLs/x86/ucrtbase.dll -------------------------------------------------------------------------------- /CpiwBypa/CpiwBypa.rc: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | #include 4 | 5 | 1 VERSIONINFO 6 | FILEVERSION KEX_VERSION_FV 7 | FILEOS VOS_NT 8 | #if defined(KEX_TARGET_TYPE_EXE) 9 | FILETYPE VFT_APP 10 | #elif defined(KEX_TARGET_TYPE_DLL) 11 | FILETYPE VFT_DLL 12 | #endif 13 | BEGIN 14 | BLOCK "StringFileInfo" 15 | BEGIN 16 | BLOCK "040904B0" 17 | BEGIN 18 | VALUE "LegalCopyright", KEX_WEB_STR 19 | VALUE "FileDescription", "Windows Explorer CPIW Version Check Bypass DLL" 20 | VALUE "FileVersion", KEX_VERSION_STR 21 | VALUE "InternalName", KEX_COMPONENT 22 | VALUE "OriginalFilename", "CPIWBYPA.DLL" 23 | END 24 | END 25 | 26 | BLOCK "VarFileInfo" 27 | BEGIN 28 | VALUE "Translation", 0x0409 0x04B0 29 | END 30 | END -------------------------------------------------------------------------------- /CpiwBypa/CpiwBypa.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Resource Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | -------------------------------------------------------------------------------- /CpiwBypa/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #define NOGDICAPMASKS 5 | #define NOVIRTUALKEYCODES 6 | #define NOWINSTYLES 7 | #define NOSYSMETRICS 8 | #define NOMENUS 9 | #define NOICONS 10 | #define NOKEYSTATES 11 | #define NOSYSCOMMANDS 12 | #define NORASTEROPS 13 | #define NOSHOWWINDOW 14 | #define NOATOM 15 | #define NOCLIPBOARD 16 | #define NOCOLOR 17 | #define NODRAWTEXT 18 | #define NOGDI 19 | #define NOKERNEL 20 | #define NONLS 21 | #define NOMB 22 | #define NOMEMMGR 23 | #define NOOPENFILE 24 | #define NOSCROLL 25 | #define NOTEXTMETRIC 26 | #define NOWH 27 | #define NOWINOFFSETS 28 | #define NOCOMM 29 | #define NOKANJI 30 | #define NOHELP 31 | #define NOPROFILER 32 | #define NODEFERWINDOWPOS 33 | #define NOMCX 34 | #define NOCRYPT 35 | #define NOMETAFILE 36 | #define NOSERVICE 37 | #define NOSOUND 38 | #define _UXTHEME_H_ 39 | 40 | #define KEX_COMPONENT L"CpiwBypa" 41 | #define KEX_ENV_WIN32 42 | #define KEX_TARGET_TYPE_DLL 43 | -------------------------------------------------------------------------------- /KexCfg/KexCfg.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/KexCfg/KexCfg.ico -------------------------------------------------------------------------------- /KexCfg/KexCfg.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/KexCfg/KexCfg.rc -------------------------------------------------------------------------------- /KexCfg/KexCfg.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | 29 | 30 | Resource Files 31 | 32 | 33 | 34 | 35 | Source Files 36 | 37 | 38 | Source Files 39 | 40 | 41 | Source Files 42 | 43 | 44 | Source Files 45 | 46 | 47 | -------------------------------------------------------------------------------- /KexCfg/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #pragma comment(lib, "wtsapi32.lib") 4 | #pragma comment(lib, "uxtheme.lib") 5 | 6 | // The graphical asserts use task dialogs which we won't have access to 7 | // when running as local SYSTEM. 8 | #define KEX_DISABLE_GRAPHICAL_ASSERTS 9 | 10 | #define KEX_TARGET_TYPE_EXE 11 | #define KEX_ENV_WIN32 12 | #define KEX_COMPONENT L"KexCfg" 13 | #define FRIENDLYAPPNAME L"VxKex Configuration Tool" 14 | -------------------------------------------------------------------------------- /KexCfg/kexcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "buildcfg.h" 4 | #include 5 | #include 6 | 7 | // Use KexCfgMessageBox instead 8 | #undef MessageBox 9 | 10 | // 11 | // cmdline.c 12 | // 13 | 14 | VOID KexCfgHandleCommandLine( 15 | IN PCWSTR CommandLine); 16 | 17 | // 18 | // gui.c 19 | // 20 | 21 | VOID KexCfgOpenGUI( 22 | VOID); 23 | 24 | // 25 | // main.c 26 | // 27 | 28 | EXTERN BOOLEAN Interactive; 29 | EXTERN ULONG SessionId; 30 | 31 | // 32 | // util.c 33 | // 34 | 35 | BOOLEAN RunningInInteractiveWindowStation( 36 | VOID); 37 | 38 | INT KexCfgMessageBox( 39 | IN HWND ParentWindow OPTIONAL, 40 | IN PWSTR Message, 41 | IN PWSTR Title, 42 | IN ULONG Flags); 43 | 44 | BOOLEAN KexCfgParseBooleanParameter( 45 | IN PCWSTR Parameter); -------------------------------------------------------------------------------- /KexCfg/main.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // main.c 6 | // 7 | // Abstract: 8 | // 9 | // Main file for KexCfg. 10 | // 11 | // Author: 12 | // 13 | // vxiiduu (09-Feb-2024) 14 | // 15 | // Environment: 16 | // 17 | // Win32 mode. Sometimes this program is run as Administrator, sometimes 18 | // as a standard account, sometimes as the local SYSTEM account. 19 | // 20 | // Revision History: 21 | // 22 | // vxiiduu 09-Feb-2024 Initial creation. 23 | // 24 | /////////////////////////////////////////////////////////////////////////////// 25 | 26 | #include "kexcfg.h" 27 | #include 28 | 29 | BOOLEAN Interactive; 30 | ULONG SessionId; 31 | 32 | VOID EntryPoint( 33 | VOID) 34 | { 35 | PCWSTR CommandLine; 36 | 37 | // 38 | // When we are running as the local SYSTEM account, we cannot just call 39 | // MessageBox to display information to the user, because processes running 40 | // as the SYSTEM account run on a non-interactive session for security 41 | // reasons (on Windows Vista and later). 42 | // 43 | // The WTSSendMessage function allows us to display a message box on the 44 | // interactive desktop. But in order to do so, we need to have a session ID, 45 | // which we can determine by enumerating all sessions and finding the first 46 | // one which is "active" (i.e. logged in with a user). 47 | // 48 | 49 | Interactive = RunningInInteractiveWindowStation(); 50 | 51 | if (Interactive) { 52 | SessionId = WTS_CURRENT_SESSION; 53 | } else { 54 | BOOLEAN Success; 55 | PWTS_SESSION_INFO SessionInfo; 56 | ULONG NumberOfSessions; 57 | 58 | Success = WTSEnumerateSessions( 59 | WTS_CURRENT_SERVER, 60 | 0, 1, 61 | &SessionInfo, 62 | &NumberOfSessions); 63 | 64 | try { 65 | ULONG Index; 66 | 67 | for (Index = 0; Index < NumberOfSessions; ++Index) { 68 | if (SessionInfo[Index].State == WTSActive) { 69 | SessionId = SessionInfo[Index].SessionId; 70 | } 71 | } 72 | } finally { 73 | WTSFreeMemory(SessionInfo); 74 | } 75 | } 76 | 77 | // 78 | // If we have no command line options, then we will open the GUI. 79 | // Otherwise we will process and act upon our command line arguments. 80 | // 81 | 82 | CommandLine = GetCommandLineWithoutImageName();; 83 | 84 | if (CommandLine[0] == '\0') { 85 | KexCfgOpenGUI(); 86 | } else { 87 | KexCfgHandleCommandLine(CommandLine); 88 | } 89 | 90 | ExitProcess(STATUS_SUCCESS); 91 | } -------------------------------------------------------------------------------- /KexCfg/resource.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define IDSTATIC -1 4 | 5 | 6 | #define IDD_DIALOG1 100 7 | 8 | #define IDC_ENABLELOGGING 101 9 | #define IDC_LOGDIR 102 10 | #define IDC_BROWSELOGDIR 103 11 | 12 | #define IDC_ENABLEFORMSI 110 13 | #define IDC_CPIWBYPA 111 14 | #define IDC_ADDTOMENU 112 15 | #define IDC_WHICHCONTEXTMENU 113 16 | 17 | #define IDC_LISTVIEW 120 18 | #define IDC_NEWAPP 121 19 | #define IDC_REMOVEAPPS 122 20 | #define IDC_PROPERTIES 123 21 | 22 | 23 | #define IDM_LISTVIEWITEMMENU 200 24 | #define M_OPENFILELOCATION 201 25 | #define M_RUNPROGRAM 202 26 | #define M_REMOVE 203 27 | #define M_PROPERTIES 204 28 | 29 | #define IDM_LISTVIEWBLANKSPACEMENU 210 30 | #define M_ADDPROGRAM 211 31 | 32 | #define IDM_LISTVIEWMULTIITEMMENU 220 33 | 34 | 35 | #define IDC_APPLY 190 36 | #define IDC_OK 191 37 | #define IDC_CANCEL 192 38 | 39 | 40 | #define IDI_APPICON 501 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /KexDll/KexDll.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/KexDll/KexDll.rc -------------------------------------------------------------------------------- /KexDll/apiset.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kexdllp.h" 3 | 4 | NTSTATUS NTAPI ApiSetQueryApiSetPresence( 5 | IN PUNICODE_STRING Namespace, 6 | OUT PBOOLEAN Present) 7 | { 8 | KexLogDebugEvent(L"ApiSetQueryApiSetPresence called with \"%wZ\"", Namespace); 9 | *Present = TRUE; 10 | return STATUS_SUCCESS; 11 | } -------------------------------------------------------------------------------- /KexDll/ashselec.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // ashselec.c 6 | // 7 | // Abstract: 8 | // 9 | // This file contains routines which dynamically select between different 10 | // implementations of DLLs by changing the DLL rewrite entries. 11 | // 12 | // Author: 13 | // 14 | // vxiiduu (16-Mar-2024) 15 | // 16 | // Environment: 17 | // 18 | // Native mode 19 | // 20 | // Revision History: 21 | // 22 | // vxiiduu 16-Mar-2024 Initial creation. 23 | // 24 | /////////////////////////////////////////////////////////////////////////////// 25 | 26 | #include "buildcfg.h" 27 | #include "kexdllp.h" 28 | 29 | STATIC NTSTATUS AshpAddUpdateRemoveDllRewriteEntry( 30 | IN PCUNICODE_STRING DllName, 31 | IN PCUNICODE_STRING RewrittenDllName OPTIONAL) 32 | { 33 | NTSTATUS Status; 34 | 35 | ASSUME (VALID_UNICODE_STRING(DllName)); 36 | ASSUME (RewrittenDllName == NULL || WELL_FORMED_UNICODE_STRING(RewrittenDllName)); 37 | 38 | Status = KexRemoveDllRewriteEntry(DllName); 39 | ASSERT (NT_SUCCESS(Status) || Status == STATUS_STRING_MAPPER_ENTRY_NOT_FOUND); 40 | 41 | if (!NT_SUCCESS(Status) && Status != STATUS_STRING_MAPPER_ENTRY_NOT_FOUND) { 42 | return Status; 43 | } 44 | 45 | if (RewrittenDllName && RewrittenDllName->Buffer != NULL) { 46 | Status = KexAddDllRewriteEntry(DllName, RewrittenDllName); 47 | } else { 48 | Status = STATUS_SUCCESS; 49 | } 50 | 51 | ASSERT (NT_SUCCESS(Status)); 52 | return Status; 53 | } 54 | 55 | NTSTATUS AshSelectDWriteImplementation( 56 | IN KEX_DWRITE_IMPLEMENTATION Implementation) 57 | { 58 | UNICODE_STRING DllName; 59 | UNICODE_STRING RewrittenDllName; 60 | 61 | RtlInitConstantUnicodeString(&DllName, L"DWrite"); 62 | 63 | switch (Implementation) { 64 | case DWriteNoImplementation: 65 | RtlInitEmptyUnicodeString(&RewrittenDllName, NULL, 0); 66 | break; 67 | case DWriteWindows10Implementation: 68 | RtlInitConstantUnicodeString(&RewrittenDllName, L"dwrw10"); 69 | break; 70 | default: 71 | NOT_REACHED; 72 | } 73 | 74 | return AshpAddUpdateRemoveDllRewriteEntry(&DllName, &RewrittenDllName); 75 | } -------------------------------------------------------------------------------- /KexDll/avrf.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // avrf.c 6 | // 7 | // Abstract: 8 | // 9 | // Functions for dealing with Application Verifier. 10 | // 11 | // Author: 12 | // 13 | // vxiiduu (03-Nov-2022) 14 | // 15 | // Revision History: 16 | // 17 | // vxiiduu 03-Nov-2022 Initial creation. 18 | // vxiiduu 05-Jan-2023 Convert to user friendly NTSTATUS. 19 | // vxiiduu 16-Mar-2024 Add more assertions. 20 | // 21 | /////////////////////////////////////////////////////////////////////////////// 22 | 23 | #include "buildcfg.h" 24 | #include "kexdllp.h" 25 | 26 | // 27 | // Disable as many application verifier functionality as we can. 28 | // This reduces the intrusiveness of VxKex, and also does stuff like stopping 29 | // app verifier from intercepting some heap calls etc. 30 | // Doesn't totally get rid of it though. We still can't totally unload verifier.dll 31 | // without causing crashes. 32 | // 33 | NTSTATUS KexDisableAVrf( 34 | VOID) 35 | { 36 | NTSTATUS Status; 37 | UNICODE_STRING VerifierDllName; 38 | PVOID VerifierDllBase; 39 | PDLL_INIT_ROUTINE VerifierDllMain; 40 | 41 | RtlInitConstantUnicodeString(&VerifierDllName, L"verifier.dll"); 42 | 43 | Status = LdrGetDllHandleByName(&VerifierDllName, NULL, &VerifierDllBase); 44 | ASSERT (NT_SUCCESS(Status)); 45 | 46 | if (!NT_SUCCESS(Status)) { 47 | // This function was probably already called. 48 | return STATUS_UNSUCCESSFUL; 49 | } 50 | 51 | Status = KexLdrFindDllInitRoutine( 52 | VerifierDllBase, 53 | (PPVOID) &VerifierDllMain); 54 | 55 | ASSERT (NT_SUCCESS(Status)); 56 | 57 | if (NT_SUCCESS(Status) && VerifierDllMain != NULL) { 58 | if (!VerifierDllMain(VerifierDllBase, DLL_PROCESS_DETACH, NULL)) { 59 | KexLogWarningEvent(L"Verifier.dll failed to de-initialize."); 60 | ASSERT (FALSE); 61 | } 62 | } 63 | 64 | NtCurrentPeb()->NtGlobalFlag &= ~(FLG_APPLICATION_VERIFIER | FLG_HEAP_PAGE_ALLOCS); 65 | 66 | Status = NtSetInformationProcess( 67 | NtCurrentProcess(), 68 | ProcessHandleTracing, 69 | NULL, 70 | 0); 71 | 72 | ASSERT (NT_SUCCESS(Status)); 73 | 74 | if (!NT_SUCCESS(Status)) { 75 | KexLogWarningEvent( 76 | L"Failed to disable process handle tracing.\r\n\r\n" 77 | L"NTSTATUS error code: %s", 78 | KexRtlNtStatusToString(Status)); 79 | } 80 | 81 | return STATUS_SUCCESS; 82 | } -------------------------------------------------------------------------------- /KexDll/buildcfg.h: -------------------------------------------------------------------------------- 1 | #define KEXAPI 2 | 3 | // 4 | // Set to TRUE to disable the PROTECTED_FUNCTION macro. 5 | // Perhaps useful for debug builds, to catch exceptions under the 6 | // debugger more quickly - however this will prevent exceptions from 7 | // being logged through VXL. 8 | // 9 | #define DISABLE_PROTECTED_FUNCTION FALSE 10 | 11 | #define KEX_COMPONENT L"KexDll" 12 | #define KEX_ENV_NATIVE 13 | #define KEX_TARGET_TYPE_DLL 14 | -------------------------------------------------------------------------------- /KexDll/etw.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // etw.c 6 | // 7 | // Abstract: 8 | // 9 | // Contains implementations of some ETW (Event Tracing for Windows) 10 | // functions. 11 | // 12 | // Author: 13 | // 14 | // vxiiduu (16-Mar-2024) 15 | // 16 | // Environment: 17 | // 18 | // Native mode. 19 | // 20 | // Revision History: 21 | // 22 | // vxiiduu 16-Mar-2024 Initial creation. 23 | // 24 | /////////////////////////////////////////////////////////////////////////////// 25 | 26 | #include "buildcfg.h" 27 | #include "kexdllp.h" 28 | #include 29 | 30 | typedef ULONG EVENT_INFO_CLASS; 31 | 32 | // 33 | // EtwEventSetInformation (which is forwarded from advapi32!EventSetInformation) 34 | // is available only on later builds of Windows 7. This function is here as a 35 | // proxy, so that earlier builds of Windows 7 do not fail to launch applications 36 | // due to the lack of this non-essential function. 37 | // 38 | 39 | KEXAPI ULONG NTAPI KexEtwEventSetInformation( 40 | IN REGHANDLE Handle, 41 | IN EVENT_INFO_CLASS InformationClass, 42 | IN PVOID EventInformation, 43 | IN ULONG InformationLength) 44 | { 45 | STATIC ULONG (NTAPI *EtwEventSetInformation) (REGHANDLE, EVENT_INFO_CLASS, PVOID, ULONG) = NULL; 46 | 47 | if (!EtwEventSetInformation) { 48 | NTSTATUS Status; 49 | ANSI_STRING ProcedureName; 50 | 51 | RtlInitConstantAnsiString(&ProcedureName, "EtwEventSetInformation"); 52 | 53 | Status = LdrGetProcedureAddress( 54 | KexData->SystemDllBase, 55 | &ProcedureName, 56 | 0, 57 | (PPVOID) &EtwEventSetInformation); 58 | 59 | if (!NT_SUCCESS(Status)) { 60 | ASSUME (EtwEventSetInformation == NULL); 61 | 62 | KexLogInformationEvent( 63 | L"EtwEventSetInformation is not available on this computer\r\n\r\n" 64 | L"This function was made available in later updates to Windows 7. " 65 | L"VxKex will return ERROR_NOT_SUPPORTED to the calling application."); 66 | } 67 | 68 | if (NT_SUCCESS(Status)) { 69 | ASSUME (EtwEventSetInformation != NULL); 70 | } 71 | } 72 | 73 | if (!EtwEventSetInformation) { 74 | return ERROR_NOT_SUPPORTED; 75 | } 76 | 77 | return EtwEventSetInformation(Handle, InformationClass, EventInformation, InformationLength); 78 | } -------------------------------------------------------------------------------- /KexDll/except.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // except.c 6 | // 7 | // Abstract: 8 | // 9 | // Contains the exception filter for general protected functions in KexDll. 10 | // 11 | // Author: 12 | // 13 | // vxiiduu (30-Oct-2022) 14 | // 15 | // Revision History: 16 | // 17 | // vxiiduu 30-Oct-2022 Initial creation. 18 | // vxiiduu 23-Feb-2024 VxlWriteLogEx is no longer a protected 19 | // function - remove extra SEH wrapping 20 | // 21 | /////////////////////////////////////////////////////////////////////////////// 22 | 23 | #include "buildcfg.h" 24 | #include "kexdllp.h" 25 | 26 | // 27 | // This function cannot contain any errors or bugs. 28 | // 29 | ULONG KexDllProtectedFunctionExceptionFilter( 30 | IN PCWSTR FunctionName, 31 | IN NTSTATUS ExceptionCode, 32 | IN PEXCEPTION_POINTERS ExceptionPointers) 33 | { 34 | PEXCEPTION_RECORD ExceptionRecord; 35 | 36 | if (ExceptionCode == STATUS_ASSERTION_FAILURE || 37 | ExceptionCode == STATUS_BREAKPOINT) { 38 | 39 | // Do not catch assertions and breakpoints. 40 | // Otherwise it would be harder to debug. 41 | return EXCEPTION_CONTINUE_SEARCH; 42 | } 43 | 44 | ExceptionRecord = ExceptionPointers->ExceptionRecord; 45 | 46 | if (ExceptionCode == STATUS_ACCESS_VIOLATION) { 47 | PCWSTR AccessType; 48 | 49 | switch (ExceptionRecord->ExceptionInformation[0]) { 50 | case 0: 51 | AccessType = L"read"; 52 | break; 53 | case 1: 54 | AccessType = L"write"; 55 | break; 56 | case 8: 57 | AccessType = L"execute"; 58 | break; 59 | default: 60 | NOT_REACHED; 61 | } 62 | 63 | KexLogErrorEvent( 64 | L"UNHANDLED EXCEPTION in %s\r\n\r\n" 65 | L"Exception code: %s (0x%08lx)\r\n" 66 | L"Exception address: 0x%p\r\n\r\n" 67 | L"Attempt to %s the inaccessible location 0x%p.", 68 | FunctionName, 69 | KexRtlNtStatusToString(ExceptionCode), ExceptionCode, 70 | ExceptionRecord->ExceptionAddress, 71 | AccessType, 72 | ExceptionRecord->ExceptionInformation[1]); 73 | } else { 74 | KexLogErrorEvent( 75 | L"UNHANDLED EXCEPTION in %s\r\n\r\n" 76 | L"Exception code: %s (0x%08lx)\r\n" 77 | L"Exception address: 0x%p", 78 | FunctionName, 79 | KexRtlNtStatusToString(ExceptionCode), ExceptionCode, 80 | ExceptionRecord->ExceptionAddress); 81 | } 82 | 83 | return EXCEPTION_EXECUTE_HANDLER; 84 | } -------------------------------------------------------------------------------- /KexDll/ntjob.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kexdllp.h" 3 | 4 | KEXAPI NTSTATUS NTAPI Ext_NtAssignProcessToJobObject( 5 | IN HANDLE JobHandle, 6 | IN HANDLE ProcessHandle) 7 | { 8 | NTSTATUS Status; 9 | 10 | Status = NtAssignProcessToJobObject( 11 | JobHandle, 12 | ProcessHandle); 13 | 14 | // 15 | // In some situations, Chromium can shit itself by trying to launch child 16 | // processes over and over if it sees this fail. 17 | // 18 | 19 | if (Status == STATUS_ACCESS_DENIED && (KexData->Flags & KEXDATA_FLAG_CHROMIUM)) { 20 | KexLogDebugEvent(L"Faking NtAssignProcessToJobObject success for Chromium compatibility"); 21 | Status = STATUS_SUCCESS; 22 | } 23 | 24 | return Status; 25 | } -------------------------------------------------------------------------------- /KexDll/ntpriv.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // ntpriv.c 6 | // 7 | // Abstract: 8 | // 9 | // Re-implementations of some small non-exported functions. 10 | // Mostly based on decompilation of Win7. 11 | // 12 | // Author: 13 | // 14 | // vxiiduu (23-Oct-2022) 15 | // 16 | // Revision History: 17 | // 18 | // vxiiduu 23-Oct-2022 Initial creation. 19 | // vxiiduu 06-Nov-2022 Add LdrpFindLoadedDllByHandle 20 | // Remove incorrect comment (LdrpHeap is 21 | // actually the same as the process heap) 22 | // vxiiduu 08-Mar-2024 Add BaseGetNamedObjectDirectory. 23 | // vxiiduu 11-Mar-2024 Move BaseGetNamedObjectDirectory to 24 | // KxBase. 25 | // 26 | /////////////////////////////////////////////////////////////////////////////// 27 | 28 | #include "buildcfg.h" 29 | #include "kexdllp.h" 30 | #include 31 | 32 | PLDR_DATA_TABLE_ENTRY NTAPI LdrpAllocateDataTableEntry( 33 | IN PVOID DllBase) 34 | { 35 | PLDR_DATA_TABLE_ENTRY Entry; 36 | PIMAGE_NT_HEADERS NtHeaders; 37 | 38 | NtHeaders = RtlImageNtHeader(DllBase); 39 | if (!NtHeaders) { 40 | return NULL; 41 | } 42 | 43 | Entry = SafeAlloc(LDR_DATA_TABLE_ENTRY, 1); 44 | if (!Entry) { 45 | return NULL; 46 | } 47 | 48 | RtlZeroMemory(Entry, sizeof(*Entry)); 49 | 50 | Entry->DllBase = DllBase; 51 | Entry->SizeOfImage = NtHeaders->OptionalHeader.SizeOfImage; 52 | Entry->TimeDateStamp = NtHeaders->FileHeader.TimeDateStamp; 53 | Entry->PatchInformation = NULL; 54 | 55 | InitializeListHead(&Entry->ForwarderLinks); 56 | InitializeListHead(&Entry->ServiceTagLinks); 57 | InitializeListHead(&Entry->StaticLinks); 58 | 59 | return Entry; 60 | } 61 | 62 | BOOLEAN NTAPI LdrpFindLoadedDllByHandle( 63 | IN PVOID DllHandle, 64 | OUT PPLDR_DATA_TABLE_ENTRY DataTableEntry) 65 | { 66 | PLDR_DATA_TABLE_ENTRY Entry; 67 | PPEB_LDR_DATA PebLdr; 68 | 69 | PebLdr = NtCurrentPeb()->Ldr; 70 | Entry = (PLDR_DATA_TABLE_ENTRY) PebLdr->InLoadOrderModuleList.Flink; 71 | 72 | if (IsListEmpty(&PebLdr->InLoadOrderModuleList)) { 73 | return FALSE; 74 | } 75 | 76 | while (Entry->DllBase != DllHandle || !Entry->InMemoryOrderLinks.Flink) { 77 | Entry = (PLDR_DATA_TABLE_ENTRY) Entry->InLoadOrderLinks.Flink; 78 | 79 | if ((PLIST_ENTRY) Entry == &PebLdr->InLoadOrderModuleList) { 80 | return FALSE; 81 | } 82 | } 83 | 84 | *DataTableEntry = Entry; 85 | return TRUE; 86 | } -------------------------------------------------------------------------------- /KexDll/ntps.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kexdllp.h" 3 | 4 | NTSTATUS NTAPI Ext_NtQueryInformationProcess( 5 | IN HANDLE ProcessHandle, 6 | IN PROCESSINFOCLASS ProcessInformationClass, 7 | OUT PVOID ProcessInformation, 8 | IN ULONG ProcessInformationLength, 9 | OUT PULONG ReturnLength OPTIONAL) 10 | { 11 | // TODO 12 | if (ProcessInformationClass == 58) { 13 | KexLogWarningEvent(L"ProcessInformationClass == 58"); 14 | KexDebugCheckpoint(); 15 | } 16 | 17 | if (ProcessInformationClass >= 51) { 18 | KexLogWarningEvent(L"ProcessInformationClass >= 51"); 19 | KexDebugCheckpoint(); 20 | } 21 | 22 | return NtQueryInformationProcess( 23 | ProcessHandle, 24 | ProcessInformationClass, 25 | ProcessInformation, 26 | ProcessInformationLength, 27 | ReturnLength); 28 | } -------------------------------------------------------------------------------- /KexDll/ntreg.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kexdllp.h" 3 | 4 | #define REG_NOTIFY_THREAD_AGNOSTIC 0x10000000 5 | 6 | NTSTATUS NTAPI Ext_NtNotifyChangeMultipleKeys( 7 | IN HANDLE MasterKeyHandle, 8 | IN ULONG Count OPTIONAL, 9 | IN OBJECT_ATTRIBUTES SlaveObjects[] OPTIONAL, 10 | IN HANDLE Event OPTIONAL, 11 | IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, 12 | IN PVOID ApcContext OPTIONAL, 13 | OUT PIO_STATUS_BLOCK IoStatusBlock, 14 | IN ULONG CompletionFilter, 15 | IN BOOLEAN WatchTree, 16 | OUT PVOID Buffer OPTIONAL, 17 | IN ULONG BufferSize, 18 | IN BOOLEAN Asynchronous) 19 | { 20 | // 21 | // If CompletionFilter contains REG_NOTIFY_THREAD_AGNOSTIC, simply 22 | // strip it out. 23 | // TODO: Implement this properly. 24 | // 25 | 26 | if (CompletionFilter & REG_NOTIFY_THREAD_AGNOSTIC) { 27 | KexLogDebugEvent(L"Stripping REG_NOTIFY_THREAD_AGNOSTIC flag from CompletionFilter"); 28 | } 29 | 30 | CompletionFilter &= ~REG_NOTIFY_THREAD_AGNOSTIC; 31 | 32 | return NtNotifyChangeMultipleKeys( 33 | MasterKeyHandle, 34 | Count, 35 | SlaveObjects, 36 | Event, 37 | ApcRoutine, 38 | ApcContext, 39 | IoStatusBlock, 40 | CompletionFilter, 41 | WatchTree, 42 | Buffer, 43 | BufferSize, 44 | Asynchronous); 45 | } 46 | 47 | NTSTATUS NTAPI Ext_NtNotifyChangeKey( 48 | IN HANDLE KeyHandle, 49 | IN HANDLE Event OPTIONAL, 50 | IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, 51 | IN PVOID ApcContext OPTIONAL, 52 | OUT PIO_STATUS_BLOCK IoStatusBlock, 53 | IN ULONG CompletionFilter, 54 | IN BOOLEAN WatchTree, 55 | OUT PVOID Buffer OPTIONAL, 56 | IN ULONG BufferSize, 57 | IN BOOLEAN Asynchronous) 58 | { 59 | // 60 | // Pass through to NtNotifyChangeMultipleKeys to avoid code duplication. 61 | // This is how the NtNotifyChangeKey function is implemented in the kernel anyway, 62 | // so there should be no issues in doing this. 63 | // 64 | 65 | return Ext_NtNotifyChangeMultipleKeys( 66 | KeyHandle, 67 | 0, 68 | NULL, 69 | Event, 70 | ApcRoutine, 71 | ApcContext, 72 | IoStatusBlock, 73 | CompletionFilter, 74 | WatchTree, 75 | Buffer, 76 | BufferSize, 77 | Asynchronous); 78 | } -------------------------------------------------------------------------------- /KexDll/rtlwow64.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "kexdllp.h" 3 | 4 | KEXAPI NTSTATUS NTAPI KexRtlWow64GetProcessMachines( 5 | IN HANDLE ProcessHandle, 6 | OUT PUSHORT ProcessMachine, 7 | OUT PUSHORT NativeMachine OPTIONAL) 8 | { 9 | NTSTATUS Status; 10 | 11 | // 12 | // The KexRtlOperatingSystemBitness macro checks a field in SharedUserData in order 13 | // to determine whether the operating system is 64-bit or 32-bit (independently of 14 | // whether this is a WOW64 process or not). 15 | // 16 | 17 | if (KexRtlOperatingSystemBitness() == 64) { 18 | // 19 | // The OS is 64 bit. Processes can be either 32 bit or 64 bit. 20 | // 21 | 22 | if (ProcessHandle == NtCurrentProcess()) { 23 | // 24 | // We know the bitness of the current process because we know at 25 | // compile time whether we are running as 32-bit code or 64-bit code. 26 | // There is no need to ask the kernel. 27 | // 28 | 29 | if (KexIs64BitBuild) { 30 | *ProcessMachine = IMAGE_FILE_MACHINE_AMD64; 31 | } else { 32 | *ProcessMachine = IMAGE_FILE_MACHINE_I386; 33 | } 34 | } else { 35 | ULONG_PTR AddressOf32BitPeb; 36 | 37 | // 38 | // We know the OS is 64-bit, but we want to see if another process is 32-bit. 39 | // We need to query the kernel to see whether that process is WOW64. 40 | // 41 | 42 | Status = NtQueryInformationProcess( 43 | ProcessHandle, 44 | ProcessWow64Information, 45 | &AddressOf32BitPeb, 46 | sizeof(AddressOf32BitPeb), 47 | NULL); 48 | 49 | if (!NT_SUCCESS(Status)) { 50 | return Status; 51 | } 52 | 53 | if (ProcessWow64Information) { 54 | *ProcessMachine = IMAGE_FILE_MACHINE_I386; 55 | } else { 56 | *ProcessMachine = IMAGE_FILE_MACHINE_AMD64; 57 | } 58 | } 59 | 60 | if (NativeMachine != NULL) { 61 | *NativeMachine = IMAGE_FILE_MACHINE_AMD64; 62 | } 63 | } else { 64 | // 65 | // The OS is 32 bit, so everything must be 32 bit. No need to check anything. 66 | // 67 | 68 | *ProcessMachine = IMAGE_FILE_MACHINE_I386; 69 | 70 | if (NativeMachine != NULL) { 71 | *NativeMachine = IMAGE_FILE_MACHINE_I386; 72 | } 73 | } 74 | 75 | return STATUS_SUCCESS; 76 | } -------------------------------------------------------------------------------- /KexDll/syscal64.asm: -------------------------------------------------------------------------------- 1 | IFDEF RAX 2 | 3 | _TEXT SEGMENT 4 | 5 | GENERATE_SYSCALL MACRO SyscallName, SyscallNumber64 6 | PUBLIC SyscallName 7 | ALIGN 16 8 | SyscallName PROC 9 | mov r10, rcx 10 | mov eax, SyscallNumber64 11 | syscall 12 | ret 13 | SyscallName ENDP 14 | ENDM 15 | 16 | GENERATE_SYSCALL KexNtQuerySystemTime, 0057h 17 | GENERATE_SYSCALL KexNtCreateUserProcess, 00AAh 18 | GENERATE_SYSCALL KexNtProtectVirtualMemory, 004Dh 19 | GENERATE_SYSCALL KexNtAllocateVirtualMemory, 0015h 20 | GENERATE_SYSCALL KexNtQueryVirtualMemory, 0020h 21 | GENERATE_SYSCALL KexNtFreeVirtualMemory, 001Bh 22 | GENERATE_SYSCALL KexNtOpenKeyEx, 00F2h 23 | GENERATE_SYSCALL KexNtQueryObject, 000Dh 24 | GENERATE_SYSCALL KexNtOpenFile, 0030h 25 | GENERATE_SYSCALL KexNtWriteFile, 0005h 26 | GENERATE_SYSCALL KexNtRaiseHardError, 0130h 27 | GENERATE_SYSCALL KexNtQueryInformationThread, 0022h 28 | GENERATE_SYSCALL KexNtSetInformationThread, 000Ah 29 | GENERATE_SYSCALL KexNtNotifyChangeKey, 00EBh 30 | GENERATE_SYSCALL KexNtNotifyChangeMultipleKeys, 00ECh 31 | GENERATE_SYSCALL KexNtCreateSection, 0047h 32 | GENERATE_SYSCALL KexNtQueryInformationProcess, 0016h 33 | GENERATE_SYSCALL KexNtAssignProcessToJobObject, 0085h 34 | 35 | _TEXT ENDS 36 | 37 | ENDIF 38 | END -------------------------------------------------------------------------------- /KexDll/vxlsever.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // vxlsever.c 6 | // 7 | // Abstract: 8 | // 9 | // Contains a routine to convert a VXLSEVERITY enumeration value into a 10 | // human-readable string. 11 | // 12 | // Author: 13 | // 14 | // vxiiduu (30-Sep-2022) 15 | // 16 | // Revision History: 17 | // 18 | // vxiiduu 30-Sep-2022 Initial creation. 19 | // vxiiduu 12-Nov-2022 Move into KexDll 20 | // 21 | /////////////////////////////////////////////////////////////////////////////// 22 | 23 | #include "buildcfg.h" 24 | #include "kexdllp.h" 25 | 26 | static PCWSTR SeverityLookupTable[][2] = { 27 | {L"Critical", L"The application encountered a critical error and cannot continue"}, 28 | {L"Error", L"The application encountered a non-critical error which affected its function"}, 29 | {L"Warning", L"An event occurred which should be investigated but does not affect the immediate functioning of the application"}, 30 | {L"Information", L"An informational message which is not a cause for concern"}, 31 | {L"Detail", L"An informational message, generated in large quantities, which is not a cause for concern"}, 32 | {L"Debug", L"Information useful only to the developer of the application"}, 33 | {L"Unknown", L"An invalid or unknown severity value"} 34 | }; 35 | 36 | // 37 | // Convert a VXLSEVERITY enumeration value into a human-readable string. 38 | // You can obtain a long description by passing TRUE for the LongDescription 39 | // parameter. 40 | // 41 | KEXAPI PCWSTR NTAPI VxlSeverityToText( 42 | IN VXLSEVERITY Severity, 43 | IN BOOLEAN LongDescription) 44 | { 45 | return SeverityLookupTable[min((ULONG) Severity, LogSeverityMaximumValue)][!!LongDescription]; 46 | } -------------------------------------------------------------------------------- /KexGui/KexGui.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | Source Files 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | -------------------------------------------------------------------------------- /KexGui/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #define NOKEYSTATES 5 | #define NOSYSCOMMANDS 6 | #define NORASTEROPS 7 | #define NOATOM 8 | #define NOMEMMGR 9 | #define NOOPENFILE 10 | #define NOCOMM 11 | #define NOKANJI 12 | #define NOHELP 13 | #define NOPROFILER 14 | #define NOMCX 15 | #define NOCRYPT 16 | #define NOMETAFILE 17 | #define NOSERVICE 18 | #define NOSOUND 19 | 20 | #define KEXGDECLSPEC 21 | 22 | #define KEX_COMPONENT L"KexGui" 23 | #define KEX_ENV_WIN32 24 | #define KEX_TARGET_TYPE_LIB 25 | -------------------------------------------------------------------------------- /KexGui/ctlsx.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // ctlsx.c 6 | // 7 | // Abstract: 8 | // 9 | // Convenience functions for interacting with Windows controls. 10 | // 11 | // Author: 12 | // 13 | // vxiiduu (01-Oct-2022) 14 | // 15 | // Environment: 16 | // 17 | // Win32 18 | // 19 | // Revision History: 20 | // 21 | // vxiiduu 01-Oct-2022 Initial creation. 22 | // vxiiduu 05-Feb-2024 Add Button_SetShield() 23 | // 24 | /////////////////////////////////////////////////////////////////////////////// 25 | 26 | #include "buildcfg.h" 27 | #include 28 | #include 29 | 30 | KEXGDECLSPEC EXTERN_C VOID KEXGAPI StatusBar_SetTextF( 31 | IN HWND Window, 32 | IN INT Index, 33 | IN PCWSTR Format, 34 | IN ...) 35 | { 36 | HRESULT Result; 37 | SIZE_T BufferCch; 38 | PWSTR Buffer; 39 | ARGLIST ArgList; 40 | 41 | ASSERT (Window != NULL); 42 | ASSERT (Format != NULL); 43 | 44 | va_start(ArgList, Format); 45 | 46 | Result = StringCchVPrintfBufferLength(&BufferCch, Format, ArgList); 47 | ASSERT (SUCCEEDED(Result)); 48 | 49 | if (FAILED(Result)) { 50 | return; 51 | } 52 | 53 | Buffer = StackAlloc(WCHAR, BufferCch); 54 | Result = StringCchVPrintf(Buffer, BufferCch, Format, ArgList); 55 | ASSERT (SUCCEEDED(Result)); 56 | 57 | if (FAILED(Result)) { 58 | return; 59 | } 60 | 61 | StatusBar_SetText(Window, Index, Buffer); 62 | } 63 | 64 | KEXGDECLSPEC EXTERN_C VOID KEXGAPI ListView_SetCheckedStateAll( 65 | IN HWND Window, 66 | IN BOOLEAN Checked) 67 | { 68 | ULONG Index; 69 | ULONG NumberOfComponents; 70 | 71 | ASSERT (Window != NULL); 72 | 73 | NumberOfComponents = ListView_GetItemCount(Window); 74 | 75 | for (Index = 0; Index < NumberOfComponents; Index++) { 76 | ListView_SetCheckState(Window, Index, Checked); 77 | } 78 | } 79 | 80 | KEXGDECLSPEC EXTERN_C VOID KEXGAPI Button_SetShield( 81 | IN HWND Window, 82 | IN BOOLEAN HasShield) 83 | { 84 | ASSERT (IsWindow(Window)); 85 | SendMessage(Window, BCM_SETSHIELD, 0, HasShield); 86 | } -------------------------------------------------------------------------------- /KexGui/dpi.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | #include 4 | 5 | STATIC BOOLEAN AlreadyInitialized = FALSE; 6 | STATIC INT DpiX = USER_DEFAULT_SCREEN_DPI; 7 | STATIC INT DpiY = USER_DEFAULT_SCREEN_DPI; 8 | 9 | STATIC VOID DpiInitialize( 10 | VOID) 11 | { 12 | HDC DeviceContext; 13 | 14 | DeviceContext = GetDC(NULL); 15 | DpiX = GetDeviceCaps(DeviceContext, LOGPIXELSX); 16 | DpiY = GetDeviceCaps(DeviceContext, LOGPIXELSY); 17 | ReleaseDC(NULL, DeviceContext); 18 | 19 | AlreadyInitialized = TRUE; 20 | } 21 | 22 | KEXGDECLSPEC INT KEXGAPI DpiScaleX( 23 | IN INT PixelsX) 24 | { 25 | if (!AlreadyInitialized) { 26 | DpiInitialize(); 27 | } 28 | 29 | return MulDiv(PixelsX, DpiX, USER_DEFAULT_SCREEN_DPI); 30 | } 31 | 32 | KEXGDECLSPEC INT KEXGAPI DpiScaleY( 33 | IN INT PixelsY) 34 | { 35 | if (!AlreadyInitialized) { 36 | DpiInitialize(); 37 | } 38 | 39 | return MulDiv(PixelsY, DpiY, USER_DEFAULT_SCREEN_DPI); 40 | } -------------------------------------------------------------------------------- /KexGui/fldrpkr.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | #include 4 | #include 5 | 6 | KEXGDECLSPEC EXTERN_C BOOLEAN KEXGAPI PickFolder( 7 | IN HWND OwnerWindow OPTIONAL, 8 | IN PCWSTR DefaultValue OPTIONAL, 9 | IN ULONG AdditionalFlags OPTIONAL, // FOS_* 10 | IN PWSTR DirectoryPath, 11 | IN ULONG DirectoryPathCch) 12 | { 13 | HRESULT Result; 14 | IFileDialog *FileDialog; 15 | IShellItem *ShellItem; 16 | PWSTR ShellName; 17 | ULONG Flags; 18 | 19 | ASSERT (DirectoryPath != NULL); 20 | ASSERT (DirectoryPathCch != 0); 21 | 22 | FileDialog = NULL; 23 | ShellItem = NULL; 24 | 25 | Result = CoCreateInstance( 26 | &CLSID_FileOpenDialog, 27 | NULL, 28 | CLSCTX_INPROC_SERVER, 29 | &IID_IFileOpenDialog, 30 | (PPVOID) &FileDialog); 31 | 32 | if (!DefaultValue) { 33 | DefaultValue = L""; 34 | } 35 | 36 | if (FAILED(Result)) { 37 | StringCchCopy(DirectoryPath, DirectoryPathCch, DefaultValue); 38 | return FALSE; 39 | } 40 | 41 | IFileDialog_GetOptions(FileDialog, &Flags); 42 | IFileDialog_SetOptions(FileDialog, Flags | FOS_PICKFOLDERS | FOS_FORCEFILESYSTEM | AdditionalFlags); 43 | IFileDialog_Show(FileDialog, OwnerWindow); 44 | IFileDialog_GetResult(FileDialog, &ShellItem); 45 | IFileDialog_Release(FileDialog); 46 | 47 | if (!ShellItem) { 48 | StringCchCopy(DirectoryPath, DirectoryPathCch, DefaultValue); 49 | return FALSE; 50 | } 51 | 52 | IShellItem_GetDisplayName(ShellItem, SIGDN_FILESYSPATH, &ShellName); 53 | StringCchCopy(DirectoryPath, DirectoryPathCch, ShellName); 54 | CoTaskMemFree(ShellName); 55 | IShellItem_Release(ShellItem); 56 | 57 | return TRUE; 58 | } -------------------------------------------------------------------------------- /KexGui/kexgui.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | 4 | #ifdef _DEBUG 5 | KEXGDECLSPEC PCWSTR KexgApplicationFriendlyName = L"YOU MUST SET AN APPLICATION FRIENDLY NAME"; 6 | #else 7 | KEXGDECLSPEC PCWSTR KexgApplicationFriendlyName = L""; 8 | #endif 9 | 10 | KEXGDECLSPEC HWND KexgApplicationMainWindow = NULL; 11 | 12 | #ifdef KEX_TARGET_TYPE_DLL 13 | BOOL WINAPI DllMain( 14 | IN HMODULE DllBase, 15 | IN ULONG Reason, 16 | IN PCONTEXT Context) 17 | { 18 | if (Reason == DLL_PROCESS_ATTACH) { 19 | DisableThreadLibraryCalls(DllBase); 20 | } 21 | 22 | return TRUE; 23 | } 24 | #endif -------------------------------------------------------------------------------- /KexGui/locale.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | #include 4 | #include 5 | 6 | KEXGDECLSPEC LANGID KEXGAPI GetVxKexUserInterfaceLanguage( 7 | VOID) 8 | { 9 | HKEY VxKexUserKeyHandle; 10 | STATIC LANGID CachedLangId = LANG_NEUTRAL; 11 | LANGID LangId; 12 | 13 | if (CachedLangId != LANG_NEUTRAL) { 14 | // Already figured out the language. 15 | return CachedLangId; 16 | } 17 | 18 | // 19 | // First of all, check if user has overridden the language in the 20 | // HKCU registry settings. The language override exists for two purposes: 21 | // 22 | // 1. User's language setting on the computer is equivalent to neither 23 | // of the VxKex supported languages, but the user understands one 24 | // of the supported languages better than English. 25 | // 26 | // 2. For developers to test in other languages without changing the 27 | // global system language. 28 | // 29 | 30 | VxKexUserKeyHandle = KxCfgOpenVxKexRegistryKey(TRUE, KEY_READ, NULL); 31 | if (VxKexUserKeyHandle) { 32 | ULONG ErrorCode; 33 | ULONG RegistryLangId; 34 | 35 | ErrorCode = RegReadI32(VxKexUserKeyHandle, NULL, L"LanguageId", &RegistryLangId); 36 | ASSERT (ErrorCode == ERROR_SUCCESS || ErrorCode == ERROR_FILE_NOT_FOUND); 37 | 38 | SafeClose(VxKexUserKeyHandle); 39 | 40 | if (ErrorCode != ERROR_SUCCESS || RegistryLangId == LANG_NEUTRAL) { 41 | goto NoRegistryLanguageFound; 42 | } 43 | 44 | if (RegistryLangId & ~0x3FF) { 45 | // invalid 46 | goto NoRegistryLanguageFound; 47 | } 48 | 49 | LangId = PRIMARYLANGID((WORD) RegistryLangId); 50 | } else { 51 | NoRegistryLanguageFound: 52 | 53 | // 54 | // No language override. Use user or system default. 55 | // 56 | 57 | LangId = PRIMARYLANGID(GetUserDefaultUILanguage()); 58 | 59 | if (LangId == LANG_NEUTRAL) { 60 | LangId = PRIMARYLANGID(GetSystemDefaultUILanguage()); 61 | } 62 | } 63 | 64 | ASSERT (LangId != LANG_NEUTRAL); 65 | ASSERT ((LangId & ~0x3FF) == 0); 66 | 67 | switch (LangId) { 68 | case LANG_ENGLISH: 69 | case LANG_RUSSIAN: 70 | // languages with primary support 71 | return LangId; 72 | case LANG_UKRAINIAN: 73 | case LANG_BELARUSIAN: 74 | // mutually intelligible - most ukrainians and belarusians understand 75 | // russian better than english 76 | return LANG_RUSSIAN; 77 | default: 78 | return LANG_ENGLISH; 79 | } 80 | } -------------------------------------------------------------------------------- /KexGui/shprops.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | KEXGDECLSPEC BOOLEAN KEXGAPI ShowPropertiesDialog( 8 | IN PCWSTR FilePath, 9 | IN INT ShowControl) 10 | { 11 | SHELLEXECUTEINFO ShellExecuteInfo; 12 | 13 | RtlZeroMemory(&ShellExecuteInfo, sizeof(ShellExecuteInfo)); 14 | ShellExecuteInfo.cbSize = sizeof(ShellExecuteInfo); 15 | ShellExecuteInfo.fMask = SEE_MASK_INVOKEIDLIST | SEE_MASK_NOASYNC | SEE_MASK_UNICODE; 16 | ShellExecuteInfo.hwnd = KexgApplicationMainWindow; 17 | ShellExecuteInfo.lpVerb = L"properties"; 18 | ShellExecuteInfo.lpFile = FilePath; 19 | ShellExecuteInfo.nShow = ShowControl; 20 | 21 | return ShellExecuteEx(&ShellExecuteInfo); 22 | } 23 | 24 | KEXGDECLSPEC HRESULT KEXGAPI OpenFileLocation( 25 | IN PCWSTR FilePath, 26 | IN ULONG Flags) 27 | { 28 | HRESULT Result; 29 | PIDLIST_ABSOLUTE IDList; 30 | ULONG SfgaoFlags; 31 | 32 | Result = SHParseDisplayName(FilePath, NULL, &IDList, 0, &SfgaoFlags); 33 | if (FAILED(Result)) { 34 | return Result; 35 | } 36 | 37 | CoInitialize(NULL); 38 | 39 | Result = SHOpenFolderAndSelectItems(IDList, 0, NULL, Flags); 40 | 41 | CoUninitialize(); 42 | 43 | return Result; 44 | } -------------------------------------------------------------------------------- /KexKMSD/KexKMSD.rc: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | #include 4 | 5 | 1 VERSIONINFO 6 | FILEVERSION KEX_VERSION_FV 7 | FILEOS VOS_NT 8 | #if defined(KEX_TARGET_TYPE_EXE) 9 | FILETYPE VFT_APP 10 | #elif defined(KEX_TARGET_TYPE_DLL) 11 | FILETYPE VFT_DLL 12 | #elif defined(KEX_TARGET_TYPE_SYS) 13 | FILETYPE VFT_DRV 14 | #endif 15 | BEGIN 16 | BLOCK "StringFileInfo" 17 | BEGIN 18 | BLOCK "040904B0" 19 | BEGIN 20 | VALUE "LegalCopyright", KEX_WEB_STR 21 | VALUE "FileDescription", "VxKex Kernel-Mode Support Driver" 22 | VALUE "FileVersion", KEX_VERSION_STR 23 | VALUE "InternalName", KEX_COMPONENT 24 | VALUE "OriginalFilename", "KEXKMSD.SYS" 25 | END 26 | END 27 | 28 | BLOCK "VarFileInfo" 29 | BEGIN 30 | VALUE "Translation", 0x0409 0x04B0 31 | END 32 | END -------------------------------------------------------------------------------- /KexKMSD/KexKMSD.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | 28 | 29 | Resource Files 30 | 31 | 32 | -------------------------------------------------------------------------------- /KexKMSD/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define KEX_COMPONENT L"KexKMSD" 4 | #define KEX_TARGET_TYPE_SYS 5 | #define KEX_ENV_NATIVE 6 | -------------------------------------------------------------------------------- /KexKMSD/drventry.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | 4 | VOID NTAPI DriverUnload( 5 | IN PDRIVER_OBJECT DriverObject) 6 | { 7 | ASSERT (DriverObject != NULL); 8 | return; 9 | } 10 | 11 | NTSTATUS NTAPI DriverEntry( 12 | IN OUT PDRIVER_OBJECT DriverObject, 13 | IN PUNICODE_STRING RegistryPath) 14 | { 15 | ASSERT (DriverObject != NULL); 16 | ASSERT (RegistryPath != NULL); 17 | 18 | KdPrint("DriverEntry called\r\n"); 19 | 20 | DriverObject->DriverUnload = DriverUnload; 21 | 22 | return STATUS_SUCCESS; 23 | } -------------------------------------------------------------------------------- /KexPathCch/KexPathCch.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | -------------------------------------------------------------------------------- /KexPathCch/buildcfg.h: -------------------------------------------------------------------------------- 1 | #define WINPATHCCHAPI 2 | #define KEX_TARGET_TYPE_LIB 3 | #define KEX_COMPONENT L"KexPathCch" 4 | -------------------------------------------------------------------------------- /KexSetup/KexSetup.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/KexSetup/KexSetup.ico -------------------------------------------------------------------------------- /KexSetup/KexSetup.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /KexSetup/KexSetup.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/KexSetup/KexSetup.rc -------------------------------------------------------------------------------- /KexSetup/KexSetup.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | Header Files 49 | 50 | 51 | 52 | 53 | Resource Files 54 | 55 | 56 | -------------------------------------------------------------------------------- /KexSetup/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define FRIENDLYAPPNAME L"VxKex Installer" 4 | #define KEX_COMPONENT L"KexSetup" 5 | #define KEX_ENV_WIN32 6 | #define KEX_TARGET_TYPE_EXE 7 | -------------------------------------------------------------------------------- /KexSetup/main.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // main.c 6 | // 7 | // Abstract: 8 | // 9 | // KexSetup, the VxKex installer (and uninstaller) program. 10 | // 11 | // Author: 12 | // 13 | // vxiiduu (31-Jan-2024) 14 | // 15 | // Environment: 16 | // 17 | // Win32, without any vxkex support components 18 | // 19 | // Revision History: 20 | // 21 | // vxiiduu 31-Jan-2024 Initial creation. 22 | // 23 | /////////////////////////////////////////////////////////////////////////////// 24 | 25 | #define NEED_VERSION_DEFS 26 | #include "kexsetup.h" 27 | 28 | BOOLEAN Is64BitOS; 29 | KEXSETUP_OPERATION_MODE OperationMode; 30 | BOOLEAN SilentUnattended; 31 | BOOLEAN PreserveConfig; 32 | WCHAR KexDir[MAX_PATH]; 33 | ULONG ExistingVxKexVersion; 34 | ULONG InstallerVxKexVersion; 35 | 36 | VOID EntryPoint( 37 | VOID) 38 | { 39 | KexgApplicationFriendlyName = FRIENDLYAPPNAME; 40 | ExistingVxKexVersion = KexSetupGetInstalledVersion(); 41 | InstallerVxKexVersion = KEX_VERSION_DW; 42 | 43 | Is64BitOS = IsWow64(); 44 | GetDefaultInstallationLocation(KexDir); 45 | ProcessCommandLineOptions(); 46 | 47 | if (SilentUnattended) { 48 | KexSetupPerformActions(); 49 | } else { 50 | DisplayInstallerGUI(); 51 | } 52 | 53 | ExitProcess(STATUS_SUCCESS); 54 | } -------------------------------------------------------------------------------- /KexSetup/perform.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/KexSetup/perform.c -------------------------------------------------------------------------------- /KexSetup/prereq.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/KexSetup/prereq.c -------------------------------------------------------------------------------- /KexSetup/resource.h: -------------------------------------------------------------------------------- 1 | #define MAIN_WINDOW_WIDTH 333 2 | #define MAIN_WINDOW_HEIGHT 222 3 | 4 | #define IDSTATIC -1 5 | 6 | #define IDI_APPICON 100 7 | 8 | #define IDD_MAINWINDOW 101 9 | 10 | #define IDBACK 102 11 | #define IDNEXT 103 12 | #define IDCANCEL2 104 13 | #define IDHDRTEXT 105 14 | #define IDHDRSUBTEXT 106 15 | #define IDPROGRESS 107 16 | 17 | #define IDS1GUIDETEXT 110 18 | #define IDS1DIRPATH 111 19 | #define IDS1BROWSE 112 20 | #define IDS1SPACEREQ 113 21 | #define IDS1SPACEAVAIL 114 22 | #define IDS1PDBNOTICE 115 23 | 24 | #define IDS2GUIDETEXT 120 25 | 26 | #define IDS3GUIDETEXT 130 27 | #define IDS3KEXCFG 131 28 | #define IDS3OPENGUIDE 132 29 | 30 | #define IDS4GUIDETEXT 140 31 | #define IDS4GUIDETEXT2 141 32 | #define IDS4PRESERVECONFIG 142 33 | 34 | #define IDS5GUIDETEXT 150 35 | 36 | #define IDS6GUIDETEXT 160 37 | #define IDS6GUIDETEXT2 161 38 | 39 | #define IDS7GUIDETEXT 170 40 | #define IDS7GUIDETEXT2 171 41 | #define IDS7CHANGELOG 172 42 | 43 | #define IDS8GUIDETEXT 180 44 | 45 | #define IDS9GUIDETEXT 190 46 | -------------------------------------------------------------------------------- /KexSetup/version.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // version.c 6 | // 7 | // Abstract: 8 | // 9 | // This file contains functions which query the currently installed version 10 | // of VxKex. 11 | // 12 | // Author: 13 | // 14 | // vxiiduu (02-Feb-2024) 15 | // 16 | // Environment: 17 | // 18 | // Win32, without any vxkex support components 19 | // 20 | // Revision History: 21 | // 22 | // vxiiduu 02-Feb-2024 Initial creation. 23 | // 24 | /////////////////////////////////////////////////////////////////////////////// 25 | 26 | #include "kexsetup.h" 27 | 28 | // Returns 0 for not installed. 29 | ULONG KexSetupGetInstalledVersion( 30 | VOID) 31 | { 32 | HKEY KeyHandle; 33 | ULONG InstalledVersion; 34 | 35 | KeyHandle = KxCfgOpenVxKexRegistryKey(FALSE, KEY_READ, NULL); 36 | if (!KeyHandle) { 37 | KeyHandle = KxCfgOpenLegacyVxKexRegistryKey(FALSE, KEY_READ, NULL); 38 | if (!KeyHandle) { 39 | return 0; 40 | } 41 | } 42 | 43 | RegReadI32(KeyHandle, NULL, L"InstalledVersion", &InstalledVersion); 44 | SafeClose(KeyHandle); 45 | 46 | return InstalledVersion; 47 | } -------------------------------------------------------------------------------- /KexShlEx/KexShlEx.def: -------------------------------------------------------------------------------- 1 | LIBRARY KexShlEx.dll 2 | EXPORTS 3 | DllCanUnloadNow PRIVATE 4 | DllGetClassObject PRIVATE 5 | DllRegisterServer PRIVATE 6 | DllUnregisterServer PRIVATE 7 | DllInstall PRIVATE -------------------------------------------------------------------------------- /KexShlEx/KexShlEx.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/KexShlEx/KexShlEx.rc -------------------------------------------------------------------------------- /KexShlEx/KexShlEx.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Resource Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | Header Files 33 | 34 | 35 | Header Files 36 | 37 | 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | Source Files 50 | 51 | 52 | Source Files 53 | 54 | 55 | -------------------------------------------------------------------------------- /KexShlEx/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define FRIENDLYAPPNAME L"VxKex Configuration Properties" 4 | #define KEX_TARGET_TYPE_DLL 5 | #define KEX_COMPONENT L"KexShlEx" 6 | #define KEX_ENV_WIN32 7 | -------------------------------------------------------------------------------- /KexShlEx/clsfctry.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // clsfctry.c 6 | // 7 | // Abstract: 8 | // 9 | // Implements the IClassFactory interface. 10 | // All just COM boilerplate crap, nothing to see here. 11 | // 12 | // Author: 13 | // 14 | // vxiiduu (08-Feb-2024) 15 | // 16 | // Environment: 17 | // 18 | // Inside explorer.exe 19 | // 20 | // Revision History: 21 | // 22 | // vxiiduu 08-Feb-2024 Initial creation. 23 | // 24 | /////////////////////////////////////////////////////////////////////////////// 25 | 26 | #include "buildcfg.h" 27 | #include "KexShlEx.h" 28 | 29 | HRESULT STDMETHODCALLTYPE CClassFactory_QueryInterface( 30 | IN IClassFactory *This, 31 | IN REFIID RefIID, 32 | OUT PPVOID ObjectOut) 33 | { 34 | ASSERT (This != NULL); 35 | ASSERT (RefIID != NULL); 36 | ASSERT (ObjectOut != NULL); 37 | 38 | if (IsEqualIID(RefIID, &IID_IUnknown)) { 39 | *ObjectOut = This; 40 | } else if (IsEqualIID(RefIID, &IID_IClassFactory)) { 41 | *ObjectOut = This; 42 | } else { 43 | *ObjectOut = NULL; 44 | return E_NOINTERFACE; 45 | } 46 | 47 | return S_OK; 48 | } 49 | 50 | ULONG STDMETHODCALLTYPE CClassFactory_AddRef( 51 | IN IClassFactory *This) 52 | { 53 | return 1; 54 | } 55 | 56 | ULONG STDMETHODCALLTYPE CClassFactory_Release( 57 | IN IClassFactory *This) 58 | { 59 | return 1; 60 | } 61 | 62 | HRESULT STDMETHODCALLTYPE CClassFactory_CreateInstance( 63 | IN IClassFactory *This, 64 | IN IUnknown *OuterIUnknown OPTIONAL, 65 | IN REFIID RefIID, 66 | OUT PPVOID ObjectOut) 67 | { 68 | IKexShlEx *CKexShlEx; 69 | 70 | ASSERT (This != NULL); 71 | ASSERT (RefIID != NULL); 72 | ASSERT (ObjectOut != NULL); 73 | 74 | if (OuterIUnknown) { 75 | return CLASS_E_NOAGGREGATION; 76 | } 77 | 78 | CKexShlEx = SafeAlloc(IKexShlEx, 1); 79 | if (!CKexShlEx) { 80 | return E_OUTOFMEMORY; 81 | } 82 | 83 | InterlockedIncrement(&DllReferenceCount); 84 | CopyMemory(CKexShlEx, &IKexShlExTemplate, sizeof(IKexShlExTemplate)); 85 | return CKexShlEx_QueryInterface(CKexShlEx, RefIID, ObjectOut); 86 | } 87 | 88 | HRESULT STDMETHODCALLTYPE CClassFactory_LockServer( 89 | IN IClassFactory *This, 90 | IN BOOL Lock) 91 | { 92 | return E_NOTIMPL; 93 | } -------------------------------------------------------------------------------- /KexShlEx/lnkfile.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "KexShlEx.h" 3 | #include 4 | 5 | // 6 | // FileName must be MAX_PATH characters in size. 7 | // 8 | HRESULT GetTargetFromLnkfile( 9 | IN OUT PWSTR FileName) 10 | { 11 | HRESULT Result; 12 | WCHAR LnkTarget[MAX_PATH]; 13 | IShellLink *ShellLink; 14 | IPersistFile *PersistFile; 15 | 16 | ShellLink = NULL; 17 | PersistFile = NULL; 18 | 19 | ASSERT (FileName != NULL); 20 | 21 | Result = CoCreateInstance( 22 | &CLSID_ShellLink, 23 | NULL, 24 | CLSCTX_INPROC_SERVER, 25 | &IID_IShellLink, 26 | (PPVOID) &ShellLink); 27 | 28 | ASSERT (SUCCEEDED(Result)); 29 | ASSERT (ShellLink != NULL); 30 | 31 | if (FAILED(Result)) { 32 | return Result; 33 | } 34 | 35 | try { 36 | Result = IShellLinkW_QueryInterface( 37 | ShellLink, 38 | &IID_IPersistFile, 39 | (PPVOID) &PersistFile); 40 | 41 | ASSERT (SUCCEEDED(Result)); 42 | ASSERT (PersistFile != NULL); 43 | 44 | if (FAILED(Result)) { 45 | leave; 46 | } 47 | 48 | Result = IPersistFile_Load(PersistFile, FileName, STGM_READ); 49 | ASSERT (SUCCEEDED(Result)); 50 | 51 | if (FAILED(Result)) { 52 | leave; 53 | } 54 | 55 | Result = IShellLinkW_Resolve( 56 | ShellLink, 57 | NULL, 58 | SLR_NOTRACK | SLR_NOSEARCH | SLR_NO_UI | SLR_NOUPDATE); 59 | 60 | if (FAILED(Result)) { 61 | leave; 62 | } 63 | 64 | Result = IShellLinkW_GetPath( 65 | ShellLink, 66 | LnkTarget, 67 | ARRAYSIZE(LnkTarget), 68 | NULL, 69 | SLGP_UNCPRIORITY); 70 | 71 | if (FAILED(Result)) { 72 | leave; 73 | } 74 | } finally { 75 | SafeRelease(ShellLink); 76 | SafeRelease(PersistFile); 77 | } 78 | 79 | if (SUCCEEDED(Result)) { 80 | Result = StringCchCopy(FileName, MAX_PATH, LnkTarget); 81 | ASSERT (SUCCEEDED(Result)); 82 | } else { 83 | FileName[0] = '\0'; 84 | } 85 | 86 | return Result; 87 | } -------------------------------------------------------------------------------- /KexShlEx/resource.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define IDSTATIC -1 4 | #define IDD_VXKEXPROPSHEETPAGE 101 5 | 6 | #define IDUSEVXKEX 110 7 | #define IDSPOOFVERSIONCHECK 111 8 | #define IDWINVERCOMBOBOX 112 9 | #define IDSTRONGSPOOF 114 10 | #define IDDISABLEFORCHILD 115 11 | #define IDDISABLEAPPSPECIFIC 116 12 | 13 | #define IDREPORTBUG 130 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /KexW32ML/KexW32ML.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | 32 | 33 | Header Files 34 | 35 | 36 | Header Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /KexW32ML/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #define NOGDICAPMASKS 5 | #define NOVIRTUALKEYCODES 6 | #define NOWINMESSAGES 7 | #define NOWINSTYLES 8 | #define NOSYSMETRICS 9 | #define NOMENUS 10 | #define NOICONS 11 | #define NOKEYSTATES 12 | #define NOSYSCOMMANDS 13 | #define NORASTEROPS 14 | #define NOSHOWWINDOW 15 | #define NOATOM 16 | #define NOCLIPBOARD 17 | #define NOCOLOR 18 | #define NOCTLMGR 19 | #define NODRAWTEXT 20 | #define NOGDI 21 | #define NOMB 22 | #define NOMEMMGR 23 | #define NOOPENFILE 24 | #define NOSCROLL 25 | #define NOTEXTMETRIC 26 | #define NOWH 27 | #define NOWINOFFSETS 28 | #define NOCOMM 29 | #define NOKANJI 30 | #define NOHELP 31 | #define NOPROFILER 32 | #define NODEFERWINDOWPOS 33 | #define NOMCX 34 | #define NOCRYPT 35 | #define NOMETAFILE 36 | #define NOSERVICE 37 | #define NOSOUND 38 | 39 | #pragma comment(lib, "advapi32") 40 | 41 | #define KW32MLDECLSPEC 42 | #define KEX_TARGET_TYPE_LIB 43 | -------------------------------------------------------------------------------- /KexW32ML/file.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | #include 4 | 5 | KW32MLDECLSPEC EXTERN_C BOOLEAN KW32MLAPI SupersedeFile( 6 | IN PCWSTR SourceFile, 7 | IN PCWSTR TargetFile, 8 | IN HANDLE TransactionHandle OPTIONAL) 9 | { 10 | BOOLEAN Success; 11 | HANDLE ExistingTransaction; 12 | 13 | ExistingTransaction = RtlGetCurrentTransaction(); 14 | 15 | if (ExistingTransaction) { 16 | RtlSetCurrentTransaction(NULL); 17 | } 18 | 19 | if (TransactionHandle) { 20 | Success = MoveFileTransacted( 21 | SourceFile, 22 | TargetFile, 23 | NULL, 24 | NULL, 25 | MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED, 26 | TransactionHandle); 27 | } else { 28 | Success = MoveFileEx( 29 | SourceFile, 30 | TargetFile, 31 | MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED); 32 | } 33 | 34 | if (!Success) { 35 | ULONG RandomIdentifier; 36 | WCHAR ExistingTargetNewName[MAX_PATH]; 37 | 38 | // try to rename the old file to .old_xxxx 39 | RandomIdentifier = GetTickCount(); 40 | 41 | StringCchPrintf( 42 | ExistingTargetNewName, 43 | ARRAYSIZE(ExistingTargetNewName), 44 | L"%s.old_%04u", TargetFile, RandomIdentifier); 45 | 46 | if (TransactionHandle) { 47 | Success = MoveFileTransacted( 48 | TargetFile, 49 | ExistingTargetNewName, 50 | NULL, 51 | NULL, 52 | 0, 53 | TransactionHandle); 54 | } else { 55 | Success = MoveFile(TargetFile, ExistingTargetNewName); 56 | } 57 | 58 | if (Success) { 59 | // schedule the old file to be deleted later 60 | 61 | if (TransactionHandle) { 62 | MoveFileTransacted( 63 | ExistingTargetNewName, 64 | NULL, 65 | NULL, 66 | NULL, 67 | MOVEFILE_DELAY_UNTIL_REBOOT, 68 | TransactionHandle); 69 | } else { 70 | MoveFileEx( 71 | ExistingTargetNewName, 72 | NULL, 73 | MOVEFILE_DELAY_UNTIL_REBOOT); 74 | } 75 | 76 | // move the new file into the old position 77 | if (TransactionHandle) { 78 | Success = MoveFileTransacted( 79 | SourceFile, 80 | TargetFile, 81 | NULL, 82 | NULL, 83 | MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED, 84 | TransactionHandle); 85 | } else { 86 | Success = MoveFileEx( 87 | SourceFile, 88 | TargetFile, 89 | MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED); 90 | } 91 | } 92 | } 93 | 94 | if (ExistingTransaction) { 95 | RtlSetCurrentTransaction(ExistingTransaction); 96 | } 97 | 98 | return Success; 99 | } -------------------------------------------------------------------------------- /KexW32ML/txapi.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | #include 4 | 5 | KW32MLDECLSPEC HANDLE KW32MLAPI CreateSimpleTransaction( 6 | IN PCWSTR Description OPTIONAL) 7 | { 8 | NTSTATUS Status; 9 | HANDLE TransactionHandle; 10 | UNICODE_STRING DescriptionUS; 11 | 12 | if (Description) { 13 | Status = RtlInitUnicodeStringEx(&DescriptionUS, Description); 14 | ASSERT (NT_SUCCESS(Status)); 15 | 16 | if (!NT_SUCCESS(Status)) { 17 | SetLastError(RtlNtStatusToDosError(Status)); 18 | return NULL; 19 | } 20 | } 21 | 22 | Status = NtCreateTransaction( 23 | &TransactionHandle, 24 | TRANSACTION_ALL_ACCESS, 25 | NULL, 26 | NULL, 27 | NULL, 28 | 0, 29 | 0, 30 | 0, 31 | NULL, 32 | Description ? &DescriptionUS : NULL); 33 | 34 | ASSERT (NT_SUCCESS(Status)); 35 | 36 | if (!NT_SUCCESS(Status)) { 37 | SetLastError(RtlNtStatusToDosError(Status)); 38 | return NULL; 39 | } 40 | 41 | ASSERT (TransactionHandle != NULL); 42 | return TransactionHandle; 43 | } -------------------------------------------------------------------------------- /KxCfgHlp/KxCfgHlp.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | Source Files 50 | 51 | 52 | Source Files 53 | 54 | 55 | 56 | 57 | Header Files 58 | 59 | 60 | Header Files 61 | 62 | 63 | -------------------------------------------------------------------------------- /KxCfgHlp/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #pragma comment(lib, "advapi32.lib") 4 | #pragma comment(lib, "oleaut32.lib") 5 | #pragma comment(lib, "taskschd.lib") 6 | 7 | #define KEX_COMPONENT L"KxCfgHlp" 8 | #define KEX_ENV_WIN32 9 | #define KEX_TARGET_TYPE_LIB 10 | #define KXCFGDECLSPEC 11 | -------------------------------------------------------------------------------- /KxCfgHlp/kexdir.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // kexdir.c 6 | // 7 | // Abstract: 8 | // 9 | // Contains functions for querying KexDir. 10 | // 11 | // Author: 12 | // 13 | // vxiiduu (02-Feb-2024) 14 | // 15 | // Environment: 16 | // 17 | // Win32 mode. This code must be able to run without KexDll, as it is used 18 | // in KexSetup. This code must function properly when run under WOW64. 19 | // 20 | // Revision History: 21 | // 22 | // vxiiduu 02-Feb-2024 Initial creation. 23 | // 24 | /////////////////////////////////////////////////////////////////////////////// 25 | 26 | #include "buildcfg.h" 27 | #include 28 | #include 29 | #include 30 | 31 | KXCFGDECLSPEC BOOLEAN KXCFGAPI KxCfgGetKexDir( 32 | OUT PWSTR Buffer, 33 | IN ULONG BufferCch) 34 | { 35 | HKEY VxKexKeyHandle; 36 | ULONG ErrorCode; 37 | 38 | ASSERT (Buffer != NULL); 39 | ASSERT (BufferCch != 0); 40 | 41 | Buffer[0] = '\0'; 42 | 43 | VxKexKeyHandle = KxCfgOpenVxKexRegistryKey( 44 | FALSE, 45 | KEY_READ, 46 | NULL); 47 | 48 | if (!VxKexKeyHandle) { 49 | VxKexKeyHandle = KxCfgOpenLegacyVxKexRegistryKey( 50 | FALSE, 51 | KEY_READ, 52 | NULL); 53 | 54 | if (!VxKexKeyHandle) { 55 | return FALSE; 56 | } 57 | } 58 | 59 | ErrorCode = RegReadString(VxKexKeyHandle, NULL, L"KexDir", Buffer, BufferCch); 60 | RegCloseKey(VxKexKeyHandle); 61 | 62 | if (ErrorCode != ERROR_SUCCESS) { 63 | SetLastError(ErrorCode); 64 | return FALSE; 65 | } 66 | 67 | ASSERT (!PathIsRelative(Buffer)); 68 | if (PathIsRelative(Buffer)) { 69 | SetLastError(ERROR_INVALID_DATA); 70 | return FALSE; 71 | } 72 | 73 | return TRUE; 74 | } -------------------------------------------------------------------------------- /KxCfgHlp/msisup.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | 4 | KXCFGDECLSPEC BOOLEAN WINAPI KxCfgEnableVxKexForMsiexec( 5 | IN BOOLEAN Enable, 6 | IN HANDLE TransactionHandle OPTIONAL) 7 | { 8 | WCHAR MsiexecPath[MAX_PATH]; 9 | 10 | GetSystemDirectory(MsiexecPath, ARRAYSIZE(MsiexecPath)); 11 | PathCchAppend(MsiexecPath, ARRAYSIZE(MsiexecPath), L"msiexec.exe"); 12 | 13 | if (Enable) { 14 | KXCFG_PROGRAM_CONFIGURATION MsiexecConfiguration; 15 | 16 | RtlZeroMemory(&MsiexecConfiguration, sizeof(MsiexecConfiguration)); 17 | MsiexecConfiguration.Enabled = TRUE; 18 | 19 | return KxCfgSetConfiguration(MsiexecPath, &MsiexecConfiguration, TransactionHandle); 20 | } else { 21 | return KxCfgDeleteConfiguration(MsiexecPath, TransactionHandle); 22 | } 23 | } 24 | 25 | KXCFGDECLSPEC BOOLEAN WINAPI KxCfgQueryVxKexEnabledForMsiexec( 26 | VOID) 27 | { 28 | BOOLEAN Success; 29 | WCHAR MsiexecPath[MAX_PATH]; 30 | KXCFG_PROGRAM_CONFIGURATION MsiexecConfiguration; 31 | 32 | GetSystemDirectory(MsiexecPath, ARRAYSIZE(MsiexecPath)); 33 | PathCchAppend(MsiexecPath, ARRAYSIZE(MsiexecPath), L"msiexec.exe"); 34 | 35 | Success = KxCfgGetConfiguration(MsiexecPath, &MsiexecConfiguration); 36 | 37 | if (!Success || !MsiexecConfiguration.Enabled) { 38 | return FALSE; 39 | } 40 | 41 | return TRUE; 42 | } -------------------------------------------------------------------------------- /KxCfgHlp/openkey.c: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Module Name: 4 | // 5 | // openkey.c 6 | // 7 | // Abstract: 8 | // 9 | // Contains functions for opening the VxKex HKLM/HKCU key. 10 | // 11 | // Author: 12 | // 13 | // vxiiduu (02-Feb-2024) 14 | // 15 | // Environment: 16 | // 17 | // Win32 mode. This code must be able to run without KexDll, as it is used 18 | // in KexSetup. This code must function properly when run under WOW64. 19 | // 20 | // Revision History: 21 | // 22 | // vxiiduu 02-Feb-2024 Initial creation. 23 | // 24 | /////////////////////////////////////////////////////////////////////////////// 25 | 26 | #include "buildcfg.h" 27 | #include 28 | #include 29 | 30 | // 31 | // Open the HKLM or HKCU VxKex key. 32 | // This function does not allow WOW64 redirection. 33 | // Returns NULL on failure. Call GetLastError for more information. 34 | // 35 | KXCFGDECLSPEC HKEY KXCFGAPI KxCfgOpenVxKexRegistryKey( 36 | IN BOOLEAN PerUserKey, 37 | IN ACCESS_MASK DesiredAccess, 38 | IN HANDLE TransactionHandle OPTIONAL) 39 | { 40 | return KxCfgpOpenKey( 41 | PerUserKey ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE, 42 | L"Software\\VXsoft\\VxKex", 43 | DesiredAccess, 44 | TransactionHandle); 45 | } 46 | 47 | // 48 | // Open the legacy, pre-rewrite VxKex key. 49 | // This function does not allow WOW64 redirection. 50 | // Returns NULL on failure. Call GetLastError for more information. 51 | // 52 | KXCFGDECLSPEC HKEY KXCFGAPI KxCfgOpenLegacyVxKexRegistryKey( 53 | IN BOOLEAN PerUserKey, 54 | IN ACCESS_MASK DesiredAccess, 55 | IN HANDLE TransactionHandle OPTIONAL) 56 | { 57 | return KxCfgpOpenKey( 58 | PerUserKey ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE, 59 | L"Software\\VXsoft\\VxKexLdr", 60 | DesiredAccess, 61 | TransactionHandle); 62 | } -------------------------------------------------------------------------------- /VxKex.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/VxKex.suo -------------------------------------------------------------------------------- /VxKexLdr.opensdf: -------------------------------------------------------------------------------- 1 | vxiiduuIVYBRIDGE -------------------------------------------------------------------------------- /VxKexLdr/VxKexLdr.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/VxKexLdr/VxKexLdr.rc -------------------------------------------------------------------------------- /VxKexLdr/VxKexLdr.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | 29 | 30 | Resource Files 31 | 32 | 33 | 34 | 35 | Header Files 36 | 37 | 38 | Header Files 39 | 40 | 41 | Header Files 42 | 43 | 44 | -------------------------------------------------------------------------------- /VxKexLdr/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define FRIENDLYAPPNAME L"VxKex Loader" 4 | #define KEX_TARGET_TYPE_EXE 5 | #define KEX_ENV_WIN32 6 | #define KEX_COMPONENT L"VxKexLdr" 7 | -------------------------------------------------------------------------------- /VxKexLdr/resource.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define IDSTATIC -1 4 | 5 | #define IDI_APPICON 501 6 | 7 | #define IDD_MAINWINDOW 100 8 | #define IDC_FILEPATH 101 9 | #define IDC_BROWSE 102 10 | #define IDC_ARGUMENTS 103 11 | #define IDC_MOREOPTIONS 104 12 | 13 | #define IDD_MOREOPTIONS 200 14 | #define IDC_ENABLESPOOF 201 15 | #define IDC_WINVER 202 16 | #define IDC_STRONGSPOOF 203 17 | #define IDC_DISABLEASH 204 18 | #define IDC_DISABLEFORCHILD 205 19 | -------------------------------------------------------------------------------- /VxKexLdr/vxkexldr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "resource.h" 5 | 6 | BOOLEAN VklCreateProcess( 7 | IN PCWSTR Path, 8 | IN PCWSTR Arguments OPTIONAL); 9 | 10 | INT_PTR CALLBACK VklDialogProc( 11 | IN HWND Window, 12 | IN UINT Message, 13 | IN WPARAM WParam, 14 | IN LPARAM LParam); -------------------------------------------------------------------------------- /VxKexLdr/vxkexldr.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/VxKexLdr/vxkexldr.ico -------------------------------------------------------------------------------- /VxlView/VxlView.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/VxlView/VxlView.rc -------------------------------------------------------------------------------- /VxlView/backendp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // 4 | // Private header file for the backend. 5 | // 6 | 7 | typedef struct { 8 | VXLHANDLE LogHandle; 9 | PPLOGENTRYCACHEENTRY LogEntryCache; // Array of pointers to LOGENTRYCACHEENTRY structures. Some of the 10 | // pointers may be NULL. The following condition holds: 11 | // if (LogEntryCache) { 12 | // DefHeapSize(LogEntryCache) / sizeof(PLOGENTRYCACHEENTRY) == NumberOfLogEntries; 13 | // } 14 | BACKENDFILTERS Filters; 15 | ULONG EstimatedNumberOfFilteredLogEntries; 16 | PULONG FilteredLookupCache; // display entry -> cache entry lookup table 17 | 18 | ULONG NumberOfLogEntries; // number of log entries in the file 19 | ULONG FilteredNumberOfLogEntries; // number of log entries that are displayed by the user's filter selection 20 | } BACKENDSTATE, *PBACKENDSTATE, **PPBACKENDSTATE, *CONST PCBACKENDSTATE, **CONST PPCBACKENDSTATE; 21 | 22 | // 23 | // Global variables, defined in backend.c 24 | // 25 | extern PBACKENDSTATE State; 26 | 27 | // 28 | // Private functions, defined in backendp.c 29 | // 30 | NTSTATUS NTAPI ExportLogThreadProc( 31 | IN PVOID Parameter); 32 | VOID PopulateSourceComponents( 33 | IN VXLHANDLE LogHandle); 34 | PLOGENTRYCACHEENTRY GetLogEntryRaw( 35 | IN ULONG EntryIndex); 36 | PLOGENTRYCACHEENTRY AddLogEntryToCache( 37 | IN ULONG EntryIndex, 38 | IN PVXLLOGENTRY LogEntry); 39 | VOID RebuildFilterCache( 40 | VOID); 41 | BOOLEAN LogEntryMatchesFilters( 42 | IN PLOGENTRYCACHEENTRY CacheEntry); -------------------------------------------------------------------------------- /VxlView/buildcfg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define NOGDICAPMASKS 4 | #define NOVIRTUALKEYCODES 5 | #define NOKEYSTATES 6 | #define NOSYSCOMMANDS 7 | #define NORASTEROPS 8 | #define NOATOM 9 | #define NODRAWTEXT 10 | #define NOMB 11 | #define NOMEMMGR 12 | #define NOOPENFILE 13 | #define NOSCROLL 14 | #define NOTEXTMETRIC 15 | #define NOWH 16 | #define NOCOMM 17 | #define NOKANJI 18 | #define NOHELP 19 | #define NOPROFILER 20 | #define NODEFERWINDOWPOS 21 | #define NOMCX 22 | #define NOCRYPT 23 | #define NOMETAFILE 24 | #define NOSERVICE 25 | #define NOSOUND 26 | 27 | // 28 | // Set to TRUE if you want VxlView to immediately prompt for a file if started 29 | // with no command-line arguments. 30 | // 31 | #define PROMPT_FOR_FILE_ON_STARTUP TRUE 32 | 33 | #pragma comment(lib, "shell32.lib") 34 | #pragma comment(lib, "uxtheme.lib") 35 | 36 | #define KEX_COMPONENT L"VxlView" 37 | #define KEX_TARGET_TYPE_EXE 38 | #define KEX_ENV_WIN32 39 | #define FRIENDLYAPPNAME L"Log Viewer" 40 | -------------------------------------------------------------------------------- /VxlView/globals.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include 3 | 4 | // 5 | // These are defined normally here but in the header file they are externed 6 | // as CONST. This is to prevent them from being edited by random code by 7 | // accident. 8 | // 9 | HWND MainWindow = NULL; 10 | HWND ListViewWindow = NULL; 11 | HWND StatusBarWindow = NULL; 12 | HWND DetailsWindow = NULL; 13 | HWND FilterWindow = NULL; -------------------------------------------------------------------------------- /VxlView/goto.c: -------------------------------------------------------------------------------- 1 | #include "buildcfg.h" 2 | #include "vxlview.h" 3 | 4 | INT_PTR CALLBACK GotoRawDlgProc( 5 | IN HWND Window, 6 | IN UINT Message, 7 | IN WPARAM WParam, 8 | IN LPARAM LParam) 9 | { 10 | if (Message == WM_INITDIALOG) { 11 | CenterWindow(Window, MainWindow); 12 | SendMessage(GetDlgItem(Window, scr1), UDM_SETRANGE32, 1, INT_MAX); 13 | Edit_LimitText(GetDlgItem(Window, edt1), 10); 14 | SetDlgItemInt(Window, edt1, 1, FALSE); 15 | } else if (Message == WM_COMMAND) { 16 | ULONG ControlId; 17 | 18 | ControlId = GET_WM_COMMAND_ID(WParam, LParam); 19 | 20 | if (ControlId == IDOK) { 21 | BOOL SuccessfulConversion; 22 | ULONG RawItemIndex; 23 | ULONG ItemIndex; 24 | 25 | ItemIndex = (ULONG) -1; 26 | RawItemIndex = GetDlgItemInt(Window, edt1, &SuccessfulConversion, FALSE); 27 | 28 | if (RawItemIndex > 0) { 29 | --RawItemIndex; 30 | } 31 | 32 | if (SuccessfulConversion) { 33 | ItemIndex = GetLogEntryIndexFromRawIndex(RawItemIndex); 34 | } 35 | 36 | if (ItemIndex == (ULONG) -1) { 37 | EDITBALLOONTIP BalloonTip; 38 | 39 | BalloonTip.cbStruct = sizeof(BalloonTip); 40 | BalloonTip.pszTitle = L"Invalid Item Number"; 41 | BalloonTip.pszText = L"The item number you entered was either out of range " 42 | L"or not displayed by the current set of filters you have " 43 | L"selected."; 44 | BalloonTip.ttiIcon = TTI_NONE; 45 | 46 | Edit_ShowBalloonTip(GetDlgItem(Window, edt1), &BalloonTip); 47 | } else { 48 | SelectListViewItemByIndex(ItemIndex); 49 | EndDialog(Window, IDOK); 50 | } 51 | } else if (ControlId == IDCANCEL) { 52 | PostMessage(Window, WM_CLOSE, 0, 0); 53 | } 54 | } else if (Message == WM_CLOSE) { 55 | EndDialog(Window, IDCANCEL); 56 | } else { 57 | return FALSE; 58 | } 59 | 60 | return TRUE; 61 | } -------------------------------------------------------------------------------- /VxlView/helpabout.c: -------------------------------------------------------------------------------- 1 | #include "vxlview.h" 2 | #include "resource.h" 3 | 4 | INT_PTR CALLBACK AboutWndProc( 5 | IN HWND AboutWindow, 6 | IN UINT Message, 7 | IN WPARAM WParam, 8 | IN LPARAM LParam) 9 | { 10 | if (Message == WM_INITDIALOG) { 11 | CenterWindow(AboutWindow, MainWindow); 12 | } else if (Message == WM_CLOSE || Message == WM_COMMAND) { 13 | EndDialog(AboutWindow, 0); 14 | } else if (Message == WM_NOTIFY) { 15 | LPNMHDR Notification = (LPNMHDR) LParam; 16 | 17 | if (Notification->idFrom == IDC_WEBSITELINK && Notification->code == NM_CLICK || Notification->code == NM_RETURN) { 18 | ShellExecute(AboutWindow, L"open", L"https://github.com/vxiiduu/VxKex", NULL, NULL, SW_SHOWNORMAL); 19 | } 20 | } else { 21 | return FALSE; 22 | } 23 | 24 | return TRUE; 25 | } -------------------------------------------------------------------------------- /VxlView/resource.h: -------------------------------------------------------------------------------- 1 | #define IDD_MAINWND 101 2 | #define IDC_LISTVIEW 102 3 | #define IDC_STATUSBAR 103 4 | 5 | #define IDD_FILTERS 108 6 | #define IDC_GBFILTERSEVERITY 109 7 | #define IDC_CBFILTERCRITICAL 110 8 | #define IDC_CBFILTERERROR 111 9 | #define IDC_CBFILTERWARNING 112 10 | #define IDC_CBFILTERINFORMATION 113 11 | #define IDC_CBFILTERDETAIL 114 12 | #define IDC_CBFILTERDEBUG 115 13 | 14 | #define IDC_GBFILTERTEXT 120 15 | #define IDC_SEARCHBOX 121 16 | #define IDC_CBCASESENSITIVE 122 17 | #define IDC_CBWILDCARD 123 18 | #define IDC_CBINVERTSEARCH 124 19 | #define IDC_CBEXACTMATCH 125 20 | #define IDC_CBSEARCHWHOLE 126 21 | 22 | #define IDC_GBFILTERCOMPONENT 130 23 | #define IDC_COMPONENTLIST 131 24 | 25 | #define IDD_DETAILS 150 26 | #define IDC_GBDETAILSBORDER 151 27 | #define IDC_DETAILSMESSAGETEXT 152 28 | #define IDC_DETAILSSEVERITYTEXT 153 29 | #define IDC_DETAILSDATETIMETEXT 154 30 | #define IDC_DETAILSSOURCETEXT 155 31 | 32 | #define IDD_ABOUT 160 33 | #define IDC_WEBSITELINK 161 34 | 35 | #define IDD_GOTORAW 170 36 | 37 | #define IDM_MAINMENU 201 38 | #define M_OPEN 202 39 | #define M_EXPORT 203 40 | #define M_EXIT 204 41 | #define M_COLUMNS 211 42 | #define M_ABOUT 221 43 | #define M_FIND 230 44 | #define M_GOTORAW 231 45 | 46 | #define IDM_COMPONENTLISTMENU 250 47 | #define M_SELECTALL 251 48 | #define M_SELECTNONE 252 49 | 50 | #define IDM_LISTVIEWMENU 260 51 | #define M_COPY 261 52 | #define M_COPYLONG 262 53 | 54 | #define IDA_ACCELERATORS 300 55 | 56 | #define IDI_APPICON 501 57 | #define IDI_FILEICON 502 58 | -------------------------------------------------------------------------------- /VxlView/statusbar.c: -------------------------------------------------------------------------------- 1 | #include "vxlview.h" 2 | #include "resource.h" 3 | 4 | VOID ResizeStatusBar( 5 | IN ULONG MainWindowNewWidth) 6 | { 7 | INT StatusBarPartWidths[2]; 8 | 9 | // tell the status bar window to correctly size itself 10 | SendMessage(StatusBarWindow, WM_SIZE, 0, 0); 11 | 12 | // resize statusbar parts 13 | StatusBarPartWidths[0] = (MainWindowNewWidth * 70) / 100; // 70% 14 | StatusBarPartWidths[1] = -1; 15 | SendMessage(StatusBarWindow, SB_SETPARTS, ARRAYSIZE(StatusBarPartWidths), (LPARAM) StatusBarPartWidths); 16 | } -------------------------------------------------------------------------------- /VxlView/vxlfile.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/VxlView/vxlfile.ico -------------------------------------------------------------------------------- /VxlView/vxlview.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/VxlView/vxlview.ico -------------------------------------------------------------------------------- /example-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i486/VxKex/f23526289b4a92e72bd0c529d0d51a2bf0350897/example-screenshot.png --------------------------------------------------------------------------------