i am trying to do a little tool to design my own custom trainers for games, but i am having a very weird problem, the custom window is created ok but in the outputed trainer.exe at the WM_CREATE message, buttons simply refuse to create.
i am kinda very confused since i checked and double checked the code and found nothing suspicious=/
here i attach the code, maybe someone can figure this out

BUTTON_SETTINGS STRUCT
butHeight DWORD ?
butWidth DWORD ?
butVertical DWORD ?
butHorizontal DWORD ?
butStyle DWORD ?
butTimer DWORD ?
butCaption db 10h dup (0)
BUTTON_SETTINGS ENDS


int 3
push SW_SHOWDEFAULT
push NULL
push NULL
push dword ptr
Call TrainerMain

@@:
jmp @B



TrainerMain proc MyhInst:HINSTANCE, hPrevInst:HINSTANCE, CmdLine:LPSTR, CmdShow:DWORD
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
LOCAL hwnd:HWND
Call @F
@@:
pop edi
sub edi, offset @B
mov wc.cbSize, SIZEOF WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW
lea eax,
mov wc.lpfnWndProc, eax
mov wc.cbClsExtra, NULL
mov wc.cbWndExtra, NULL
push edi
push MyhInst
pop wc.hInstance
mov wc.lpszMenuName, NULL
push IDI_APPLICATION
push 0
call
pop edi
push edi
mov wc.hIcon, eax
mov wc.hIconSm, eax
push IDC_ARROW
push 0
Call
pop edi
push edi
mov wc.hCursor, eax
mov wc.hbrBackground, COLOR_BTNFACE+1
lea eax,
mov wc.lpszClassName, eax
lea eax, wc.cbSize
push eax
Call
pop edi

push edi
lea eax,
lea ebx,
push 0
push MyhInst
push 0
push 0
mov edx, 012345678h ; window height gets filled in trainer designer
TrainerHeight equ $-4
push edx
mov edx, 012345678h ; window width
TrainerWidth equ $-4
push edx ; vertical position of window
mov edx, 012345678h
TrainerVertical equ $-4
push edx
mov edx, 012345678h
TrainerHorizontal equ $-4 ; horizontal position of window
push edx
push WS_SYSMENU
TrainerWindowStyles equ $-4
push ebx ; AppName
push eax ; Main Class
push WS_EX_TOPMOST

Call
mov dword ptr , eax
pop edi
push edi
push CmdShow
push hwnd
Call
pop edi
push edi
push hwnd
Call
pop edi

.WHILE TRUE

push edi
push 0
push 0
push 0
push msg
Call
pop edi

.BREAK .IF(!eax)

push edi
push msg
Call
pop edi
push edi
push msg
Call
pop edi

.ENDW
mov eax, msg.wParam
ret
TrainerMain endp



TrainerWndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM

.IF uMsg==WM_CREATE

pushad
Call @F
@@:
int 3
pop edi
sub edi, offset @B
push 0 ; address of window-creation data, not used
push dword ptr ; the image base
push 0
push dword ptr ; parent window
lea ebx,

assume ebx : ptr BUTTON_SETTINGS ; ebx now points to the button creation settings
push dword ptr .butHeight ; window height
push dword ptr .butWidth ; window width
push dword ptr .butVertical ; vertical position of window
push dword ptr .butHorizontal ; horizontal position of window
lea eax,
;lea edx, .butCaption
lea edx,
push WS_CHILD or WS_VISIBLE
;push dword ptr .butStyle ; button style from array
push edx ; button caption/text from array
push eax ; button class
push WS_EX_CLIENTEDGE ; extended style
Call
popad
assume ebx : nothing


.ELSEIF

Call @F
@@:
pop edi
sub edi, offset @B
push lParam
push wParam
push uMsg
push hWnd
Call
ret
.ENDIF
xor eax, eax
ret
TrainerWndProc endp

ButtonSettings BUTTON_SETTINGS <20,20,20,20> ; the structure which holds the buttons information

MainTrainerClass db 'random class', 0
TrainerAppName db 100h dup (0)
TrainerButtClass db "button", 0
TrainerStaticClass db 100h dup (0)
TrainerWindowMain dd ?
Posted on 2003-12-01 07:11:25 by DZA
This is just a suggestion, but if you remove all references to 'trainers' (read the faq) then you'll have better luck getting assistance.
Posted on 2003-12-01 09:26:30 by Will
don't know if this has anything to do with your problem but callback procedures such as window procs should preserv ebx, esi and edi



TrainerWndProc proc uses ebx esi edi hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
Posted on 2003-12-01 10:06:21 by ENF
rofl, trainers illegal? i wasn't up to date with this sorry...anyway, i think yall can figure out that this shit sucks very much, as there are plenty of "legal" proggies which make use of the WriteProcessMemory shit to modify other processes...examples..uhm, just the first one that comes to my mind..Crash Guard from Symantec...anyway, there are plenty others!
i respect this board, and i don't want it closed as yall prolly do, so if such discussions about trainers could cause problems, i agree

thanks go for those who repplied, if someone can help me out pls PM tho:P
Posted on 2003-12-01 11:10:30 by DZA