The value or string address is passed by procedurereturn as example below
Code: Select all
Macro __HT(__HQ)
"$"+RSet(Hex(PeekQ(@__HQ+2),#PB_Quad),16,"0")+RSet(Hex(PeekC(@__HQ+1),#PB_Byte),2,"0")+RSet(Hex(PeekC(@__HQ),#PB_Byte),2,"0")
EndMacro
Structure stt
StructureUnion
st.s{1}[10]
st10.s{10}
EndStructureUnion
EndStructure
Global s1.stt
s1\st10="1234506789"
s1\st[5]=Chr(0)
Debug " st10="+__ht(S1\st10)+" @st10="+Str(@S1\st10)
Procedure.s procs()
s.s=Space(10)
CopyMemory(@s1,@s,10)
Debug "s="+__ht(s)+" @s="+Str(@s)
ProcedureReturn s
EndProcedure
Procedure.s procsf()
sf.s{10}=Space(10)
CopyMemory(@s1,@sf,10)
Debug "sf="+__ht(sf)+" @sf="+Str(@sf)
ProcedureReturn sf
EndProcedure
Ss.s=procs()
Debug "ss="+__ht(ss)+" @ss="+Str(@ss)
sfp.s{10}=procsf()
Debug "sfp="+__ht(sfp)+" @sfp="+Str(@sfp)
One can notice that a non-fixed created or copied to a subroutine has the same address as the one passed to the main prg
It can therefore be modified in the main prg while we can not control his creation.
This means that if we change the string it will be sent in the first state if the appeal under PRG
Furthermore we can notice that the chain of length 10 has not been truncated which is normal since the address is the same
2) on fixed type strings cS (10)
This string is copied and truncated which is consistent with the management of strings
Notes: whereas in the chain not fixed can access the information after null chr (0) which is not the case in a fixed string. Apart from the above observation work on both strings will be identical
3) In conclusion
ASM routines that affect both strings are different
For non-fixed string :
Code: Select all
Ss.s=procs()
PUSH dword [_PB_StringBasePosition]
CALL _Procedure0
PUSH dword v_Ss
CALL _SYS_AllocateString4@8
Code: Select all
sfp.s{10}=procsf()
PUSH dword [_PB_StringBasePosition]
CALL _Procedure2
LEA eax,[v_sfp]
PUSH dword 10
CALL _SYS_AssignFixedString@8
One could spend between complex structures and main prg / sub prg example
Code: Select all
Structure lf
ww.w
qq.q
enstructure
Structure xx
Structureunion
Ch.s{10]
Zone_str_complex.lf
Endstructureunion
Endstructure
Can you change the routine _SYS_AssignFixedString@8 so what can pass all characters on the given length?
This would give a strong potential to PB