-
September 30th, 2005, 05:32 PM
#1
DLL help
Here is the code I have so far...
; MessageBox DLL
format PE GUI 4.0 DLL
entry DllEntryPoint
include 'INCLUDE\win32a.inc'
section '.data' data readable writeable
result db "Return this",0
section '.code' code readable executable
proc DllEntryPoint, hinstDLL,fdwReason,lpvReserved
mov eax,TRUE
ret
endp
;Message Proc
proc message, title, text
invoke MessageBox,NULL,[text],[title],MB_OK
movq eax,result
ret
endp
section '.idata' import data readable writeable
library user,'USER32.DLL'
import user,\
MessageBox,'MessageBoxA'
section '.edata' export data readable
export 'message.DLL',\
message, 'message';Export function,name
section '.reloc' fixups data discardable
But I need the return value of proc message to be a 64 bit value but it returns it has 32 bit.
This is the part I need help with:
;Message Proc
proc message, title, text
invoke MessageBox,NULL,[text],[title],MB_OK
movq eax,result
ret
endp
I need to convert eax to a 64 bit value but I got now clue how, or if that doesn't work how would I get a 64 bit value?
-
September 30th, 2005, 07:59 PM
#2
Re: DLL help
Originally Posted by Rune Hunter
Here is the code I have so far...
;Message Proc
proc message, title, text
invoke MessageBox,NULL,[text],[title],MB_OK
movq eax,result
ret
endp
I need to convert eax to a 64 bit value but I got now clue how, or if that doesn't work how would I get a 64 bit value?
You can't return a 64 bit value into a 32 bit register. MOVQ (and MOVD) are designed to be used with MMX registers.
If you must return a 64 bit value and can't use MMX, then you can go with 2 options:
return in 2 32 bit reigsters; eg: EDX/EAX
or return a reference of 'result' in EAX (assuming 'result' is a memory location that will remain valid upon return from the procedure.
So, to return the address of 'result' in eax, use:
mov eax, result
Then to access it:
[eax + 0 ] for low order dword
[eax + 4 ] for high order dword
-sevagK
www.geocities.com/kahlinor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|