News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

pointer to struct

Started by aloha_arts, May 04, 2010, 03:16:04 PM

Previous topic - Next topic

aloha_arts

how can i define a procedure that fills up a structure with some string fields in masm,
provided that the procedure invokes some other functions to fill each field?

i need to call the procedure from c.

example:


MYSTRUCT STRUCT
    str1 BYTE 10 dup(?)
    str2 BYTE 10 dup(?)
MYSTRUCT  ENDS


myproc PROC STDCALL pMyStruct:DWORD
    push ebx
   
    lea  ebx, pMyStruct
   
    invoke  FillStringProcedure, addr [ebx].MYSTRUCT.str1
    invoke  FillStringProcedure, addr [ebx].MYSTRUCT.str1

    pop ebx
    ret
myproc endp



FillStringProcedure fills up a string from a given pointer

thankyou.

qWord

lea  ebx, pMyStruct
this load the variables address, not the content (which is the pointer)
-->
mov ebx,pMyStruct
FPU in a trice: SmplMath
It's that simple!

korte



MYSTRUCT STRUCT
    str1 BYTE 10 dup(?)
    str2 BYTE 10 dup(?)
MYSTRUCT  ENDS

mystruct MYSTRUCT {}


    invoke  MessageBox ,0, addr mystruct.str1, addr mystruct.str2,0