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.)
thanks:(
thanks:(
Can you not double post? An answer
is not faster when double posting.
I have deleted the other post in Main.
is not faster when double posting.
I have deleted the other post in Main.
hehe that's my fault :)
I moved it but chose the wrong moving option.
I thought his question would be helped faster in 'Main'.
I moved it but chose the wrong moving option.
I thought his question would be helped faster in 'Main'.
Whoops, guess I deleted the wrong one.
Sorry, Moojit - I can't move it to Main.
Sorry, Moojit - I can't move it to Main.
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:
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?
regards
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?
regards
.386
.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
.const
NewLine db 0Ah, 0Dh
.code
start proc uses esi edi
LOCAL hHeap:HANDLE
LOCAL pHeap:LPVOID
LOCAL cb:UINT
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
.endw
invoke MessageBox, NULL, edi, NULL, MB_OK
invoke HeapFree, hHeap, 0, edi
.break
.else
invoke GetLastError
.break .if eax != ERROR_INSUFFICIENT_BUFFER
; 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
.endif
.endw
.endif
invoke HeapFree, hHeap, 0, pHeap
.endif
invoke ExitProcess, 0
start endp
end start
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.
regards
regards
QueryDosDevice
"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."
"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."
uhmm.... i had to... anyway... thanks Four-F for that info. sorry to bother you :)
regards
regards
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
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