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

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