Jump to content

  • Log In with Google      Sign In   
  • Create Account

[Win32] IFileOpenDialog::Show throw exception


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Plerion   Members   -  Reputation: 368

Like
0Likes
Like

Posted 09 February 2011 - 03:51 PM

Hello!

Im observing a very weird behaviour when using the IFileOpenDialog interface. I have the following wrapper:

FileOpenDialog::FileOpenDialog()
{
    HRESULT res = CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&m_native));
    if(m_native == NULL)
        throw Win32Exception("CoCreateInstance", HRESULT_CODE(res));
}

void FileOpenDialog::ShowDialog(HWND hWindow)
{
    HRESULT hRes = m_native->Show(hWindow);
}

I also have my own exception system built up. But now if i use that code m_native->Show throws an exception with code 0x6BA which will launch my exception system. Normally i terminate my application if exceptions occur after displaying some infos about it. But if i now return EXCEPTION_CONTINUE_SEARCH the system doesnt care about that exception and all works as it should.

Image:
Posted Image


So i have three questions:
Why is there obviously another handler even if i set my handler up with AddVectoredExceptionHandler and First set to FALSE?
Why is that exception thrown?
How can i determine if i really have an unhandled exception which wont have any handler in later handlers?

Greetings and thanks
Plerion

Sponsor:

#2 SiCrane   Moderators   -  Reputation: 9668

Like
1Likes
Like

Posted 09 February 2011 - 05:08 PM

Vectored exception handlers are not the only type of SEH exception handlers. In addition to vectored exception handlers there are frame based exception handlers and a top level exception handler for the thread. When an SEH exception is raised, first the vectored exception handlers are tried, then any frame based exception handlers then finally the top level exception handler. For a vectored exception handler, there's always another exception handler that could be called. The default behavior of the top level exception handler is to "handle" the exception by displaying an error message saying there has been an unhandled exception, so trying to find out if there's an handler that will handle the exception isn't actually all that useful. However, it sounds like you don't really want a vectored exception handler, but you want your exception handler to be the top level handler. To do this you can use the SetUnhandledExceptionFilter() function.

#3 Plerion   Members   -  Reputation: 368

Like
0Likes
Like

Posted 10 February 2011 - 02:08 PM

Hey!

Thank you for the tip, ive messed something up with my most recent project where i had to catch exceptions _before_  the games own handler comes to play (i was drawing a chatoverlay into a games client). But now i have the problem, that no exception is catched at all. I always get an APPCRASH-message from windows excatly pointing to the location where ive put my __asm cli; (checked with IDA). So it seems that the exception is not passed to my unhandled exception filter at all (set using SetUnhandledExceptionFilter).

Greetings



#4 SiCrane   Moderators   -  Reputation: 9668

Like
0Likes
Like

Posted 10 February 2011 - 02:53 PM

If that's not working for you, I'd just use a frame based handler.

#5 Plerion   Members   -  Reputation: 368

Like
0Likes
Like

Posted 10 February 2011 - 03:38 PM

Actually i would like to understand why its not working. Why is my call to SetUnhandledExceptionFilter obviously completely ignored? My exception handler never gets called at all and i get an appcrash. Ive used SetUnhandledExceptionFilter before without any problems but now im just skipped by the OS. May the problem be that i call the function inside a DLL and register a function within it?




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS