Add _except_handler4_common to MSVCRT.DLL
msvcrt-excepthandler4common
Purpose/History
Software intended to run on later than Windows 8/2012, does use _except_handler4_common function in MSVCRT.DLL. These steps allow you to add it.
This function is used for error handling in application in Windows 8/2012 and later.
These files come from the Microsoft Visual C++ Runtime Source Code that comes with Visual Studio 2017. The actual error handler code comes from https://github.com/Speedi13/ManualMapped_SEH_32bit
Requirements
- A x86 version of Windows 2003 / XP SP1 with source code available: see build-win2k3
- Recommended: version check unlock to allow run software for Windows Vista and above: kernel32-version-unlock
nullptremulation - new feature in C++ not supported in these build tools: extras-nullptr\base\crts\crtw32\extrasfolder - where .c/.h files are stored that will be added to MSVCRT.DLL when compiled and linked
Changes
- Add
gs_cookie.c gs_report.c gs_support.cfrom the Microsoft Visual C++ Runtime Source Code that comes with Visual Studio 2017 or from below links the\base\crts\crtw32\extrasfolder:
https://public-archive.org/hacked_team/rcs-dev%5Cshare/HOME/cod/CRT/crt/src/vcruntime/gs_cookie.c
https://public-archive.org/hacked_team/rcs-dev%5Cshare/HOME/cod/CRT/crt/src/vcruntime/gs_report.c
https://public-archive.org/hacked_team/rcs-dev%5Cshare/HOME/cod/CRT/crt/src/vcruntime/gs_support.c - Add the following
chandler4.cppto the\base\crts\crtw32\extrasfolder:
- Add (the name of the function)
_except_handler4_commonafter_except_handler3in\base\crts\libw32\lib\dll\obj\i386\ntcrt.def - In
\base\crts\libw32\lib\dll40\crt40.def, add
_except_handler4_common = msvcrt._except_handler4_common PRIVATE
after
_except_handler3 = msvcrt._except_handler3 PRIVATE - Add the following
dirsfile to\base\crts\crtw32\extras
- Add the following
lsourcesfile to\base\crts\crtw32\extras
- Add the following
sources.ntfile to\base\crts\crtw32\extras
- Add the following
sourcesfile to\base\crts\crtw32\extras\dll
- Copy
makefilefrom\base\crts\crtw32\dllstuff\dllto\base\crts\crtw32\extras\dll - Copy
sourcesfrom\base\crts\crtw32\dllstuff\dll_dbgto\base\crts\crtw32\extras\dll_dbg - Copy
makefilefrom\base\crts\crtw32\dllstuff\dll_dbgto\base\crts\crtw32\extras\dll_dbg - Add
extrasat the end of theDIRSmacro in\base\crts\crtw32\dirs- make sure that the line above it is terminated with\ - Add
..\..\..\crtw32\extras\dll$(DOBJ)\$O\extras.libto theLINKLIBSandOBJLIBFILESmacros in\base\crts\libw32\lib\sources.nt- make sure that the line above it is terminated with\ - In
\base\crts\makefile.inc, add
- In
\base\crts\makefile.inc, after
add
- In
\base\crts\makefile.inc, after
add
- Run
bczin\base\crts - Overwrite the created
\base\crts\libw32\lib\dll\obj\i386\MSVCRT.DLLin theC:\WINDOWS\SYSTEM32folder of your Windows XP installation