0

Hello, I have this code:

.data
xd db "jjjj",0
      .code

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

LibMain proc instance:DWORD,reason:DWORD,unused:DWORD 

    .if reason == DLL_PROCESS_ATTACH

push dword ptr ds:[ xd]
call Teste
      mov eax, TRUE                 ; return TRUE so DLL will start

    .elseif reason == DLL_PROCESS_DETACH

    .elseif reason == DLL_THREAD_ATTACH

    .elseif reason == DLL_THREAD_DETACH

    .endif

    ret

LibMain endp

Teste proc T
        invoke MessageBox, NULL, addr T, addr T, MB_OK
        ret 

Teste endp

But, the messagebox, after the "jjj" text, there is some weird characters.
How to fix it?

3
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by GunnerInc
0

What your doing is passing the address of the proceedure to MesssageBox instead of xd

invoke  MessageBox, NULL, addr xd, addr xd, MB_OK.

It will look kid of odd those, your caption being exactly the same as text

0

Also, since the address of xd is known at assembly time you can do:

invoke	MessageBox, NULL, offset xd, offset xd, MB_OK

or

push	MB_OK
	push	offset xd
	push	offset xd
	push	NULL
	call	MessageBox
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.