I wanted to check if a drive was present, with QueryDosDevice, and saw only one drive S:
So I launched Olly and checked. Under XP, 170+ "devices", under Win7 a bit more 8)
include \masm32\MasmBasic\MasmBasic.inc ; download (http://masm32.com/board/index.php?topic=94.0)
SetGlobals buflen=80000, buffer[80000]:BYTE
Init
SetGlobals
lea esi, buffer
invoke QueryDosDevice, 0, esi, buflen
.if !eax
Inkey Err$() ; unlikely
.else
push esi
xchg eax, ecx
.Repeat
lodsb
.if !al
mov byte ptr [esi-1], 10 ; replace zero delimiter with LF
.endif
dec ecx
.Until Sign?
pop esi
StringToArray esi, dd$() ; translate buffer to string array
QSort dd$() ; make it alphabetical
For_ ecx=0 To eax-2 ; last one is an empty string
Print Str$("\n%i\t",ecx+1), Left$(dd$(ecx), 60) ; some are too long for the console
Next
Inkey Str$("\n%i DOS devices found", ecx)
.endif
Exit
end start