trying to convert this c++ code to masm
PSDATA 64 db (?)
dll.asm(25) : error A2008: syntax error : integer
i first did it that way then tried
ppdata PSDATA 64 <?>
dll.asm(25) : error A2179: structure improperly initialized
dll.asm(25) : error A2008: syntax error : in structure
any help?



dll function is FindPSData
it will return the number of items
and we must pass the pointer to array of PSDATA

using ps.dll

typedef struct PPSDATA{
char resname[100];
char restype[100];
char usrname[100];
char pass[100];
} PSDATA;
PSDATA psd[500];
typedef int ( *FINDPSDAT)(PSDATA *psd);
FINDPSDAT FindPSd;
FindPSd = (FINDPSDAT)GetProcAddress(LoadLibrary((LPCTSTR) "ps.dll"), "FindPSData");
int psno;
if(FindPSd) psno=FindPSd(psd);
else
MessageBox(0,"failed","r",MB_OK);
char messout[500];
for(int i=0;i<psno;i++){
wsprintf(messout,"%s %s %s %s",psd[i].resname,psd[i].restype,psd[i].usrname,psd[i].pass);
MessageBox(0,messout,"out",MB_OK);
}


PSDATA struc
resname db 100 dup (?)
restype db 100 dup (?)
usrname db 100 dup (?)
pass db 100 dup (?)
PSDATA ends
.data
RetAddress DWORD ?
TheDLL db "ps.dll",0
TheFunction db "FindPSData",0

.data?
PSDATA 64 db (<>)
hLib dd ?
FunctionAddy dd ? ; the address of the The dll Function
.code
start:
invoke LoadLibrary,offset TheDLL
mov hLib,eax
invoke GetProcAddress,hLib,addr TheFunction
mov FunctionAddy,eax
push OFFSET PSDATA
call [FunctionAddy]
Invoke MessageBox,0,addr TheDLL,eax,0
invoke FreeLibrary,hLib
invoke ExitProcess,NULL
Posted on 2004-01-29 00:56:44 by illwill
Hi,

instead of

PSDATA 64 db (<> )

you should try

psd PSDATA 64 dup (<>)
Posted on 2004-01-29 01:21:46 by japheth
ok that worked... now how would i get data from the struct
Posted on 2004-01-29 22:11:12 by illwill
to access data (for example from item 2):

lea eax, psd.resname
Posted on 2004-01-29 23:26:16 by japheth