Привет!
Помогите пожалуйста понять как работать с функциями win api (особенно интересует. как получит возвращаемое значение).
Например, есть код
WCHAR FSType[512];
if (GetVolumeInformationW(L"D:\\", NULL, 0, NULL, NULL, NULL, FSType, ARRAYSIZE(FSType))) {
wprintf(L"FS type = %s\n", FSType);
}
invoke GetVolumeInformationW, (???), NULL, 0, NULL, NULL, NULL, ???, 512
Адреса строки и массива.
Если надо работать непосредственно со строкой (первый параметр), то
invoke GetVolumeInformationW, uni$("D:\"), ...(макрос uni$ описан в \masm32\macros\ucmacros.asm, если что)
Спасибо, ответы помогли.. Но что-то я так и не понял до конца(
Допустим, надо определить файловую систему логического раздела. Вот что у меня выходит
.486
.model flat, stdcall
option casemap :none
include c:\\masm32\include\windows.inc
include c:\\masm32\macros\macros.asm
include c:\\masm32\macros\ucmacros.asm
include c:\\masm32\include\masm32.inc
include c:\\masm32\include\gdi32.inc
include c:\\masm32\include\user32.inc
include c:\\masm32\include\kernel32.inc
includelib c:\\masm32\lib\masm32.lib
includelib c:\\masm32\lib\gdi32.lib
includelib c:\\masm32\lib\user32.lib
includelib c:\\masm32\lib\kernel32.lib
.data
adr db "D:\", 0
mas db 512 dup(0)
.code
start:
mov eax, 0
invoke GetVolumeInformationW, uni$("D:\"), NULL , 0, NULL, NULL, NULL, offset mas, 2
mov al, mas
mov ebx, 0
test al, 0BH
jz next1
print chr$("FAT32")
jmp end_partition
next1:
test al, 80H
jz next2
print chr$("NTFS")
jmp end_partition
next2:
print chr$("OtherFS")
end_partition:
print chr$(10, 13)
invoke ExitProcess, 0
exit
end start
mas db 512 dup(0)
.code
start:
mov eax, 0
invoke GetVolumeInformationW, uni$("D:\"), NULL, 0, NULL, NULL, NULL, ADDR mas, MAX_PATH
invoke MessageBoxW, NULL, addr mas, uni$("D:\ FS Info"), MB_OK
invoke ExitProcess, 0
exit
end start
mas db 512 dup(0)
.code
start:
mov eax, 0
invoke GetVolumeInformationW, uni$("D:\"), NULL, 0, NULL, NULL, NULL, ADDR mas, MAX_PATH
invoke MessageBoxW, NULL, addr mas, uni$("D:\ FS Info"), MB_OK
invoke ExitProcess, 0
exit
end start
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives){...}
sDrive db "Drive", 0Смысл программы, которую пишешь, в чем состоит?
driveNames db 128 dup(?);
.code
start:
mov eax, 0
invoke GetLogicalDriveStrings, SIZEOF driveNames, ADDR driveNames
lea esi, driveNames
.REPEAT
invoke GetDriveType, esi
.IF EAX == DRIVE_FIXED
invoke MessageBox, NULL, esi, ADDR sDrive, MB_OK
; Ну, а уж тут - делай что тебе надо...
.ENDIF
add esi, 4
.UNTIL byte ptr [esi] == 0
invoke ExitProcess, 0
exit
end start
sDrive db "Drive", 0Смысл программы, которую пишешь, в чем состоит?
driveNames db 128 dup(?);
.code
start:
mov eax, 0
invoke GetLogicalDriveStrings, SIZEOF driveNames, ADDR driveNames
lea esi, driveNames
.REPEAT
invoke GetDriveType, esi
.IF EAX == DRIVE_FIXED
invoke MessageBox, NULL, esi, ADDR sDrive, MB_OK
; Ну, а уж тут - делай что тебе надо...
.ENDIF
add esi, 4
.UNTIL byte ptr [esi] == 0
invoke ExitProcess, 0
exit
end start