68 NewTime.
QuadPart = AbsoluteTime.QuadPart - RelativeTime.QuadPart;
82 TRACE(
"SampStartRpcServer() called\n");
90 WARN(
"RpcServerUseProtseqEpW() failed (Status %lx)\n",
Status);
99 WARN(
"RpcServerRegisterIf() failed (Status %lx)\n",
Status);
106 WARN(
"RpcServerListen() failed (Status %lx)\n",
Status);
110 TRACE(
"SampStartRpcServer() done\n");
128 FIXME(
"SAMPR_HANDLE_rundown(%p)\n", hHandle);
142 TRACE(
"SamrConnect(%p %p %lx)\n",
145 InRevisionInfo.V1.Revision = 0;
146 InRevisionInfo.V1.SupportedFeatures = 0;
166 TRACE(
"SamrCloseHandle(%p)\n", SamHandle);
183 TRACE(
"SamrCloseHandle done (Status 0x%08lx)\n",
Status);
199 ULONG RelativeSdSize = 0;
204 TRACE(
"SamrSetSecurityObject(%p %lx %p)\n",
280 if (RelativeSd ==
NULL)
300 ERR(
"RtlSetSecurityObject failed (Status 0x%08lx)\n",
Status);
312 ERR(
"SampSetObjectAttribute failed (Status 0x%08lx)\n",
Status);
319 if (RelativeSd !=
NULL)
338 ULONG RelativeSdSize = 0;
339 ULONG ResultSdSize = 0;
342 TRACE(
"SamrQuerySecurityObject(%p %lx %p)\n",
380 if (RelativeSd ==
NULL)
400 RelativeSd->
Owner = 0;
403 RelativeSd->
Group = 0;
406 RelativeSd->
Control &= ~SE_DACL_PRESENT;
409 RelativeSd->
Control &= ~SE_SACL_PRESENT;
420 if (ResultSd ==
NULL)
442 SdData->
Length = ResultSdSize;
452 if (ResultSd !=
NULL)
456 if (RelativeSd !=
NULL)
471 TRACE(
"SamrShutdownSamServer(%p)\n",
494 ERR(
"SampShutdownDisplayCache() failed (Status 0x%08lx)\n",
Status);
511 WCHAR DomainKeyName[64];
519 TRACE(
"SamrLookupDomainInSamServer(%p %p %p)\n",
520 ServerHandle,
Name, DomainId);
556 TRACE(
"Domain key name: %S\n", DomainKeyName);
568 (
PVOID)&DomainNameString,
572 TRACE(
"Domain name: %S\n", DomainNameString);
578 TRACE(
"Found it!\n");
622 IN OUT unsigned long *EnumerationContext,
624 IN ULONG PreferedMaximumLength,
628 WCHAR DomainKeyName[64];
639 TRACE(
"SamrEnumerateDomainsInSamServer(%p %p %p %lu %p)\n",
640 ServerHandle, EnumerationContext,
Buffer, PreferedMaximumLength,
661 EnumIndex = *EnumerationContext;
674 TRACE(
"EnumIndex: %lu\n", EnumIndex);
675 TRACE(
"Domain key name: %S\n", DomainKeyName);
690 TRACE(
"SampRegQueryValue returned %08lX\n",
Status);
708 TRACE(
"EnumCount: %lu\n", EnumCount);
712 if (EnumBuffer ==
NULL)
726 EnumIndex = *EnumerationContext;
727 for (
i = 0;
i < EnumCount;
i++, EnumIndex++)
736 TRACE(
"EnumIndex: %lu\n", EnumIndex);
737 TRACE(
"Domain key name: %S\n", DomainKeyName);
752 TRACE(
"SampRegQueryValue returned %08lX\n",
Status);
771 TRACE(
"SampRegQueryValue returned %08lX\n",
Status);
787 *EnumerationContext += EnumCount;
789 *CountReturned = EnumCount;
798 *EnumerationContext = 0;
802 if (EnumBuffer !=
NULL)
840 TRACE(
"SamrOpenDomain(%p %lx %p %p)\n",
865 if ((DomainId->SubAuthorityCount == 1) &&
869 TRACE(
"Opening the builtin domain object.\n");
879 else if ((DomainId->SubAuthorityCount == 4) &&
883 TRACE(
"Opening the account domain object.\n");
906 TRACE(
"SamrOpenDomain done (Status 0x%08lx)\n",
Status);
924 if (InfoBuffer ==
NULL)
949 if (InfoBuffer !=
NULL)
1008 if (InfoBuffer ==
NULL)
1050 L"ReplicaSourceNodeName",
1093 if (InfoBuffer !=
NULL)
1124 if (InfoBuffer ==
NULL)
1144 if (InfoBuffer !=
NULL)
1164 if (InfoBuffer ==
NULL)
1182 if (InfoBuffer !=
NULL)
1205 if (InfoBuffer ==
NULL)
1223 if (InfoBuffer !=
NULL)
1246 if (InfoBuffer ==
NULL)
1251 L"ReplicaSourceNodeName",
1264 if (InfoBuffer !=
NULL)
1289 if (InfoBuffer ==
NULL)
1308 if (InfoBuffer !=
NULL)
1330 if (InfoBuffer ==
NULL)
1352 if (InfoBuffer !=
NULL)
1374 if (InfoBuffer ==
NULL)
1393 if (InfoBuffer !=
NULL)
1415 if (InfoBuffer ==
NULL)
1461 L"ReplicaSourceNodeName",
1504 if (InfoBuffer !=
NULL)
1535 if (InfoBuffer ==
NULL)
1556 if (InfoBuffer !=
NULL)
1578 if (InfoBuffer ==
NULL)
1602 if (InfoBuffer !=
NULL)
1619 TRACE(
"SamrQueryInformationDomain(%p %lu %p)\n",
1620 DomainHandle, DomainInformationClass,
Buffer);
1623 DomainInformationClass,
1798 TRACE(
"SamrSetInformationDomain(%p %lu %p)\n",
1799 DomainHandle, DomainInformationClass, DomainInformation);
1801 switch (DomainInformationClass)
1835 switch (DomainInformationClass)
1850 &DomainInformation->Oem.OemInformation);
1856 &DomainInformation->Name.DomainName);
1861 L"ReplicaSourceNodeName",
1862 &DomainInformation->Replication.ReplicaSourceNodeName);
1898 OUT unsigned long *RelativeId)
1911 TRACE(
"SamrCreateGroupInDomain(%p %p %lx %p %p)\n",
1936 TRACE(
"SampCheckAccountName failed (Status 0x%08lx)\n",
Status);
1945 TRACE(
"Group name \'%S\' already exists in domain (Status 0x%08lx)\n",
1955 TRACE(
"SampCreateGroupSD failed (Status 0x%08lx)\n",
Status);
1964 (
PVOID)&FixedDomainData,
1973 ulRid = FixedDomainData.
NextRid;
1988 TRACE(
"RID: %lx\n", ulRid);
2021 FixedGroupData.
GroupId = ulRid;
2070 *RelativeId = ulRid;
2089 IN OUT unsigned long *EnumerationContext,
2091 IN unsigned long PreferedMaximumLength,
2092 OUT unsigned long *CountReturned)
2098 WCHAR GroupName[64];
2100 ULONG EnumCount = 0;
2109 TRACE(
"SamrEnumerateUsersInDomain(%p %p %p %lu %p)\n",
2110 DomainHandle, EnumerationContext,
Buffer,
2111 PreferedMaximumLength, CountReturned);
2140 EnumIndex = *EnumerationContext;
2144 NameLength = 64 *
sizeof(
WCHAR);
2159 TRACE(
"EnumIndex: %lu\n", EnumIndex);
2160 TRACE(
"Group name: %S\n", GroupName);
2161 TRACE(
"Name length: %lu\n", NameLength);
2175 TRACE(
"EnumCount: %lu\n", EnumCount);
2182 if (EnumBuffer ==
NULL)
2204 EnumIndex = *EnumerationContext;
2205 for (
i = 0;
i < EnumCount;
i++, EnumIndex++)
2207 NameLength = 64 *
sizeof(
WCHAR);
2223 TRACE(
"EnumIndex: %lu\n", EnumIndex);
2224 TRACE(
"Group name: %S\n", GroupName);
2225 TRACE(
"Name length: %lu\n", NameLength);
2226 TRACE(
"RID: %lu\n", Rid);
2251 *EnumerationContext += EnumCount;
2253 *CountReturned = EnumCount;
2257 *EnumerationContext = 0;
2261 if (EnumBuffer !=
NULL)
2300 OUT unsigned long *RelativeId)
2307 UCHAR LogonHours[23];
2316 TRACE(
"SamrCreateUserInDomain(%p %p %lx %p %p)\n",
2320 Name->Length == 0 ||
2322 UserHandle ==
NULL ||
2348 TRACE(
"SampCheckAccountName failed (Status 0x%08lx)\n",
Status);
2357 TRACE(
"User name \'%S\' already exists in domain (Status 0x%08lx)\n",
2367 (
PVOID)&FixedDomainData,
2376 ulRid = FixedDomainData.
NextRid;
2379 TRACE(
"RID: %lx\n", ulRid);
2387 TRACE(
"SampCreateAccountSid failed (Status 0x%08lx)\n",
Status);
2397 TRACE(
"SampCreateUserSD failed (Status 0x%08lx)\n",
Status);
2450 FixedUserData.
UserId = ulRid;
2506 L"HomeDirectoryDrive",
2576 memset(&(LogonHours[2]), 0xff, 21);
2582 sizeof(LogonHours));
2679 *RelativeId = ulRid;
2686 if (UserSid !=
NULL)
2701 IN OUT unsigned long *EnumerationContext,
2702 IN unsigned long UserAccountControl,
2704 IN unsigned long PreferedMaximumLength,
2705 OUT unsigned long *CountReturned)
2713 ULONG EnumCount = 0;
2722 TRACE(
"SamrEnumerateUsersInDomain(%p %p %lx %p %lu %p)\n",
2723 DomainHandle, EnumerationContext, UserAccountControl,
Buffer,
2724 PreferedMaximumLength, CountReturned);
2753 EnumIndex = *EnumerationContext;
2757 NameLength = 64 *
sizeof(
WCHAR);
2772 TRACE(
"EnumIndex: %lu\n", EnumIndex);
2773 TRACE(
"User name: %S\n", UserName);
2774 TRACE(
"Name length: %lu\n", NameLength);
2788 TRACE(
"EnumCount: %lu\n", EnumCount);
2795 if (EnumBuffer ==
NULL)
2817 EnumIndex = *EnumerationContext;
2818 for (
i = 0;
i < EnumCount;
i++, EnumIndex++)
2820 NameLength = 64 *
sizeof(
WCHAR);
2836 TRACE(
"EnumIndex: %lu\n", EnumIndex);
2837 TRACE(
"User name: %S\n", UserName);
2838 TRACE(
"Name length: %lu\n", NameLength);
2839 TRACE(
"RID: %lu\n", Rid);
2864 *EnumerationContext += EnumCount;
2866 *CountReturned = EnumCount;
2870 *EnumerationContext = 0;
2874 if (EnumBuffer !=
NULL)
2913 OUT unsigned long *RelativeId)
2925 TRACE(
"SamrCreateAliasInDomain(%p %p %lx %p %p)\n",
2926 DomainHandle, AccountName,
DesiredAccess, AliasHandle, RelativeId);
2950 TRACE(
"SampCheckAccountName failed (Status 0x%08lx)\n",
Status);
2956 AccountName->Buffer);
2959 TRACE(
"Alias name \'%S\' already exists in domain (Status 0x%08lx)\n",
2960 AccountName->Buffer,
Status);
2969 TRACE(
"SampCreateAliasSD failed (Status 0x%08lx)\n",
Status);
2978 (
PVOID)&FixedDomainData,
2987 ulRid = FixedDomainData.
NextRid;
3002 TRACE(
"RID: %lx\n", ulRid);
3024 AccountName->Buffer,
3067 *RelativeId = ulRid;
3086 IN OUT unsigned long *EnumerationContext,
3088 IN unsigned long PreferedMaximumLength,
3089 OUT unsigned long *CountReturned)
3095 WCHAR AliasName[64];
3097 ULONG EnumCount = 0;
3106 TRACE(
"SamrEnumerateAliasesInDomain(%p %p %p %lu %p)\n",
3107 DomainHandle, EnumerationContext,
Buffer,
3108 PreferedMaximumLength, CountReturned);
3137 EnumIndex = *EnumerationContext;
3141 NameLength = 64 *
sizeof(
WCHAR);
3156 TRACE(
"EnumIndex: %lu\n", EnumIndex);
3157 TRACE(
"Alias name: %S\n", AliasName);
3158 TRACE(
"Name length: %lu\n", NameLength);
3172 TRACE(
"EnumCount: %lu\n", EnumCount);
3179 if (EnumBuffer ==
NULL)
3201 EnumIndex = *EnumerationContext;
3202 for (
i = 0;
i < EnumCount;
i++, EnumIndex++)
3204 NameLength = 64 *
sizeof(
WCHAR);
3220 TRACE(
"EnumIndex: %lu\n", EnumIndex);
3221 TRACE(
"Alias name: %S\n", AliasName);
3222 TRACE(
"Name length: %lu\n", NameLength);
3223 TRACE(
"RID: %lu\n", Rid);
3248 *EnumerationContext += EnumCount;
3250 *CountReturned = EnumCount;
3254 *EnumerationContext = 0;
3258 if (EnumBuffer !=
NULL)
3303 ULONG MaxSidCount = 0;
3309 WCHAR NameBuffer[9];
3311 TRACE(
"SamrGetAliasMembership(%p %p %p)\n",
3312 DomainHandle, SidArray, Membership);
3348 for (
i = 0;
i < SidArray->Count;
i++)
3351TRACE(
"Open %S\n", MemberSidString);
3365 TRACE(
"Found %lu values\n", ValueCount);
3366 MaxSidCount += ValueCount;
3378 if (MaxSidCount == 0)
3384 TRACE(
"Maximum sid count: %lu\n", MaxSidCount);
3386 if (RidArray ==
NULL)
3393 for (
i = 0;
i < SidArray->Count;
i++)
3396TRACE(
"Open %S\n", MemberSidString);
3410 TRACE(
"Found %lu values\n", ValueCount);
3412 for (
j = 0;
j < ValueCount;
j++)
3425 RidArray[RidIndex] =
wcstoul(NameBuffer,
NULL, 16);
3446 Membership->Count = MaxSidCount;
3447 Membership->Element = RidArray;
3451 if (RidArray !=
NULL)
3473 ULONG MappedCount = 0;
3479 TRACE(
"SamrLookupNamesInDomain(%p %lu %p %p %p)\n",
3480 DomainHandle,
Count,
Names, RelativeIds, Use);
3496 RelativeIds->Count = 0;
3507 if (RelativeIds->Element ==
NULL)
3515 if (Use->Element ==
NULL)
3521 RelativeIds->Count =
Count;
3534 &AccountsKeyHandle);
3562 TRACE(
"Rid: %lu\n", RelativeId);
3563 RelativeIds->Element[
i] = RelativeId;
3573 &AccountsKeyHandle);
3601 TRACE(
"Rid: %lu\n", RelativeId);
3602 RelativeIds->Element[
i] = RelativeId;
3612 &AccountsKeyHandle);
3640 TRACE(
"Rid: %lu\n", RelativeId);
3641 RelativeIds->Element[
i] = RelativeId;
3648 RelativeIds->Element[
i] = 0;
3658 if (MappedCount == 0)
3660 else if (MappedCount <
Count)
3665 if (RelativeIds->Element !=
NULL)
3668 RelativeIds->Element =
NULL;
3671 RelativeIds->Count = 0;
3673 if (Use->Element !=
NULL)
3676 Use->Element =
NULL;
3703 ULONG MappedCount = 0;
3708 TRACE(
"SamrLookupIdsInDomain(%p %lu %p %p %p)\n",
3709 DomainHandle,
Count, RelativeIds,
Names, Use);
3744 if (Use->Element ==
NULL)
3755 TRACE(
"RID: %lu\n", RelativeIds[
i]);
3757 swprintf(RidString,
L"%08lx", RelativeIds[
i]);
3763 &AccountsKeyHandle);
3792 Names->Element[
i].Buffer,
3819 &AccountsKeyHandle);
3848 Names->Element[
i].Buffer,
3875 &AccountsKeyHandle);
3906 Names->Element[
i].Buffer,
3939 if (MappedCount == 0)
3941 else if (MappedCount <
Count)
3960 if (Use->Element !=
NULL)
3963 Use->Element =
NULL;
3980 IN unsigned long GroupId,
3988 TRACE(
"SamrOpenGroup(%p %lx %lx %p)\n",
4041 ULONG MembersLength = 0;
4048 if (InfoBuffer ==
NULL)
4109 if (InfoBuffer !=
NULL)
4135 if (InfoBuffer ==
NULL)
4152 if (InfoBuffer !=
NULL)
4177 if (InfoBuffer ==
NULL)
4199 if (InfoBuffer !=
NULL)
4219 if (InfoBuffer ==
NULL)
4236 if (InfoBuffer !=
NULL)
4259 TRACE(
"SamrQueryInformationGroup(%p %lu %p)\n",
4260 GroupHandle, GroupInformationClass,
Buffer);
4273 switch (GroupInformationClass)
4320 TRACE(
"SampGetObjectAttributeString failed (Status 0x%08lx)\n",
Status);
4328 TRACE(
"SampCheckAccountName failed (Status 0x%08lx)\n",
Status);
4342 TRACE(
"Group name \'%S\' already exists in domain (Status 0x%08lx)\n",
4354 TRACE(
"SampSetAccountNameInDomain failed (Status 0x%08lx)\n",
Status);
4363 TRACE(
"SampRemoveAccountNameFromDomain failed (Status 0x%08lx)\n",
Status);
4372 TRACE(
"SampSetObjectAttribute failed (Status 0x%08lx)\n",
Status);
4423 TRACE(
"SamrSetInformationGroup(%p %lu %p)\n",
4424 GroupHandle, GroupInformationClass,
Buffer);