jack_p50
asked on
Detecting windows
How dos program can detect if was runned from windows (if windows are running)?
I just tested it, and yes, the above code will detect Windows 95/98.
If you want to determine the exact version of Windows, you can check the contents of the accumulator after the first call to interrupt $2f. AL will contain the "integer" part of the version, and AH will contain the "decimal part". Example AL=3, AH=11 means Windows 3.11.
ASKER
I'm satisfyed. Please post lightly modified function, that returns version as answer.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK, winver returns 4.0 in win95/98.
4.0 is Windows 95, 4.10 is Windows 98.
ASKER
you've 98? I'm OSR2
Type
Win3ModeType = (NoWin, RealStd, Enhanced);
Function CheckForWin3 : Win3ModeType; Assembler;
Asm
mov ax,1600h
int 2Fh
cmp al,1
jbe @@CheckRealStd
cmp al,80h
jae @@CheckRealStd
mov al,2
jmp @@ExitPoint
@@CheckRealStd:
mov ax,4680h
int 2Fh
or ax,ax
jnz @@notWin
mov al,1
jmp @@ExitPoint
@@notWin:
xor al,al
@@ExitPoint:
end;