advapi32: Set domain name and computer sid using new helper
functions.
Robert Reif
reif at earthlink.net
Sat Jul 29 08:25:50 CDT 2006
Applies on top of previous patch.
-------------- next part --------------
--- wine.cvs/dlls/advapi32/lsa.c 2006-07-29 08:59:38.000000000 -0400
+++ wine/dlls/advapi32/lsa.c 2006-07-29 09:12:29.000000000 -0400
@@ -394,10 +394,9 @@ NTSTATUS WINAPI LsaQueryInformationPolic
{
POLICY_PRIMARY_DOMAIN_INFO ppdi;
SID sid;
+ DWORD padding[3];
};
- SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
-
struct di * xdi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*xdi));
HKEY key;
BOOL useDefault = TRUE;
@@ -431,15 +430,36 @@ NTSTATUS WINAPI LsaQueryInformationPolic
RegCloseKey(key);
}
if (useDefault)
- RtlCreateUnicodeStringFromAsciiz(&(xdi->ppdi.Name), "DOMAIN");
-
+ {
+ DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
+ LPWSTR buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize * sizeof(WCHAR));
+ if (GetComputerNameW(buf, &dwSize))
+ {
+ xdi->ppdi.Name.Buffer = buf;
+ xdi->ppdi.Name.Length = dwSize * sizeof(WCHAR);
+ }
+ }
+
TRACE("setting domain to %s\n", debugstr_w(xdi->ppdi.Name.Buffer));
-
+
xdi->ppdi.Sid = &(xdi->sid);
- xdi->sid.Revision = SID_REVISION;
- xdi->sid.SubAuthorityCount = 1;
- xdi->sid.IdentifierAuthority = localSidAuthority;
- xdi->sid.SubAuthority[0] = SECURITY_LOCAL_SYSTEM_RID;
+
+ /* read the computer SID from the registry */
+ if (!ADVAPI_GetComputerSid(&(xdi->sid)))
+ {
+ SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
+
+ xdi->sid.Revision = SID_REVISION;
+ xdi->sid.SubAuthorityCount = 4;
+ xdi->sid.IdentifierAuthority = localSidAuthority;
+ xdi->sid.SubAuthority[0] = SECURITY_NT_NON_UNIQUE;
+ xdi->sid.SubAuthority[1] = 0;
+ xdi->sid.SubAuthority[2] = 0;
+ xdi->sid.SubAuthority[3] = 0;
+ }
+
+ TRACE("setting SID to %s\n", debugstr_sid(&xdi->sid));
+
*Buffer = xdi;
}
break;
More information about the wine-patches
mailing list