I'm having problems getting this API to work w/ MASM32, has anyone tried it or been successful? It's defined in kernel32.inc. I've verified that the C version of this call does work. It returns error code 0x3e6h (998 Invalid access to memory location.)

Posted on 2002-02-28 16:27:45 by moojit
Can you not double post? An answer
is not faster when double posting.
I have deleted the other post in Main.
Posted on 2002-02-28 16:35:31 by bitRAKE
hehe that's my fault :)

I moved it but chose the wrong moving option.
I thought his question would be helped faster in 'Main'.
Posted on 2002-02-28 16:55:31 by Hiroshimator
Whoops, guess I deleted the wrong one.
Sorry, Moojit - I can't move it to Main.
Posted on 2002-02-28 17:16:18 by bitRAKE
hi all, i had a little same problem with it. it been one day long i tried to figure out why my call to QueryDosDevice API in win98 doesnt work. it return 0, aka no device. i use these codes:

char buff[256] = "";
DWORD retv = QueryDosDevice(NULL, &buff[0], 255);

i passed the 1st param NULL to enum all available dos devices , but it failed. i try with "C:" or "D:" in 1st param, it work. but the former was not. anyone know how to call it properly?

Posted on 2002-12-30 07:33:03 by dion

.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\iinclude\user32.inc
include \masm32\iinclude\kernel32.inc

includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib

NewLine db 0Ah, 0Dh


start proc uses esi edi


invoke GetProcessHeap
.if eax != NULL
mov hHeap, eax
; lets start with 1024 bytes
mov cb, 1024
invoke HeapAlloc, hHeap, 0, cb
.if eax != NULL
mov pHeap, eax

.while TRUE
invoke QueryDosDevice, NULL, pHeap, cb
.if eax != 0
; Process buffer filled with the info
mov eax, cb
add eax, 512
invoke HeapAlloc, hHeap, HEAP_ZERO_MEMORY, eax
.break .if eax == NULL
mov edi, eax
mov esi, pHeap

.while TRUE
invoke lstrcat, edi, esi
invoke lstrcat, edi, addr NewLine

invoke lstrlen, esi
add esi, eax
inc esi
.break .if byte ptr [esi] == 0

invoke MessageBox, NULL, edi, NULL, MB_OK
invoke HeapFree, hHeap, 0, edi
invoke GetLastError
; assume 65536 byte is enough
.break .if cb >= 1000h * 10h
; try twice more memory
shl cb, 1
invoke HeapReAlloc, hHeap, 0, pHeap, cb
.break .if eax == NULL
mov pHeap, eax

invoke HeapFree, hHeap, 0, pHeap

invoke ExitProcess, 0

start endp

end start
Posted on 2003-01-01 10:08:29 by Four-F
thanks Four-F. but FYI, that the call to QueryDosDevice was fail, and there is a wierd behaviour that when i set buffer to extend 255 bytes, it wont process "D:" or "C:" string, aka error reported. and please note that i'm running it in win98, NOT in winNT/2K/XP. i had run it on those OS and its OK, but in Win98, its NOT.

Posted on 2003-01-02 00:18:57 by dion

"Windows 98/Me: QueryDosDeviceW is supported by the Microsoft Layer for Unicode. To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems."
Posted on 2003-01-04 04:01:10 by Four-F
uhmm.... i had to... anyway... thanks Four-F for that info. sorry to bother you :)

Posted on 2003-01-04 23:50:03 by dion
Posted on 2003-01-05 03:58:37 by shsho
ok?? geeee! could you be more descriptive than just saying "ok?" ?

btw, actually i didnt pursue it anymore because MS said it need install something again :( all in all, it is not user-friendly anymore :(
who wants to download it just to running that API in win98, eh?
well, maybe you want that, but how about your users then? if i'm the user, then maybe i choose to delete your app immediately rather than dl that file ;p
what da... ok, ok, enuff that :p
Posted on 2003-01-12 20:38:05 by dion