In gina, the system will list the domain name of the current system. How to get the primary domain name in your program?

From the released the Windows2000 and NT source code, you can get the code of gina. It locate on \win2k\private\windows\gina\winlogon\usrpro.c.

Here is the code:



DWORD rc;
PWSTR PrimaryDomain;

rc = NetGetJoinInformation (
NULL,
&PrimaryDomain,
&Type
);

if (rc != ERROR_SUCCESS)
{
PrimaryDomain = NULL;
}
else
{
wprintf(TEXT(“PrimaryDomain : %s\n”),PrimaryDomain);
}

Tags: , , ,