;made by correy
;made in 2009.04.01
;Email:leguanyuan@126.com
;QQ:112426112
;rc me.rc
;ml /coff test.asm /link /subsystem:windows me.res
.386
.model flat,stdcall
option casemap:none
include windows.inc
include kernel32.inc
include user32.inc
include comdlg32.inc
;made in 2009.04.01
;Email:leguanyuan@126.com
;QQ:112426112
;rc me.rc
;ml /coff test.asm /link /subsystem:windows me.res
.386
.model flat,stdcall
option casemap:none
include windows.inc
include kernel32.inc
include user32.inc
include comdlg32.inc
includelib user32.lib
includelib kernel32.lib
includelib comdlg32.lib
includelib Comctl32.lib
includelib kernel32.lib
includelib comdlg32.lib
includelib Comctl32.lib
.data
mebmp db "mebmp",0
szClassName db "made by correy",0
menocorrey db "meno_correy",0
szButton db "button",0
szButtonText db "选择文件并转换为16进制",0
SZEDIT DB "eDIT",0
SZsTATIC DB "Static",0
mebmp db "mebmp",0
szClassName db "made by correy",0
menocorrey db "meno_correy",0
szButton db "button",0
szButtonText db "选择文件并转换为16进制",0
SZEDIT DB "eDIT",0
SZsTATIC DB "Static",0
;szSaveCaption db 'save as',0
szDefExt db 'txt',0
szClass db "msctls_statusbar32",0
szDefExt db 'txt',0
szClass db "msctls_statusbar32",0
correy db "made by correy",0
FilterString db "all File",0,"*.*",0,0
h db "%8x",0
FilterString db "all File",0,"*.*",0,0
h db "%8x",0
.data?
hInstance dd ?
hMenu dd ?
stWndClass WNDCLASSEX <>
stMsg MSG <>
hwndEdit HWND ?
hInstance dd ?
hMenu dd ?
stWndClass WNDCLASSEX <>
stMsg MSG <>
hwndEdit HWND ?
ofn OPENFILENAME <>
buffer db 102400 DUP (?)
hfile dd ?
hfilemap dd ?
ipmem dd ?
nc db 2 dup (?)
buffer db 102400 DUP (?)
hfile dd ?
hfilemap dd ?
ipmem dd ?
nc db 2 dup (?)
szFileName db MAX_PATH dup (?)
szBuffer db 1024 dup (?)
hWinMain dd ?
v dd ?
x dd ?
szBuffer db 1024 dup (?)
hWinMain dd ?
v dd ?
x dd ?
.const
me equ 07777h
me equ 07777h
.code
showeax proc
local bufferp[9]:byte
pushad
mov cx,2
xor esi,esi
againp:
dec cx
rol al,4
push ax
and ax,0Fh
cmp ax,9
jg big
add ax,30h
mov [nc+esi],al
;inc esi
;mov [bufferp+esi],20h
pop ax
inc esi
cmp cx,0
jne againp
je showp
big:
add ax,37h
mov [nc+esi],al
;inc esi
;mov [bufferp+esi],20h
pop ax
inc esi
cmp cx,0
jne againp
showp:;
inc esi
mov [nc+esi],20h
;invoke MessageBox,NULL,addr bufferp,0,0
popad
ret
showeax endp
local bufferp[9]:byte
pushad
mov cx,2
xor esi,esi
againp:
dec cx
rol al,4
push ax
and ax,0Fh
cmp ax,9
jg big
add ax,30h
mov [nc+esi],al
;inc esi
;mov [bufferp+esi],20h
pop ax
inc esi
cmp cx,0
jne againp
je showp
big:
add ax,37h
mov [nc+esi],al
;inc esi
;mov [bufferp+esi],20h
pop ax
inc esi
cmp cx,0
jne againp
showp:;
inc esi
mov [nc+esi],20h
;invoke MessageBox,NULL,addr bufferp,0,0
popad
ret
showeax endp
liuchunli proc hWnd,uMsg,wParam,lParam
LOCAL ps:PAINTSTRUCT
LOCAL hdc:HDC
LOCAL hMemDC:HDC
LOCAL rect:RECT
mov eax,uMsg
.if eax == WM_CREATE
invoke LoadIcon,hInstance,me
invoke SendMessage,hWnd,WM_SETICON,ICON_BIG,eax
invoke CreateWindowEx,NULL,offset SZEDIT,0,WS_CHILD or WS_VISIBLE or ES_MULTILINE or WS_VSCROLL,\
0,0,350,350,hWnd,4,hInstance,NULL
mov hwndEdit,eax
invoke CreateWindowEx,NULL,offset szButton,offset szButtonText,\
WS_CHILD or WS_VISIBLE,0,350,190,20,hWnd,5,hInstance,NULL
ret
.ELSEIF uMsg==WM_COMMAND
mov eax,wParam
.IF ax==5
mov ofn.lStructSize,SIZEOF ofn
mov ofn.lpstrFilter, OFFSET FilterString
mov ofn.lpstrFile, OFFSET buffer
mov ofn.nMaxFile,512
mov ofn.Flags, OFN_FILEMUSTEXIST or OFN_PATHMUSTEXIST or OFN_LONGNAMES or OFN_EXPLORER or OFN_HIDEREADONLY
invoke GetOpenFileName, ADDR ofn
LOCAL ps:PAINTSTRUCT
LOCAL hdc:HDC
LOCAL hMemDC:HDC
LOCAL rect:RECT
mov eax,uMsg
.if eax == WM_CREATE
invoke LoadIcon,hInstance,me
invoke SendMessage,hWnd,WM_SETICON,ICON_BIG,eax
invoke CreateWindowEx,NULL,offset SZEDIT,0,WS_CHILD or WS_VISIBLE or ES_MULTILINE or WS_VSCROLL,\
0,0,350,350,hWnd,4,hInstance,NULL
mov hwndEdit,eax
invoke CreateWindowEx,NULL,offset szButton,offset szButtonText,\
WS_CHILD or WS_VISIBLE,0,350,190,20,hWnd,5,hInstance,NULL
ret
.ELSEIF uMsg==WM_COMMAND
mov eax,wParam
.IF ax==5
mov ofn.lStructSize,SIZEOF ofn
mov ofn.lpstrFilter, OFFSET FilterString
mov ofn.lpstrFile, OFFSET buffer
mov ofn.nMaxFile,512
mov ofn.Flags, OFN_FILEMUSTEXIST or OFN_PATHMUSTEXIST or OFN_LONGNAMES or OFN_EXPLORER or OFN_HIDEREADONLY
invoke GetOpenFileName, ADDR ofn
invoke CreateFile, addr buffer, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL
mov hfile,eax
invoke CreateFileMapping,eax, NULL, PAGE_READONLY,0,0,0
mov hfilemap,eax
invoke MapViewOfFile,eax,FILE_MAP_READ,0,0,0
mov ipmem,eax
;invoke MessageBox,0,ipmem,ipmem,0
invoke GetFileSize,hfile,0
mov v,eax
;invoke wsprintf,addr buffer,addr h,eax
;invoke MessageBox,0,addr buffer,addr correy,0
mov ecx,6114
mov esi,ipmem
mov edi,offset buffer
as:
mov al,byte ptr [esi]
call showeax
mov dx,word ptr [nc]
mov word ptr [edi],dx
add edi,2
mov word ptr [edi],20h
inc edi
inc esi
dec ecx
cmp ecx,0
jne as
invoke SetWindowText,hwndEdit,addr buffer
;invoke MessageBox,hWnd,addr buffer,addr correy,0
invoke UnmapViewOfFile,ipmem
invoke CloseHandle,hfilemap
invoke CloseHandle,hfile
.ENDIF
.elseif uMsg==WM_DESTROY
invoke PostQuitMessage,NULL
ret
.else
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
liuchunli endp
mov hfile,eax
invoke CreateFileMapping,eax, NULL, PAGE_READONLY,0,0,0
mov hfilemap,eax
invoke MapViewOfFile,eax,FILE_MAP_READ,0,0,0
mov ipmem,eax
;invoke MessageBox,0,ipmem,ipmem,0
invoke GetFileSize,hfile,0
mov v,eax
;invoke wsprintf,addr buffer,addr h,eax
;invoke MessageBox,0,addr buffer,addr correy,0
mov ecx,6114
mov esi,ipmem
mov edi,offset buffer
as:
mov al,byte ptr [esi]
call showeax
mov dx,word ptr [nc]
mov word ptr [edi],dx
add edi,2
mov word ptr [edi],20h
inc edi
inc esi
dec ecx
cmp ecx,0
jne as
invoke SetWindowText,hwndEdit,addr buffer
;invoke MessageBox,hWnd,addr buffer,addr correy,0
invoke UnmapViewOfFile,ipmem
invoke CloseHandle,hfilemap
invoke CloseHandle,hfile
.ENDIF
.elseif uMsg==WM_DESTROY
invoke PostQuitMessage,NULL
ret
.else
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
liuchunli endp
start:
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke LoadMenu, 0, OFFSET menocorrey
mov hMenu,eax
push hInstance
pop stWndClass.hInstance
mov stWndClass.cbSize,sizeof WNDCLASSEX
mov stWndClass.hbrBackground,6
invoke LoadCursor,0,IDC_ARROW
mov stWndClass.hCursor,eax
;mov stWndClass.lpszMenuName,OFFSET menocorrey
mov stWndClass.lpszClassName,offset szClassName
mov stWndClass.lpfnWndProc,offset liuchunli
invoke RegisterClassEx,addr stWndClass
invoke CreateWindowEx,WS_EX_CLIENTEDGE,offset szClassName,offset szClassName,\
DS_SETFONT or WS_POPUP or WS_VISIBLE or WS_SYSMENU or WS_CAPTION,CW_USEDEFAULT,CW_USEDEFAULT,370,410,0,hMenu,hInstance,0
mov hInstance,eax
invoke ShowWindow,hInstance,1
invoke UpdateWindow,hInstance
.while TRUE
invoke GetMessage,addr stMsg,NULL,0,0
.break .if eax == 0
invoke TranslateMessage,addr stMsg
invoke DispatchMessage,addr stMsg
.endw
invoke ExitProcess,NULL
end start
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke LoadMenu, 0, OFFSET menocorrey
mov hMenu,eax
push hInstance
pop stWndClass.hInstance
mov stWndClass.cbSize,sizeof WNDCLASSEX
mov stWndClass.hbrBackground,6
invoke LoadCursor,0,IDC_ARROW
mov stWndClass.hCursor,eax
;mov stWndClass.lpszMenuName,OFFSET menocorrey
mov stWndClass.lpszClassName,offset szClassName
mov stWndClass.lpfnWndProc,offset liuchunli
invoke RegisterClassEx,addr stWndClass
invoke CreateWindowEx,WS_EX_CLIENTEDGE,offset szClassName,offset szClassName,\
DS_SETFONT or WS_POPUP or WS_VISIBLE or WS_SYSMENU or WS_CAPTION,CW_USEDEFAULT,CW_USEDEFAULT,370,410,0,hMenu,hInstance,0
mov hInstance,eax
invoke ShowWindow,hInstance,1
invoke UpdateWindow,hInstance
.while TRUE
invoke GetMessage,addr stMsg,NULL,0,0
.break .if eax == 0
invoke TranslateMessage,addr stMsg
invoke DispatchMessage,addr stMsg
.endw
invoke ExitProcess,NULL
end start
没有评论:
发表评论