+ Status = SamQueryInformationUser(UserHandle,
+ UserAccountNameInformation,
+ (PVOID*)&AccountNameInfo);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("SamSetInformationUser() failed (Status %08lx)\n", Status);
+ goto done;
+ }
+
+ AdminInfo.Name = RtlAllocateHeap(RtlGetProcessHeap(),
+ HEAP_ZERO_MEMORY,
+ AccountNameInfo->UserName.Length + sizeof(WCHAR));
+ if (AdminInfo.Name != NULL)
+ RtlCopyMemory(AdminInfo.Name,
+ AccountNameInfo->UserName.Buffer,
+ AccountNameInfo->UserName.Length);
+
+ AdminInfo.Domain = RtlAllocateHeap(RtlGetProcessHeap(),
+ HEAP_ZERO_MEMORY,
+ OrigInfo->DomainName.Length + sizeof(WCHAR));
+ if (AdminInfo.Domain != NULL)
+ RtlCopyMemory(AdminInfo.Domain,
+ OrigInfo->DomainName.Buffer,
+ OrigInfo->DomainName.Length);
+
+ AdminInfo.Password = RtlAllocateHeap(RtlGetProcessHeap(),
+ 0,
+ (wcslen(Password) + 1) * sizeof(WCHAR));
+ if (AdminInfo.Password != NULL)
+ wcscpy(AdminInfo.Password, Password);
+
+ DPRINT1("Administrator Name: %S\n", AdminInfo.Name);
+ DPRINT1("Administrator Domain: %S\n", AdminInfo.Domain);
+ DPRINT1("Administrator Password: %S\n", AdminInfo.Password);
+