[NETAPI32]

NetWkstaGetInfo: Retrieve the primary domain name instead of the account domain name as the workgroup/domain name. System CPL shows the proper workgroup name.

svn path=/trunk/; revision=69927
This commit is contained in:
Eric Kohl 2015-11-17 20:19:36 +00:00
parent 4871d817fe
commit d40a762095

View file

@ -509,11 +509,11 @@ NET_API_STATUS WINAPI NetWkstaGetInfo( LMSTR servername, DWORD level,
ret = LsaNtStatusToWinError(NtStatus); ret = LsaNtStatusToWinError(NtStatus);
else else
{ {
PPOLICY_ACCOUNT_DOMAIN_INFO DomainInfo; PPOLICY_PRIMARY_DOMAIN_INFO DomainInfo;
LsaQueryInformationPolicy(PolicyHandle, LsaQueryInformationPolicy(PolicyHandle,
PolicyAccountDomainInformation, (PVOID*)&DomainInfo); PolicyPrimaryDomainInformation, (PVOID*)&DomainInfo);
domainNameLen = lstrlenW(DomainInfo->DomainName.Buffer) + 1; domainNameLen = lstrlenW(DomainInfo->Name.Buffer) + 1;
size = sizeof(WKSTA_INFO_102) + computerNameLen * sizeof(WCHAR) size = sizeof(WKSTA_INFO_102) + computerNameLen * sizeof(WCHAR)
+ domainNameLen * sizeof(WCHAR) + sizeof(lanroot); + domainNameLen * sizeof(WCHAR) + sizeof(lanroot);
ret = NetApiBufferAllocate(size, (LPVOID *)bufptr); ret = NetApiBufferAllocate(size, (LPVOID *)bufptr);
@ -529,7 +529,7 @@ NET_API_STATUS WINAPI NetWkstaGetInfo( LMSTR servername, DWORD level,
memcpy(info->wki102_computername, computerName, memcpy(info->wki102_computername, computerName,
computerNameLen * sizeof(WCHAR)); computerNameLen * sizeof(WCHAR));
info->wki102_langroup = info->wki102_computername + computerNameLen; info->wki102_langroup = info->wki102_computername + computerNameLen;
memcpy(info->wki102_langroup, DomainInfo->DomainName.Buffer, memcpy(info->wki102_langroup, DomainInfo->Name.Buffer,
domainNameLen * sizeof(WCHAR)); domainNameLen * sizeof(WCHAR));
info->wki102_lanroot = info->wki102_langroup + domainNameLen; info->wki102_lanroot = info->wki102_langroup + domainNameLen;
memcpy(info->wki102_lanroot, lanroot, sizeof(lanroot)); memcpy(info->wki102_lanroot, lanroot, sizeof(lanroot));