Author: ekohl
Date: Sun Nov 15 20:54:12 2015
New Revision: 69894
URL:
http://svn.reactos.org/svn/reactos?rev=69894&view=rev
Log:
[SYSSETUP]
Add a hack to set the Primary Domain Name (Workgroup Name).
#CORE-10459 #comment Does this fix the bug?
Modified:
trunk/reactos/dll/win32/syssetup/security.c
Modified: trunk/reactos/dll/win32/syssetup/security.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/securit…
==============================================================================
--- trunk/reactos/dll/win32/syssetup/security.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/syssetup/security.c [iso-8859-1] Sun Nov 15 20:54:12 2015
@@ -127,6 +127,81 @@
SamCloseHandle(ServerHandle);
}
+
+ return Status;
+}
+
+
+/* Hack */
+static
+NTSTATUS
+SetPrimaryDomain(LPCWSTR DomainName,
+ PSID DomainSid)
+{
+ PPOLICY_PRIMARY_DOMAIN_INFO OrigInfo = NULL;
+ POLICY_PRIMARY_DOMAIN_INFO Info;
+ LSA_OBJECT_ATTRIBUTES ObjectAttributes;
+ LSA_HANDLE PolicyHandle;
+ NTSTATUS Status;
+
+ DPRINT1("SYSSETUP: SetPrimaryDomain()\n");
+
+ memset(&ObjectAttributes, 0, sizeof(LSA_OBJECT_ATTRIBUTES));
+ ObjectAttributes.Length = sizeof(LSA_OBJECT_ATTRIBUTES);
+
+ Status = LsaOpenPolicy(NULL,
+ &ObjectAttributes,
+ POLICY_VIEW_LOCAL_INFORMATION | POLICY_TRUST_ADMIN,
+ &PolicyHandle);
+ if (Status != STATUS_SUCCESS)
+ {
+ DPRINT("LsaOpenPolicy failed (Status: 0x%08lx)\n", Status);
+ return Status;
+ }
+
+ Status = LsaQueryInformationPolicy(PolicyHandle,
+ PolicyPrimaryDomainInformation,
+ (PVOID *)&OrigInfo);
+ if (Status == STATUS_SUCCESS && OrigInfo != NULL)
+ {
+ if (DomainName == NULL)
+ {
+ Info.Name.Buffer = OrigInfo->Name.Buffer;
+ Info.Name.Length = OrigInfo->Name.Length;
+ Info.Name.MaximumLength = OrigInfo->Name.MaximumLength;
+ }
+ else
+ {
+ Info.Name.Buffer = (LPWSTR)DomainName;
+ Info.Name.Length = wcslen(DomainName) * sizeof(WCHAR);
+ Info.Name.MaximumLength = Info.Name.Length + sizeof(WCHAR);
+ }
+
+ if (DomainSid == NULL)
+ Info.Sid = OrigInfo->Sid;
+ else
+ Info.Sid = DomainSid;
+ }
+ else
+ {
+ Info.Name.Buffer = (LPWSTR)DomainName;
+ Info.Name.Length = wcslen(DomainName) * sizeof(WCHAR);
+ Info.Name.MaximumLength = Info.Name.Length + sizeof(WCHAR);
+ Info.Sid = DomainSid;
+ }
+
+ Status = LsaSetInformationPolicy(PolicyHandle,
+ PolicyPrimaryDomainInformation,
+ (PVOID)&Info);
+ if (Status != STATUS_SUCCESS)
+ {
+ DPRINT("LsaSetInformationPolicy failed (Status: 0x%08lx)\n", Status);
+ }
+
+ if (OrigInfo != NULL)
+ LsaFreeMemory(OrigInfo);
+
+ LsaClose(PolicyHandle);
return Status;
}
@@ -317,11 +392,15 @@
SetupCloseInfFile(hSecurityInf);
}
+
VOID
InstallSecurity(VOID)
{
InstallBuiltinAccounts();
InstallPrivileges();
+
+ /* Hack */
+ SetPrimaryDomain(L"WORKGROUP", NULL);
}