发一段代码,这里IDOK里提取text进行溢出
.386
.Model Flat, StdCall
Option Casemap :None
Include windows.inc
Include user32.inc
Include kernel32.inc
Include gdi32.inc
includelib gdi32.lib
IncludeLib user32.lib
IncludeLib kernel32.lib
include macro.asm
IDD_DIALOG1 EQU 101
IDC_EDIT1 EQU 1000
.data
hInstance dd 0
bigbuffer BYTE 24 dup (0)
.code
_bufferflow proc lpbuffer
local @smallbuffer[36]:BYTE
invoke lstrcpy,addr @smallbuffer,lpbuffer
_bufferflow endp
DlgProc proc hWnd,uMsg,wParam,lParam
.if uMsg==WM_INITDIALOG
invoke LoadIcon,hInstance,100
invoke SendMessage,hWnd,WM_SETICON,ICON_SMALL,eax
.elseif uMsg==WM_COMMAND
mov eax,wParam
and eax,0ffffh
.if eax==IDOK
invoke GetDlgItemText,hWnd,IDC_EDIT1,offset bigbuffer,24
invoke _bufferflow,offset bigbuffer
.elseif eax==IDCANCEL
invoke SendMessage,hWnd,WM_CLOSE,0,0
.endif
.elseif uMsg==WM_CLOSE
invoke EndDialog,hWnd,wParam
.else
mov eax,FALSE
ret
.endif
mov eax,TRUE
ret
DlgProc endp
start: invoke GetModuleHandle,NULL
mov hInstance,eax
invoke DialogBoxParam,hInstance,IDD_DIALOG1,0,offset DlgProc,0
invoke ExitProcess,0
end start
这里溢出代码写的是不是很不标准啊在_bufferflow里面,我是才学的。
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!