.386
model flat,STDCALL
include win32.inc
extrn BeginPaint:PROC
extrn CreateWindowExA:PROC
extrn DefWindowProcA:PROC
extrn DispatchMessageA:PROC
extrn EndPaint:PROC
extrn ExitProcess:PROC
extrn GetMessageA:PROC
extrn GetModuleHandleA:PROC
extrn LoadCursorA:PROC
extrn LoadIconA:PROC
extrn MessageBoxA:PROC
extrn PostQuitMessage:PROC
extrn RegisterClassA:PROC
extrn ShowWindow:PROC
extrn UpdateWindow:PROC
extrn SendMessageA:proc
extrn SetFocus:proc
extrn GetClientRect:proc
extrn VirtualQuery:PROC
extrn _wsprintfA:PROC
.data
hed dd 0
newhwnd dd 0
lppaint PAINTSTRUCT
msg MSGSTRUCT
wc WNDCLASS
mbi MEMORY_BASIC_INFORMATION
;начальный базавый адрес области виртуальной памяти
vbm dd 400000h
rct RECT
hInst dd 0
szTitleName db 'Карта адресного пространства процесса',0
szClassName db 'ASMCLASS32',0
szClassName1 db 'edit',0
lpfor db 'Базовый адрес: %#X,Тип %#X, Состояние: %#X, Размер: %#X, Атриб_защиты: %#X',0
lpstr db 128 dup (0)
Buffer db 4096 dup (0)
.code
start: call GetModuleHandleA,0
mov [hInst], eax
reg_class:
mov [wc.clsStyle],CS_HREDRAW+CS_VREDRAW+CS_GLOBALCLASS
mov [wc.clsLpfnWndProc], offset WndProc
mov [wc.clsCbClsExtra], 0
mov [wc.clsCbWndExtra], 0
mov eax, [hInst]
mov [wc.clsHInstance], eax
call LoadIconA,0,IDI_APPLICATION
mov [wc.clsHIcon], eax
call LoadCursorA,0,IDC_ARROW
mov [wc.clsHCursor], eax
mov [wc.clsHbrBackground], COLOR_WINDOW + 1
mov dword ptr [wc.clsLpszMenuName], 0
mov dword ptr [wc.clsLpszClassName], offset szClassName
call RegisterClassA,offset wc
call CreateWindowExA,0,offset szClassName,offset szTitleName,
WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,0,0,[hInst],0
mov [newhwnd], eax
call ShowWindow,[newhwnd],SW_SHOWNORMAL
call UpdateWindow,[newhwnd]
msg_loop:
call GetMessageA,offset msg,0,0,0
cmp ax, 0
je end_loop
call DispatchMessageA,offset msg
jmp msg_loop
end_loop:
push [msg.msWPARAM]
call ExitProcess
WndProc proc uses ebx edi esi, hwnd:DWORD, wmsg:DWORD,
wparam:DWORD, lparam:DWORD
LOCAL theDC:DWORD
cmp [wmsg], WM_DESTROY
je wmdestroy
cmp [wmsg], WM_SIZE
je wmsize
cmp [wmsg], WM_CREATE
je wmcreate
cmp [wmsg], WM_LBUTTONDOWN
je wmlbuttondown
cmp [wmsg], WM_PAINT
je wmpaint
jmp defwndproc
wmpaint:
mov eax, 0
jmp finish
wmcreate:
call GetClientRect,[hwnd],offset rct
sub [rct.rcRight],20
sub [rct.rcBottom],20
call CreateWindowExA,WS_EX_CLIENTEDGE,offset szClassName1,0,
WS_VISIBLE or WS_CHILD or ES_LEFT OR ES_MULTILINE or
ES_AUTOHSCROLL or ES_AUTOVSCROLL,0,0,[rct.rcRight],
[rct.rcBottom],[hwnd],0,[hInst],0
mov [hed],eax
mov edi,offset Buffer
cld
qq4: mov esi,offset lpstr
call VirtualQuery,[vbm],offset mbi,size mbi
call _wsprintfA,offsetlpstr,offset lpfor,[mbi.BaseAddress],
[mbi.lType],[mbi.State],[mbi.RegionSize],[mbi.AllocationProtect]
mov ecx,eax
rep movsb
mov [edi],byte ptr 13
inc edi
mov [edi],byte ptr 10
inc edi
mov ebx,[mbi.RegionSize]
add [vbm],ebx
cmp [vbm],7ffff000h
jb qq4
mov [edi],byte ptr 0
call SendMessageA,[hed],WM_SETTEXT,0,offset Buffer
call SetFocus,[hed]
mov eax, 0
jmp finish
defwndproc:
call DefWindowProcA,[hwnd],[wmsg],[wparam],[lparam]
jmp finish
wmdestroy:
call PostQuitMessage,0
mov eax, 0
jmp finish
wmlbuttondown:
call SendMessageA,[newhwnd],WM_DESTROY,0,0
mov eax, 0
jmp finish
wmsize:
mov eax, 0
finish:
ret
WndProc endp
public WndProc
end start
Опубликован 25.12.2016 в 19:23 Последнее изменение: 26.12.2016 в 08:02