Re: Almost there on Win OS detection

From: Calm n Collected (spamtrap_at_crayne.org)
Date: 09/19/04


Date: Sun, 19 Sep 2004 00:29:40 +0000 (UTC)


"Jim Carlock" <spamtrap@crayne.org> wrote in message news:<mnM2d.39824$uN5.1365@tornado.tampabay.rr.com>...
> Interrupt 2F, 160A does not put 0000 into AX on a WinXP
> Pro machine while running the program inside of debug.exe.
>
> A tmp.com with the program loaded reports that XP is NOT
> a Win32 system.
>
> AX retains 160A inside of it upon return from the int 2F. 2F
> does no visible changes to the registers. Of course, the debug
> program I'm using is the one that comes with XP, and it does
> NOT appear to support 32-bit registers.
>
> The code appears as follows inside the program, tmp.com:
> 0100 mov ax, cs
> 0102 mov ds, ax
> 0104 mov ax, 160a
> 0107 int 2f
> 0109 cmp ax, 0000
> 010C jnz 011F
> 010E cmp bh, 04
> 0111 jl 011F
> 0113 mov ah, 09
> 0115 mov dx, 031e
> 0118 int 21
> 011A mov ax, 4c00
> 011D int 21
> 011F mov ah, 09
> 0121 mov dx, 0300
> 0124 int 21
> 0126 mov ax, 4c01
> 0129 int 21
> 012B int 20
>
> a 300
> db "A Win32 OS is NOT present!!" 0a 0d "$"
> a 31e
> db "A Win32 OS is present." 0a 0d "$"
>
> I'm sure the first two lines aren't needed to run the program.
>
> --
> Jim Carlock
> http://www.microcosmotalk.com/
> Post replies to the newsgroup.

Could you try this. I think this is a better way. This also assembles OK under
ml 6.14 directly.

Thanks.

;=============================================================
; LFN.ASM Works fine up to Win2000 ,NT and XP not tested yet
; Code by Hutch
; This is a quick and dirty example of how to check for
; LFN support.
;
; ML /c LFN.ASM
; LINK16 LFN.OBJ;
;=============================================================
      .model small
      .stack
      .data
         buffer db 262 dup(0)
         no db "no$"
         support db "support",13,10,"$"
      .code
      .startup
      ; Set up and call the Windows 9x Long Filename Get
      ; Current Directory function. If the function is
      ; supported it will return with the carry flag clear.
      ; If the function is not supported (OSs prior to
      ; Windows 95 and Windows 9x MS-DOS mode), it will
      ; return with the carry flag set (and the value
      ; 7100h in AX).
      mov ax,7147h
      ; DL = drive number (00h = current, 01h = A:, etc)
      mov dl,0
      ; DS:SI -> buffer for ASCIZ directory name
      mov si,offset buffer
      ; For compatibility with OSs prior to Windows 95 and
      ; Windows 9x MS -DOS mode, the carry flag should be
      ; set prior to the call.
      stc
      int 21h
      jnc @F
      mov ah,9
      mov dx,offset no
      int 21h

   @@:
      mov ah,9
      mov dx,offset support
      int 21h
         
      ; Wait for key press.
     ; mov ah,0
     ; int 16h
     ; cmp ah,1
      .exit
end



Relevant Pages

  • Re: which way is faster?
    ... For example, I can add to allocated variables, and I can move them to ... addition in the registers is faster. ... MOV eax, ... cycles I read, inclusive, Using your previously posted technic. ...
    (alt.lang.asm)
  • Re: howto: MOV EAX, <64bit value> ?
    ... mov eax, ... MOV and the same number of 'pull' instructions on the other. ... wise compression routine to get them to fit into the 8-bit registers. ...
    (alt.lang.asm)
  • Re: Help in getting application to access I/O space
    ... pointers for how to do 32-bit I/O space accesses, ... BYTE inpb(USHORT addr) ... mov dx, addr ... the registers are mapped as offsets into "I/O Space". ...
    (microsoft.public.windowsce.embedded)
  • Re: Help in getting application to access I/O space
    ... BYTE inpb(USHORT addr) ... mov dx, addr ... the registers are mapped as offsets into "I/O Space". ...
    (microsoft.public.windowsce.embedded)
  • Re: Help in getting application to access I/O space
    ... BYTE inpb(USHORT addr) ... mov dx, addr ... the registers are mapped as offsets into "I/O Space". ...
    (microsoft.public.windowsce.embedded)