OldCigarettes Windows 2000 XP API Wrapper Pack (OCW)

The wrapper, tools, and info you need to get games working

OldCigarettes Windows 2000 XP API Wrapper Pack (OCW)

PostPosted by OldCigarette » Tue Feb 05, 2008 11:26 pm

This is a collection of my various API fixes for compatibility with XP games. Unlike most other API fixes these are not EXE hacks! These are DLL wrappers which means only the portions of code that are XP specific are changed, your windows 2000 code is left intact! These strive for a high level of compatibility so that they can be used for ANY game. Also my kernel32 wrapper has additional features such as GetVersion faking and other options that may be useful. Below is the latest readme, if your game is missing one of the API calls listed it is likely this pack will fix it!

Important
As of v1.8 you may need to update your kernel32 so it has certain Heap functions. Here is a link to update which contains an update kernel32, you only need run it if you get error messages about missing functions in kernel32_org.dll.
http://www.microsoft.com/downloads/deta ... laylang=en

Download
Wrapper Pack v1_10

Latest Source Code
On SourceForge

Latest Readme
Code: Select all
Windows 2000 XP API Wrapper Pack
--------------------------------
Copyright 2008, distributed under the terms of the
Lesser GNU General Public License.

!!!!!!!DISCLAIMER!!!!!!!
THIS PACK IS NOT CREATED/SUPPORTED BY MICROSOFT IN ANYWAY.
WHEN MESSING WITH SYSTEM DLLS YOU CAN HOSE YOUR SYSTEM, READ WHAT THIS DOC SAYS
AND FOLLOW IT'S ADVICE. YOU SHOULD NOT DELETE ANYTHING FROM SYSTEM32, THESE
WRAPPERS ARE NOT INTENDED TO BE PLACED THERE! FOLLOW THIS AND YOU WILL BE
SAFE. IF YOU ARE COMFORTABLE WITH DOS AND KNOW WHAT YOU ARE DOING YOU CAN UNDO
THE CHANGE IF YOU NEED TO BUT DO NOT COME CRYING TO ME IF SOMETHING GOES WRONG.

The Win2k wrapper pack is a collection of DLLs (dynamic loaded libraries) that
'wrap' the Windows API. These wrapper DLLs 'target' original copies of the
system DLLs. Most of these fixes were chosen to get newer games working on 2K,
but I've added a lot of application fixes too.

This is NOT meant as a general XP compatibility kit to drop in your system32,
while that does work in MOST cases it is kind of dangerous and I don't recommend
it, see above :). Rather these DLLs should be placed along side the executable
or in the start directory of the application.

In order to use these wrapper DLLs you MUST copy the original system DLLs
somewhere in the DLL search path with the TARGET name listed below. In my case I
have a folder in my PATH (WINXP_DLLS) that are unique to XP, ie no 2k
equivalent. I place my TARGET DLLs here as well.

