home *** CD-ROM | disk | FTP | other *** search
/ Boston 2 / boston-2.iso / DOS / PROGRAM / PASCAL / CHKWIN / CHKWIN.PAS < prev   
Pascal/Delphi Source File  |  1993-12-01  |  2KB  |  61 lines

  1. {   Copyright (C) 1991 by: NativSoft Computing
  2.                            1155 College Ave.
  3.                            Adrian, MI, 49221
  4.                            CIS 71160,1045
  5.  
  6.     Based on information published in an article
  7.     by Ben Myers of Spirit of Performance, Inc.
  8.     (Dr. Dobb's Journal, #172, January, 1991, pg 116)
  9.  
  10.     Compiled with Turbo Pascal v6.
  11.  
  12.     Modified by Tom Clark.  Changed Errorlevel values.
  13.  
  14.     Return Errorlevel 0 if Windows not running,
  15.                       1 if Windows 2.x,
  16.                       2 if Windows 3 real or standard mode,
  17.                       3 if Windows 3 enhanced mode.
  18.  
  19. }
  20.  
  21. program findwin;
  22.  
  23. var t     : byte;
  24.     valu  : word;
  25.  
  26. BEGIN
  27.  
  28.   {Inline assembler or macro is necessary to make the multiplex (2Fh) call
  29.    because Turbo Pascal only *fakes* INTR procedure -- i.e., this DOESN'T
  30.    work:           var regs : registers;
  31.                      ...
  32.                    regs.ax := $1600;
  33.                    intr($2F,regs);
  34.                    valu := regs.al                                         }
  35.  
  36.   ASM
  37.     MOV AX, 1600h
  38.     INT 2Fh
  39.     MOV valu, AX
  40.   END;
  41.  
  42.   case lo(valu) of
  43.     $01,$FF : t := 1;           {win/386, ver 2.xx running}
  44.     $00,$80 : begin             {Enhanced, WIN/386, or WIN ver 2.xx NOT RUNNING
  45.                                  ... so, test for real or standard win 3.x }
  46.                 ASM
  47.                   MOV AX, 4680h
  48.                   INT 2Fh
  49.                   MOV valu, AX
  50.                 END;
  51.  
  52.                 if valu = 0 then t := 2   {real or standard win 3.x running}
  53.                 else t := 0;              {apparently NO WIN is running}
  54.               end;
  55.     else t := 3;  {enhanced win 3.x running}
  56.   end; {case}
  57.  
  58. halt(t);
  59.  
  60. end.
  61.