Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. SetUnhandledExceptionFilter doesnt work

SetUnhandledExceptionFilter doesnt work

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chintoo723
    wrote on last edited by
    #1

    I have a C++ DLL that some other programs use. I set SetUnhandledExceptionFilter in the DLL to catch any application crashes. The application crashes, the DLL's ProcessDetach isnt called, but this filter function isnt called either. Any tips for debugging this problem? thanks!

    _ S 2 Replies Last reply
    0
    • C Chintoo723

      I have a C++ DLL that some other programs use. I set SetUnhandledExceptionFilter in the DLL to catch any application crashes. The application crashes, the DLL's ProcessDetach isnt called, but this filter function isnt called either. Any tips for debugging this problem? thanks!

      _ Offline
      _ Offline
      __yb
      wrote on last edited by
      #2

      Maybe someone called ExitProcess? put a breakpoint in ExitProcess and track back the call stack..

      C 1 Reply Last reply
      0
      • C Chintoo723

        I have a C++ DLL that some other programs use. I set SetUnhandledExceptionFilter in the DLL to catch any application crashes. The application crashes, the DLL's ProcessDetach isnt called, but this filter function isnt called either. Any tips for debugging this problem? thanks!

        S Offline
        S Offline
        Stephen Hewitt
        wrote on last edited by
        #3

        Maybe another module called SetUnhandledExceptionFilter and replaced your handler but isn't calling yours. It is unusual for a DLL to call this API - Normally you'd do this kind of thing in the .EXE. You could place a breakpoint inside SetUnhandledExceptionFilter and check for this. Steve

        C 1 Reply Last reply
        0
        • _ __yb

          Maybe someone called ExitProcess? put a breakpoint in ExitProcess and track back the call stack..

          C Offline
          C Offline
          Chintoo723
          wrote on last edited by
          #4

          __yb wrote:

          Maybe someone called ExitProcess?

          If that is the case my DLL's ProcessDetach should be called right? Other possibility is TerminateProcess is called.

          __yb wrote:

          put a breakpoint in ExitProcess and track back the call stack..

          I will try this. Although I only have release version of the application - I am not sure if I am going to get the call stack to see. thanks!

          1 Reply Last reply
          0
          • S Stephen Hewitt

            Maybe another module called SetUnhandledExceptionFilter and replaced your handler but isn't calling yours. It is unusual for a DLL to call this API - Normally you'd do this kind of thing in the .EXE. You could place a breakpoint inside SetUnhandledExceptionFilter and check for this. Steve

            C Offline
            C Offline
            Chintoo723
            wrote on last edited by
            #5

            Stephen Hewitt wrote:

            Maybe another module called SetUnhandledExceptionFilter and replaced your handler but isn't calling yours

            How do we detect that? How do find out the currently set unhandled exception filters, if any?

            Stephen Hewitt wrote:

            It is unusual for a DLL to call this API - Normally you'd do this kind of thing in the .EXE

            Actually, it used to work earlier. Due to some changes this regressed. I only need tips to debug this.

            Stephen Hewitt wrote:

            You could place a breakpoint inside SetUnhandledExceptionFilter and check for this.

            As I said I already have a message box as the first statement in SetUnhandledExceptionFilter filter, and that doesnt come up. So I am assuming my filter isnt called at all :-( thanks!

            S 1 Reply Last reply
            0
            • C Chintoo723

              Stephen Hewitt wrote:

              Maybe another module called SetUnhandledExceptionFilter and replaced your handler but isn't calling yours

              How do we detect that? How do find out the currently set unhandled exception filters, if any?

              Stephen Hewitt wrote:

              It is unusual for a DLL to call this API - Normally you'd do this kind of thing in the .EXE

              Actually, it used to work earlier. Due to some changes this regressed. I only need tips to debug this.

              Stephen Hewitt wrote:

              You could place a breakpoint inside SetUnhandledExceptionFilter and check for this.

              As I said I already have a message box as the first statement in SetUnhandledExceptionFilter filter, and that doesnt come up. So I am assuming my filter isnt called at all :-( thanks!

              S Offline
              S Offline
              Stephen Hewitt
              wrote on last edited by
              #6

              Brundiez wrote:

              How do we detect that? How do find out the currently set unhandled exception filters, if any?

              I would use WinDBG as follows: 1. Start the process in question. 2. Type "bp kernel32!SetUnhandledExceptionFilter" in the command window. 3. Press F5. 4. When the breakpoint is hit look at the stack. 5. Goto step 3 This will show every call to SetUnhandledExceptionFilter made in the process. I would only pay attention to breakpoints that occur after your call to SetUnhandledExceptionFilter. Steve

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups