LsaEnumerateAccountsWithUserRight failed for remote computer



Hi,
My application uses LSA calls. LsaOpenPolicy() is followed by
LsaEnumerateAccountsWithUserRight().
The code works fine if it is for local machine, but failed for remote
machine.
LsaEnumerateAccountsWithUserRight() returns 0x8000001a, by calling
GetLastError() and convert it to string
it says "Overlapped I/O operation is in progress.".
It looks like LsaEnumerateAccountsWithUserRight() is using overlapped I/O
to retrieve information.
My question is.
Is there a mechanism that I can wait the completion of that overlapped I/O?
Or is there a way to disable overlapped I/O and use synchnonized I/O
instead?

One word, how can I make it work for remote computer? The documentation says
LsaOpenPolicy can be used for both
local and remote computer?

Thanks in advance,
Chris


NTSTATUS ntsResult = LsaOpenPolicy(
&systemName, //Name of the target system.
&ObjectAttributes, //Object attributes.
POLICY_LOOKUP_NAMES | POLICY_VIEW_LOCAL_INFORMATION,
//Desired access permissions.
&lsahPolicyHandle //Receives the policy handle.
);
ntsResult = LsaEnumerateAccountsWithUserRight(lsahPolicyHandle,
&priv_name,(void **)&data, &count);


.



Relevant Pages