Ensuring windows compatibility.

Microsoft has created several guidelines and test tools to ensure any application is compatible with XP SP3 and higher operating systems. Current testing difficulty is at the windows 7 level.

I will present these guidelines in the suggest order of applying them:

  1. (almost DONE, no /SAFESEH due to some modules like ffmpeg and libmpeg2) Enable the following switches in the project files. (as of 1988699, f7ee8de and 08dacff)
    • /GS [This option greatly strengthens the resilience against Buffer overflows at the cost of on average a 3% loss in overall speed.]
    • /DYNAMICBASE [This option makes sure memory allocation locations are randomized on each run on supported windows version, as a side effect, this option slightly improves performance of the application on 32-bit systems]
    • /NXCOMPAT [This option forces windows to enable full DEP]
    • /SAFESEH [This switch will make sure every linked object has an exception handler]
  1. DONE: Add Heap Corruption Detection (as of 22cd497)

As Microsoft explains on this page we should include Heap Corruption detection to all the exe files in the MPC-HC project.

Heap corruption detection is the ability to fail an application if the heap manager detects that the application has corrupted the heap, or the heap becomes inconsistent. This setting does not only detect heap-based buffer overruns, but certain illegal operations, for example, freeing a pointer to the wrong heap will also fail the application.

Application compatibility with heap corruption detection requires a small code change that applies only to Windows Vista. The following code will fail gracefully on Windows platforms that do not support the function (most notably Windows 2000) and will enable the heap corruption detection option for the calling application when run on Windows Vista/7.

BOOL SetHeapOptions() {
   HMODULE hLib = LoadLibrary(L"kernel32.dll");
   if (hLib == NULL)
        return FALSE;

   typedef BOOL (WINAPI *HSI)
   HSI pHsi = (HSI)GetProcAddress(hLib,"HeapSetInformation");
   if (!pHsi) {
      return FALSE;

#ifndef HeapEnableTerminationOnCorruption
#   define HeapEnableTerminationOnCorruption (HEAP_INFORMATION_CLASS)1

   BOOL fRet = (pHsi)(NULL,HeapEnableTerminationOnCorruption,NULL,0)
            ? TRUE
            : FALSE;
   if (hLib)

   return fRet;
  1. TODO Pass all the Microsoft Application Verifier tests

The application should successfully run in different use cases with the app verifier running.

  1. TODO Pass the windows 7 logo test

Pass all the tests in the logo test found here.

  1. DONE: Optional, get a code signing certificate.

Now that you have passed all the tests you can get a certificate and actually get the logo. Having the logo also means you gain access to Winqual which provides all the data windows collects when the application crashes.

Last modified 3 years ago Last modified on 2013-02-14T10:08:04+01:00