home *** CD-ROM | disk | FTP | other *** search
-
-
- /***
- This code should detect the presense of Windows when run from a DOS
- application. It doesn't detect Windows' real mode (which isn't
- supported under 3.1, and is of little advantage even under 3.0).
- ***/
-
-
- int windows_running( void)
- {
- asm mov ax,160AH
- asm int 2FH
- asm or ax,ax
- asm jz windows_found /* Win 3.1 found */
-
- asm mov ax,1600H
- asm int 2FH
- asm and al,2FH
- asm jnz windows_found /* Win 3.0 enhanced mode */
-
- asm mov ax,4680H
- asm int 2FH
- asm or ax,ax
- asm jnz windows_not_found
-
- asm sub bx,bx
- asm mov es,bx
- asm mov di,bx
- asm mov ax,4B02H
- asm int 2FH
- asm or ax,ax /* DOS 5.0 Windows-like code running, */
- asm jz windows_not_found /* but it's not Windows */
-
- asm mov ax,1605H
- asm int 2FH
- asm inc cx
- asm push cx
- asm mov ax,1606H
- asm int 2FH
- asm pop cx
- asm jcxz windows_found /* Win 3.0 standard mode */
-
- windows_not_found:
- asm sub ax,ax
- goto end_windows_running;
-
- windows_found:
- asm mov ax,1
-
- end_windows_running:
- return _AX;
- }
-
- #include <stdio.h>
-
- main()
- {
- puts( ( windows_running()) ? "Windows Running" : "Windows not found");
- return 0;
- }
-
-
-