Hacker Newsnew | past | comments | ask | show | jobs | submit | Deadcode0's commentslogin

I'll take this one :)

Not even a hello world supports Windows 95 when compiled by MSVC 2005, and it's just because of a call to IsDebuggerPresent() in the standard library's startup code. To work around this, I overrode the definition of that function in one of WA's .cpp modules, to delay-load the real function, and return FALSE if it doesn't exist:

  extern "C" __declspec(noinline) BOOL WINAPI _imp__IsDebuggerPresent(VOID)
  {
   typedef BOOL (WINAPI *IsDebuggerPresent_t)(VOID);
   if (HMODULE lib = GetModuleHandle("KERNEL32.dll"))
    if (IsDebuggerPresent_t proc = (IsDebuggerPresent_t)GetProcAddress(lib, "IsDebuggerPresent"))
     return proc();
   return FALSE;
  }
(Many more hacks like this would be necessary if using a later version of MSVC. So I use Daffodil to allow using a later version of Visual Studio while still using Visual C++ 2005 for the actual compiling.)

Other than that, it was just a matter of identifying all the API calls requiring Windows 98 or later and replacing them with their Windows 95 equivalents. In cases where this would mean sacrificing functionality, that meant delay-loading the Windows 98-or-later version and falling back to the Windows 95 version if necessary, such as with GetDiskFreeSpaceEx() vs. GetDiskFreeSpace().


Do you still test on Windows 95?


Yes, occasionally, under a VM (and at least one of our alpha testers has tested it on a period-correct machine). Windows 95 support isn't perfect; Hardware Cursors don't work properly (an option that didn't exist in WA v3.0) although that has a simple workaround – disabling them. And the game's taskbar button sticks on the taskbar after the game has been closed, disappearing only after being clicked. Other than that it works fine as far as we're aware.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: