Click here to Skip to main content
15,887,434 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHttp Response Code is -1 ? Pin
VishalIndia21-Oct-09 20:29
VishalIndia21-Oct-09 20:29 
AnswerRe: Http Response Code is -1 ? Pin
Randor 21-Oct-09 21:22
professional Randor 21-Oct-09 21:22 
GeneralRe: Http Response Code is -1 ? Pin
VishalIndia21-Oct-09 22:05
VishalIndia21-Oct-09 22:05 
GeneralRe: Http Response Code is -1 ? Pin
Randor 22-Oct-09 16:40
professional Randor 22-Oct-09 16:40 
GeneralRe: Http Response Code is -1 ? Pin
VishalIndia24-Oct-09 7:01
VishalIndia24-Oct-09 7:01 
GeneralRe: Http Response Code is -1 ? Pin
Randor 24-Oct-09 16:55
professional Randor 24-Oct-09 16:55 
GeneralRe: Http Response Code is -1 ? Pin
rahul.kulshreshtha29-Oct-09 0:12
rahul.kulshreshtha29-Oct-09 0:12 
QuestionHow to catch exception before a crash happens? Pin
jtasph21-Oct-09 20:20
jtasph21-Oct-09 20:20 
I want to log some information before the application crashes. I find the function SetUnhandledExceptionFilter() in MSDN, which enables an application to supersede the top-level exception handler of each thread and process. I'm not sure whether it can catch all exception in a MFC application or not.
I also found some articles about SetUnhandledExceptionFilter in VS2005. It seems that we need to disable the SetUnhandledExceptionFilter function called by CRT. The code is as follows:
void DisableSetUnhandledExceptionFilter()
{
    void *addr = (void*)GetProcAddress(LoadLibrary(_T("kernel32.dll")),
                                                         "SetUnhandledExceptionFilter");
    if (addr) 
    {
              unsigned char code[16];
              int size = 0;
              code[size++] = 0x33;
              code[size++] = 0xC0;
              code[size++] = 0xC2;
              code[size++] = 0x04;
              code[size++] = 0x00;
 
              DWORD dwOldFlag, dwTempFlag;
              VirtualProtect(addr, size, PAGE_READWRITE, &dwOldFlag);
              WriteProcessMemory(GetCurrentProcess(), addr, code, size, NULL);
              VirtualProtect(addr, size, dwOldFlag, &dwTempFlag);
       }
}

I don't know what's the meaning of "0x33, 0xC0, 0xC2, 0x04, 0x00". Who does understand the code?
In addition, when I debug the code to catch exception, a exception dialog will ask me "Abort, Retry or Ignore". If I select "Abort" or "Ignore', my defined exception funciton will not call. Instead I want it will be called in any case.
So is there some solution for my requirement? Thanks!
AnswerRe: How to catch exception before a crash happens? Pin
Randor 21-Oct-09 20:29
professional Randor 21-Oct-09 20:29 
QuestionRe: How to catch exception before a crash happens? Pin
jtasph21-Oct-09 20:39
jtasph21-Oct-09 20:39 
AnswerRe: How to catch exception before a crash happens? Pin
Randor 21-Oct-09 20:57
professional Randor 21-Oct-09 20:57 
GeneralOT Pin
Rajesh R Subramanian21-Oct-09 20:59
professionalRajesh R Subramanian21-Oct-09 20:59 
GeneralRe: OT Pin
Randor 21-Oct-09 21:06
professional Randor 21-Oct-09 21:06 
GeneralRe: OT-2 Pin
CPallini21-Oct-09 21:10
mveCPallini21-Oct-09 21:10 
JokeRe: OT-2 Pin
Rajesh R Subramanian22-Oct-09 7:39
professionalRajesh R Subramanian22-Oct-09 7:39 
GeneralRe: OT-2 Pin
CPallini22-Oct-09 9:26
mveCPallini22-Oct-09 9:26 
AnswerRe: How to catch exception before a crash happens? Pin
Naveen21-Oct-09 20:59
Naveen21-Oct-09 20:59 
QuestionRe: How to catch exception before a crash happens? Pin
jtasph21-Oct-09 21:26
jtasph21-Oct-09 21:26 
AnswerRe: How to catch exception before a crash happens? Pin
Naveen21-Oct-09 21:53
Naveen21-Oct-09 21:53 
AnswerRe: How to catch exception before a crash happens? Pin
Randor 21-Oct-09 22:10
professional Randor 21-Oct-09 22:10 
GeneralRe: How to catch exception before a crash happens? Pin
jtasph21-Oct-09 22:18
jtasph21-Oct-09 22:18 
QuestionRe: How to catch exception before a crash happens? [modified] Pin
jtasph21-Oct-09 23:16
jtasph21-Oct-09 23:16 
QuestionNeed help for CStdioFile Read mode Pin
Nicholas Amh21-Oct-09 19:23
Nicholas Amh21-Oct-09 19:23 
AnswerRe: Need help for CStdioFile Read mode Pin
Adam Roderick J21-Oct-09 19:38
Adam Roderick J21-Oct-09 19:38 
GeneralRe: Need help for CStdioFile Read mode Pin
Nicholas Amh21-Oct-09 19:47
Nicholas Amh21-Oct-09 19:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.