.386
.model flat,stdcall
option casemap:none
;********************************************************************
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
;********************************************************************
.data
szTitle db 'ReadMBR',0
szDrivePath db '\\.\PHYSICALDRIVE0',0
;********************************************************************
.data?
buffer db 513 dup(0)
hFile dd ?
numOfRead dd ?
;********************************************************************
.code
start:
invoke CreateFile,addr szDrivePath,\
GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,0,NULL
.if eax != INVALID_HANDLE_VALUE
mov hFile,eax
invoke SetFilePointer,hFile,0,NULL,FILE_BEGIN
.if eax
invoke ReadFile,hFile,addr buffer,\
512,addr numOfRead,NULL
.if eax
invoke MessageBox,NULL,offset buffer,\
offset szTitle,MB_OK
invoke ExitProcess,NULL
.endif
.endif
.endif
invoke CloseHandle,hFile
end start
我想用以上代码读取MBR的信息,为什么一运行就产生异常被终止。。。望高人指点。。。。
(以管理员身份登陆)
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!