Search code examples
cwindowswinapiwindows-error-reporting

How to programmatically determine if the OS we are currently running on is Windows Error Reporting capable?


I would like to determine if the OS that my program currently running on is Windows Error Reporting capable. I would like to do this using some kind of API.

Windows Error Reporting was introducing from Vista onwards, but I just can't check if(osType == Vista)

because, my code runs on WES 7 and WES 2009 (Windows Embedded Standard).

Is there any way do this?

Thanks a lot for ur help and suggestions:)


Solution

  • Just attempt to do a LoadLibrary for "wer.dll". If it succeeds, you have WER.

    BOOL IsWindowsErrorReportingAvailable()
    {
        BOOL fRet = FALSE;
    
        HMODULE hMod = LoadLibrary("wer.dll");
    
        fRet = (hMod != NULL);
    
        if (fRet)
        {
            // make sure the APIs from WER we want to use are available
            fRet = (NULL != GetProcAddress(hMod, L"ReportFault"));
        }
    
        CloseHandle(hMod);
    
        return fRet;
    }