Run .exe / .dll compiled with Microsoft Visual C++ 2005 under Windows 95

It is unlikely, but you may need to execute .exe / .dll compiled with Microsoft Visual C++ 2005 under Windows 95. I know that official support ended in 1 January 2002, but believe me – there are more than couple of people, that still need to run this OS.

So here comes the problem. You try to execute some program, and get error:
---------------------------
Error Starting Program
---------------------------
The Some_File.exe file is linked to missing export KERNEL32.DLL:IsDebuggerPresent.
---------------------------
OK
---------------------------

This is a most common problem, with simplest solution. Open that .exe file with Hex editor (any Hex editor). Find string ‘IsDebuggerPresent’ and replace it with ‘GetCurrentProcess’ (or any other Import from kernel32.dll, that has the same length and does not take any parameters).

Function prototypes:
HANDLE WINAPI GetCurrentProcess(void);
BOOL WINAPI IsDebuggerPresent(void);

Hex view before:
0000FF68 53 65 74 55 6E 68 61 6E SetUnhan
0000FF70 64 6C 65 64 45 78 63 65 dledExce
0000FF78 70 74 69 6F 6E 46 69 6C ptionFil
0000FF80 74 65 72 00 39 02 49 73 ter 9 Is
0000FF88 44 65 62 75 67 67 65 72 Debugger
0000FF90 50 72 65 73 65 6E 74 00 Present
0000FF98 A0 01 47 65 74 50 72 6F   GetPro
0000FFA0 63 41 64 64 72 65 73 73 cAddress
0000FFA8 00 00

Hex view after:
0000FF68 53 65 74 55 6E 68 61 6E SetUnhan
0000FF70 64 6C 65 64 45 78 63 65 dledExce
0000FF78 70 74 69 6F 6E 46 69 6C ptionFil
0000FF80 74 65 72 00 39 02 47 65 ter 9 Ge
0000FF88 74 43 75 72 72 65 6E 74 tCurrent
0000FF90 50 72 6F 63 65 73 73 00 Process
0000FF98 A0 01 47 65 74 50 72 6F   GetPro
0000FFA0 63 41 64 64 72 65 73 73 cAddress
0000FFA8 00 00