home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / caway349.zip / BIN / CROAK2.C < prev    next >
C/C++ Source or Header  |  1996-06-17  |  741b  |  33 lines

  1. // croak2.c
  2. // C source example #2 on using UserDump API function
  3. #include <stdio.h>
  4. #include <i86.h>
  5.  
  6. char buffer[128]="Help me, I'm trapped in CW.ERR";
  7.  
  8. void main(void)
  9. {
  10.     int i;
  11.     union REGS regs;
  12.     struct SREGS sregs;
  13.  
  14.     segread(&sregs);
  15.     sregs.es=sregs.ds;
  16.     regs.x.edi=(int)buffer;
  17.     regs.w.cx=128;
  18.     regs.h.bl='A';  // ASCII dump
  19.     regs.h.bh=0;    // no presetting dump bytes
  20.     regs.w.ax=0xff2f;
  21.     int386x(0x31,®s,®s,&sregs);
  22.     croaker();
  23. }
  24.  
  25. void croaker(void)
  26. {
  27.     int i,peekaboo=0x12345678;
  28.  
  29.     printf("%d ",*(int *)peekaboo);     // if this one doesn't GPF,
  30.     peekaboo=0x87654321;                // then
  31.     printf("%d\n",*(int *)peekaboo);    // this one will
  32. }
  33.