format PE GUI 4.0 on 'stub\DOS_STUB.BIN'

include 'include\macro\stdcall.inc'
include 'include\macro\import.inc'
include 'include\kernel.inc'
include 'include\user.inc'
entry start

section '010101' import data readable writeable
;section '.idata' import data readable writeable
;data import
library kernel,'KERNEL32.DLL',\
user,'USER32.DLL'
kernel:
; import ExitProcess,'ExitProcess',\
; GetModuleHandle,'GetModuleHandleA'
import GetModuleHandle,'GetModuleHandleA'

user:
import RegisterClass,'RegisterClassA',\
CreateWindowEx,'CreateWindowExA',\
DefWindowProc,'DefWindowProcA',\
GetMessage,'GetMessageA',\
TranslateMessage,'TranslateMessage',\
DispatchMessage,'DispatchMessageA',\
LoadCursor,'LoadCursorA',\
PostQuitMessage,'PostQuitMessage'
;end data

start:
invoke LoadCursor,0,IDC_ARROW
mov [wc.hCursor],eax
mov [wc.lpfnWndProc],WindowProc
mov [wc.hbrBackground],COLOR_BTNFACE+1
mov [wc.lpszClassName],_class
invoke RegisterClass,wc
invoke GetModuleHandle,0
invoke CreateWindowEx,0,_class,_class,WS_VISIBLE+WS_OVERLAPPEDWINDOW,276,177,256,256,NULL,NULL,eax,NULL
msg_loop:
invoke GetMessage,msg,NULL,0,0
or eax,eax
jz end_loop
invoke TranslateMessage,msg
invoke DispatchMessage,msg
jmp msg_loop
end_loop:
ret
; invoke ExitProcess,0

WindowProc:
cmp dword [esp+4+4],WM_DESTROY
je ExitWindowProc:
jmp [DefWindowProc]
ExitWindowProc:
push dword 0
call [PostQuitMessage]
xor eax,eax
ret 16

_class db 'zjlcc',0
msg MSG
wc WNDCLASS
Posted on 2002-06-28 00:54:23 by zjlcc