This is the repository for Discord Messenger's modern Windows API shim. Its aim is to implement a shim for certain APIs that were implemented in versions earlier than Discord Messenger targets.
It performs its duty by:
-
Using the actual procedures, when available, or
-
Providing an (admittedly maybe crappy, but passable) implementation of the function, if Windows did not provide us with its own version.
To use, simply embed the src/*.cpp and include/ri/*.hpp files in your project. Then you will
simply add ri:: to all uses of modern Windows APIs that are implemented by this project and call
ri::InitReimplementation() before any of the code that uses it.
This is a list of functions shimmed, along with their implementation if Windows doesn't provide one. This list hasn't been updated in a while and is probably incomplete.
-
GetFileSizeEx- Implemented usingGetFileSize. -
SetFilePointerEx- Copied from https://github.com/enlyze/EnlyzeWinCompatLib/blob/master/src/winnt_40.cpp#L43 -
VerSetConditionMask- Copied from ReactOS' implementation -
VerifyVersionInfo- Implemented usingGetVersionEx. -
RegisterWaitForSingleObject- ReturnsINVALID_HANDLE_VALUEthroughphNewWaitObjectandFALSEto the caller. Not implemented. -
UnregisterWaitEx- Not implemented, returnsFALSE. -
GradientFill- Not implemented, returnsFALSE. -
AlphaBlend- Not implemented, simply callsStretchBlt. -
TransparentBlt- Not implemented, simply callsStretchBlt. -
SHGetFolderPath- Not implemented, just returns".". -
PathFileExists- Implemented usingGetFileAttributes. -
GetMenuInfo- Not implemented, returnsFALSE. -
SetMenuInfo- Not implemented, returnsFALSE. -
GetGestureInfo- Not implemented, returnsFALSE. -
SetDCBrushColor- Creates a new brush unless the color is the same. You must useri::GetDCBrush()instead ofGetStockObject()to get this brush. IfSetDCBrushColoris imported, thenri::GetDCBrush()redirects toGetStockObject(DC_BRUSH). -
SetDCPenColor- Creates a new pen unless the color is the same. You must useri::GetDCPen()instead ofGetStockObject()to get this pen. IfSetDCPenColoris imported, thenri::GetDCPen()redirects toGetStockObject(DC_PEN). -
MonitorFromPoint- Returns a fake magic value to be passed intoGetMonitorInfo. -
GetMonitorInfo- Simulates fetching information about the primary monitor usingGetSystemMetrics. -
AnimateWindow- Hides or shows the window based on the flags parameter. Animation related flags are ignored. -
InitializeCriticalSectionAndSpinCount- Initializes a critical section. Ignores the spin count. -
TryEnterCriticalSection- Not implemented, returnsFALSE. -
GetVersionEx- Assumes a Windows 9X target (WIN32_WINDOWS) andszCSDVersionreturns"Unknown Windows", but the major, minor, and build numbers are pulled fromGetVersion(). -
QueueUserAPC- Not implemented. Used by asio to wake up sleeping threads. -
SHGetFileInfo- Not implemented. Clears thehIconmember and returns 0. -
Shell_NotifyIcon- Not implemented. Returns 0. -
TrackMouseEvent- Not implemented. Returns 0. -
DrawEdge- Barely implemented. Draws a single solid black rectangle. -
DrawIconEx- Barely implemented. Simply callsDrawIconon the icon with no regard to sizing. -
GetScrollInfo- Emulated usingGetScrollPosandGetScrollRangeto the best of its ability. -
SetScrollInfo- Emulated usingSetScrollPosandSetScrollRangeto the best of its ability. -
GetSysColorBrush- UsesGetSysColorand creates solid brushes on demand. -
LoadImage- Unimplemented. ReturnsNULL. -
CertOpenSystemStoreA- Unimplemented. ReturnsNULL. -
CertCloseStore- Unimplemented. ReturnsFALSE. -
CertFindCertificateInStore- Unimplemented. ReturnsNULL. -
CertFreeCertificateContext- Unimplemented. ReturnsFALSE. -
CertEnumCertificatesInStore- Unimplemented. ReturnsNULL. -
CoInitialize- Unimplemented. Returns0.
This project is licensed under the MIT license. See the license file for details.