I am puzzled. Attached are some examples. ex7.c is the most basic one. Basically writing to a NULL pointer to cause an exception. In the exception handler, a dialog is shown, then the program terminates.
In ex8.c I've used native CE calls to create a file and write to it before the exception, after it (should never happen), and from the handler. I have a similar file using stdio which exhibits the same behaviour : it doesn't do what I think it should. The result is a file with a single message Main : start instead of Main : start Handler In ex9.c you can see that things continue to work if no file was opened before causing an exception. In ex8b.c you can see that merely opening a file is enough to cause the exception handler not to work any more. Can anyone shed light on this ? Thanks, Danny -- Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info
#include <windows.h> #include <stdio.h> #include <stdlib.h> #include "myexcpt.h" void handler(struct _EXCEPTION_RECORD *ExceptionRecord, void *EstablisherFrame, struct _CONTEXT *ContextRecord, struct _DISPATCHER_CONTEXT *DispatcherContext) { MessageBoxW(0, L" ? ", L"Handler : error", 0); exit(0); } int main(int argc, char *argv[]) __attribute__((__exception_handler__(handler))); int main(int argc, char *argv[]) { int *i; i = 0; *i = 1; exit(0); }
#include <windows.h> #include <stdio.h> #include <stdlib.h> #include "myexcpt.h" HANDLE h = 0; void handler(struct _EXCEPTION_RECORD *ExceptionRecord, void *EstablisherFrame, struct _CONTEXT *ContextRecord, struct _DISPATCHER_CONTEXT *DispatcherContext) { DWORD w; WriteFile(h, "Handler\r\n", 9, &w, NULL); (void)CloseHandle(h); exit(0); } int main(int argc, char *argv[]) __attribute__((__exception_handler__(handler))); int main(int argc, char *argv[]) { int *i; DWORD w; h = CreateFile(L"\\storage card\\devel\\ex8log.txt", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); i = 0; WriteFile(h, "Main : start\r\n", 14, &w, NULL); *i = 1; WriteFile(h, "Main : end\r\n", 12, &w, NULL); (void)CloseHandle(h); exit(0); }
#include <windows.h> #include <stdio.h> #include <stdlib.h> #include "myexcpt.h" HANDLE h = 0; void handler(struct _EXCEPTION_RECORD *ExceptionRecord, void *EstablisherFrame, struct _CONTEXT *ContextRecord, struct _DISPATCHER_CONTEXT *DispatcherContext) { MessageBoxW(0, L" ? ", L"Handler : error", 0); exit(0); } int main(int argc, char *argv[]) __attribute__((__exception_handler__(handler))); int main(int argc, char *argv[]) { int *i; DWORD w; h = CreateFile(L"\\storage card\\devel\\ex8log.txt", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); (void)CloseHandle(h); i = 0; *i = 1; exit(0); }
#include <windows.h> #include <stdio.h> #include <stdlib.h> #include "myexcpt.h" void handler(struct _EXCEPTION_RECORD *ExceptionRecord, void *EstablisherFrame, struct _CONTEXT *ContextRecord, struct _DISPATCHER_CONTEXT *DispatcherContext) { DWORD w; HANDLE h = CreateFile(L"\\storage card\\devel\\handler.txt", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); WriteFile(h, "Handler\r\n", 9, &w, NULL); CloseHandle(h); MessageBoxW(0, L" ? ", L"Handler : error", 0); exit(0); } int main(int argc, char *argv[]) __attribute__((__exception_handler__(handler))); int main(int argc, char *argv[]) { int *i; i = 0; *i = 1; exit(0); }
signature.asc
Description: This is a digitally signed message part
------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________ Cegcc-devel mailing list Cegcc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cegcc-devel