Usage of Minidump within a COM Object -
i'm developing com dll add-in msoffice. since i'm not creating logs within add-in add crash report generator add-in.
hopefully 'minidump' best choice, have never use minidump inside com object.
i appreciate if can point out possibilities of creating such crash dump minidump inside com object.
thank you
i suspect should able use technique described here, create minidump.
the actual implementation straightforward. following simple example of how use minidumpwritedump.
#include <dbghelp.h> #include <shellapi.h> #include <shlobj.h> int generatedump(exception_pointers* pexceptionpointers) { bool bminidumpsuccessful; wchar szpath[max_path]; wchar szfilename[max_path]; wchar* szappname = l"appname"; wchar* szversion = l"v1.0"; dword dwbuffersize = max_path; handle hdumpfile; systemtime stlocaltime; minidump_exception_information expparam; getlocaltime( &stlocaltime ); gettemppath( dwbuffersize, szpath ); stringcchprintf( szfilename, max_path, l"%s%s", szpath, szappname ); createdirectory( szfilename, null ); stringcchprintf( szfilename, max_path, l"%s%s\\%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp", szpath, szappname, szversion, stlocaltime.wyear, stlocaltime.wmonth, stlocaltime.wday, stlocaltime.whour, stlocaltime.wminute, stlocaltime.wsecond, getcurrentprocessid(), getcurrentthreadid()); hdumpfile = createfile(szfilename, generic_read|generic_write, file_share_write|file_share_read, 0, create_always, 0, 0); expparam.threadid = getcurrentthreadid(); expparam.exceptionpointers = pexceptionpointers; expparam.clientpointers = true; bminidumpsuccessful = minidumpwritedump(getcurrentprocess(), getcurrentprocessid(), hdumpfile, minidumpwithdatasegs, &expparam, null, null); return exception_execute_handler; } void somefunction() { __try { int *pbadptr = null; *pbadptr = 0; } __except(generatedump(getexceptioninformation())) { } }
Comments
Post a Comment