为什么当我尝试写第33段时,GetLastError
会返回5?
我的Masm32源代码:
include \masm32\include\masm32rt.inc
.data?
hDrv HANDLE ?
buffer byte 512 dup(?)
tmp512 byte 512 dup(?)
.code
start:
STRING p,"\\.\PhysicalDrive0"
call main
inkey
exit
main proc
local i:dword
invoke CreateFile,addr p,GENERIC_READ or GENERIC_WRITE,NULL,NULL,OPEN_EXISTING,0,0
mov hDrv,eax
mov i,1
.while TRUE
invoke ReadFile,hDrv,addr buffer,512,addr tmp512,NULL
invoke WriteFile,hDrv,addr buffer,512,addr tmp512,NULL
.if eax==1
print str$(i),13,10,0
inc i
.else
invoke GetLastError
print str$(eax),13,10,0
.endif
.endw
invoke CloseHandle,hDrv
ret
main endp
end start
答案 0 :(得分:0)
这里解释了错误代码......
https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382%28v=vs.85%29.aspx
ERROR_ACCESS_DENIED
5 (0x5)
可能是许可问题。
Access is denied.