.386
.model flat,stdcall
option casemap:none
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
include ole32.inc
includelib ole32.lib
include shell32.inc
includelib shell32.lib
include comdlg32.inc
includelib Comdlg32.lib
DLG_MAIN EQU 1000
IDC_OPEN EQU 1001
IDC_DOS EQU 1002
IDC_FILE EQU 1003
IDC_OPTIONAL EQU 1004
IDC_DIRECTORIES EQU 1005
IDC_SECTION EQU 1006
IDC_CHARATERISICS EQU 1007
IDC_EDT1 EQU 1008
IDC_ENTRYPOINT EQU 1009
IDC_EDT2 EQU 1010
IDC_IMAGEBASE EQU 1011
IDC_EDT3 EQU 1012
IDC_EDT4 EQU 1013
IDC_SUM EQU 1014
IDC_CODERVA EQU 1015
IDC_EDT5 EQU 1016
IDC_EDT6 EQU 1017
IDC_DATARVA EQU 1018
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data?
hInstance dd ?
hWinMain dd ?
szFilePath db MAX_PATH DUP (?)
hFile dd ?
.data
szFilter db 'Excutive Files(*.txt;*.dll)',0,0
szDefExt db '.exe',0
.code
_Open proc
LOCAL buffer:dword
LOCAL pFile:dword
LOCAL @bytesread:dword
LOCAL @stOpenFileName:OPENFILENAME
LOCAL @szFileName[MAX_PATH]:byte
invoke RtlZeroMemory,addr @stOpenFileName,sizeof(OPENFILENAME)
mov @stOpenFileName.lpstrFilter,offset szFilter
invoke RtlZeroMemory,addr @szFileName,MAX_PATH
mov @stOpenFileName.lpstrFile,addr @szFileName
mov @stOpenFileName.nMaxFile,MAX_PATH
mov @stOpenFileName.lpstrDefExt,offset szDefExt
mov @stOpenFileName.Flags,OFN_PATHMUSTEXIST or OFN_FILEMUSTEXIST
invoke GetOpenFileName,addr @stOpenFileName
invoke CreateFile,addr @szFileName,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,NULL,NULL
.if eax == INVALID_HANDLE_VALUE
invoke MessageBox,hWinMain,NULL,NULL,MB_OK
xor eax,eax
ret
.endif
mov hFile,eax
invoke RtlZeroMemory,addr buffer,sizeof(dword)
invoke SetFilePointer,hFile,3ch,0,FILE_BEGIN
invoke ReadFile,hFile,addr buffer,4,addr @bytesread,NULL
invoke SetDlgItemInt,hWinMain,IDC_EDT1,addr buffer,FALSE
ret
_Open endp
_DlgMainProc proc uses ebx edi esi hWnd,uMsg,wParam,lParam
mov eax,uMsg
.if eax == WM_CLOSE
invoke CloseHandle,hFile
invoke EndDialog,hWnd,NULL
.elseif eax == WM_INITDIALOG
push hWnd
pop hWinMain
.elseif eax == WM_COMMAND
mov eax,wParam
movzx eax,ax
.if ax == IDC_OPEN
invoke _Open
.endif
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
_DlgMainProc endp
start: invoke GetModuleHandle,NULL
mov hInstance,eax
invoke DialogBoxParam,hInstance,DLG_MAIN,NULL,offset _DlgMainProc,NULL
invoke ExitProcess,NULL
end start
error A2008: syntax error : addr
搞的头大,实在搞不懂才发到论坛里的,希望各位朋友帮忙看看我哪里写错了
------解决方案--------------------
mov @stOpenFileName.lpstrFile,addr @szFileName
改写成
lea eax,@szFileName
mov @stOpenFileName.lpstrFile,eax