I was very kindly given this procedure and it works well.
fn1 proc C uses esi edi p:ptr PCHAR, n:DWORD
.
.
print PCHAR ptr [edi+esi*PCHAR],13,10
I couldn't find any reference to PCHAR which isn't surprising since it does look rather C-like.
I'm therefore bewildered at how masm manages to deal with it.
If this is a stupid question...please forgive me.
masm doesn't really deal with it :P
\masm32\include\windows.inc does
you can look in that file and find
PCHAR typedef DWORD
which tells the assembler to treat PCHAR as a DWORD-sized data type
PCHAR is "pointer to char"
That's great. Once again...thank you for the explanation.
Quote from: dedndave on May 17, 2013, 01:23:10 AM
masm doesn't really deal with it :P
MASM does handle types :t
That PCHAR is defined as DWORD is an issue of the MASM32 SDK, where all pointer types are declared as DWORDs. For correct declared pointer types MASM also offers dereferencing. e.g.:
include \masm32\include\masm32rt.inc
_PCHAR typedef ptr CHAR
.const
foo CHAR "some text"
.code
main proc
mov esi,OFFSET foo
assume esi: _PCHAR ; try also PCHAR
xor ecx,ecx
.while [esi+ecx] ; [PCAHR] ==> CHAR
inc ecx
.endw
assume esi:nothing
exit
main endp
end main
Thank you very much for the additional information.
It's very much appreciated.