0

I am trying find a problem with my program that is hooking into a game. This is vc++. Basically I launch the program and then hook into it using SDL. When I run the code from VS2010, all works fine. But when I try to run from command prompt, my program can launch the game, but after that the game crashes immediately.

I was viewing windows event logs, and it appears that there is an access violation. 0xc000005

How can I log any further details about the program that crashes? I tried "procdump" but that is not useful as I cannot INDIRECTLY target the hooked game from console. Rather it can only target my application that hooks.

Anyway of getting detailed dumps is highly appreciated in this case. Thanks!

Wajih
  • 793
  • 3
  • 14
  • 31
  • 1
    If you don't get the WER crash dialog, the one that gives you lots of time to attach a debugger, then attach it when [the program starts up](http://stackoverflow.com/questions/5513654/how-to-set-breakpoint-at-the-very-beginning-of-program-execution). – Hans Passant Jan 30 '15 at 10:52
  • 1
    Run VS2010 IDE with `/debugexe` option. I.e. `> vcvarsall.bat` then `> devenv.exe /debugexe YourProgram.exe`. If you want to generate minidump on error, you may use domething like this: https://github.com/myaut/tsload/blob/master/agent/test/common/fault.c – myaut Jan 30 '15 at 10:55
  • Ok thanks, I am going to give it a try. – Wajih Jan 30 '15 at 11:05
  • I will try both methods! – Wajih Jan 30 '15 at 11:10

1 Answers1

1

You can perform postmortem debugging by using a combination of the WER registry keys/values to trap any dump that is produced. I’ve used this method to prevent the WER system from collecting the dump file (.dmp). I’ve also written about this in another similar post. To accomplish this, you will need to create a registry key under

Software\Microsoft\Windows\Windows Error Reporting

if one does not already exist. The key should be

LocalDumps\your application.exe

Once that’s done, modify these keys/values to meet your needs:

DumpCount, DumpFolder, DumpType

You’ll need Administrator rights to create and modify the keys, and, you should reset everything you’ve modified when you’re done debugging.

Community
  • 1
  • 1
rrirower
  • 4,338
  • 4
  • 27
  • 45