Remove maximum executable version check for NT 5.2 in Windows XP/2003#

kernel32-version-unlock

Purpose#

When a new executable (.exe-file) is launched, Windows will call a variant of the CreateProcess / CreateProcessInternalW function from the KERNEL32.DLL library, which will eventually call the BasepIsImageVersionOk function which will detect if that executable is build for NT version 5.2 or lower and allow the executable to run.
When this is not the case, thus in case of a Windows 10 (NT version 10) executable: Windows will stop the execution with a popup-message: ...exe is not a valid Win32 application.

Another way around this would be by modifying the .exe-file itself, through changes in the extended PE-header (NT-header), more information can be found here https://ntcore.com/?p=458

Requirements#

A x86 version of Windows 2003 / XP SP1 with source code available: see build-win2k3

Changes#

  1. In \base\win32\client\process.c look for the BasepIsImageVersionOk function:
    BOOL
    BasepIsImageVersionOk(
        IN ULONG ImageMajorVersion,
        IN ULONG ImageMinorVersion
        )
    {
        //
        // Make sure image is at least 3.10
        //
        if ( ( ImageMajorVersion < 3 ) ||
             ( ImageMajorVersion == 3 && ImageMinorVersion < 10 ) ) {
            return FALSE;
            }
        //
        // And not greater than what we are
        //
        if ( ( ImageMajorVersion > USER_SHARED_DATA->NtMajorVersion ) ||
             ( ImageMajorVersion == USER_SHARED_DATA->NtMajorVersion &&
               ImageMinorVersion > USER_SHARED_DATA->NtMinorVersion
             )
           ) {
            return FALSE;
            }
        return TRUE;
    }
    
  2. and comment out the second if-test like so:
BOOL
BasepIsImageVersionOk(
    IN ULONG ImageMajorVersion,
    IN ULONG ImageMinorVersion
    )
{
    //
    // Make sure image is at least 3.10
    //
    if ( ( ImageMajorVersion < 3 ) ||
         ( ImageMajorVersion == 3 && ImageMinorVersion < 10 ) ) {
        return FALSE;
        }
    //
    // And not greater than what we are - ignore this, see kernel32-version-unlock
    //
/*
    if ( ( ImageMajorVersion > USER_SHARED_DATA->NtMajorVersion ) ||
         ( ImageMajorVersion == USER_SHARED_DATA->NtMajorVersion &&
           ImageMinorVersion > USER_SHARED_DATA->NtMinorVersion
         )
       ) {
        return FALSE;
        }
*/
    return TRUE;
}
  1. Run bcz in \base\win32\client
  2. Overwrite the created \base\win32\client\daytona\obj\i386\KERNEL32.DLL in the C:\WINDOWS\SYSTEM32 folder of your Windows XP installation.
Edit
Pub: Nov 13 2020 19:04 UTC
Edit: Nov 19 2020 18:42 UTC
Views: 1366