Related Projects > NASMX

using demo5 by Bryant Keller

(1/2) > >>

william427:
can you jump out of proc and then return with an answer?
is it allright to jump where I commented ;;;;jump here ?
and will it return to that spot?
thanks



--- Code: ---proc    Wm_CommandProc
.hwnd    argd
.wparam  argd
.lparam  argd


    cmp      argv(.wparam), dword 201
    je       .cmd_idok
    cmp      argv(.wparam), dword 200
    je       .cmd_idgo
    xor      eax, eax
    ret

.cmd_idok:
    invoke   EndDialog, dword argv(.hwnd), byte 1
    mov      eax, 1
    ret

.cmd_idgo:
    invoke   SendDlgItemMessageA, dword argv(.hwnd), dword 205, dword WM_GETTEXTLENGTH, dword NULL, dword NULL
    cmp      eax, 0
    jne      .fine
    invoke   MessageBoxA, dword argv(.hwnd), dword szContent, dword szTitle, dword MB_OK | MB_ICONERROR
    mov      eax, 1
    ret

.fine:
    inc      eax
    mov      ecx, eax
    push     eax
    invoke   GetProcessHeap
    mov      [dwHeap], eax
    invoke   HeapAlloc, eax, dword 0x000008, ecx
    mov      [dwText], eax
    pop      eax
    invoke   SendDlgItemMessageA, dword argv(.hwnd), dword 205, dword WM_GETTEXT, eax, dword dwText
 ;;;;;   jump here
    invoke   SendDlgItemMessageA, dword argv(.hwnd), dword 206, dword WM_SETTEXT, dword 0, dword dwText
    invoke   HeapFree, dword dwHeap, dword 0x000008, dword dwText
    mov      eax, 1
    ret

endproc



--- End code ---

william427:
is it ok to alter an rc file?
thanks

Rob Neff:
You are free to jump around "within" the procedure itself ( just remember to use the "dot" notation for labels within the proc.

If you're going to jump "into" a proc from an outside location you should know how the names are mangled depending on the operating system being assembled for.  You must also ensure that you set up the stack properly prior to the jump so that it does not become corrupted when the procedure ends.

Feel free to modify the RC files to your hearts content.  They are just text files that you can edit with a text editor.  Look up the keywords used within those resource files so you understand what each token does.  If you're using Windows there is a tool named ResEd in the nasmx/bin directory that you can use to easily create and/or modify RC files.

william427:
hey yall
is gettext a storage place like a string?and what does dwtext do ?
thanks
william



--- Code: ---invoke   SendDlgItemMessageA, dword argv(.hwnd), dword 205, dword WM_GETTEXT, eax, dword dwText


--- End code ---

william427:

--- Quote from: william427 on August 12, 2014, 02:20:46 PM ---hey yall
is gettext a storage place like a string?and what does dwtext do ?
thanks
william
is the lParam  of SendDlgItemMessageA the
pointer to the buffer that is to receive the text



--- Code: ---invoke   SendDlgItemMessageA, dword argv(.hwnd), dword 205, dword WM_GETTEXT, eax, dword dwText


--- End code ---

--- End quote ---

Navigation

[0] Message Index

[#] Next page

Go to full version