Log in

View Full Version : adding code


The Keeper
August 11th, 2002, 03:49
Hello,

i've been trying to add some code to a program, i could make it show the serial in a msgbox, now i want it to set the serial serial in the edit box, i got spy++ and looked at the window,

i see

000488 Register #32770 Dialog
A04 Edit
904 Edit

i put a int 3 where i want to add the code and assembled from there

push 488
push a04 (guessin its the serial edit)
call getdlgitem

but it returned 0, i tried reversed then and stil lreturning , am i doing something wrong ?

ps: the program doesnt export getdlgitem, but from sice i can assemble it, i guess im calling it directly, could anyone point me out if im doing something wrong ? this seems to be easy but its getting me

thanks in advance
the keeper

ZaiRoN
August 11th, 2002, 11:21
hi The Keeper,
if you want to set the serial you have to use the function

SetDlgItemText:
BOOL_SetDlgItemText(
HWND_hDlg, <-------- handle of the dialog box
int_nIDDlgItem, <----- the id of the control (you can retrieve the id using a resource editor)
LPCTSTR_lpString <--- a pointer to the serial
);

you don't need to use GetDlgItem in this case because the function GetDlgItem is used to retrieve the handle of a specific control in the dialog box.

if the proggie doesn't import the function you can add using a specific tool (lordpe or something else) or adding it manually

ciao,
ZaiRoN

The Keeper
August 11th, 2002, 19:53
Hello, i got the id and the pointer but doesnt the handle always change ? how do i get the handle to the dialogbox ?

thanks in advance

?ferret
August 12th, 2002, 01:26
Hint: How does the proggy know where it is?

Check the original params for the dialog box for the address to push ;-)

The Keeper
August 12th, 2002, 16:01
GetModuleHandle
The GetModuleHandle function retrieves a module handle for the specified module if the file has been mapped into the address space of the calling process.

To avoid the race conditions described in the Remarks section, use the GetModuleHandleEx function.

HMODULE GetModuleHandle(
LPCTSTR lpModuleName // module name
);

is that what u mean ?