能力值:
( LV2,RANK:10 )
|
-
-
2 楼
invoke wsprintf,addr @szBuffer,addr szFormat,@dw , addr @lpMsgBuf
去掉 addr 即可
|
能力值:
( LV3,RANK:30 )
|
-
-
3 楼
.const
szFormat db '%s failed with error %d: %s',0
invoke wsprintf,addr @szBuffer,addr szFormat,@dw ,addr @lpMsgBuf
wsprintf少一个参数,另外FormatMessage的参数似乎也有点问题
|
能力值:
( LV9,RANK:380 )
|
-
-
4 楼
.386
.model flat,stdcall
option casemap:none
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; Include 文件定义
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 数据段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data
szText db 'test',0
szFormat db '%s failed with error %d: %s',0
.data?
@szBuffer db 256 dup(?)
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 代码段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.code
_ErrorExit proc lpszFunction:DWORD
pushad
invoke GetLastError
mov esi,eax
;invoke FormatMessage,FORMAT_MESSAGE_ALLOCATE_BUFFER or FORMAT_MESSAGE_FROM_SYSTEM,NULL,@dw ,0,addr @lpMsgBuf,0,NULL
push 0 ; Arguments
push 0 ; nSize
push offset @szBuffer ; lpBuffer
push 400h ; dwLanguageId
push esi ; dwMessageId
push 0 ; lpSource
push 1100h ; dwFlags
call FormatMessage
mov ecx, dword ptr @szBuffer
invoke wsprintf,addr @szBuffer,addr szFormat,lpszFunction,esi,ecx
invoke MessageBox,NULL,addr @szBuffer,NULL,MB_OK
mov ecx, dword ptr @szBuffer
invoke LocalFree,ecx
popad
ret
_ErrorExit endp
start:
invoke _ErrorExit,offset szText
invoke ExitProcess,NULL
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
end start
|
能力值:
( LV4,RANK:50 )
在线值:
|
-
-
5 楼
哇哦果然有高手,谢谢了。我对的崇拜有如滔滔江水,一发不可收拾。
|