Hi,

here is some code :

invoke NetFileEnum,NULL,NULL,NULL,3,addr buf,8200,addr read, addr total,NULL
.if read >= 1

invoke MessageBox,NULL,addr buf[0].fi3_pathname, addr buf[0].fi3_pathname],MB_OK

.endif
----------------------
buf structure
-----------------------
typedef struct _FILE_INFO_3 {
DWORD fi3_id;
DWORD fi3_permissions;
DWORD fi3_num_locks;
LPTSTR fi3_pathname;
LPTSTR fi3_username;
} FILE_INFO_3, *PFILE_INFO_3, *LPFILE_INFO_3;


I am trying to see if the structure gets filled properly by just viewing the pathname of the first entry but i don't get anything ! Anyone has any idea what i am missing???
Posted on 2002-07-08 15:33:24 by Ray
    [*]LPTSTR fi3_pathname - I assume this data contains the address of a string buffer
    [*]addr buf[0].fi3_pathname & addr buf[0].fi3_pathname - Your only pushing the first 4 bytes of both strings, try removing ADDR's on the MessageBox parameters.
Posted on 2002-07-08 16:10:06 by stryker

    [*]LPTSTR fi3_pathname - I assume this data contains the address of a string buffer
    [*]addr buf[0].fi3_pathname & addr buf[0].fi3_pathname - Your only pushing the first 4 bytes of both strings, try removing ADDR's on the MessageBox parameters.


I tried removing the ADDR, still it doesn't seem to work. I get an empty msg box.
Btw, I think they are suppose to be Unicode strings.
Posted on 2002-07-09 01:18:06 by Ray
    [*]NetFileEnum assumes your an Administrator or Account Operators(from the PSDK) to succesfully use this function. Try to do some error checkings first, on what were the returned values before printing it out on a message box.
    [*]Try using the WideCharToMultiByte function on the unicode string
Posted on 2002-07-09 01:55:36 by stryker

    [*]NetFileEnum assumes your an Administrator or Account Operators(from the PSDK) to succesfully use this function. Try to do some error checkings first, on what were the returned values before printing it out on a message box.
    [*]Try using the WideCharToMultiByte function on the unicode string


I tried using WideCharToMultiByte last night with the same results( empty string ).
I will give it another try tonight. thanks .
Posted on 2002-07-09 04:09:03 by Ray
ok i am stupid. I just cant make it to work.

here is the c++ code:
// Alocate memory

Status = NetApiBufferAllocate(BufSize, (LPVOID*)&Buffer);
do
{
Status = NetFileEnum(ServerName,
NULL,
NULL,
3,
(LPBYTE*)&Buffer,
BufSize,
&EntriesRead,
&EntriesTotal,
&ResumeHndl);

// For each opened file...
for (DWORD E = 0; E < EntriesRead; E++)
{
// check if it's the specified file...
if (wcsstr(Buffer->fi3_pathname, FileSearch) != NULL)
// Show 'Who has file opened'.
wprintf(L"%-25s\n", Buffer->fi3_username);

Buffer++;
} // End For E
} // End do...
while (Status == ERROR_MORE_DATA);
// Free the buffers memory.
if (Buffer != NULL)
NetApiBufferFree((LPVOID)Buffer);
// Everything went OK.
.....
can someone just tell me the equivalent in masm??

thanks a lot.

Posted on 2002-07-09 15:04:27 by Ray
Just for a reference,
here is what i was doing wrong:

NT wants the address of the pointer for the FUTURE buffer, while win9x wants the pointer to the buffer already ALLOCATED beforehand.

therefore assuming NT and the above the call becomes :

.data
myPtr dd 0

.code

invoke NetFileEnum,NULL,addr zBasePath,NULL,3,addr myPtr,8192,addr read, addr total,NULL

...
and to free the buffer allocated:

invoke NetApiBufferFree, myPtr
Posted on 2002-07-14 05:55:58 by Ray