home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l350 / 3.ddi / EXAMPLES / WINDOWS / WINTASK.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-30  |  1009 b   |  59 lines

  1. /* 
  2. WINTASK.C
  3. */ 
  4.  
  5. #include <stdlib.h> 
  6. #include <string.h>
  7. #include <dos.h> 
  8. #include <pharlap.h>
  9. #include "wintask.h" 
  10.  
  11. #define CLEAR(x)    memset(&x, 0, sizeof(x)) 
  12.  
  13. unsigned VMId(void) 
  14.     SWI_REGS r; 
  15.     CLEAR(r); 
  16.     r.eax = 0x1683; 
  17.     _dx_real_int(0x2f, &r);
  18.     return r.ebx & 0xFFFF;  // VM# returned in BX 
  19.  
  20. void BeginCriticalSection(void) 
  21.     SWI_REGS r; 
  22.     CLEAR(r); 
  23.     r.eax = 0x1681; 
  24.     _dx_real_int(0x2f, &r);
  25.  
  26. void EndCriticalSection(void) 
  27.     SWI_REGS r; 
  28.     CLEAR(r); 
  29.     r.eax = 0x1682; 
  30.     _dx_real_int(0x2f, &r);
  31.  
  32. void Yield(void)
  33. {
  34.     SWI_REGS r;
  35.     memset(&r, 0, sizeof(r));
  36.     r.eax = 0x1680;
  37.     _dx_real_int(0x2f, &r);
  38.     return;
  39. }
  40.  
  41. int win3e(int *pmaj, int *pmin) 
  42.    SWI_REGS regs;
  43.  
  44.    memset(®s, 0, sizeof(regs));
  45.    regs.eax = 0x1600;
  46.    _dx_real_int(0x2f, ®s);
  47.    *pmaj = regs.eax & 0xff;
  48.    *pmin = (regs.eax >> 8) & 0xff;
  49.    return (*pmaj > 1 && *pmaj != 0x80);
  50.  
  51.