1

I am using following piece of code to fetch the current user. problem here is that network management APIs doesn't seem to work for trusted domain. I replaced the NetGetAnyDCName with DsGetDcName successfully. Now the problem is that NetUserGetInfo fails to retrieve the user info from a domain controller of a trusted domain.

Question - How do I get the user profile from the trusted domain ? Is there any substitute of NetUserGetInfo method similar to DsGetDcName ? I can't figure it out. Please help.

ns = NetGetAnyDCName(NULL, domain, &pDCName);

if (ns != NERR_Success)
{
    if(fLog!=NULL)fprintf(fLog,PGPTXT_MACHINE8("Non-fatal error: NetGetAnyDCName failed: %d.\n"), ns);

    pDCName = (LPBYTE) domain;
    bFreeDCName = FALSE;
}
else
{
    if(fLog!=NULL)fprintf(fLog,PGPTXT_MACHINE8("NetGetAnyDCName *%S*.\n"), (LPWSTR)pDCName);
}

if(fLog!=NULL)fprintf(fLog,PGPTXT_MACHINE8("NetUserGetInfo *%S* *%S*.\n"), (LPWSTR)pDCName,userName);

ns = NetUserGetInfo ((LPWSTR)pDCName, (LPWSTR)userName, 4, (LPBYTE*)&pui4);
4

0 に答える 0