Hi Claus,
We can help you here with your WERAPI questions. Off hand, I think you would be interested in the restart and recovery APIs in addition to the WER Data Collection APIs. I envision that the new rich WERAPIs in Windows Vista will enable you to do everything you need. I'll talk to the Developer Lead of the APIs to see if there are any samples or guidance available and one of us will get back to you.
In the meanwhile, you can explore these APIs at http://msdn2.microsoft.com/en-us/library/ms681656.aspx (Core WERAPIs) and http://msdn2.microsoft.com/en-us/library/aa373342.aspx (Application Restart and Recovery APIs).
Kind Regards,
-Jason
// Set up parameters for WerReportCreate()
WER_REPORT_INFORMATION werReportInfo;
memset(&werReportInfo, 0, sizeof(werReportInfo));
werReportInfo.dwSize = sizeof(werReportInfo);
wcscpy_s(werReportInfo.wzFriendlyEventName,
_countof(werReportInfo.wzFriendlyEventName), L"Friendly event name");
wcscpy_s(werReportInfo.wzDescription,
_countof(werReportInfo.wzDescription), L"Critical runtime problem");
werReportInfo.hwndParent = AfxGetMainWnd()->m_hWnd;
PCWSTR eventType = L"MyApp";
HREPORT hReportHandle;
if (SUCCEEDED(pWerReportCreate(eventType, WerReportCritical,
&werReportInfo, &hReportHandle)) && hReportHandle) {
WER_EXCEPTION_INFORMATION werExceptionInformation;
werExceptionInformation.bClientPointers = FALSE;
werExceptionInformation.pExceptionPointers = inExceptionPointer;
bool dumpAdded = SUCCEEDED(pWerReportAddDump(hReportHandle, ::GetCurrentProcess(),
::GetCurrentThread(), WerDumpTypeMiniDump, &werExceptionInformation, NULL, 0));
WER_SUBMIT_RESULT submitResult;
DWORD submitOptions = WER_SUBMIT_ADD_REGISTERED_DATA | WER_SUBMIT_OUTOFPROCESS;
if (SUCCEEDED(pWerReportSubmit(hReportHandle, WerConsentNotAsked,
submitOptions, &submitResult))) {
// handle submitResult
// ...
}
}
Claus Brod wrote:
Hi all,
I'm experimenting with the available APIs for error reporting. On XP systems, I'm using ReportFault(), which seems to work as expected- it displays the WER dialogs, sends data to the Winqual site (including minidump data), launches a debugger when asked for by the user etc.
That doesn't sound correct to me. In my experience, ReportFault() just returns frrvLaunchDebugger when somebody hits the 'debug' button and it is then up to you to do the launching. Are you sure you're not just seeing the exception go all the way out to the Unhandled Exception Filter provided by the O/S, which itself calls ReportFault() and knows how to launch the debugger
Hi Claus,
ReportFault is a deprecated API in Vista. We do not recommend setting up exception filters and calling ReportFault for crash reporting. Instead for reliability we recommend that you let the OS handle the exception. Your observation is correct that in some cases ReportFault on Vista may lead to process terminations. Further we also do not recommend trying to continue a process after it has encountered a crash. In Vista if you want to support Application recovery, please look at the RegisterApplicationRecoveryCallback API (http://msdn2.microsoft.com/en-us/library/aa373345.aspx). The callback can run for as long as needed if it keeps doing a keep alive ping as mentioned in the documentation.
Please let us know if there are further questions.
Thanks,
Kinshuman
Hi Claus,
I need to defer to Kinshu on the details of the WER APIs, but I do know that the Windows Vista WER behavior for saving the minidump is dependent on the Server side data request. This means that there will only be a minidump (or whatever was explicitly specified) if the servers are asking for a cab file containing data collection. This behavior is not consistent with older versions of Windows Error Reporting on XP and Server 2003.
Have you mapped your test application in Winqual This will set the server for data collection for your file. If this is the case, and you still don't see your cab files please post the event ID and EventType and I'll take a look at the servers.
Kind Regards,
-Jason
Yes, that's right.
I do not know how the behavior changes when the data collection API is used though. I envision that the dump file would be created right away when WER data collection was registered by the application and made available through WERCON.exe on the local machine. However, this may be a wrong assumption. I'll check with Kinshu.
Thanks,
-Jason