In some cases (kernel32.dll, shell32, & user32.dll) the DLL search path must be
modified due to 'KnownDLLs' These KnownDLLs are only loaded from the system32,
but this functionality can be disabled by Regedt32. (*IMPORTANT regedit.exe
won't work*) Simply add the DLLs to exclude from 'KnownDLLs' to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\ExcludeFromKnownDlls
this is a multiline value, so place a dll on each line.

Included in this pack should be a ExcludeFromKnownDlls.reg which will set this
to kernel32, shell32, advapi32 & user32. A reboot is needed for this to take
effect. To see a list of KnownDLLs see
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\KnownDLLs

For more info on DLL search paths see this awesome page
DLL Loading Rules in Win32 [http://home.att.net/~raffles1/older/dll_loading_rules_in_win32.htm]

======================
=Current DLL Wrappers=
======================

ADVAPI32.DLL TARGET=ADVAPI32_ORG.DLL
**********************************
XP FUNCTIONS
A_SHAInit
A_SHAUpdate
A_SHAFinal
MD5Init
MD5Update
MD5Final
SystemFunction036
TraceMessage

CredGetSessionTypes
CredWriteW
CredWriteA
CredReadW
CredReadA
CredFree
CredEnumerateW
CredEnumerateA
CredDeleteW
CredDeleteA

SHELL32.DLL TARGET=SHELL32_ORG.DLL
**********************************
XP FUNCTIONS
IsUserAnAdmin
SHParseDisplayName
SHGetFolderPathAndSubDirW
SHGetFolderPathAndSubDirA
SHCreateFileExtractIconW
SHGetImageList
SHCreateShellItem (partial)

USER32.DLL TARGET=USER32_ORG.DLL INI=win2k_xp_kernel32.ini
**********************************************************
This DLL provides RAWINPUT for windows 2000. There is an option to use either
DirectInput or a keyboard/mouse low level hook which can be specified in the ini
file. The ini file is the same one that kernel32 uses the info is just in a
different section.

Default ini values
[win2k_xp_user32]
UseDirectInput=0

XP FUNCTIONS
GetRegisteredRawInputDevice
RegisterRawInputDevices
GetRawInputBuffer
GetRawInputData
GetRawInputDeviceList
GetRawInputDeviceInfoA
GetRawInputDeviceInfoW
GetLayeredWindowAttributes
GetWindowRgnBox
DisableProcessWindowsGhosting
PrintWindow
SetProcessDPIAware

KERNEL32.DLL TARGET=KERNEL32_ORG.DLL INI=win2k_xp_kernel32.ini
**************************************************************
This DLL use a ini file (win2k_xp_kernel32.ini) for advanced configuration. It
should be in the start directory of the application. This ini file is not
required, default values will be used as listed below.

*majVer, minVer, buildNum, majSP, minSP, and versionString are all overrides for
 GetVersion, GetVersionEx, and VerifyVersionInfo, if omitted the system value is
 returned. Using this with msiexec will not result in anything good (tries to
 make a bunch of XP calls.)
*verifyVersion if set to 1 will force VerifyVersionInfo to return TRUE
*versionFaking can be set to 'include' or 'exclude', this works with the
 [version_module_list] section described below.
*GetModuleOriginal if not set to 0 will return a HANDLE to the system
 kernel32.dll, this might be useful if kernel32 has a new exports and this and
 this wrapper is out of date.
*geoNation & geoRegion specify return values for GetUserGeoID. If omitted
 defaults to United States.
*SystemDirectory overrides the return value for GetSystemDirectoryA &
 GetSystemDirectoryW. If omiited returns the system value.
*Load_ACLayers if not set to 0 will do LoadLibrary("aclayers.dll"), this is to
 get past securom, which doesn't seem to approve of the wrapper. Make sure to
 place aclayers.dll somewhere in the search path.
*RewriteExportTable if not set to 0 will do some export hacks for programs that
 think they know how to read a PE. (Basically the RVA for the functions in the
 wrapper will point to KERNEL32_ORG)
*debug set to larger values will produce more information in a console window,
 larger values include all previous level of detail. Note that the debugging
 output capabilities of kernel32 is also accessed by user32 (and more dlls in the
 future) so if you want to see debugging info from them you must also run the
 kernel32 dll.
 1 - Errors
 2 - Warnings
 3 - Info
 4 - Trace
 
Example win2k_xp_kernel32.ini (All default values on MY machine)
[win2k_xp_kernel32]
majVer=5
minVer=0
buildNum=2195
GetModuleOriginal=0
geoNation=244
geoRegion=244
geoISO2=US
geoISO3=USA
SystemDirectory=C:\WINNT\system32
Load_ACLayers=0
RewriteExportTable=0
verifyVersion=0
versionFaking=exclude
debug=0

The version faking can also use a filter rather than being global.
versionFaking must be set above to either 'include' or 'exclude' to
perform filtering. If 'include' also listed modules will have faking
applied, if 'exclude' only the modules listed will NOT have faking
applied. Each module's filename should be listed and followed with '=1'.

Example version faking section (in same ini file).
[version_module_list]
SomeModule.exe=1
AnotherModule.dll=1

XP FUNCTIONS
GetProcessId
GetThreadId
RestoreLastError
GetModuleHandleExW
GetModuleHandleExA
EncodePointer
DecodePointer
InterlockedPopEntrySList
InterlockedPushEntrySList
InitializeSListHead
InterlockedFlushSList
GetNativeSystemInfo
WTSGetActiveConsoleSessionId
GetUserGeoID
GetGeoInfoA
GetGeoInfoW
GetProcessHandleCount
CheckRemoteDebuggerPresent
GetNumaProcessorNode
GetNumaNodeProcessorMask
GetSystemTimes
GetSystemWow64DirectoryA
GetSystemWow64DirectoryW
IsWow64Process
AttachConsole
GetVolumePathNamesForVolumeNameA
GetVolumePathNamesForVolumeNameW
AddVectoredExceptionHandler
RemoveVectoredExceptionHandler
RtlCaptureContext
QueryDepthSList
TzSpecificLocalTimeToSystemTime
SetDllDirectoryW
SetDllDirectoryA
GetDllDirectoryW
GetDllDirectoryA
SetProcessDEPPolicy
CaptureStackBackTrace
SetThreadUILanguage
IsProcessInJob    (partial)
ActivateActCtx    (stub)
DeactivateActCtx  (stub)
ReleaseActCtx     (stub)
GetCurrentActCtx  (stub)
CreateActCtxW     (stub)
CreateActCtxA     (stub)

WTSAPI32.DLL TARGET=WTSAPI32_ORG.DLL
************************************
Provides two functions present in XP, but meaningless in 2K, always do nothing
and return success.

XP FUNCTIONS
WTSRegisterSessionNotification
WTSUnRegisterSessionNotification
WTSQueryUserToken

WS2_32.DLL TARGET=WS2_32_ORG.DLL
********************************
XP FUNCTIONS
getaddrinfo
freeaddrinfo
getnameinfo
FreeAddrInfoW
ConnectEx
DisconnectEx

UXTHEME.DLL
***********
Just some stubs for now
OpenThemeData       (stub)
CloseThemeData      (stub)
DrawThemeBackground (stub)
GetCurrentThemeName (stub)
IsAppThemed         (stub)

Tools for troubleshooting
-------------------------
Dependency Walker [http://www.dependencywalker.com/]
API Monitor [http://www.rohitab.com/apimonitor/]
APISpy32 [http://www.internals.com/]

Credits
-------
OldCigarette - coder of wrapper pack
OldBoy2k     - old fashioned win2k user
TheProphet   - RawInput and GetSystemTimes code
DosFreak     - tester extraordinaire
WINE         - Code bits, most of advapi32 (http://www.winehq.org/)
ReactOS      - killer API documentation


Previous Releases
Wrapper Pack v1_9
Wrapper Pack v1_8
Wrapper Pack v1_7
Wrapper Pack v1_6
Wrapper Pack v1_5
Wrapper Pack v1_4
Wrapper Pack v1_3_1
Wrapper Pack v1_3
Wrapper Pack v1_2
Wrapper Pack v1_1
Wrapper Pack v1
Last edited by OldCigarette on Tue Jul 22, 2008 4:16 pm, edited 1 time in total.
OldCigarette
 
Posts: 208
Joined: Sun Feb 03, 2008 6:35 am
Location: Qo`nos

PostPosted by OldCigarette » Thu May 15, 2008 4:03 am

Version 1.6 changes
http://oldcigaret.info/win2k/phpBB3/viewtopic.php?t=66
GetRawInputDeviceList
GetRawInputDeviceInfo

http://oldcigaret.info/win2k/phpBB3/viewtopic.php?t=74
SHGetImageList

http://oldcigaret.info/win2k/phpBB3/viewtopic.php?t=71
QueryDepthSList
TzSpecificLocalTimeToSystemTime
SetDllDirectory
GetDllDirectory
SHGetFolderPathAndSubDir
SHCreateFileExtractIcon
SHCreateShellItem
CredGetSessionTypes
CredWrite
CredRead
CredFree
CredEnumerate
CredDelete
OldCigarette
 
Posts: 208
Joined: Sun Feb 03, 2008 6:35 am
Location: Qo`nos

PostPosted by OldCigarette » Tue Jul 22, 2008 4:15 pm

Version 1.7 changes

new functions
user32.PrintWindow
user32.SetProcessDPIAware
user32.GetRawInputBuffer

kernel32.IsProcessorFeaturePresent (always say SSE2 ok)
kernel32.ActivateActCtx (stub)
kernel32.DeactivateActCtx (stub)
kernel32.ReleaseActCtx (stub)
kernel32.GetCurrentActCtx (stub)
kernel32.CreateActCtxW (stub)
kernel32.IsProcessInJob (partial)

uxtheme.OpenThemeData (stub)
uxtheme.CloseThemeData (stub)
uxtheme.DrawThemeBackground (stub)

VerifyVersionInfo - complete implementation for faking
verifyVersion ini option bug where it would randomly work

Changed wrsapi32 targer from _OLD to _ORG to match the other wrappers.

Placed the project under the LGPL license.
OldCigarette
 
Posts: 208
Joined: Sun Feb 03, 2008 6:35 am
Location: Qo`nos

Re: OldCigarettes Windows 2000 XP API Wrapper Pack

PostPosted by OldCigarette » Sat Jan 17, 2009 9:28 pm

Version 1.8 changes
Hooked CreateWindowEx to ignore WS_EX_COMPOSITED, XP only flag
Hooked RegisterClass(Ex) to ignore CS_DROPSHADOW, XP only flag

EncodePointer/DecodePointer does some encoding now

Hooked LoadLibrary(Ex) to ignore directory when specifing wrapped dll names (was causing big issues with kernel32)

IsProcessorFeaturePresent properly detects sse2

VersionVerifyInfo/GetVersionEx fixed wSuiteMask and wProductType which I forgot to add

Fixed problem in advapi32 where SystemFunction036 wouldn't work

Redid how wrappers link to org DLLs. Tages copy protection and some other software could not properly handle it.

Fixed GetModuleHandleEx when modifing reference count

uxtheme
GetCurrentThemeName (stub)
IsAppThemed (stub)

There was a lot of under the hood changes in this release. If you run into any problems please post about them.
OldCigarette
 
Posts: 208
Joined: Sun Feb 03, 2008 6:35 am
Location: Qo`nos

Re: OldCigarettes Windows 2000 XP API Wrapper Pack

PostPosted by OldCigarette » Sun Dec 06, 2009 3:52 am

Update: 09.12.2009

Version 1.9 changes
kernel32
AddRefActCtx,ZombifyActCtx,QueryActCtxW stubs
GetDiskFreeSpaceA,GetDiskFreeSpaceW hooked to fix ERROR_DIR_NOT_ROOT for xblades see here and here.

user32
GetRegisteredRawInputDevices - new for Xblades see here and here.
IsWinEventHookInstalled
fixed stupid bug in RegisterClassEx

advapi32
InitiateSystemShutdown routines hooked to behave more like xp

shell32
IsUserAnAdmin exposed for Fuel see here

wtsapi32
WTSQueryUserToken
OldCigarette
 
Posts: 208
Joined: Sun Feb 03, 2008 6:35 am
Location: Qo`nos

Re:

PostPosted by BlackWingCat » Tue Dec 15, 2009 3:50 am

OldCigarette wrote:Version 1.6 changes
viewtopic.php?t=66
GetRawInputDeviceList
GetRawInputDeviceInfo

switch(uiCommand) {
case RIDI_DEVICENAME:
switch((DWORD)hDevice) {
case MOUSE_DEVICE_HANDLE:
len = strlen("Wrapper Mouse");
if(wide) RtlCopyMemory(pData, "Wrapper Mouse", len*sizeof(CHAR));
else RtlCopyMemory(pData, L"Wrapper Mouse", len*sizeof(WCHAR));
size_wrote = len * (wide ? sizeof(WCHAR) : sizeof(CHAR));
break;
case KBD_DEVICE_HANDLE:
len = strlen("Wrapper Keyboard");
if(wide) RtlCopyMemory(pData, "Wrapper Keyboard", len*sizeof(CHAR));
else RtlCopyMemory(pData, L"Wrapper Keyboard", len*sizeof(WCHAR));
size_wrote = len * (wide ? sizeof(WCHAR) : sizeof(CHAR));
break;
default:
if(DbgPrintf) DbgPrintf(DBG_WARN, S_YELLOW "user32: GetRawInputDeviceInfo - Unknown device %X\n", hDevice);
return 0;
}
break;


I think the correct code is following. :)

if(!wide) RtlCopyMemory(pData, "Wrapper Mouse", len*sizeof(CHAR));
else RtlCopyMemory(pData, L"Wrapper Mouse", len*sizeof(WCHAR));


if(!wide) RtlCopyMemory(pData, "Wrapper Keyboard", len*sizeof(CHAR));
else RtlCopyMemory(pData, L"Wrapper Keyboard", len*sizeof(WCHAR));
BlackWingCat
 
Posts: 75
Joined: Sat Mar 07, 2009 7:20 am
Location: Kanagawa, Japan

Re: OldCigarettes Windows 2000 XP API Wrapper Pack (OCW)

PostPosted by OldCigarette » Mon Feb 28, 2011 3:05 am

Update: 27.02.2011
Version 1.10 changes


just some small fixes
above user32 (thanks BWC :) )
Interlocked SList bug fixes
ShellItem::GetParent memory bug fix
added SetThreadUILanguage hack
RtlCaptureStackBackTrace stub
OldCigarette
 
Posts: 208
Joined: Sun Feb 03, 2008 6:35 am
Location: Qo`nos

Re: OldCigarettes Windows 2000 XP API Wrapper Pack (OCW)

PostPosted by OldBoy2k » Mon Feb 28, 2011 2:34 pm

v1.10 update release notes:
User32.dll - DefRawInputProc (stub)
Kernel32.dll - SetFileValidData,ConvertFiberToThread,GetLogicalProcessorInformation (stub)

Wrappercode can now also be found on Sourceforge.net: Win2kxp
OldBoy2k
 
Posts: 1351
Joined: Fri Feb 15, 2008 5:10 pm

Re: OldCigarettes Windows 2000 XP API Wrapper Pack (OCW)

PostPosted by dupko » Fri Aug 03, 2012 12:47 pm

No more uptades?
Image
dupko
 
Posts: 1
Joined: Fri Aug 03, 2012 12:46 pm

Re: OldCigarettes Windows 2000 XP API Wrapper Pack (OCW)

PostPosted by OldBoy2k » Sun Apr 21, 2013 12:03 pm

Here is a temporary download location for the OCW Wrapper pack v1.10 until the forum is back:
BlackWingCats blog: Windows 2000 Gaming info

BR
OldBoy2k
OldBoy2k
 
Posts: 1351
Joined: Fri Feb 15, 2008 5:10 pm

Re: OldCigarettes Windows 2000 XP API Wrapper Pack (OCW)

PostPosted by BlackWingCat » Mon Apr 18, 2016 2:27 am

BOOL WINAPI XP_GetModuleHandleExW(DWORD dwFlags, PWSTR lpModuleName, HMODULE* phModule)

It should be fixed to the following.

-> if(dwFlags & GET_MODULE_HANDLE_EX_FLAG_PIN)
> inc_loadcount = TRUE;

+> if(dwFlags & GET_MODULE_HANDLE_EX_FLAG_PIN) {
> inc_loadcount = TRUE;
+> mod->LoadCount = -1;
+> }
BlackWingCat
 
Posts: 75
Joined: Sat Mar 07, 2009 7:20 am
Location: Kanagawa, Japan


Return to Tools & Info

Who is online

Users browsing this forum: No registered users and 0 guests

cron