flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > macro proc problem

Author
Thread Post new topic Reply to topic
marcinzabrze12



Joined: 07 Aug 2011
Posts: 60
marcinzabrze12
If Arg in below procedure is a pointer to structure for example WIN32_FIND_DATA, how i can get pointer to a field .cFileName of this structure ?

Now i'm get it in this way:

Code:
section '.data' data readable writeable
WFD       WIN32_FIND_DATA

section '.code' code readable executable
start:
        stdcall  NameProc, WFD
        invoke  ExitProcess,0

proc NameProc uses ebx esi edi, Arg
 mov  eax, [Arg]
 add   eax, 44  ; because I already know that is offset a field .cFileName
 
ret
endp    


Is ther other way to get it if I don't remember a value of numerical constant this field of structure ???

Sorry for my english.
Post 15 Aug 2011, 22:30
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Code:
proc NameProc uses ebx esi edi, Arg
 mov  eax, [Arg]
 lea  eax, [eax + WIN32_FIND_DATA.cFileName] ; Or "add eax, WIN32_FIND_DATA.cFileName"

ret
endp    
Post 15 Aug 2011, 23:55
View user's profile Send private message Reply with quote
Mike Gonta



Joined: 26 Dec 2010
Posts: 238
Location: the-ideom
Mike Gonta
marcinzabrze12 wrote:
Is ther other way to get it if I don't remember a value of numerical constant this field of structure ???
Code:
include 'macro/masm.inc'
all EQU ebx ecx edx edi esi ; simple equate for "uses"
proc NameProc uses all, Arg
  assume eax:WIN32_FIND_DATA
  mov eax, [Arg] 
  lea eax, [eax.cFileName]
ret 
endp    

_________________
Mike Gonta
the-ideom - now you know how to compile

https://mikegonta.com
Post 16 Aug 2011, 08:01
View user's profile Send private message Visit poster's website Reply with quote
Mike Gonta



Joined: 26 Dec 2010
Posts: 238
Location: the-ideom
Mike Gonta
marcinzabrze12 wrote:
Is ther other way to get it if I don't remember a value of numerical constant this field of structure ???
Code:
include 'macro/masm.inc'
all EQU ebx ecx edx edi esi ; simple equate for "uses"
proc NameProc uses all, Arg
  assume eax:WIN32_FIND_DATA
  mov eax, [Arg] 
  lea eax, [eax.cFileName]
ret 
endp    

_________________
Mike Gonta
the-ideom - now you know how to compile

https://mikegonta.com
Post 16 Aug 2011, 08:04
View user's profile Send private message Visit poster's website Reply with quote
marcinzabrze12



Joined: 07 Aug 2011
Posts: 60
marcinzabrze12
@LocoDelAssembly: It's exactly what i need know: WIN32_FIND_DATA.cFileName = 44

@Mike Gonta: I can't understand "assume" - Makes what this instruction ?
Post 16 Aug 2011, 09:00
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.