home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / ddjmag / ddj9209.zip / POST.ASC < prev    next >
Text File  |  1992-08-10  |  641b  |  39 lines

  1. _POSTMORTEM DEBUGGING_
  2. by Matt Pietrek
  3.  
  4. [EXAMPLE 1]
  5.  
  6. #include <windows.h>
  7. #include <string.h>
  8. #include <dos.h>
  9.  
  10. int MeaningOfLife = 0x42;   // A meaningless global,
  11.                             // for DFA demonstration
  12.  
  13. void Foo(void far *ptr)
  14. {
  15.     _fstrlen(ptr);  // This call will GP fault
  16. }
  17.  
  18. static void Bar(void far *ptr)
  19. {
  20.     void far *b;    // Local var for DFA demonstration
  21.     
  22.     b = ptr;
  23.         
  24.     Foo(b);
  25. }
  26.  
  27. int PASCAL WinMain(
  28.     HANDLE hInstance,
  29.     HANDLE hPrevInstance,
  30.     LPSTR lpszCmdLine,
  31.     int nCmdShow
  32. )
  33. {
  34.     Bar(MK_FP(1,0));    // pass bad pointer
  35.     return 0;   
  36. }
  37.  
  38.  
  39.