Windows Server 2003 (NT 5.2.3790.0) build guide
Windows 10 Compatibility for Windows XP/2003 - extras for KERNEL32.DLL
Implementation of some KERNEL32.DLL functions, available in Windows versions released after Windows XP/2003, to get software to that is compatible with Windows 2003R2/Vista/2008/2008R2/7/8/8.1/2016/10/2019 to run in Windows XP/2003.
The current implementation of C code compiles and links fine with the existing KERNEL32.DLL code, but is a work in progress.
Function | Status | Functionality | Last updated |
---|---|---|---|
RunOnceExecuteOnce | Implemented | redirected to NTDLL.DLL | 2020/12/02 |
RunOnceComplete | Implemented | redirected to NTDLL.DLL | 2020/12/02 |
InitializeConditionVariable | Implemented | redirected to NTDLL.DLL | 2020/12/01 |
AcquireSRWLockExclusive | Implemented | redirected to NTDLL.DLL | 2020/12/01 |
AcquireSRWLockShared | Implemented | redirected to NTDLL.DLL | 2020/12/01 |
TryAcquireSRWLockExclusive | Implemented | redirected to NTDLL.DLL | 2020/12/01 |
ReleaseSRWLockExclusive | Implemented | redirected to NTDLL.DLL | 2020/12/01 |
ReleaseSRWLockShared | Implemented | redirected to NTDLL.DLL | 2020/12/01 |
InitializeSRWLock | Implemented | redirected to NTDLL.DLL | 2020/12/01 |
InitializeCriticalSectionEx | Implemented | redirected to NTDLL.DLL | 2020/12/01 |
WakeConditionVariable | Implemented | redirected to NTDLL.DLL | 2020/12/01 |
WakeAllConditionVariable | Implemented | redirected to NTDLL.DLL | 2020/12/01 |
InitializeConditionVariable | Implemented | redirected to NTDLL.DLL | 2020/12/01 |
SetErrorMode | Implemented | Microsoft - already available in code, just added | 2020/11/28 |
GetErrorMode | Implemented | Microsoft - already available in code, just added | 2020/11/28 |
InitOnceExecuteOnce | Missing | Needed by explorer.exe | 2020/11/24 |
DecodePointer | Tested | redirected to NTDLL.DLL, see kernel32-obfuscated-pointers | 2020/11/28 |
EncodePointer | Tested | redirected to in NTDLL.DLL, see kernel32-obfuscated-pointers | 2020/11/28 |
GetFinalPathNameByHandleA | Tested | mofeyi implementation for VOLUME_NAME_NT VOLUME_NAME_DOS VOLUME_NAME_GUID VOLUME_NAME_NONE flags | 2020/11/28 |
GetFinalPathNameByHandleW | Tested | mofeyi implementation for VOLUME_NAME_NT VOLUME_NAME_DOS VOLUME_NAME_GUID VOLUME_NAME_NONE flags | 2020/11/28 |
GetTickCount64 | Tested | old Wine | 2020/11/24 |
InitOnceExecuteOnce | Missing | Needed by explorer.exe | 2020/11/24 |
InitOnceBeginInitialize | Missing | Needed by explorer.exe | 2020/11/24 |
InitOnceExecuteOnce | Missing | Needed by explorer.exe | 2020/11/24 |
InitOnceComplete | Missing | Needed by explorer.exe | 2020/11/24 |
GetSystemTimePreciseAsFileTime | Missing | Needed by explorer.exe | 2020/11/24 |
CopyFile2 | Missing | Needed by explorer.exe | 2020/11/24 |
GetLocaleInfoEx | Missing | Needed by explorer.exe | 2020/11/24 |
LCMapStringEx | Missing | Needed by explorer.exe | 2020/11/24 |
SubmitThreadpoolWork | Missing | Needed by explorer.exe | 2020/11/24 |
CreateThreadpoolWork | Missing | Needed by explorer.exe | 2020/11/24 |
FreeLibraryWhenCallbackReturns | Missing | Needed by explorer.exe | 2020/11/24 |
CloseThreadpoolWork | Missing | Needed by explorer.exe | 2020/11/24 |
CheckElevationEnabled | Missing | Needed by explorer.exe | 2020/11/24 |
CheckElevation | Missing | Needed by explorer.exe | 2020/11/24 |
CreateThreadpoolWork | Missing | Needed by explorer.exe | 2020/11/24 |
CreateThreadpoolWait | Missing | Needed by explorer.exe | 2020/11/24 |
SubmitThreadpoolWork | Missing | Needed by explorer.exe | 2020/11/24 |
WaitForThreadpoolWaitCallbacks | Missing | Needed by explorer.exe | 2020/11/24 |
CloseThreadpoolWait | Missing | Needed by explorer.exe | 2020/11/24 |
SetThreadpoolWait | Missing | Needed by explorer.exe | 2020/11/24 |
GetThreadUILanguage | Missing | Needed by explorer.exe | 2020/11/24 |
GetProcessMitigationPolicy | Missing | Needed by explorer.exe | 2020/11/24 |
GetDateFormatEx | Missing | Needed by explorer.exe | 2020/11/24 |
GetTimeFormatEx | Missing | Needed by explorer.exe | 2020/11/24 |
SHExpandEnvironmentStringsW | Missing | Needed by explorer.exe | 2020/11/24 |
GetProductInfo | Missing | Needed by explorer.exe | 2020/11/24 |
GetOsSafeBootMode | Missing | Needed by explorer.exe | 2020/11/24 |
GetDynamicTimeZoneInformation | Missing | Needed by explorer.exe | 2020/11/24 |
SetProcessDEPPolicy | Missing | Needed by explorer.exe | 2020/11/24 |
PowerCreateRequest | Missing | Needed by explorer.exe | 2020/11/24 |
PowerSetRequest | Missing | Needed by explorer.exe | 2020/11/24 |
CreateSymbolicLinkW | Implemented | Redirected to CreateHardLinkW - untested | 2020/11/24 |
InitializeProcThreadAttributeList | Implemented | Wine - untested | 2020/11/24 |
UpdateProcThreadAttributeList | Implemented | Wine - untested | 2020/11/24 |
DeleteProcThreadAttributeList | Implemented | Wine - untested | 2020/11/24 |
GetActiveProcessorCount | Implemented | Using GetNativeSystemInfo & dwNumberOfProcessors - suggested 4chan anon »78840134 -basic - 1 group of n processors - untested | 2020/11/24 |
GetLogicalProcessorInformationEx | need implementation | returns empty structure | 2020/11/23 |
CreateMutexExA | Implemented | Wine - untested | 2020/11/21 |
CreateMutexExW | Implemented | Wine - untested | 2020/11/21 |
CreateEventExW | Implemented | Wine - untested | 2020/11/21 |
CreateSemaphoreExW | Implemented | Wine - untested | 2020/11/21 |
CreateThreadpoolTimer | Implemented | Wine - untested | 2020/11/21 |
VirtualProtect | Implemented | Wine - untested | 2020/11/22 |
VirtualProtectEx | Implemented | Wine - untested | 2020/11/22 |
CompareStringEx | Implemented | Wine & wcscmp - untested | 2020/11/22 |
CompareStringOrdinal | Implemented | Wine & wcscmp - untested | 2020/11/22 |
FindNLSString | Implemented | Wine & wcscmp - untested | 2020/11/22 |
FindNLSStringEx | Implemented | Wine & wcscmp - untested | 2020/11/22 |
FindStringOrdinal | Implemented | Wine & wcscmp - untested | 2020/11/22 |
LocaleNameToLCID | Implemented | using GetLcidFromRfc1766 & SysAllocString - untested, need to get rid of LoadLibrary & GetProcAddress | 2020/11/22 |
LCIDToLocaleName | Implemented | using GetLocaleInfoW - untested | 2020/11/22 |
IsValidLocaleName | Implemented | Wine - untested | 2020/11/22 |
QueryFullProcessImageNameA | Implemented | Wine - untested | 2020/11/22 |
QueryFullProcessImageNameW | Implemented | Wine - untested | 2020/11/22 |
RegisterApplicationRestart | Implemented | Stub returning S_OK | 2020/11/21 |
ApplicationRecoveryInProgress | Implemented | Stub returning S_OK | 2020/11/21 |
ApplicationRecoveryFinished | Implemented | Stub returning S_OK | 2020/11/21 |
RegisterApplicationRecoveryCallback | Implemented | Stub returning S_OK | 2020/11/21 |
UnregisterApplicationRecoveryCallback | Implemented | Stub returning S_OK | 2020/11/21 |
CreateThreadpoolTimer | Implemented | Wine - untested | 2020/11/21 |
SetThreadpoolTimer | Implemented | Wine - untested | 2020/11/21 |
CloseThreadpoolTimer | Implemented | Wine - untested | 2020/11/21 |
WaitForThreadpoolTimerCallbacks | Implemented | Wine - untested | 2020/11/21 |
ResolveDelayLoadedAPI | Implemented | Wine - untested | 2020/11/21 |
GetFileInformationByHandleEx | Implemented | Wine - untested | 2020/11/21 |
Requirements
- A x86 version of Windows 2003 / XP SP1 with source code available: see build-win2k3
- Disable Windows File Protection when DLL’s replacing after installation, see https://www.technipages.com/enable-disable-wfp
- Ability to execute executables built for newer versions than Windows XP SP2 / Windows Server 2003 RTM (NT 5.2).
Changes
Changes only happen in \base\win32\client
- (Included in the patched files) Add to
\base\win32\client\sources.inc
’s SOURCES macro (typically line 113):
\
..\_file.c \
..\_list.c \
..\_loader.c \
..\_kernelbase_debug.c \
..\_kernelbase_locale.c \
..\_memory.c \
..\_process.c \
..\_synchapi.c \
..\_security.c \
..\_system.c
- (Included in the patched files) Add to
\base\win32\client\sources.inc
’s SOURCES macro (typically line 1056):
// Changes for WindowsXP+
InitializeSRWLock = NTDLL.RtlInitializeSRWLock
AcquireSRWLockExclusive = NTDLL.RtlAcquireSRWLockExclusive
AcquireSRWLockShared = NTDLL.RtlAcquireSRWLockShared
TryAcquireSRWLockExclusive = NTDLL.RtlTryAcquireSRWLockExclusive
ReleaseSRWLockExclusive = NTDLL.RtlReleaseSRWLockExclusive
ReleaseSRWLockShared = NTDLL.RtlReleaseSRWLockShared
InitializeCriticalSectionEx = NTDLL.RtlInitializeCriticalSectionEx
CreateMutexExA
CreateMutexExW
CreateEventExW
CreateSemaphoreExW
CreateThreadpoolTimer
// CloseThreadpoolTimer
DecodePointer = NTDLL.RtlDecodePointer
EncodePointer = NTDLL.RtlEncodePointer
VirtualProtect
VirtualProtectEx
CompareStringEx
CompareStringOrdinal
FindNLSString
FindNLSStringEx
FindStringOrdinal
LocaleNameToLCID
LCIDToLocaleName
IsValidLocaleName
QueryFullProcessImageNameA
QueryFullProcessImageNameW
RegisterApplicationRestart
ApplicationRecoveryInProgress
ApplicationRecoveryFinished
RegisterApplicationRecoveryCallback
UnregisterApplicationRecoveryCallback
CreateThreadpoolTimer
SetThreadpoolTimer
CloseThreadpoolTimer
WaitForThreadpoolTimerCallbacks
ResolveDelayLoadedAPI
GetFileInformationByHandleEx
GetFinalPathNameByHandle = GetFinalPathNameByHandleW
GetFinalPathNameByHandleA
GetFinalPathNameByHandleW
GetTickCount64
GetActiveProcessorCount
GetLogicalProcessorInformationEx
InitializeProcThreadAttributeList
UpdateProcThreadAttribute
DeleteProcThreadAttributeList
CreateSymbolicLinkW
GetErrorMode
SetErrorMode
InitializeConditionVariable = NTDLL.RtlInitializeConditionVariable
WakeByAddressAll = NTDLL.RtlWakeByAddressAll
WakeAllConditionVariable = NTDLL.RtlWakeAllConditionVariable
WakeConditionVariable = NTDLL.RtlWakeConditionVariable
RunOnceExecuteOnce=NTDLL.RtlRunOnceExecuteOnce
RunOnceComplete=NTDLL.RtlRunOnceComplete
- Place
_*.c
&_*.h
files from the<date>__KERNEL32.DLL.zip
archive, see Download below - Launch Razzle (32-bit) command, see build-win2k3
- Change directory
\base\win32\client
and runbcz
- Copy the
\base\win32\client\daytona\obj\i386\kernel32.dll
to yourc:\windows\system32\
on your Windows XP/2003 environment
Download implementations
Date | Filename | Link |
---|---|---|
2020/12/02 | 20201202__KERNEL32.DLL.v6.zip | https://gofile.io/d/DH9dZL |
Test Harness
Some functions are being tested now as Python 3.9 does crash when starting, using a small program (WIP) calling the function with an input value:
Example kernel32_test.c
- complete project below:
#include <stdio.h>
#define NOMINMAX
#include <Windows.h>
typedef ULONGLONG (*_GetTickCount64)();
VOID
__cdecl main(USHORT argc, PCHAR *argv)
{
printf("Started - loading kernel32.dll\n");
{
HMODULE kernel32=LoadLibrary("kernel32.dll");
if (!kernel32) {
printf("kernel32.dll failed to load: %d\n", GetLastError());
}
{
//GetTickCount64
_GetTickCount64 GetTickCount64 = (_GetTickCount64)GetProcAddress(kernel32,"GetTickCount64");
if (!GetTickCount64) {
printf("GetTickCount64 not implemented!\n");
} else {
ULONGLONG result = GetTickCount64();
if (!result) {
printf("GetTickCount64 null result!\n", GetLastError());
} else {
printf("GetTickCount64 SUCCESS result: %d\n", result);
}
}
}
}
return;
}
Output of program with unmodified Windows XP/2003 KERNEL32.DLL installed:
Started - loading kernel32.dll
GetTickCount64 not implemented!
Output of program with modified KERNEL32.DLL
Started - loading kernel32.dll
GetTickCount64 SUCCESS result: 349463837
To be stored under \kernel32_test
, build using Razzle and the bz
command