[PATCH 1/4] advapi32: Use GetWindowsAccountDomainSid() to retrieve the domain SID.
Dmitry Timoshkov
dmitry at baikal.ru
Fri Mar 2 04:44:17 CST 2018
Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
dlls/advapi32/lsa.c | 23 ++++++++++++++++-------
include/winbase.h | 1 +
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/dlls/advapi32/lsa.c b/dlls/advapi32/lsa.c
index 6f51f9df57..f2fcc0701b 100644
--- a/dlls/advapi32/lsa.c
+++ b/dlls/advapi32/lsa.c
@@ -763,16 +763,24 @@ NTSTATUS WINAPI LsaQueryInformationPolicy(
break;
case PolicyDnsDomainInformation: /* 12 (0xc) */
{
- struct di
+ struct
{
POLICY_DNS_DOMAIN_INFO info;
- SID sid;
+ struct
+ {
+ SID sid;
+ DWORD sid_subauthority[3];
+ } domain_sid;
WCHAR domain_name[MAX_COMPUTERNAME_LENGTH + 1];
WCHAR dns_domain_name[MAX_COMPUTERNAME_LENGTH + 1];
WCHAR dns_forest_name[MAX_COMPUTERNAME_LENGTH + 1];
- };
+ } *xdi;
+ struct
+ {
+ SID sid;
+ DWORD sid_subauthority[3];
+ } computer_sid;
DWORD dwSize;
- struct di *xdi;
xdi = heap_alloc_zero(sizeof(*xdi));
if (!xdi) return STATUS_NO_MEMORY;
@@ -788,10 +796,11 @@ NTSTATUS WINAPI LsaQueryInformationPolicy(
/* FIXME: also set DnsDomainName and DnsForestName */
- if (ADVAPI_GetComputerSid(&xdi->sid))
+ dwSize = sizeof(xdi->domain_sid);
+ if (ADVAPI_GetComputerSid(&computer_sid.sid) && GetWindowsAccountDomainSid(&computer_sid.sid, &xdi->domain_sid.sid, &dwSize))
{
- xdi->info.Sid = &xdi->sid;
- TRACE("setting SID to %s\n", debugstr_sid(&xdi->sid));
+ xdi->info.Sid = &xdi->domain_sid.sid;
+ TRACE("setting SID to %s\n", debugstr_sid(&xdi->domain_sid.sid));
}
*Buffer = xdi;
diff --git a/include/winbase.h b/include/winbase.h
index e47c87a544..f6cca1d2d2 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -2245,6 +2245,7 @@ WINBASEAPI BOOL WINAPI GetVolumePathNameW(LPCWSTR,LPWSTR,DWORD);
WINBASEAPI BOOL WINAPI GetVolumePathNamesForVolumeNameA(LPCSTR,LPSTR,DWORD,PDWORD);
WINBASEAPI BOOL WINAPI GetVolumePathNamesForVolumeNameW(LPCWSTR,LPWSTR,DWORD,PDWORD);
#define GetVolumePathNamesForVolumeName WINELIB_NAME_AW(GetVolumePathNamesForVolumeName)
+WINBASEAPI BOOL WINAPI GetWindowsAccountDomainSid(PSID,PSID,DWORD*);
WINBASEAPI UINT WINAPI GetWindowsDirectoryA(LPSTR,UINT);
WINBASEAPI UINT WINAPI GetWindowsDirectoryW(LPWSTR,UINT);
#define GetWindowsDirectory WINELIB_NAME_AW(GetWindowsDirectory)
--
2.16.2
More information about the wine-devel
mailing list