208 ULONG AccountControl = 0;
237 return AccountControl;
246 ULONG SystemSecondsSince1970;
247 ULONG PasswordSecondsSince1970;
257 return SystemSecondsSince1970 - PasswordSecondsSince1970;
277 Ace->Mask &= ~USER_CHANGE_PASSWORD;
306 TRACE(
"SamQuerySecurityObject() failed (Status 0x%08lx)\n",
Status);
317 TRACE(
"RtlGetDaclSecurityDescriptor() failed (Status 0x%08lx)\n",
Status);
322 if (Present ==
FALSE)
324 TRACE(
"No DACL present\n");
335 TRACE(
"RtlQueryInformationAcl() failed (Status 0x%08lx)\n",
Status);
341 if (LocalDacl ==
NULL)
343 TRACE(
"Memory allocation failed\n");
358 TRACE(
"done (ApiStatus: 0x%08lx)\n", ApiStatus);
419 ULONG GroupCount, SidCount, AliasCount,
i;
426 FIXME(
"GetUserPrivileges(%p)\n", UserHandle);
434 ERR(
"SamGetGroupsForUser() failed (Status 0x%08lx)\n",
Status);
460 for (
i = 0;
i < GroupCount;
i++)
463 GroupMembership[
i].RelativeId,
481 ERR(
"SamGetAliasMembership() failed (Status 0x%08lx)\n",
Status);
489 for (
i = 0;
i < AliasCount;
i++)
491 switch (AliasArray[
i])
530 if (AliasArray !=
NULL)
533 if (SidArray !=
NULL)
535 for (
i = 0;
i < SidCount;
i++)
541 if (GroupMembership !=
NULL)
562 DWORD Priv = 0, AuthFlags = 0;
584 ERR(
"SamQueryInformationUser failed (Status %08lx)\n",
Status);
1393 if (UserInfo !=
NULL)
1405 if (LocalBuffer !=
NULL)
1603 if (parm_err !=
NULL)
1717 if (parm_err !=
NULL)
1853 if (parm_err !=
NULL)
1986 if (parm_err !=
NULL)
2136 if (parm_err !=
NULL)
2200 ERR(
"SamSetInformationUser failed (Status %08lx)\n",
Status);
2233 ERR(
"SamLookupNamesInDomain(%wZ) failed (Status %08lx)\n", UserName,
Status);
2240 ERR(
"Object is not a user!\n");
2252 ERR(
"SamOpenUser failed (Status %08lx)\n",
Status);
2258 if (RelativeIds !=
NULL)
2290 if (parm_err !=
NULL)
2306 if (servername !=
NULL)
2316 ERR(
"SamConnect failed (Status %08lx)\n",
Status);
2323 (servername !=
NULL) ? &ServerName :
NULL,
2328 ERR(
"OpenAccountDomain failed (Status %08lx)\n",
Status);
2347 ERR(
"SamCreateUser2InDomain failed (Status %08lx)\n",
Status);
2359 ERR(
"SetUserInfo failed (Status %lu)\n", ApiStatus);
2364 if (UserHandle !=
NULL)
2372 if (DomainHandle !=
NULL)
2375 if (ServerHandle !=
NULL)
2406 ULONG RequestBufferSize;
2407 ULONG ResponseBufferSize = 0;
2421 if ((oldpassword ==
NULL) ||
2422 (newpassword ==
NULL))
2452 (
PVOID*)&RequestBuffer);
2509 (
PVOID*)&ResponseBuffer,
2510 &ResponseBufferSize,
2525 if (RequestBuffer !=
NULL)
2528 if (ResponseBuffer !=
NULL)
2556 if (servername !=
NULL)
2568 ERR(
"SamConnect failed (Status %08lx)\n",
Status);
2579 ERR(
"OpenBuiltinDomain failed (Status %08lx)\n",
Status);
2591 TRACE(
"OpenUserByName(%wZ) failed (ApiStatus %lu)\n", &UserName, ApiStatus);
2595 if (UserHandle ==
NULL)
2597 if (DomainHandle !=
NULL)
2600 DomainHandle =
NULL;
2605 (servername !=
NULL) ? &ServerName :
NULL,
2610 ERR(
"OpenAccountDomain failed (Status %08lx)\n",
Status);
2622 ERR(
"OpenUserByName(%wZ) failed (ApiStatus %lu)\n", &UserName, ApiStatus);
2633 ERR(
"SamDeleteUser failed (Status %08lx)\n",
Status);
2642 if (UserHandle !=
NULL)
2645 if (DomainHandle !=
NULL)
2648 if (ServerHandle !=
NULL)
2670 EnumContext->
Count = 0;
2671 EnumContext->
Index = 0;
2686 *AllocatedEnumContext = EnumContext;
2719 ListEntry = ListEntry->
Flink)
2722 if (EnumContext->
EnumHandle == EnumerationHandle)
2724 FoundEnumContext = EnumContext;
2732 return FoundEnumContext;
2760 filter,
bufptr, prefmaxlen, entriesread, totalentries, resume_handle);
2766 if (servername !=
NULL)
2769 if (resume_handle !=
NULL && *resume_handle != 0)
2785 ERR(
"SamConnect failed (Status %08lx)\n",
Status);
2795 ERR(
"GetAccountDomainSid failed (Status %08lx)\n",
Status);
2807 ERR(
"SamOpenDomain failed (Status %08lx)\n",
Status);
2816 ERR(
"GetBuiltinDomainSid failed (Status %08lx)\n",
Status);
2832 ERR(
"SamOpenDomain failed (Status %08lx)\n",
Status);
2840 TRACE(
"EnumContext->Index: %lu\n", EnumContext->
Index);
2841 TRACE(
"EnumContext->Count: %lu\n", EnumContext->
Count);
2843 if (EnumContext->
Index >= EnumContext->
Count)
2851 TRACE(
"Calling SamEnumerateUsersInDomain\n");
2857 &EnumContext->
Count);
2859 TRACE(
"SamEnumerateUsersInDomain returned (Status %08lx)\n",
Status);
2862 ERR(
"SamEnumerateUsersInDomain failed (Status %08lx)\n",
Status);
2878 TRACE(
"EnumContext: %lu\n", EnumContext);
2879 TRACE(
"EnumContext->Count: %lu\n", EnumContext->
Count);
2880 TRACE(
"EnumContext->Buffer: %p\n", EnumContext->
Buffer);
2897 ERR(
"SamOpenUser failed (Status %08lx)\n",
Status);
2910 ERR(
"BuildUserInfoBuffer failed (ApiStatus %lu)\n", ApiStatus);
2917 EnumContext->
Index++;
2926 if (EnumContext !=
NULL)
2927 *totalentries = EnumContext->
Count;
2931 if (EnumContext !=
NULL)
2950 for (
i = 0;
i < EnumContext->
Count;
i++)
2963 if (UserHandle !=
NULL)
2966 if (resume_handle !=
NULL)
2967 *resume_handle = EnumContext ? EnumContext->
EnumHandle : 0;
2971 TRACE(
"return %lu\n", ApiStatus);
3008 if (servername !=
NULL)
3020 ERR(
"SamConnect failed (Status %08lx)\n",
Status);
3030 ERR(
"GetAccountDomainSid failed (Status %08lx)\n",
Status);
3039 &AccountDomainHandle);
3042 ERR(
"SamOpenDomain failed (Status %08lx)\n",
Status);
3055 ERR(
"SamLookupNamesInDomain(%wZ) failed (Status %08lx)\n", &UserName,
Status);
3066 ERR(
"Account is not a User!\n");
3078 ERR(
"SamOpenUser failed (Status %08lx)\n",
Status);
3089 ERR(
"SamGetGroupsForUser failed (Status %08lx)\n",
Status);
3095 if (GroupCount == 0)
3104 if (GroupMembership !=
NULL)
3107 if (UserHandle !=
NULL)
3110 if (RelativeIds !=
NULL)
3119 if (AccountDomainHandle !=
NULL)
3122 if (ServerHandle !=
NULL)
3170 if (servername !=
NULL)
3182 ERR(
"SamConnect failed (Status %08lx)\n",
Status);
3191 ERR(
"GetBuiltinDomainSid failed (Status %08lx)\n",
Status);
3204 &BuiltinDomainHandle);
3207 ERR(
"SamOpenDomain failed (Status %08lx)\n",
Status);
3217 ERR(
"GetAccountDomainSid failed (Status %08lx)\n",
Status);
3226 &AccountDomainHandle);
3229 ERR(
"SamOpenDomain failed (Status %08lx)\n",
Status);
3242 ERR(
"SamLookupNamesInDomain(%wZ) failed (Status %08lx)\n", &UserName,
Status);
3253 ERR(
"No user found!\n");
3258 TRACE(
"RID: %lu\n", RelativeIds[0]);
3271 ERR(
"SamOpenUser failed (Status %08lx)\n",
Status);
3284 ERR(
"BuildUserInfoBuffer failed (ApiStatus %08lu)\n", ApiStatus);
3289 if (UserHandle !=
NULL)
3292 if (RelativeIds !=
NULL)
3298 if (AccountDomainHandle !=
NULL)
3304 if (BuiltinDomainHandle !=
NULL)
3310 if (ServerHandle !=
NULL)
3342 ULONG BuiltinMemberCount = 0;
3343 ULONG AccountMemberCount = 0;
3357 TRACE(
"(%s, %s, %d, %08x, %p %d, %p, %p) stub!\n",
3359 prefmaxlen, entriesread, totalentries);
3369 WARN(
"The flag LG_INCLUDE_INDIRECT is not supported yet!\n");
3372 if (servername !=
NULL)
3384 ERR(
"SamConnect failed (Status %08lx)\n",
Status);
3392 &BuiltinDomainHandle);
3395 ERR(
"OpenBuiltinDomain failed (Status %08lx)\n",
Status);
3405 ERR(
"GetAccountDomainSid failed (Status %08lx)\n",
Status);
3414 &AccountDomainHandle);
3417 ERR(
"SamOpenDomain failed (Status %08lx)\n",
Status);
3430 ERR(
"SamLookupNamesInDomain(%wZ) failed (Status %08lx)\n", &UserName,
Status);
3441 ERR(
"Account is not a User!\n");
3452 ERR(
"BuildSidFromSidAndRid failed!\n");
3460 &BuiltinMemberCount,
3464 ERR(
"SamGetAliasMembership failed (Status %08lx)\n",
Status);
3469 if (BuiltinMemberCount > 0)
3479 ERR(
"SamLookupIdsInDomain failed (Status %08lx)\n",
Status);
3489 &AccountMemberCount,
3493 ERR(
"SamGetAliasMembership failed (Status %08lx)\n",
Status);
3498 if (AccountMemberCount > 0)
3508 ERR(
"SamLookupIdsInDomain failed (Status %08lx)\n",
Status);
3517 for (
i = 0;
i < BuiltinMemberCount;
i++)
3519 if (BuiltinNames[
i].
Length > 0)
3526 for (
i = 0;
i < AccountMemberCount;
i++)
3528 if (AccountNames[
i].
Length > 0)
3552 for (
i = 0;
i < BuiltinMemberCount;
i++)
3554 if (BuiltinNames[
i].
Length > 0)
3566 for (
i = 0;
i < AccountMemberCount;
i++)
3568 if (AccountNames[
i].
Length > 0)
3581 if (AccountNames !=
NULL)
3584 if (BuiltinNames !=
NULL)
3587 if (AccountAliases !=
NULL)
3590 if (BuiltinAliases !=
NULL)
3593 if (RelativeIds !=
NULL)
3599 if (UserSid !=
NULL)
3605 if (AccountDomainHandle !=
NULL)
3608 if (BuiltinDomainHandle !=
NULL)
3611 if (ServerHandle !=
NULL)
3621 *entriesread =
Count;
3622 *totalentries =
Count;
3686 if (servername !=
NULL)
3696 ERR(
"SamConnect failed (Status %08lx)\n",
Status);
3706 ERR(
"GetAccountDomainSid failed (Status %08lx)\n",
Status);
3741 ERR(
"OpenAccountDomain failed (Status %08lx)\n",
Status);
3752 (
PVOID*)&PasswordInfo);
3761 (
PVOID*)&LogoffInfo);
3775 (
PVOID*)&ServerRoleInfo);
3784 (
PVOID*)&ReplicationInfo);
3792 ReplicationInfo->ReplicaSourceNodeName.Length +
sizeof(
WCHAR);
3807 NameInfo->DomainName.Length +
sizeof(
WCHAR) +
3815 (
PVOID*)&LockoutInfo);
3826 TRACE(
"Invalid level %d is specified\n",
level);
3836 WARN(
"NetApiBufferAllocate() failed\n");
3907 if (LockoutInfo !=
NULL)
3910 if (NameInfo !=
NULL)
3913 if (ReplicationInfo !=
NULL)
3916 if (ServerRoleInfo !=
NULL)
3919 if (LogoffInfo !=
NULL)
3922 if (PasswordInfo !=
NULL)
3925 if (DomainSid !=
NULL)
3928 if (DomainHandle !=
NULL)
3931 if (ServerHandle !=
NULL)
3964 FIXME(
"(%s %s %lu %p %lu)\n",
3989 TRACE(
"(%s %s %lu %p %p)\n",
3992 if (parm_err !=
NULL)
4030 if (servername !=
NULL)