I wanted to do a out-of-process exception handler and i had created a watch-dog process which does dedicated exception handling when child process raises exception. I had succes
I will put this together as an answer, although it really should be a comment to Hans's answer (and the comments there) but it seems some explanation is necessary:
The code posted in the question correctly passes the value(s) of the struct mytest
structure into shared memory.
The second code snippet:
(For ex)Process 2 :
cout << passdata->except->ExceptionRecord->ExceptionCode << endl ;
Shows a misunderstanding though: While you can read the value of the pointer passdata.except
, in process 2 this is just an arbitrary 32/64 bit value, it is not a valid pointer.
You can pass this to MiniDumpWriteDump
, this function will eveluate this pointer value in the context of the target process (proc 1). But you cannot dereference it in process #2.
Hans's example gives the solution, iff you need the value of ExeptionCode
in process #2, then you need to dereference the pointer in proc#1 and put the value into the data you write to shared memory.