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

StackOverflow https://stackoverflow.com/questions/7010924

Question

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:)

Was it helpful?

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;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top