ReactOS  0.4.14-dev-838-g99f979d
samrpc.c File Reference
#include "samsrv.h"
Include dependency graph for samrpc.c:

Go to the source code of this file.

Functions

static LARGE_INTEGER SampAddRelativeTimeToTime (IN LARGE_INTEGER AbsoluteTime, IN LARGE_INTEGER RelativeTime)
 
VOID SampStartRpcServer (VOID)
 
void __RPC_FAR *__RPC_USER midl_user_allocate (SIZE_T len)
 
void __RPC_USER midl_user_free (void __RPC_FAR *ptr)
 
void __RPC_USER SAMPR_HANDLE_rundown (SAMPR_HANDLE hHandle)
 
NTSTATUS NTAPI SamrConnect (IN PSAMPR_SERVER_NAME ServerName, OUT SAMPR_HANDLE *ServerHandle, IN ACCESS_MASK DesiredAccess)
 
NTSTATUS NTAPI SamrCloseHandle (IN OUT SAMPR_HANDLE *SamHandle)
 
NTSTATUS NTAPI SamrSetSecurityObject (IN SAMPR_HANDLE ObjectHandle, IN SECURITY_INFORMATION SecurityInformation, IN PSAMPR_SR_SECURITY_DESCRIPTOR SecurityDescriptor)
 
NTSTATUS NTAPI SamrQuerySecurityObject (IN SAMPR_HANDLE ObjectHandle, IN SECURITY_INFORMATION SecurityInformation, OUT PSAMPR_SR_SECURITY_DESCRIPTOR *SecurityDescriptor)
 
NTSTATUS NTAPI SamrShutdownSamServer (IN SAMPR_HANDLE ServerHandle)
 
NTSTATUS NTAPI SamrLookupDomainInSamServer (IN SAMPR_HANDLE ServerHandle, IN PRPC_UNICODE_STRING Name, OUT PRPC_SID *DomainId)
 
NTSTATUS NTAPI SamrEnumerateDomainsInSamServer (IN SAMPR_HANDLE ServerHandle, IN OUT unsigned long *EnumerationContext, OUT PSAMPR_ENUMERATION_BUFFER *Buffer, IN ULONG PreferedMaximumLength, OUT PULONG CountReturned)
 
NTSTATUS NTAPI SamrOpenDomain (IN SAMPR_HANDLE ServerHandle, IN ACCESS_MASK DesiredAccess, IN PRPC_SID DomainId, OUT SAMPR_HANDLE *DomainHandle)
 
static NTSTATUS SampQueryDomainPassword (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampGetNumberOfAccounts (PSAM_DB_OBJECT DomainObject, LPCWSTR AccountType, PULONG Count)
 
static NTSTATUS SampQueryDomainGeneral (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainLogoff (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainOem (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainName (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainReplication (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainServerRole (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainModified (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainState (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainGeneral2 (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainLockout (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryDomainModified2 (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
NTSTATUS NTAPI SamrQueryInformationDomain (IN SAMPR_HANDLE DomainHandle, IN DOMAIN_INFORMATION_CLASS DomainInformationClass, OUT PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
static NTSTATUS SampSetDomainPassword (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetDomainLogoff (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetDomainServerRole (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetDomainState (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetDomainLockout (PSAM_DB_OBJECT DomainObject, PSAMPR_DOMAIN_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrSetInformationDomain (IN SAMPR_HANDLE DomainHandle, IN DOMAIN_INFORMATION_CLASS DomainInformationClass, IN PSAMPR_DOMAIN_INFO_BUFFER DomainInformation)
 
NTSTATUS NTAPI SamrCreateGroupInDomain (IN SAMPR_HANDLE DomainHandle, IN PRPC_UNICODE_STRING Name, IN ACCESS_MASK DesiredAccess, OUT SAMPR_HANDLE *GroupHandle, OUT unsigned long *RelativeId)
 
NTSTATUS NTAPI SamrEnumerateGroupsInDomain (IN SAMPR_HANDLE DomainHandle, IN OUT unsigned long *EnumerationContext, OUT PSAMPR_ENUMERATION_BUFFER *Buffer, IN unsigned long PreferedMaximumLength, OUT unsigned long *CountReturned)
 
NTSTATUS NTAPI SamrCreateUserInDomain (IN SAMPR_HANDLE DomainHandle, IN PRPC_UNICODE_STRING Name, IN ACCESS_MASK DesiredAccess, OUT SAMPR_HANDLE *UserHandle, OUT unsigned long *RelativeId)
 
NTSTATUS NTAPI SamrEnumerateUsersInDomain (IN SAMPR_HANDLE DomainHandle, IN OUT unsigned long *EnumerationContext, IN unsigned long UserAccountControl, OUT PSAMPR_ENUMERATION_BUFFER *Buffer, IN unsigned long PreferedMaximumLength, OUT unsigned long *CountReturned)
 
NTSTATUS NTAPI SamrCreateAliasInDomain (IN SAMPR_HANDLE DomainHandle, IN PRPC_UNICODE_STRING AccountName, IN ACCESS_MASK DesiredAccess, OUT SAMPR_HANDLE *AliasHandle, OUT unsigned long *RelativeId)
 
NTSTATUS NTAPI SamrEnumerateAliasesInDomain (IN SAMPR_HANDLE DomainHandle, IN OUT unsigned long *EnumerationContext, OUT PSAMPR_ENUMERATION_BUFFER *Buffer, IN unsigned long PreferedMaximumLength, OUT unsigned long *CountReturned)
 
NTSTATUS NTAPI SamrGetAliasMembership (IN SAMPR_HANDLE DomainHandle, IN PSAMPR_PSID_ARRAY SidArray, OUT PSAMPR_ULONG_ARRAY Membership)
 
NTSTATUS NTAPI SamrLookupNamesInDomain (IN SAMPR_HANDLE DomainHandle, IN ULONG Count, IN RPC_UNICODE_STRING Names[], OUT PSAMPR_ULONG_ARRAY RelativeIds, OUT PSAMPR_ULONG_ARRAY Use)
 
NTSTATUS NTAPI SamrLookupIdsInDomain (IN SAMPR_HANDLE DomainHandle, IN ULONG Count, IN ULONG *RelativeIds, OUT PSAMPR_RETURNED_USTRING_ARRAY Names, OUT PSAMPR_ULONG_ARRAY Use)
 
NTSTATUS NTAPI SamrOpenGroup (IN SAMPR_HANDLE DomainHandle, IN ACCESS_MASK DesiredAccess, IN unsigned long GroupId, OUT SAMPR_HANDLE *GroupHandle)
 
static NTSTATUS SampQueryGroupGeneral (PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryGroupName (PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryGroupAttribute (PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryGroupAdminComment (PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER *Buffer)
 
NTSTATUS NTAPI SamrQueryInformationGroup (IN SAMPR_HANDLE GroupHandle, IN GROUP_INFORMATION_CLASS GroupInformationClass, OUT PSAMPR_GROUP_INFO_BUFFER *Buffer)
 
static NTSTATUS SampSetGroupName (PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetGroupAttribute (PSAM_DB_OBJECT GroupObject, PSAMPR_GROUP_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrSetInformationGroup (IN SAMPR_HANDLE GroupHandle, IN GROUP_INFORMATION_CLASS GroupInformationClass, IN PSAMPR_GROUP_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrAddMemberToGroup (IN SAMPR_HANDLE GroupHandle, IN unsigned long MemberId, IN unsigned long Attributes)
 
NTSTATUS NTAPI SamrDeleteGroup (IN OUT SAMPR_HANDLE *GroupHandle)
 
NTSTATUS NTAPI SamrRemoveMemberFromGroup (IN SAMPR_HANDLE GroupHandle, IN unsigned long MemberId)
 
NTSTATUS NTAPI SamrGetMembersInGroup (IN SAMPR_HANDLE GroupHandle, OUT PSAMPR_GET_MEMBERS_BUFFER *Members)
 
NTSTATUS NTAPI SamrSetMemberAttributesOfGroup (IN SAMPR_HANDLE GroupHandle, IN unsigned long MemberId, IN unsigned long Attributes)
 
NTSTATUS NTAPI SamrOpenAlias (IN SAMPR_HANDLE DomainHandle, IN ACCESS_MASK DesiredAccess, IN ULONG AliasId, OUT SAMPR_HANDLE *AliasHandle)
 
static NTSTATUS SampQueryAliasGeneral (PSAM_DB_OBJECT AliasObject, PSAMPR_ALIAS_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryAliasName (PSAM_DB_OBJECT AliasObject, PSAMPR_ALIAS_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryAliasAdminComment (PSAM_DB_OBJECT AliasObject, PSAMPR_ALIAS_INFO_BUFFER *Buffer)
 
NTSTATUS NTAPI SamrQueryInformationAlias (IN SAMPR_HANDLE AliasHandle, IN ALIAS_INFORMATION_CLASS AliasInformationClass, OUT PSAMPR_ALIAS_INFO_BUFFER *Buffer)
 
static NTSTATUS SampSetAliasName (PSAM_DB_OBJECT AliasObject, PSAMPR_ALIAS_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrSetInformationAlias (IN SAMPR_HANDLE AliasHandle, IN ALIAS_INFORMATION_CLASS AliasInformationClass, IN PSAMPR_ALIAS_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrDeleteAlias (IN OUT SAMPR_HANDLE *AliasHandle)
 
NTSTATUS NTAPI SamrAddMemberToAlias (IN SAMPR_HANDLE AliasHandle, IN PRPC_SID MemberId)
 
NTSTATUS NTAPI SamrRemoveMemberFromAlias (IN SAMPR_HANDLE AliasHandle, IN PRPC_SID MemberId)
 
NTSTATUS NTAPI SamrGetMembersInAlias (IN SAMPR_HANDLE AliasHandle, OUT PSAMPR_PSID_ARRAY_OUT Members)
 
NTSTATUS NTAPI SamrOpenUser (IN SAMPR_HANDLE DomainHandle, IN ACCESS_MASK DesiredAccess, IN unsigned long UserId, OUT SAMPR_HANDLE *UserHandle)
 
NTSTATUS NTAPI SamrDeleteUser (IN OUT SAMPR_HANDLE *UserHandle)
 
static NTSTATUS SampQueryUserGeneral (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserPreferences (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserLogon (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserAccount (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserLogonHours (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserName (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserAccountName (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserFullName (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserPrimaryGroup (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserHome (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserScript (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserProfile (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserAdminComment (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserWorkStations (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserControl (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserExpires (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserInternal1 (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserInternal2 (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserParameters (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampQueryUserAll (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER *Buffer)
 
NTSTATUS NTAPI SamrQueryInformationUser (IN SAMPR_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, OUT PSAMPR_USER_INFO_BUFFER *Buffer)
 
static NTSTATUS SampSetUserName (PSAM_DB_OBJECT UserObject, PRPC_UNICODE_STRING NewUserName)
 
static NTSTATUS SampSetUserGeneral (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetUserPreferences (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetUserPrimaryGroup (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetUserControl (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetUserExpires (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetUserInternal1 (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetUserInternal2 (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
 
static NTSTATUS SampSetUserAll (PSAM_DB_OBJECT UserObject, PSAMPR_USER_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrSetInformationUser (IN SAMPR_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, IN PSAMPR_USER_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrChangePasswordUser (IN SAMPR_HANDLE UserHandle, IN unsigned char LmPresent, IN PENCRYPTED_LM_OWF_PASSWORD OldLmEncryptedWithNewLm, IN PENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithOldLm, IN unsigned char NtPresent, IN PENCRYPTED_NT_OWF_PASSWORD OldNtEncryptedWithNewNt, IN PENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithOldNt, IN unsigned char NtCrossEncryptionPresent, IN PENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithNewLm, IN unsigned char LmCrossEncryptionPresent, IN PENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithNewNt)
 
NTSTATUS NTAPI SamrGetGroupsForUser (IN SAMPR_HANDLE UserHandle, OUT PSAMPR_GET_GROUPS_BUFFER *Groups)
 
NTSTATUS NTAPI SamrQueryDisplayInformation (IN SAMPR_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformationClass, IN unsigned long Index, IN unsigned long EntryCount, IN unsigned long PreferredMaximumLength, OUT unsigned long *TotalAvailable, OUT unsigned long *TotalReturned, OUT PSAMPR_DISPLAY_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrGetDisplayEnumerationIndex (IN SAMPR_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformationClass, IN PRPC_UNICODE_STRING Prefix, OUT unsigned long *Index)
 
NTSTATUS NTAPI SamrTestPrivateFunctionsDomain (IN SAMPR_HANDLE DomainHandle)
 
NTSTATUS NTAPI SamrTestPrivateFunctionsUser (IN SAMPR_HANDLE UserHandle)
 
NTSTATUS NTAPI SamrGetUserDomainPasswordInformation (IN SAMPR_HANDLE UserHandle, OUT PUSER_DOMAIN_PASSWORD_INFORMATION PasswordInformation)
 
NTSTATUS NTAPI SamrRemoveMemberFromForeignDomain (IN SAMPR_HANDLE DomainHandle, IN PRPC_SID MemberSid)
 
NTSTATUS NTAPI SamrQueryInformationDomain2 (IN SAMPR_HANDLE DomainHandle, IN DOMAIN_INFORMATION_CLASS DomainInformationClass, OUT PSAMPR_DOMAIN_INFO_BUFFER *Buffer)
 
NTSTATUS NTAPI SamrQueryInformationUser2 (IN SAMPR_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, OUT PSAMPR_USER_INFO_BUFFER *Buffer)
 
NTSTATUS NTAPI SamrQueryDisplayInformation2 (IN SAMPR_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformationClass, IN unsigned long Index, IN unsigned long EntryCount, IN unsigned long PreferredMaximumLength, OUT unsigned long *TotalAvailable, OUT unsigned long *TotalReturned, OUT PSAMPR_DISPLAY_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrGetDisplayEnumerationIndex2 (IN SAMPR_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformationClass, IN PRPC_UNICODE_STRING Prefix, OUT unsigned long *Index)
 
NTSTATUS NTAPI SamrCreateUser2InDomain (IN SAMPR_HANDLE DomainHandle, IN PRPC_UNICODE_STRING Name, IN unsigned long AccountType, IN ACCESS_MASK DesiredAccess, OUT SAMPR_HANDLE *UserHandle, OUT unsigned long *GrantedAccess, OUT unsigned long *RelativeId)
 
NTSTATUS NTAPI SamrQueryDisplayInformation3 (IN SAMPR_HANDLE DomainHandle, IN DOMAIN_DISPLAY_INFORMATION DisplayInformationClass, IN unsigned long Index, IN unsigned long EntryCount, IN unsigned long PreferredMaximumLength, OUT unsigned long *TotalAvailable, OUT unsigned long *TotalReturned, OUT PSAMPR_DISPLAY_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrAddMultipleMembersToAlias (IN SAMPR_HANDLE AliasHandle, IN PSAMPR_PSID_ARRAY MembersBuffer)
 
NTSTATUS NTAPI SamrRemoveMultipleMembersFromAlias (IN SAMPR_HANDLE AliasHandle, IN PSAMPR_PSID_ARRAY MembersBuffer)
 
NTSTATUS NTAPI SamrOemChangePasswordUser2 (IN handle_t BindingHandle, IN PRPC_STRING ServerName, IN PRPC_STRING UserName, IN PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldLm, IN PENCRYPTED_LM_OWF_PASSWORD OldLmOwfPasswordEncryptedWithNewLm)
 
NTSTATUS NTAPI SamrUnicodeChangePasswordUser2 (IN handle_t BindingHandle, IN PRPC_UNICODE_STRING ServerName, IN PRPC_UNICODE_STRING UserName, IN PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldNt, IN PENCRYPTED_NT_OWF_PASSWORD OldNtOwfPasswordEncryptedWithNewNt, IN unsigned char LmPresent, IN PSAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldLm, IN PENCRYPTED_LM_OWF_PASSWORD OldLmOwfPasswordEncryptedWithNewNt)
 
NTSTATUS NTAPI SamrGetDomainPasswordInformation (IN handle_t BindingHandle, IN PRPC_UNICODE_STRING Unused, OUT PUSER_DOMAIN_PASSWORD_INFORMATION PasswordInformation)
 
NTSTATUS NTAPI SamrConnect2 (IN PSAMPR_SERVER_NAME ServerName, OUT SAMPR_HANDLE *ServerHandle, IN ACCESS_MASK DesiredAccess)
 
NTSTATUS NTAPI SamrSetInformationUser2 (IN SAMPR_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, IN PSAMPR_USER_INFO_BUFFER Buffer)
 
NTSTATUS NTAPI SamrSetBootKeyInformation (IN handle_t BindingHandle)
 
NTSTATUS NTAPI SamrGetBootKeyInformation (IN handle_t BindingHandle)
 
NTSTATUS NTAPI SamrConnect3 (IN handle_t BindingHandle)
 
NTSTATUS NTAPI SamrConnect4 (IN PSAMPR_SERVER_NAME ServerName, OUT SAMPR_HANDLE *ServerHandle, IN unsigned long ClientRevision, IN ACCESS_MASK DesiredAccess)
 
NTSTATUS NTAPI SamrUnicodeChangePasswordUser3 (IN handle_t BindingHandle)
 
NTSTATUS NTAPI SamrConnect5 (IN PSAMPR_SERVER_NAME ServerName, IN ACCESS_MASK DesiredAccess, IN unsigned long InVersion, IN SAMPR_REVISION_INFO *InRevisionInfo, OUT unsigned long *OutVersion, OUT SAMPR_REVISION_INFO *OutRevisionInfo, OUT SAMPR_HANDLE *ServerHandle)
 
NTSTATUS NTAPI SamrRidToSid (IN SAMPR_HANDLE ObjectHandle, IN unsigned long Rid, OUT PRPC_SID *Sid)
 
NTSTATUS NTAPI SamrSetDSRMPassword (IN handle_t BindingHandle, IN PRPC_UNICODE_STRING Unused, IN unsigned long UserId, IN PENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword)
 
NTSTATUS NTAPI SamrValidatePassword (IN handle_t Handle, IN PASSWORD_POLICY_VALIDATION_TYPE ValidationType, IN PSAM_VALIDATE_INPUT_ARG InputArg, OUT PSAM_VALIDATE_OUTPUT_ARG *OutputArg)
 

Variables

static SID_IDENTIFIER_AUTHORITY NtSidAuthority = {SECURITY_NT_AUTHORITY}
 
static GENERIC_MAPPING ServerMapping
 
static GENERIC_MAPPING DomainMapping
 
static GENERIC_MAPPING AliasMapping
 
static GENERIC_MAPPING GroupMapping
 
static GENERIC_MAPPING UserMapping
 
PGENERIC_MAPPING pServerMapping = &ServerMapping
 

Function Documentation

◆ midl_user_allocate()

void __RPC_FAR* __RPC_USER midl_user_allocate ( SIZE_T  len)

Definition at line 114 of file samrpc.c.

115 {
117 }
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLenum GLsizei len
Definition: glext.h:6722
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

Referenced by SampQueryAliasAdminComment(), SampQueryAliasGeneral(), SampQueryAliasName(), SampQueryDomainGeneral(), SampQueryDomainGeneral2(), SampQueryDomainLockout(), SampQueryDomainLogoff(), SampQueryDomainModified(), SampQueryDomainModified2(), SampQueryDomainName(), SampQueryDomainOem(), SampQueryDomainPassword(), SampQueryDomainReplication(), SampQueryDomainServerRole(), SampQueryDomainState(), SampQueryGroupAdminComment(), SampQueryGroupAttribute(), SampQueryGroupGeneral(), SampQueryGroupName(), SampQueryUserAccount(), SampQueryUserAccountName(), SampQueryUserAdminComment(), SampQueryUserAll(), SampQueryUserControl(), SampQueryUserExpires(), SampQueryUserFullName(), SampQueryUserGeneral(), SampQueryUserHome(), SampQueryUserInternal1(), SampQueryUserInternal2(), SampQueryUserLogon(), SampQueryUserLogonHours(), SampQueryUserName(), SampQueryUserParameters(), SampQueryUserPreferences(), SampQueryUserPrimaryGroup(), SampQueryUserProfile(), SampQueryUserScript(), SampQueryUserWorkStations(), SamrEnumerateAliasesInDomain(), SamrEnumerateDomainsInSamServer(), SamrEnumerateGroupsInDomain(), SamrEnumerateUsersInDomain(), SamrGetAliasMembership(), SamrGetGroupsForUser(), SamrGetMembersInGroup(), SamrLookupDomainInSamServer(), SamrLookupIdsInDomain(), SamrLookupNamesInDomain(), and SamrQuerySecurityObject().

◆ midl_user_free()

void __RPC_USER midl_user_free ( void __RPC_FAR ptr)

Definition at line 120 of file samrpc.c.

121 {
122  HeapFree(GetProcessHeap(), 0, ptr);
123 }
static PVOID ptr
Definition: dispmode.c:27
#define GetProcessHeap()
Definition: compat.h:403
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by SampQueryAliasAdminComment(), SampQueryAliasGeneral(), SampQueryAliasName(), SampQueryDomainGeneral(), SampQueryDomainGeneral2(), SampQueryDomainLockout(), SampQueryDomainLogoff(), SampQueryDomainModified(), SampQueryDomainModified2(), SampQueryDomainName(), SampQueryDomainOem(), SampQueryDomainPassword(), SampQueryDomainReplication(), SampQueryDomainServerRole(), SampQueryDomainState(), SampQueryGroupAdminComment(), SampQueryGroupAttribute(), SampQueryGroupGeneral(), SampQueryGroupName(), SampQueryUserAccount(), SampQueryUserAccountName(), SampQueryUserAdminComment(), SampQueryUserAll(), SampQueryUserControl(), SampQueryUserExpires(), SampQueryUserFullName(), SampQueryUserGeneral(), SampQueryUserHome(), SampQueryUserInternal1(), SampQueryUserInternal2(), SampQueryUserLogon(), SampQueryUserLogonHours(), SampQueryUserName(), SampQueryUserParameters(), SampQueryUserPreferences(), SampQueryUserPrimaryGroup(), SampQueryUserProfile(), SampQueryUserScript(), SampQueryUserWorkStations(), SampSetAliasName(), SampSetGroupName(), SampSetUserName(), SamrEnumerateAliasesInDomain(), SamrEnumerateDomainsInSamServer(), SamrEnumerateGroupsInDomain(), SamrEnumerateUsersInDomain(), SamrGetAliasMembership(), SamrGetGroupsForUser(), SamrGetMembersInAlias(), SamrGetMembersInGroup(), SamrLookupIdsInDomain(), and SamrLookupNamesInDomain().

◆ SampAddRelativeTimeToTime()

static LARGE_INTEGER SampAddRelativeTimeToTime ( IN LARGE_INTEGER  AbsoluteTime,
IN LARGE_INTEGER  RelativeTime 
)
static

Definition at line 63 of file samrpc.c.

65 {
66  LARGE_INTEGER NewTime;
67 
68  NewTime.QuadPart = AbsoluteTime.QuadPart - RelativeTime.QuadPart;
69 
70  if (NewTime.QuadPart < 0)
71  NewTime.QuadPart = 0;
72 
73  return NewTime;
74 }
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by SampQueryUserAll(), and SampQueryUserLogon().

◆ SampGetNumberOfAccounts()

static NTSTATUS SampGetNumberOfAccounts ( PSAM_DB_OBJECT  DomainObject,
LPCWSTR  AccountType,
PULONG  Count 
)
static

Definition at line 953 of file samrpc.c.

956 {
957  HANDLE AccountKeyHandle = NULL;
958  HANDLE NamesKeyHandle = NULL;
960 
961  *Count = 0;
962 
963  Status = SampRegOpenKey(DomainObject->KeyHandle,
964  AccountType,
965  KEY_READ,
966  &AccountKeyHandle);
967  if (!NT_SUCCESS(Status))
968  return Status;
969 
970  Status = SampRegOpenKey(AccountKeyHandle,
971  L"Names",
972  KEY_READ,
973  &NamesKeyHandle);
974  if (!NT_SUCCESS(Status))
975  goto done;
976 
977  Status = SampRegQueryKeyInfo(NamesKeyHandle,
978  NULL,
979  Count);
980 
981 done:
982  SampRegCloseKey(&NamesKeyHandle);
983  SampRegCloseKey(&AccountKeyHandle);
984 
985  return Status;
986 }
#define KEY_READ
Definition: nt_native.h:1023
LONG NTSTATUS
Definition: precomp.h:26
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
NTSTATUS SampRegCloseKey(IN OUT PHANDLE KeyHandle)
Definition: registry.c:26
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS SampRegQueryKeyInfo(IN HANDLE KeyHandle, OUT PULONG SubKeyCount, OUT PULONG ValueCount)
Definition: registry.c:181
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
HANDLE KeyHandle
Definition: samsrv.h:51
NTSTATUS SampRegOpenKey(IN HANDLE ParentKeyHandle, IN LPCWSTR KeyName, IN ACCESS_MASK DesiredAccess, OUT PHANDLE KeyHandle)
Definition: registry.c:158

Referenced by SampQueryDomainGeneral(), and SampQueryDomainGeneral2().

◆ SampQueryAliasAdminComment()

static NTSTATUS SampQueryAliasAdminComment ( PSAM_DB_OBJECT  AliasObject,
PSAMPR_ALIAS_INFO_BUFFER Buffer 
)
static

Definition at line 5105 of file samrpc.c.

5107 {
5108  PSAMPR_ALIAS_INFO_BUFFER InfoBuffer = NULL;
5109  NTSTATUS Status;
5110 
5111  *Buffer = NULL;
5112 
5113  InfoBuffer = midl_user_allocate(sizeof(SAMPR_ALIAS_INFO_BUFFER));
5114  if (InfoBuffer == NULL)
5116 
5117  Status = SampGetObjectAttributeString(AliasObject,
5118  L"Description",
5119  &InfoBuffer->AdminComment.AdminComment);
5120  if (!NT_SUCCESS(Status))
5121  {
5122  TRACE("Status 0x%08lx\n", Status);
5123  goto done;
5124  }
5125 
5126  *Buffer = InfoBuffer;
5127 
5128 done:
5129  if (!NT_SUCCESS(Status))
5130  {
5131  if (InfoBuffer != NULL)
5132  {
5133  if (InfoBuffer->AdminComment.AdminComment.Buffer != NULL)
5135 
5136  midl_user_free(InfoBuffer);
5137  }
5138  }
5139 
5140  return Status;
5141 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
static const WCHAR L[]
Definition: oid.c:1250
RPC_UNICODE_STRING AdminComment
Definition: sam.idl:429
Status
Definition: gdiplustypes.h:24
SAMPR_ALIAS_ADM_COMMENT_INFORMATION AdminComment
Definition: sam.idl:445
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by SamrQueryInformationAlias().

◆ SampQueryAliasGeneral()

static NTSTATUS SampQueryAliasGeneral ( PSAM_DB_OBJECT  AliasObject,
PSAMPR_ALIAS_INFO_BUFFER Buffer 
)
static

Definition at line 4982 of file samrpc.c.

4984 {
4985  PSAMPR_ALIAS_INFO_BUFFER InfoBuffer = NULL;
4986  HANDLE MembersKeyHandle = NULL;
4987  NTSTATUS Status;
4988 
4989  *Buffer = NULL;
4990 
4991  InfoBuffer = midl_user_allocate(sizeof(SAMPR_ALIAS_INFO_BUFFER));
4992  if (InfoBuffer == NULL)
4994 
4995  Status = SampGetObjectAttributeString(AliasObject,
4996  L"Name",
4997  &InfoBuffer->General.Name);
4998  if (!NT_SUCCESS(Status))
4999  {
5000  TRACE("Status 0x%08lx\n", Status);
5001  goto done;
5002  }
5003 
5004  Status = SampGetObjectAttributeString(AliasObject,
5005  L"Description",
5006  &InfoBuffer->General.AdminComment);
5007  if (!NT_SUCCESS(Status))
5008  {
5009  TRACE("Status 0x%08lx\n", Status);
5010  goto done;
5011  }
5012 
5013  /* Open the Members subkey */
5014  Status = SampRegOpenKey(AliasObject->KeyHandle,
5015  L"Members",
5016  KEY_READ,
5017  &MembersKeyHandle);
5018  if (NT_SUCCESS(Status))
5019  {
5020  /* Retrieve the number of members of the alias */
5021  Status = SampRegQueryKeyInfo(MembersKeyHandle,
5022  NULL,
5023  &InfoBuffer->General.MemberCount);
5024  if (!NT_SUCCESS(Status))
5025  {
5026  TRACE("Status 0x%08lx\n", Status);
5027  goto done;
5028  }
5029  }
5031  {
5032  InfoBuffer->General.MemberCount = 0;
5034  }
5035  else
5036  {
5037  TRACE("Status 0x%08lx\n", Status);
5038  goto done;
5039  }
5040 
5041  *Buffer = InfoBuffer;
5042 
5043 done:
5044  SampRegCloseKey(&MembersKeyHandle);
5045 
5046  if (!NT_SUCCESS(Status))
5047  {
5048  if (InfoBuffer != NULL)
5049  {
5050  if (InfoBuffer->General.Name.Buffer != NULL)
5051  midl_user_free(InfoBuffer->General.Name.Buffer);
5052 
5053  if (InfoBuffer->General.AdminComment.Buffer != NULL)
5055 
5056  midl_user_free(InfoBuffer);
5057  }
5058  }
5059 
5060  return Status;
5061 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
#define KEY_READ
Definition: nt_native.h:1023
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS SampRegCloseKey(IN OUT PHANDLE KeyHandle)
Definition: registry.c:26
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS SampRegQueryKeyInfo(IN HANDLE KeyHandle, OUT PULONG SubKeyCount, OUT PULONG ValueCount)
Definition: registry.c:181
Definition: bufpool.h:45
RPC_UNICODE_STRING Name
Definition: sam.idl:417
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
HANDLE KeyHandle
Definition: samsrv.h:51
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
SAMPR_ALIAS_GENERAL_INFORMATION General
Definition: sam.idl:443
NTSTATUS SampRegOpenKey(IN HANDLE ParentKeyHandle, IN LPCWSTR KeyName, IN ACCESS_MASK DesiredAccess, OUT PHANDLE KeyHandle)
Definition: registry.c:158
return STATUS_SUCCESS
Definition: btrfs.c:2938
RPC_UNICODE_STRING AdminComment
Definition: sam.idl:419
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by SamrQueryInformationAlias().

◆ SampQueryAliasName()

static NTSTATUS SampQueryAliasName ( PSAM_DB_OBJECT  AliasObject,
PSAMPR_ALIAS_INFO_BUFFER Buffer 
)
static

Definition at line 5065 of file samrpc.c.

5067 {
5068  PSAMPR_ALIAS_INFO_BUFFER InfoBuffer = NULL;
5069  NTSTATUS Status;
5070 
5071  *Buffer = NULL;
5072 
5073  InfoBuffer = midl_user_allocate(sizeof(SAMPR_ALIAS_INFO_BUFFER));
5074  if (InfoBuffer == NULL)
5076 
5077  Status = SampGetObjectAttributeString(AliasObject,
5078  L"Name",
5079  &InfoBuffer->Name.Name);
5080  if (!NT_SUCCESS(Status))
5081  {
5082  TRACE("Status 0x%08lx\n", Status);
5083  goto done;
5084  }
5085 
5086  *Buffer = InfoBuffer;
5087 
5088 done:
5089  if (!NT_SUCCESS(Status))
5090  {
5091  if (InfoBuffer != NULL)
5092  {
5093  if (InfoBuffer->Name.Name.Buffer != NULL)
5094  midl_user_free(InfoBuffer->Name.Name.Buffer);
5095 
5096  midl_user_free(InfoBuffer);
5097  }
5098  }
5099 
5100  return Status;
5101 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
SAMPR_ALIAS_NAME_INFORMATION Name
Definition: sam.idl:444
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
RPC_UNICODE_STRING Name
Definition: sam.idl:424
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by SamrQueryInformationAlias().

◆ SampQueryDomainGeneral()

static NTSTATUS SampQueryDomainGeneral ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 990 of file samrpc.c.

992 {
993  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
994  SAM_DOMAIN_FIXED_DATA FixedData;
995  ULONG Length = 0;
997 
998  *Buffer = NULL;
999 
1000  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1001  if (InfoBuffer == NULL)
1003 
1004  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1005  Status = SampGetObjectAttribute(DomainObject,
1006  L"F",
1007  NULL,
1008  (PVOID)&FixedData,
1009  &Length);
1010  if (!NT_SUCCESS(Status))
1011  goto done;
1012 
1013  InfoBuffer->General.ForceLogoff.LowPart = FixedData.ForceLogoff.LowPart;
1014  InfoBuffer->General.ForceLogoff.HighPart = FixedData.ForceLogoff.HighPart;
1017  InfoBuffer->General.DomainServerState = FixedData.DomainServerState;
1018  InfoBuffer->General.DomainServerRole = FixedData.DomainServerRole;
1020 
1021  /* Get the OemInformation string */
1022  Status = SampGetObjectAttributeString(DomainObject,
1023  L"OemInformation",
1024  &InfoBuffer->General.OemInformation);
1025  if (!NT_SUCCESS(Status))
1026  {
1027  TRACE("Status 0x%08lx\n", Status);
1028  goto done;
1029  }
1030 
1031  /* Get the Name string */
1032  Status = SampGetObjectAttributeString(DomainObject,
1033  L"Name",
1034  &InfoBuffer->General.DomainName);
1035  if (!NT_SUCCESS(Status))
1036  {
1037  TRACE("Status 0x%08lx\n", Status);
1038  goto done;
1039  }
1040 
1041  /* Get the ReplicaSourceNodeName string */
1042  Status = SampGetObjectAttributeString(DomainObject,
1043  L"ReplicaSourceNodeName",
1044  &InfoBuffer->General.ReplicaSourceNodeName);
1045  if (!NT_SUCCESS(Status))
1046  {
1047  TRACE("Status 0x%08lx\n", Status);
1048  goto done;
1049  }
1050 
1051  /* Get the number of Users in the Domain */
1052  Status = SampGetNumberOfAccounts(DomainObject,
1053  L"Users",
1054  &InfoBuffer->General.UserCount);
1055  if (!NT_SUCCESS(Status))
1056  {
1057  TRACE("Status 0x%08lx\n", Status);
1058  goto done;
1059  }
1060 
1061  /* Get the number of Groups in the Domain */
1062  Status = SampGetNumberOfAccounts(DomainObject,
1063  L"Groups",
1064  &InfoBuffer->General.GroupCount);
1065  if (!NT_SUCCESS(Status))
1066  {
1067  TRACE("Status 0x%08lx\n", Status);
1068  goto done;
1069  }
1070 
1071  /* Get the number of Aliases in the Domain */
1072  Status = SampGetNumberOfAccounts(DomainObject,
1073  L"Aliases",
1074  &InfoBuffer->General.AliasCount);
1075  if (!NT_SUCCESS(Status))
1076  {
1077  TRACE("Status 0x%08lx\n", Status);
1078  goto done;
1079  }
1080 
1081  *Buffer = InfoBuffer;
1082 
1083 done:
1084  if (!NT_SUCCESS(Status))
1085  {
1086  if (InfoBuffer != NULL)
1087  {
1088  if (InfoBuffer->General.OemInformation.Buffer != NULL)
1090 
1091  if (InfoBuffer->General.DomainName.Buffer != NULL)
1092  midl_user_free(InfoBuffer->General.DomainName.Buffer);
1093 
1094  if (InfoBuffer->General.ReplicaSourceNodeName.Buffer != NULL)
1096 
1097  midl_user_free(InfoBuffer);
1098  }
1099  }
1100 
1101  return Status;
1102 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
struct _SAM_DOMAIN_FIXED_DATA SAM_DOMAIN_FIXED_DATA
OLD_LARGE_INTEGER ForceLogoff
Definition: sam.idl:203
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
RPC_UNICODE_STRING ReplicaSourceNodeName
Definition: sam.idl:206
DOMAIN_SERVER_ENABLE_STATE DomainServerState
Definition: samsrv.h:84
LARGE_INTEGER DomainModifiedCount
Definition: samsrv.h:72
RPC_UNICODE_STRING OemInformation
Definition: sam.idl:204
RPC_UNICODE_STRING DomainName
Definition: sam.idl:205
BOOLEAN UasCompatibilityRequired
Definition: samsrv.h:86
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
LARGE_INTEGER ForceLogoff
Definition: samsrv.h:75
SAMPR_DOMAIN_GENERAL_INFORMATION General
Definition: sam.idl:268
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:514
static const WCHAR L[]
Definition: oid.c:1250
ULONG LowPart
Definition: typedefs.h:104
OLD_LARGE_INTEGER DomainModifiedCount
Definition: sam.idl:207
Status
Definition: gdiplustypes.h:24
unsigned long LowPart
Definition: msv1_0.h:63
unsigned char UasCompatibilityRequired
Definition: sam.idl:210
unsigned long DomainServerRole
Definition: sam.idl:209
DOMAIN_SERVER_ROLE DomainServerRole
Definition: samsrv.h:85
static NTSTATUS SampGetNumberOfAccounts(PSAM_DB_OBJECT DomainObject, LPCWSTR AccountType, PULONG Count)
Definition: samrpc.c:953
unsigned int ULONG
Definition: retypes.h:1
unsigned long DomainServerState
Definition: sam.idl:208
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by SamrQueryInformationDomain().

◆ SampQueryDomainGeneral2()

static NTSTATUS SampQueryDomainGeneral2 ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1397 of file samrpc.c.

1399 {
1400  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1401  SAM_DOMAIN_FIXED_DATA FixedData;
1402  ULONG Length = 0;
1403  NTSTATUS Status;
1404 
1405  *Buffer = NULL;
1406 
1407  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1408  if (InfoBuffer == NULL)
1410 
1411  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1412  Status = SampGetObjectAttribute(DomainObject,
1413  L"F",
1414  NULL,
1415  (PVOID)&FixedData,
1416  &Length);
1417  if (!NT_SUCCESS(Status))
1418  goto done;
1419 
1420  InfoBuffer->General2.I1.ForceLogoff.LowPart = FixedData.ForceLogoff.LowPart;
1421  InfoBuffer->General2.I1.ForceLogoff.HighPart = FixedData.ForceLogoff.HighPart;
1424  InfoBuffer->General2.I1.DomainServerState = FixedData.DomainServerState;
1425  InfoBuffer->General2.I1.DomainServerRole = FixedData.DomainServerRole;
1427 
1428  InfoBuffer->General2.LockoutDuration = FixedData.LockoutDuration;
1430  InfoBuffer->General2.LockoutThreshold = FixedData.LockoutThreshold;
1431 
1432  /* Get the OemInformation string */
1433  Status = SampGetObjectAttributeString(DomainObject,
1434  L"OemInformation",
1435  &InfoBuffer->General2.I1.OemInformation);
1436  if (!NT_SUCCESS(Status))
1437  {
1438  TRACE("Status 0x%08lx\n", Status);
1439  goto done;
1440  }
1441 
1442  /* Get the Name string */
1443  Status = SampGetObjectAttributeString(DomainObject,
1444  L"Name",
1445  &InfoBuffer->General2.I1.DomainName);
1446  if (!NT_SUCCESS(Status))
1447  {
1448  TRACE("Status 0x%08lx\n", Status);
1449  goto done;
1450  }
1451 
1452  /* Get the ReplicaSourceNodeName string */
1453  Status = SampGetObjectAttributeString(DomainObject,
1454  L"ReplicaSourceNodeName",
1455  &InfoBuffer->General2.I1.ReplicaSourceNodeName);
1456  if (!NT_SUCCESS(Status))
1457  {
1458  TRACE("Status 0x%08lx\n", Status);
1459  goto done;
1460  }
1461 
1462  /* Get the number of Users in the Domain */
1463  Status = SampGetNumberOfAccounts(DomainObject,
1464  L"Users",
1465  &InfoBuffer->General2.I1.UserCount);
1466  if (!NT_SUCCESS(Status))
1467  {
1468  TRACE("Status 0x%08lx\n", Status);
1469  goto done;
1470  }
1471 
1472  /* Get the number of Groups in the Domain */
1473  Status = SampGetNumberOfAccounts(DomainObject,
1474  L"Groups",
1475  &InfoBuffer->General2.I1.GroupCount);
1476  if (!NT_SUCCESS(Status))
1477  {
1478  TRACE("Status 0x%08lx\n", Status);
1479  goto done;
1480  }
1481 
1482  /* Get the number of Aliases in the Domain */
1483  Status = SampGetNumberOfAccounts(DomainObject,
1484  L"Aliases",
1485  &InfoBuffer->General2.I1.AliasCount);
1486  if (!NT_SUCCESS(Status))
1487  {
1488  TRACE("Status 0x%08lx\n", Status);
1489  goto done;
1490  }
1491 
1492  *Buffer = InfoBuffer;
1493 
1494 done:
1495  if (!NT_SUCCESS(Status))
1496  {
1497  if (InfoBuffer != NULL)
1498  {
1499  if (InfoBuffer->General2.I1.OemInformation.Buffer != NULL)
1501 
1502  if (InfoBuffer->General2.I1.DomainName.Buffer != NULL)
1504 
1505  if (InfoBuffer->General2.I1.ReplicaSourceNodeName.Buffer != NULL)
1507 
1508  midl_user_free(InfoBuffer);
1509  }
1510  }
1511 
1512  return Status;
1513 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
struct _SAM_DOMAIN_FIXED_DATA SAM_DOMAIN_FIXED_DATA
OLD_LARGE_INTEGER ForceLogoff
Definition: sam.idl:203
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
unsigned short LockoutThreshold
Definition: sam.idl:221
LONG NTSTATUS
Definition: precomp.h:26
RPC_UNICODE_STRING ReplicaSourceNodeName
Definition: sam.idl:206
DOMAIN_SERVER_ENABLE_STATE DomainServerState
Definition: samsrv.h:84
LARGE_INTEGER DomainModifiedCount
Definition: samsrv.h:72
RPC_UNICODE_STRING OemInformation
Definition: sam.idl:204
RPC_UNICODE_STRING DomainName
Definition: sam.idl:205
BOOLEAN UasCompatibilityRequired
Definition: samsrv.h:86
SAMPR_DOMAIN_GENERAL_INFORMATION I1
Definition: sam.idl:218
smooth NULL
Definition: ftsmooth.c:416
LARGE_INTEGER LockoutObservationWindow
Definition: samsrv.h:77
Definition: bufpool.h:45
LARGE_INTEGER ForceLogoff
Definition: samsrv.h:75
LARGE_INTEGER LockoutObservationWindow
Definition: sam.idl:220
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
LARGE_INTEGER LockoutDuration
Definition: samsrv.h:76
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:514
static const WCHAR L[]
Definition: oid.c:1250
ULONG LowPart
Definition: typedefs.h:104
OLD_LARGE_INTEGER DomainModifiedCount
Definition: sam.idl:207
Status
Definition: gdiplustypes.h:24
unsigned long LowPart
Definition: msv1_0.h:63
unsigned char UasCompatibilityRequired
Definition: sam.idl:210
SAMPR_DOMAIN_GENERAL_INFORMATION2 General2
Definition: sam.idl:276
USHORT LockoutThreshold
Definition: samsrv.h:83
unsigned long DomainServerRole
Definition: sam.idl:209
DOMAIN_SERVER_ROLE DomainServerRole
Definition: samsrv.h:85
static NTSTATUS SampGetNumberOfAccounts(PSAM_DB_OBJECT DomainObject, LPCWSTR AccountType, PULONG Count)
Definition: samrpc.c:953
unsigned int ULONG
Definition: retypes.h:1
unsigned long DomainServerState
Definition: sam.idl:208
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by SamrQueryInformationDomain().

◆ SampQueryDomainLockout()

static NTSTATUS SampQueryDomainLockout ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1517 of file samrpc.c.

1519 {
1520  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1521  SAM_DOMAIN_FIXED_DATA FixedData;
1522  ULONG Length = 0;
1523  NTSTATUS Status;
1524 
1525  *Buffer = NULL;
1526 
1527  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1528  if (InfoBuffer == NULL)
1530 
1531  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1532  Status = SampGetObjectAttribute(DomainObject,
1533  L"F",
1534  NULL,
1535  (PVOID)&FixedData,
1536  &Length);
1537  if (!NT_SUCCESS(Status))
1538  goto done;
1539 
1540  InfoBuffer->Lockout.LockoutDuration = FixedData.LockoutDuration;
1542  InfoBuffer->Lockout.LockoutThreshold = FixedData.LockoutThreshold;
1543 
1544  *Buffer = InfoBuffer;
1545 
1546 done:
1547  if (!NT_SUCCESS(Status))
1548  {
1549  if (InfoBuffer != NULL)
1550  {
1551  midl_user_free(InfoBuffer);
1552  }
1553  }
1554 
1555  return Status;
1556 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
struct _SAM_DOMAIN_FIXED_DATA SAM_DOMAIN_FIXED_DATA
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
LARGE_INTEGER LockoutObservationWindow
Definition: sam.idl:243
SAMPR_DOMAIN_LOCKOUT_INFORMATION Lockout
Definition: sam.idl:277
smooth NULL
Definition: ftsmooth.c:416
LARGE_INTEGER LockoutObservationWindow
Definition: samsrv.h:77
Definition: bufpool.h:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned short LockoutThreshold
Definition: sam.idl:244
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
LARGE_INTEGER LockoutDuration
Definition: samsrv.h:76
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:514
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
LARGE_INTEGER LockoutDuration
Definition: sam.idl:242
USHORT LockoutThreshold
Definition: samsrv.h:83
unsigned int ULONG
Definition: retypes.h:1
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationDomain().

◆ SampQueryDomainLogoff()

static NTSTATUS SampQueryDomainLogoff ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1106 of file samrpc.c.

1108 {
1109  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1110  SAM_DOMAIN_FIXED_DATA FixedData;
1111  ULONG Length = 0;
1112  NTSTATUS Status;
1113 
1114  *Buffer = NULL;
1115 
1116  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1117  if (InfoBuffer == NULL)
1119 
1120  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1121  Status = SampGetObjectAttribute(DomainObject,
1122  L"F",
1123  NULL,
1124  (PVOID)&FixedData,
1125  &Length);
1126  if (!NT_SUCCESS(Status))
1127  goto done;
1128 
1129  InfoBuffer->Logoff.ForceLogoff.LowPart = FixedData.ForceLogoff.LowPart;
1130  InfoBuffer->Logoff.ForceLogoff.HighPart = FixedData.ForceLogoff.HighPart;
1131 
1132  *Buffer = InfoBuffer;
1133 
1134 done:
1135  if (!NT_SUCCESS(Status))
1136  {
1137  if (InfoBuffer != NULL)
1138  {
1139  midl_user_free(InfoBuffer);
1140  }
1141  }
1142 
1143  return Status;
1144 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
struct _SAM_DOMAIN_FIXED_DATA SAM_DOMAIN_FIXED_DATA
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
LARGE_INTEGER ForceLogoff
Definition: samsrv.h:75
DOMAIN_LOGOFF_INFORMATION Logoff
Definition: sam.idl:269
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:514
static const WCHAR L[]
Definition: oid.c:1250
ULONG LowPart
Definition: typedefs.h:104
Status
Definition: gdiplustypes.h:24
LARGE_INTEGER ForceLogoff
Definition: ntsam.h:371
unsigned int ULONG
Definition: retypes.h:1
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationDomain().

◆ SampQueryDomainModified()

static NTSTATUS SampQueryDomainModified ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1312 of file samrpc.c.

1314 {
1315  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1316  SAM_DOMAIN_FIXED_DATA FixedData;
1317  ULONG Length = 0;
1318  NTSTATUS Status;
1319 
1320  *Buffer = NULL;
1321 
1322  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1323  if (InfoBuffer == NULL)
1325 
1326  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1327  Status = SampGetObjectAttribute(DomainObject,
1328  L"F",
1329  NULL,
1330  (PVOID)&FixedData,
1331  &Length);
1332  if (!NT_SUCCESS(Status))
1333  goto done;
1334 
1337  InfoBuffer->Modified.CreationTime.LowPart = FixedData.CreationTime.LowPart;
1338  InfoBuffer->Modified.CreationTime.HighPart = FixedData.CreationTime.HighPart;
1339 
1340  *Buffer = InfoBuffer;
1341 
1342 done:
1343  if (!NT_SUCCESS(Status))
1344  {
1345  if (InfoBuffer != NULL)
1346  {
1347  midl_user_free(InfoBuffer);
1348  }
1349  }
1350 
1351  return Status;
1352 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
struct _SAM_DOMAIN_FIXED_DATA SAM_DOMAIN_FIXED_DATA
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
LARGE_INTEGER DomainModifiedCount
Definition: samsrv.h:72
LARGE_INTEGER CreationTime
Definition: ntsam.h:397
DOMAIN_MODIFIED_INFORMATION Modified
Definition: sam.idl:274
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:514
static const WCHAR L[]
Definition: oid.c:1250
ULONG LowPart
Definition: typedefs.h:104
Status
Definition: gdiplustypes.h:24
LARGE_INTEGER DomainModifiedCount
Definition: ntsam.h:396
LARGE_INTEGER CreationTime
Definition: samsrv.h:71
unsigned int ULONG
Definition: retypes.h:1
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationDomain().

◆ SampQueryDomainModified2()

static NTSTATUS SampQueryDomainModified2 ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1560 of file samrpc.c.

1562 {
1563  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1564  SAM_DOMAIN_FIXED_DATA FixedData;
1565  ULONG Length = 0;
1566  NTSTATUS Status;
1567 
1568  *Buffer = NULL;
1569 
1570  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1571  if (InfoBuffer == NULL)
1573 
1574  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1575  Status = SampGetObjectAttribute(DomainObject,
1576  L"F",
1577  NULL,
1578  (PVOID)&FixedData,
1579  &Length);
1580  if (!NT_SUCCESS(Status))
1581  goto done;
1582 
1585  InfoBuffer->Modified2.CreationTime.LowPart = FixedData.CreationTime.LowPart;
1586  InfoBuffer->Modified2.CreationTime.HighPart = FixedData.CreationTime.HighPart;
1589 
1590  *Buffer = InfoBuffer;
1591 
1592 done:
1593  if (!NT_SUCCESS(Status))
1594  {
1595  if (InfoBuffer != NULL)
1596  {
1597  midl_user_free(InfoBuffer);
1598  }
1599  }
1600 
1601  return Status;
1602 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
struct _SAM_DOMAIN_FIXED_DATA SAM_DOMAIN_FIXED_DATA
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
LARGE_INTEGER DomainModifiedCount
Definition: samsrv.h:72
LARGE_INTEGER DomainModifiedCount
Definition: ntsam.h:429
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
LARGE_INTEGER CreationTime
Definition: ntsam.h:430
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:514
static const WCHAR L[]
Definition: oid.c:1250
ULONG LowPart
Definition: typedefs.h:104
DOMAIN_MODIFIED_INFORMATION2 Modified2
Definition: sam.idl:278
Status
Definition: gdiplustypes.h:24
LARGE_INTEGER ModifiedCountAtLastPromotion
Definition: samsrv.h:78
LARGE_INTEGER CreationTime
Definition: samsrv.h:71
unsigned int ULONG
Definition: retypes.h:1
LARGE_INTEGER ModifiedCountAtLastPromotion
Definition: ntsam.h:431
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationDomain().

◆ SampQueryDomainName()

static NTSTATUS SampQueryDomainName ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1189 of file samrpc.c.

1191 {
1192  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1193  NTSTATUS Status;
1194 
1195  *Buffer = NULL;
1196 
1197  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1198  if (InfoBuffer == NULL)
1200 
1201  /* Get the Name string */
1202  Status = SampGetObjectAttributeString(DomainObject,
1203  L"Name",
1204  &InfoBuffer->Name.DomainName);
1205  if (!NT_SUCCESS(Status))
1206  {
1207  TRACE("Status 0x%08lx\n", Status);
1208  goto done;
1209  }
1210 
1211  *Buffer = InfoBuffer;
1212 
1213 done:
1214  if (!NT_SUCCESS(Status))
1215  {
1216  if (InfoBuffer != NULL)
1217  {
1218  if (InfoBuffer->Name.DomainName.Buffer != NULL)
1219  midl_user_free(InfoBuffer->Name.DomainName.Buffer);
1220 
1221  midl_user_free(InfoBuffer);
1222  }
1223  }
1224 
1225  return Status;
1226 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
RPC_UNICODE_STRING DomainName
Definition: sam.idl:232
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
SAMPR_DOMAIN_NAME_INFORMATION Name
Definition: sam.idl:271
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by SamrQueryInformationDomain().

◆ SampQueryDomainOem()

static NTSTATUS SampQueryDomainOem ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1148 of file samrpc.c.

1150 {
1151  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1152  NTSTATUS Status;
1153 
1154  *Buffer = NULL;
1155 
1156  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1157  if (InfoBuffer == NULL)
1159 
1160  /* Get the OemInformation string */
1161  Status = SampGetObjectAttributeString(DomainObject,
1162  L"OemInformation",
1163  &InfoBuffer->Oem.OemInformation);
1164  if (!NT_SUCCESS(Status))
1165  {
1166  TRACE("Status 0x%08lx\n", Status);
1167  goto done;
1168  }
1169 
1170  *Buffer = InfoBuffer;
1171 
1172 done:
1173  if (!NT_SUCCESS(Status))
1174  {
1175  if (InfoBuffer != NULL)
1176  {
1177  if (InfoBuffer->Oem.OemInformation.Buffer != NULL)
1178  midl_user_free(InfoBuffer->Oem.OemInformation.Buffer);
1179 
1180  midl_user_free(InfoBuffer);
1181  }
1182  }
1183 
1184  return Status;
1185 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
static const WCHAR L[]
Definition: oid.c:1250
RPC_UNICODE_STRING OemInformation
Definition: sam.idl:227
Status
Definition: gdiplustypes.h:24
SAMPR_DOMAIN_OEM_INFORMATION Oem
Definition: sam.idl:270
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by SamrQueryInformationDomain().

◆ SampQueryDomainPassword()

static NTSTATUS SampQueryDomainPassword ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 906 of file samrpc.c.

908 {
909  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
910  SAM_DOMAIN_FIXED_DATA FixedData;
911  ULONG Length = 0;
913 
914  *Buffer = NULL;
915 
916  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
917  if (InfoBuffer == NULL)
919 
920  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
921  Status = SampGetObjectAttribute(DomainObject,
922  L"F",
923  NULL,
924  (PVOID)&FixedData,
925  &Length);
926  if (!NT_SUCCESS(Status))
927  goto done;
928 
929  InfoBuffer->Password.MinPasswordLength = FixedData.MinPasswordLength;
930  InfoBuffer->Password.PasswordHistoryLength = FixedData.PasswordHistoryLength;
931  InfoBuffer->Password.PasswordProperties = FixedData.PasswordProperties;
932  InfoBuffer->Password.MaxPasswordAge.LowPart = FixedData.MaxPasswordAge.LowPart;
933  InfoBuffer->Password.MaxPasswordAge.HighPart = FixedData.MaxPasswordAge.HighPart;
934  InfoBuffer->Password.MinPasswordAge.LowPart = FixedData.MinPasswordAge.LowPart;
935  InfoBuffer->Password.MinPasswordAge.HighPart = FixedData.MinPasswordAge.HighPart;
936 
937  *Buffer = InfoBuffer;
938 
939 done:
940  if (!NT_SUCCESS(Status))
941  {
942  if (InfoBuffer != NULL)
943  {
944  midl_user_free(InfoBuffer);
945  }
946  }
947 
948  return Status;
949 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
struct _SAM_DOMAIN_FIXED_DATA SAM_DOMAIN_FIXED_DATA
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
USHORT MinPasswordLength
Definition: samsrv.h:81
LONG NTSTATUS
Definition: precomp.h:26
LARGE_INTEGER MinPasswordAge
Definition: samsrv.h:74
ULONG PasswordProperties
Definition: samsrv.h:80
LARGE_INTEGER MinPasswordAge
Definition: ntsam.h:348
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
DOMAIN_PASSWORD_INFORMATION Password
Definition: sam.idl:267
LARGE_INTEGER MaxPasswordAge
Definition: ntsam.h:347
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:514
static const WCHAR L[]
Definition: oid.c:1250
ULONG LowPart
Definition: typedefs.h:104
Status
Definition: gdiplustypes.h:24
LARGE_INTEGER MaxPasswordAge
Definition: samsrv.h:73
unsigned int ULONG
Definition: retypes.h:1
USHORT PasswordHistoryLength
Definition: samsrv.h:82
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationDomain().

◆ SampQueryDomainReplication()

static NTSTATUS SampQueryDomainReplication ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1230 of file samrpc.c.

1232 {
1233  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1234  NTSTATUS Status;
1235 
1236  *Buffer = NULL;
1237 
1238  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1239  if (InfoBuffer == NULL)
1241 
1242  /* Get the ReplicaSourceNodeName string */
1243  Status = SampGetObjectAttributeString(DomainObject,
1244  L"ReplicaSourceNodeName",
1245  &InfoBuffer->Replication.ReplicaSourceNodeName);
1246  if (!NT_SUCCESS(Status))
1247  {
1248  TRACE("Status 0x%08lx\n", Status);
1249  goto done;
1250  }
1251 
1252  *Buffer = InfoBuffer;
1253 
1254 done:
1255  if (!NT_SUCCESS(Status))
1256  {
1257  if (InfoBuffer != NULL)
1258  {
1259  if (InfoBuffer->Replication.ReplicaSourceNodeName.Buffer != NULL)
1261 
1262  midl_user_free(InfoBuffer);
1263  }
1264  }
1265 
1266  return Status;
1267 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
SAMPR_DOMAIN_REPLICATION_INFORMATION Replication
Definition: sam.idl:273
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
static const WCHAR L[]
Definition: oid.c:1250
RPC_UNICODE_STRING ReplicaSourceNodeName
Definition: sam.idl:237
Status
Definition: gdiplustypes.h:24
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by SamrQueryInformationDomain().

◆ SampQueryDomainServerRole()

static NTSTATUS SampQueryDomainServerRole ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1271 of file samrpc.c.

1273 {
1274  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1275  SAM_DOMAIN_FIXED_DATA FixedData;
1276  ULONG Length = 0;
1277  NTSTATUS Status;
1278 
1279  *Buffer = NULL;
1280 
1281  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1282  if (InfoBuffer == NULL)
1284 
1285  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1286  Status = SampGetObjectAttribute(DomainObject,
1287  L"F",
1288  NULL,
1289  (PVOID)&FixedData,
1290  &Length);
1291  if (!NT_SUCCESS(Status))
1292  goto done;
1293 
1294  InfoBuffer->Role.DomainServerRole = FixedData.DomainServerRole;
1295 
1296  *Buffer = InfoBuffer;
1297 
1298 done:
1299  if (!NT_SUCCESS(Status))
1300  {
1301  if (InfoBuffer != NULL)
1302  {
1303  midl_user_free(InfoBuffer);
1304  }
1305  }
1306 
1307  return Status;
1308 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
struct _SAM_DOMAIN_FIXED_DATA SAM_DOMAIN_FIXED_DATA
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
DOMAIN_SERVER_ROLE DomainServerRole
Definition: ntsam.h:391
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:514
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
DOMAIN_SERVER_ROLE_INFORMATION Role
Definition: sam.idl:272
DOMAIN_SERVER_ROLE DomainServerRole
Definition: samsrv.h:85
unsigned int ULONG
Definition: retypes.h:1
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationDomain().

◆ SampQueryDomainState()

static NTSTATUS SampQueryDomainState ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1356 of file samrpc.c.

1358 {
1359  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1360  SAM_DOMAIN_FIXED_DATA FixedData;
1361  ULONG Length = 0;
1362  NTSTATUS Status;
1363 
1364  *Buffer = NULL;
1365 
1366  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1367  if (InfoBuffer == NULL)
1369 
1370  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1371  Status = SampGetObjectAttribute(DomainObject,
1372  L"F",
1373  NULL,
1374  (PVOID)&FixedData,
1375  &Length);
1376  if (!NT_SUCCESS(Status))
1377  goto done;
1378 
1379  InfoBuffer->State.DomainServerState = FixedData.DomainServerState;
1380 
1381  *Buffer = InfoBuffer;
1382 
1383 done:
1384  if (!NT_SUCCESS(Status))
1385  {
1386  if (InfoBuffer != NULL)
1387  {
1388  midl_user_free(InfoBuffer);
1389  }
1390  }
1391 
1392  return Status;
1393 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
struct _SAM_DOMAIN_FIXED_DATA SAM_DOMAIN_FIXED_DATA
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
DOMAIN_SERVER_ENABLE_STATE DomainServerState
Definition: ntsam.h:402
LONG NTSTATUS
Definition: precomp.h:26
DOMAIN_STATE_INFORMATION State
Definition: sam.idl:275
DOMAIN_SERVER_ENABLE_STATE DomainServerState
Definition: samsrv.h:84
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:514
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
unsigned int ULONG
Definition: retypes.h:1
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationDomain().

◆ SampQueryGroupAdminComment()

static NTSTATUS SampQueryGroupAdminComment ( PSAM_DB_OBJECT  GroupObject,
PSAMPR_GROUP_INFO_BUFFER Buffer 
)
static

Definition at line 4313 of file samrpc.c.

4315 {
4316  PSAMPR_GROUP_INFO_BUFFER InfoBuffer = NULL;
4317  NTSTATUS Status;
4318 
4319  *Buffer = NULL;
4320 
4321  InfoBuffer = midl_user_allocate(sizeof(SAMPR_GROUP_INFO_BUFFER));
4322  if (InfoBuffer == NULL)
4324 
4325  Status = SampGetObjectAttributeString(GroupObject,
4326  L"AdminComment",
4327  &InfoBuffer->AdminComment.AdminComment);
4328  if (!NT_SUCCESS(Status))
4329  {
4330  TRACE("Status 0x%08lx\n", Status);
4331  goto done;
4332  }
4333 
4334  *Buffer = InfoBuffer;
4335 
4336 done:
4337  if (!NT_SUCCESS(Status))
4338  {
4339  if (InfoBuffer != NULL)
4340  {
4341  if (InfoBuffer->AdminComment.AdminComment.Buffer != NULL)
4343 
4344  midl_user_free(InfoBuffer);
4345  }
4346  }
4347 
4348  return Status;
4349 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
RPC_UNICODE_STRING AdminComment
Definition: sam.idl:392
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
SAMPR_GROUP_ADM_COMMENT_INFORMATION AdminComment
Definition: sam.idl:411
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by SamrQueryInformationGroup().

◆ SampQueryGroupAttribute()

static NTSTATUS SampQueryGroupAttribute ( PSAM_DB_OBJECT  GroupObject,
PSAMPR_GROUP_INFO_BUFFER Buffer 
)
static

Definition at line 4269 of file samrpc.c.

4271 {
4272  PSAMPR_GROUP_INFO_BUFFER InfoBuffer = NULL;
4273  SAM_GROUP_FIXED_DATA FixedData;
4274  ULONG Length = 0;
4275  NTSTATUS Status;
4276 
4277  *Buffer = NULL;
4278 
4279  InfoBuffer = midl_user_allocate(sizeof(SAMPR_GROUP_INFO_BUFFER));
4280  if (InfoBuffer == NULL)
4282 
4283  Length = sizeof(SAM_GROUP_FIXED_DATA);
4284  Status = SampGetObjectAttribute(GroupObject,
4285  L"F",
4286  NULL,
4287  (PVOID)&FixedData,
4288  &Length);
4289  if (!NT_SUCCESS(Status))
4290  {
4291  TRACE("Status 0x%08lx\n", Status);
4292  goto done;
4293  }
4294 
4295  InfoBuffer->Attribute.Attributes = FixedData.Attributes;
4296 
4297  *Buffer = InfoBuffer;
4298 
4299 done:
4300  if (!NT_SUCCESS(Status))
4301  {
4302  if (InfoBuffer != NULL)
4303  {
4304  midl_user_free(InfoBuffer);
4305  }
4306  }
4307 
4308  return Status;
4309 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _SAM_GROUP_FIXED_DATA SAM_GROUP_FIXED_DATA
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:514
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
unsigned int ULONG
Definition: retypes.h:1
SAMPR_GROUP_ATTRIBUTE_INFORMATION Attribute
Definition: sam.idl:410
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationGroup().

◆ SampQueryGroupGeneral()

static NTSTATUS SampQueryGroupGeneral ( PSAM_DB_OBJECT  GroupObject,
PSAMPR_GROUP_INFO_BUFFER Buffer 
)
static

Definition at line 4139 of file samrpc.c.

4141 {
4142  PSAMPR_GROUP_INFO_BUFFER InfoBuffer = NULL;
4143  SAM_GROUP_FIXED_DATA FixedData;
4144  ULONG MembersLength = 0;
4145  ULONG Length = 0;
4146  NTSTATUS Status;
4147 
4148  *Buffer = NULL;
4149 
4150  InfoBuffer = midl_user_allocate(sizeof(SAMPR_GROUP_INFO_BUFFER));
4151  if (InfoBuffer == NULL)
4153 
4154  Status = SampGetObjectAttributeString(GroupObject,
4155  L"Name",
4156  &InfoBuffer->General.Name);
4157  if (!NT_SUCCESS(Status))
4158  {
4159  TRACE("Status 0x%08lx\n", Status);
4160  goto done;
4161  }
4162 
4163  Status = SampGetObjectAttributeString(GroupObject,
4164  L"AdminComment",
4165  &InfoBuffer->General.AdminComment);
4166  if (!NT_SUCCESS(Status))
4167  {
4168  TRACE("Status 0x%08lx\n", Status);
4169  goto done;
4170  }
4171 
4172  Length = sizeof(SAM_GROUP_FIXED_DATA);
4173  Status = SampGetObjectAttribute(GroupObject,
4174  L"F",
4175  NULL,
4176  (PVOID)&FixedData,
4177  &Length);
4178  if (!NT_SUCCESS(Status))
4179  {
4180  TRACE("Status 0x%08lx\n", Status);
4181  goto done;
4182  }
4183 
4184  InfoBuffer->General.Attributes = FixedData.Attributes;
4185 
4186  Status = SampGetObjectAttribute(GroupObject,
4187  L"Members",
4188  NULL,
4189  NULL,
4190  &MembersLength);
4192  {
4193  TRACE("Status 0x%08lx\n", Status);
4194  goto done;
4195  }
4196 
4198  {
4199  InfoBuffer->General.MemberCount = 0;
4201  }
4202  else
4203  {
4204  InfoBuffer->General.MemberCount = MembersLength / sizeof(ULONG);
4205  }
4206 
4207  *Buffer = InfoBuffer;
4208 
4209 done:
4210  if (!NT_SUCCESS(Status))
4211  {
4212  if (InfoBuffer != NULL)
4213  {
4214  if (InfoBuffer->General.Name.Buffer != NULL)
4215  midl_user_free(InfoBuffer->General.Name.Buffer);
4216 
4217  if (InfoBuffer->General.AdminComment.Buffer != NULL)
4219 
4220  midl_user_free(InfoBuffer);
4221  }
4222  }
4223 
4224  return Status;
4225 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
RPC_UNICODE_STRING Name
Definition: sam.idl:379
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
SAMPR_GROUP_GENERAL_INFORMATION General
Definition: sam.idl:408
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _SAM_GROUP_FIXED_DATA SAM_GROUP_FIXED_DATA
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:514
static const WCHAR L[]
Definition: oid.c:1250
RPC_UNICODE_STRING AdminComment
Definition: sam.idl:382
Status
Definition: gdiplustypes.h:24
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2938
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by SamrQueryInformationGroup().

◆ SampQueryGroupName()

static NTSTATUS SampQueryGroupName ( PSAM_DB_OBJECT  GroupObject,
PSAMPR_GROUP_INFO_BUFFER Buffer 
)
static

Definition at line 4229 of file samrpc.c.

4231 {
4232  PSAMPR_GROUP_INFO_BUFFER InfoBuffer = NULL;
4233  NTSTATUS Status;
4234 
4235  *Buffer = NULL;
4236 
4237  InfoBuffer = midl_user_allocate(sizeof(SAMPR_GROUP_INFO_BUFFER));
4238  if (InfoBuffer == NULL)
4240 
4241  Status = SampGetObjectAttributeString(GroupObject,
4242  L"Name",
4243  &InfoBuffer->Name.Name);
4244  if (!NT_SUCCESS(Status))
4245  {
4246  TRACE("Status 0x%08lx\n", Status);
4247  goto done;
4248  }
4249 
4250  *Buffer = InfoBuffer;
4251 
4252 done:
4253  if (!NT_SUCCESS(Status))
4254  {
4255  if (InfoBuffer != NULL)
4256  {
4257  if (InfoBuffer->Name.Name.Buffer != NULL)
4258  midl_user_free(InfoBuffer->Name.Name.Buffer);
4259 
4260  midl_user_free(InfoBuffer);
4261  }
4262  }
4263 
4264  return Status;
4265 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
RPC_UNICODE_STRING Name
Definition: sam.idl:387
SAMPR_GROUP_NAME_INFORMATION Name
Definition: sam.idl:409
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by SamrQueryInformationGroup().

◆ SampQueryUserAccount()

static NTSTATUS SampQueryUserAccount ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 5979 of file samrpc.c.

5981 {
5982  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
5983  SAM_USER_FIXED_DATA FixedData;
5984  ULONG Length = 0;
5985  NTSTATUS Status;
5986 
5987  *Buffer = NULL;
5988 
5989  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
5990  if (InfoBuffer == NULL)
5992 
5993  Length = sizeof(SAM_USER_FIXED_DATA);
5994  Status = SampGetObjectAttribute(UserObject,
5995  L"F",
5996  NULL,
5997  (PVOID)&FixedData,
5998  &Length);
5999  if (!NT_SUCCESS(Status))
6000  goto done;
6001 
6002  InfoBuffer->Account.UserId = FixedData.UserId;
6003  InfoBuffer->Account.PrimaryGroupId = FixedData.PrimaryGroupId;
6004  InfoBuffer->Account.LastLogon.LowPart = FixedData.LastLogon.LowPart;
6005  InfoBuffer->Account.LastLogon.HighPart = FixedData.LastLogon.HighPart;
6006  InfoBuffer->Account.LastLogoff.LowPart = FixedData.LastLogoff.LowPart;
6007  InfoBuffer->Account.LastLogoff.HighPart = FixedData.LastLogoff.HighPart;
6008  InfoBuffer->Account.PasswordLastSet.LowPart = FixedData.PasswordLastSet.LowPart;
6009  InfoBuffer->Account.PasswordLastSet.HighPart = FixedData.PasswordLastSet.HighPart;
6010  InfoBuffer->Account.AccountExpires.LowPart = FixedData.AccountExpires.LowPart;
6011  InfoBuffer->Account.AccountExpires.HighPart = FixedData.AccountExpires.HighPart;
6012  InfoBuffer->Account.BadPasswordCount = FixedData.BadPasswordCount;
6013  InfoBuffer->Account.LogonCount = FixedData.LogonCount;
6014  InfoBuffer->Account.UserAccountControl = FixedData.UserAccountControl;
6015 
6016  /* Get the Name string */
6017  Status = SampGetObjectAttributeString(UserObject,
6018  L"Name",
6019  &InfoBuffer->Account.UserName);
6020  if (!NT_SUCCESS(Status))
6021  {
6022  TRACE("Status 0x%08lx\n", Status);
6023  goto done;
6024  }
6025 
6026  /* Get the FullName string */
6027  Status = SampGetObjectAttributeString(UserObject,
6028  L"FullName",
6029  &InfoBuffer->Account.FullName);
6030  if (!NT_SUCCESS(Status))
6031  {
6032  TRACE("Status 0x%08lx\n", Status);
6033  goto done;
6034  }
6035 
6036  /* Get the HomeDirectory string */
6037  Status = SampGetObjectAttributeString(UserObject,
6038  L"HomeDirectory",
6039  &InfoBuffer->Account.HomeDirectory);
6040  if (!NT_SUCCESS(Status))
6041  {
6042  TRACE("Status 0x%08lx\n", Status);
6043  goto done;
6044  }
6045 
6046  /* Get the HomeDirectoryDrive string */
6047  Status = SampGetObjectAttributeString(UserObject,
6048  L"HomeDirectoryDrive",
6049  &InfoBuffer->Account.HomeDirectoryDrive);
6050  if (!NT_SUCCESS(Status))
6051  {
6052  TRACE("Status 0x%08lx\n", Status);
6053  goto done;
6054  }
6055 
6056  /* Get the ScriptPath string */
6057  Status = SampGetObjectAttributeString(UserObject,
6058  L"ScriptPath",
6059  &InfoBuffer->Account.ScriptPath);
6060  if (!NT_SUCCESS(Status))
6061  {
6062  TRACE("Status 0x%08lx\n", Status);
6063  goto done;
6064  }
6065 
6066  /* Get the ProfilePath string */
6067  Status = SampGetObjectAttributeString(UserObject,
6068  L"ProfilePath",
6069  &InfoBuffer->Account.ProfilePath);
6070  if (!NT_SUCCESS(Status))
6071  {
6072  TRACE("Status 0x%08lx\n", Status);
6073  goto done;
6074  }
6075 
6076  /* Get the AdminComment string */
6077  Status = SampGetObjectAttributeString(UserObject,
6078  L"AdminComment",
6079  &InfoBuffer->Account.AdminComment);
6080  if (!NT_SUCCESS(Status))
6081  {
6082  TRACE("Status 0x%08lx\n", Status);
6083  goto done;
6084  }
6085 
6086  /* Get the WorkStations string */
6087  Status = SampGetObjectAttributeString(UserObject,
6088  L"WorkStations",
6089  &InfoBuffer->Account.WorkStations);
6090  if (!NT_SUCCESS(Status))
6091  {
6092  TRACE("Status 0x%08lx\n", Status);
6093  goto done;
6094  }
6095 
6096  /* Get the LogonHours attribute */
6097  Status = SampGetLogonHoursAttribute(UserObject,
6098  &InfoBuffer->Account.LogonHours);
6099  if (!NT_SUCCESS(Status))
6100  {
6101  TRACE("Status 0x%08lx\n", Status);
6102  goto done;
6103  }
6104 
6105  *Buffer = InfoBuffer;
6106 
6107 done:
6108  if (!NT_SUCCESS(Status))
6109  {
6110  if (InfoBuffer != NULL)
6111  {
6112  if (InfoBuffer->Account.UserName.Buffer != NULL)
6113  midl_user_free(InfoBuffer->Account.UserName.Buffer);
6114 
6115  if (InfoBuffer->Account.FullName.Buffer != NULL)
6116  midl_user_free(InfoBuffer->Account.FullName.Buffer);
6117 
6118  if (InfoBuffer->Account.HomeDirectory.Buffer != NULL)
6120 
6121  if (InfoBuffer->Account.HomeDirectoryDrive.Buffer != NULL)
6123 
6124  if (InfoBuffer->Account.ScriptPath.Buffer != NULL)
6125  midl_user_free(InfoBuffer->Account.ScriptPath.Buffer);
6126 
6127  if (InfoBuffer->Account.ProfilePath.Buffer != NULL)
6129 
6130  if (InfoBuffer->Account.AdminComment.Buffer != NULL)
6132 
6133  if (InfoBuffer->Account.WorkStations.Buffer != NULL)
6135 
6136  if (InfoBuffer->Account.LogonHours.LogonHours != NULL)
6138 
6139  midl_user_free(InfoBuffer);
6140  }
6141  }
6142 
6143  return Status;
6144 }
RPC_UNICODE_STRING ScriptPath
Definition: sam.idl:570
struct _SAM_USER_FIXED_DATA SAM_USER_FIXED_DATA
unsigned short LogonCount
Definition: sam.idl:578
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
LARGE_INTEGER AccountExpires
Definition: samsrv.h:104
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
unsigned long UserAccountControl
Definition: sam.idl:581
OLD_LARGE_INTEGER LastLogoff
Definition: sam.idl:575
ULONG PrimaryGroupId
Definition: samsrv.h:107
LONG NTSTATUS
Definition: precomp.h:26
unsigned short BadPasswordCount
Definition: sam.idl:577
RPC_UNICODE_STRING FullName
Definition: sam.idl:565
RPC_UNICODE_STRING HomeDirectory
Definition: sam.idl:568
OLD_LARGE_INTEGER PasswordLastSet
Definition: sam.idl:579
NTSTATUS SampGetLogonHoursAttribute(IN PSAM_DB_OBJECT UserObject, IN OUT PSAMPR_LOGON_HOURS LogonHours)
Definition: user.c:619
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
SAMPR_LOGON_HOURS LogonHours
Definition: sam.idl:576
SAMPR_USER_ACCOUNT_INFORMATION Account
Definition: sam.idl:725
#define TRACE(s)
Definition: solgame.cpp:4
LARGE_INTEGER PasswordLastSet
Definition: samsrv.h:103
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
RPC_UNICODE_STRING ProfilePath
Definition: sam.idl:571
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:514
static const WCHAR L[]
Definition: oid.c:1250
ULONG LowPart
Definition: typedefs.h:104
RPC_UNICODE_STRING HomeDirectoryDrive
Definition: sam.idl:569
LARGE_INTEGER LastLogon
Definition: samsrv.h:101
RPC_UNICODE_STRING UserName
Definition: sam.idl:564
Status
Definition: gdiplustypes.h:24
USHORT BadPasswordCount
Definition: samsrv.h:111
OLD_LARGE_INTEGER LastLogon
Definition: sam.idl:574
unsigned long PrimaryGroupId
Definition: sam.idl:567
unsigned long LowPart
Definition: msv1_0.h:63
ULONG UserAccountControl
Definition: samsrv.h:108
unsigned int ULONG
Definition: retypes.h:1
unsigned char * LogonHours
Definition: msv1_0.h:94
RPC_UNICODE_STRING WorkStations
Definition: sam.idl:573
LARGE_INTEGER LastLogoff
Definition: samsrv.h:102
RPC_UNICODE_STRING AdminComment
Definition: sam.idl:572
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55
OLD_LARGE_INTEGER AccountExpires
Definition: sam.idl:580

Referenced by SamrQueryInformationUser().

◆ SampQueryUserAccountName()

static NTSTATUS SampQueryUserAccountName ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6248 of file samrpc.c.

6250 {
6251  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6252  NTSTATUS Status;
6253 
6254  *Buffer = NULL;
6255 
6256  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6257  if (InfoBuffer == NULL)
6259 
6260  /* Get the Name string */
6261  Status = SampGetObjectAttributeString(UserObject,
6262  L"Name",
6263  &InfoBuffer->AccountName.UserName);
6264  if (!NT_SUCCESS(Status))
6265  {
6266  TRACE("Status 0x%08lx\n", Status);
6267  goto done;
6268  }
6269 
6270  *Buffer = InfoBuffer;
6271 
6272 done:
6273  if (!NT_SUCCESS(Status))
6274  {
6275  if (InfoBuffer != NULL)
6276  {
6277  if (InfoBuffer->AccountName.UserName.Buffer != NULL)
6279 
6280  midl_user_free(InfoBuffer);
6281  }
6282  }
6283 
6284  return Status;
6285 }
SAMPR_USER_A_NAME_INFORMATION AccountName
Definition: sam.idl:727
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
RPC_UNICODE_STRING UserName
Definition: sam.idl:586
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by SamrQueryInformationUser().

◆ SampQueryUserAdminComment()

static NTSTATUS SampQueryUserAdminComment ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6508 of file samrpc.c.

6510 {
6511  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6512  NTSTATUS Status;
6513 
6514  *Buffer = NULL;
6515 
6516  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6517  if (InfoBuffer == NULL)
6519 
6520  /* Get the AdminComment string */
6521  Status = SampGetObjectAttributeString(UserObject,
6522  L"AdminComment",
6523  &InfoBuffer->AdminComment.AdminComment);
6524  if (!NT_SUCCESS(Status))
6525  {
6526  TRACE("Status 0x%08lx\n", Status);
6527  goto done;
6528  }
6529 
6530  *Buffer = InfoBuffer;
6531 
6532 done:
6533  if (!NT_SUCCESS(Status))
6534  {
6535  if (InfoBuffer != NULL)
6536  {
6537  if (InfoBuffer->AdminComment.AdminComment.Buffer != NULL)
6539 
6540  midl_user_free(InfoBuffer);
6541  }
6542  }
6543 
6544  return Status;
6545 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
RPC_UNICODE_STRING AdminComment
Definition: sam.idl:618
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
SAMPR_USER_ADMIN_COMMENT_INFORMATION AdminComment
Definition: sam.idl:733
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by SamrQueryInformationUser().

◆ SampQueryUserAll()

static NTSTATUS SampQueryUserAll ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6852 of file samrpc.c.

6854 {
6855  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6856  SAM_DOMAIN_FIXED_DATA DomainFixedData;
6857  SAM_USER_FIXED_DATA FixedData;
6858  LARGE_INTEGER PasswordCanChange;
6859  LARGE_INTEGER PasswordMustChange;
6860  ULONG Length = 0;
6861  NTSTATUS Status;
6862 
6863  *Buffer = NULL;
6864 
6865  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6866  if (InfoBuffer == NULL)
6868 
6869  /* Get the fixed size domain data */
6870  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
6872  L"F",
6873  NULL,
6874  (PVOID)&DomainFixedData,
6875  &Length);
6876  if (!NT_SUCCESS(Status))
6877  goto done;
6878 
6879  /* Get the fixed size user data */
6880  Length = sizeof(SAM_USER_FIXED_DATA);
6881  Status = SampGetObjectAttribute(UserObject,
6882  L"F",
6883  NULL,
6884  (PVOID)&FixedData,
6885  &Length);
6886  if (!NT_SUCCESS(Status))
6887  goto done;
6888 
6889  /* Set the fields to be returned */
6890  if (UserObject->Trusted)
6891  {
6897  }
6898  else
6899  {
6900  InfoBuffer->All.WhichFields = 0;
6901 
6902  if (UserObject->Access & USER_READ_GENERAL)
6904 
6905  if (UserObject->Access & USER_READ_LOGON)
6906  InfoBuffer->All.WhichFields |= USER_ALL_READ_LOGON_MASK;
6907 
6908  if (UserObject->Access & USER_READ_ACCOUNT)
6910 
6911  if (UserObject->Access & USER_READ_PREFERENCES)
6913  }
6914 
6915  /* Fail, if no fields are to be returned */
6916  if (InfoBuffer->All.WhichFields == 0)
6917  {
6919  goto done;
6920  }
6921 
6922  /* Get the UserName attribute */
6923  if (InfoBuffer->All.WhichFields & USER_ALL_USERNAME)
6924  {
6925  Status = SampGetObjectAttributeString(UserObject,
6926  L"Name",
6927  &InfoBuffer->All.UserName);
6928  if (!NT_SUCCESS(Status))
6929  {
6930  TRACE("Status 0x%08lx\n", Status);
6931  goto done;
6932  }
6933  }
6934 
6935  /* Get the FullName attribute */
6936  if (InfoBuffer->All.WhichFields & USER_ALL_FULLNAME)
6937  {
6938  Status = SampGetObjectAttributeString(UserObject,
6939  L"FullName",
6940  &InfoBuffer->All.FullName);
6941  if (!NT_SUCCESS(Status))
6942  {
6943  TRACE("Status 0x%08lx\n", Status);
6944  goto done;
6945  }
6946  }
6947 
6948  /* Get the UserId attribute */
6949  if (InfoBuffer->All.WhichFields & USER_ALL_USERID)
6950  {
6951  InfoBuffer->All.UserId = FixedData.UserId;
6952  }
6953 
6954  /* Get the PrimaryGroupId attribute */
6955  if (InfoBuffer->All.WhichFields & USER_ALL_PRIMARYGROUPID)
6956  {
6957  InfoBuffer->All.PrimaryGroupId = FixedData.PrimaryGroupId;
6958  }
6959 
6960  /* Get the AdminComment attribute */
6961  if (InfoBuffer->All.WhichFields & USER_ALL_ADMINCOMMENT)
6962  {
6963  Status = SampGetObjectAttributeString(UserObject,
6964  L"AdminComment",
6965  &InfoBuffer->All.AdminComment);
6966  if (!NT_SUCCESS(Status))
6967  {
6968  TRACE("Status 0x%08lx\n", Status);
6969  goto done;
6970  }
6971  }
6972 
6973  /* Get the UserComment attribute */
6974  if (InfoBuffer->All.WhichFields & USER_ALL_USERCOMMENT)
6975  {
6976  Status = SampGetObjectAttributeString(UserObject,
6977  L"UserComment",
6978  &InfoBuffer->All.UserComment);
6979  if (!NT_SUCCESS(Status))
6980  {
6981  TRACE("Status 0x%08lx\n", Status);
6982  goto done;
6983  }
6984  }
6985 
6986  /* Get the HomeDirectory attribute */
6987  if (InfoBuffer->All.WhichFields & USER_ALL_HOMEDIRECTORY)
6988  {
6989  Status = SampGetObjectAttributeString(UserObject,
6990  L"HomeDirectory",
6991  &InfoBuffer->All.HomeDirectory);
6992  if (!NT_SUCCESS(Status))
6993  {
6994  TRACE("Status 0x%08lx\n", Status);
6995  goto done;
6996  }
6997  }
6998 
6999  /* Get the HomeDirectoryDrive attribute */
7000  if (InfoBuffer->All.WhichFields & USER_ALL_HOMEDIRECTORYDRIVE)
7001  {
7002  Status = SampGetObjectAttributeString(UserObject,
7003  L"HomeDirectoryDrive",
7004  &InfoBuffer->Home.HomeDirectoryDrive);
7005  if (!NT_SUCCESS(Status))
7006  {
7007  TRACE("Status 0x%08lx\n", Status);
7008  goto done;
7009  }
7010  }
7011 
7012  /* Get the ScriptPath attribute */
7013  if (InfoBuffer->All.WhichFields & USER_ALL_SCRIPTPATH)
7014  {
7015  Status = SampGetObjectAttributeString(UserObject,
7016  L"ScriptPath",
7017  &InfoBuffer->All.ScriptPath);
7018  if (!NT_SUCCESS(Status))
7019  {
7020  TRACE("Status 0x%08lx\n", Status);
7021  goto done;
7022  }
7023  }
7024 
7025  /* Get the ProfilePath attribute */
7026  if (InfoBuffer->All.WhichFields & USER_ALL_PROFILEPATH)
7027  {
7028  Status = SampGetObjectAttributeString(UserObject,
7029  L"ProfilePath",
7030  &InfoBuffer->All.ProfilePath);
7031  if (!NT_SUCCESS(Status))
7032  {
7033  TRACE("Status 0x%08lx\n", Status);
7034  goto done;
7035  }
7036  }
7037 
7038  /* Get the WorkStations attribute */
7039  if (InfoBuffer->All.WhichFields & USER_ALL_WORKSTATIONS)
7040  {
7041  Status = SampGetObjectAttributeString(UserObject,
7042  L"WorkStations",
7043  &InfoBuffer->All.WorkStations);
7044  if (!NT_SUCCESS(Status))
7045  {
7046  TRACE("Status 0x%08lx\n", Status);
7047  goto done;
7048  }
7049  }
7050 
7051  /* Get the LastLogon attribute */
7052  if (InfoBuffer->All.WhichFields & USER_ALL_LASTLOGON)
7053  {
7054  InfoBuffer->All.LastLogon.LowPart = FixedData.LastLogon.LowPart;
7055  InfoBuffer->All.LastLogon.HighPart = FixedData.LastLogon.HighPart;
7056  }
7057 
7058  /* Get the LastLogoff attribute */
7059  if (InfoBuffer->All.WhichFields & USER_ALL_LASTLOGOFF)
7060  {
7061  InfoBuffer->All.LastLogoff.LowPart = FixedData.LastLogoff.LowPart;
7062  InfoBuffer->All.LastLogoff.HighPart = FixedData.LastLogoff.HighPart;
7063  }
7064 
7065  /* Get the LogonHours attribute */
7066  if (InfoBuffer->All.WhichFields & USER_ALL_LOGONHOURS)
7067  {
7068  Status = SampGetLogonHoursAttribute(UserObject,
7069  &InfoBuffer->All.LogonHours);
7070  if (!NT_SUCCESS(Status))
7071  {
7072  TRACE("Status 0x%08lx\n", Status);
7073  goto done;
7074  }
7075  }
7076 
7077  /* Get the BadPasswordCount attribute */
7078  if (InfoBuffer->All.WhichFields & USER_ALL_BADPASSWORDCOUNT)
7079  {
7080  InfoBuffer->All.BadPasswordCount = FixedData.BadPasswordCount;
7081  }
7082 
7083  /* Get the LogonCount attribute */
7084  if (InfoBuffer->All.WhichFields & USER_ALL_LOGONCOUNT)
7085  {
7086  InfoBuffer->All.LogonCount = FixedData.LogonCount;
7087  }
7088 
7089  /* Get the PasswordCanChange attribute */
7090  if (InfoBuffer->All.WhichFields & USER_ALL_PASSWORDCANCHANGE)
7091  {
7092  PasswordCanChange = SampAddRelativeTimeToTime(FixedData.PasswordLastSet,
7093  DomainFixedData.MinPasswordAge);
7094  InfoBuffer->All.PasswordCanChange.LowPart = PasswordCanChange.LowPart;
7095  InfoBuffer->All.PasswordCanChange.HighPart = PasswordCanChange.HighPart;
7096  }
7097 
7098  /* Get the PasswordMustChange attribute */
7099  if (InfoBuffer->All.WhichFields & USER_ALL_PASSWORDMUSTCHANGE)
7100  {
7101  PasswordMustChange = SampAddRelativeTimeToTime(FixedData.PasswordLastSet,
7102  DomainFixedData.MaxPasswordAge);
7103  InfoBuffer->All.PasswordMustChange.LowPart = PasswordMustChange.LowPart;
7104  InfoBuffer->All.PasswordMustChange.HighPart = PasswordMustChange.HighPart;
7105  }
7106 
7107  /* Get the PasswordLastSet attribute */
7108  if (InfoBuffer->All.WhichFields & USER_ALL_PASSWORDLASTSET)
7109  {
7110  InfoBuffer->All.PasswordLastSet.LowPart = FixedData.PasswordLastSet.LowPart;
7111  InfoBuffer->All.PasswordLastSet.HighPart = FixedData.PasswordLastSet.HighPart;
7112  }
7113 
7114  /* Get the AccountExpires attribute */
7115  if (InfoBuffer->All.WhichFields & USER_ALL_ACCOUNTEXPIRES)
7116  {
7117  InfoBuffer->All.AccountExpires.LowPart = FixedData.AccountExpires.LowPart;
7118  InfoBuffer->All.AccountExpires.HighPart = FixedData.AccountExpires.HighPart;
7119  }
7120 
7121  /* Get the UserAccountControl attribute */
7122  if (InfoBuffer->All.WhichFields & USER_ALL_USERACCOUNTCONTROL)
7123  {
7124  InfoBuffer->All.UserAccountControl = FixedData.UserAccountControl;
7125  }
7126 
7127  /* Get the Parameters attribute */
7128  if (InfoBuffer->All.WhichFields & USER_ALL_PARAMETERS)
7129  {
7130  Status = SampGetObjectAttributeString(UserObject,
7131  L"Parameters",
7132  &InfoBuffer->All.Parameters);
7133  if (!NT_SUCCESS(Status))
7134  {
7135  TRACE("Status 0x%08lx\n", Status);
7136  goto done;
7137  }
7138  }
7139 
7140  /* Get the CountryCode attribute */
7141  if (InfoBuffer->All.WhichFields & USER_ALL_COUNTRYCODE)
7142  {
7143  InfoBuffer->All.CountryCode = FixedData.CountryCode;
7144  }
7145 
7146  /* Get the CodePage attribute */
7147  if (InfoBuffer->All.WhichFields & USER_ALL_CODEPAGE)
7148  {
7149  InfoBuffer->All.CodePage = FixedData.CodePage;
7150  }
7151 
7152  /* Get the LmPassword and NtPassword attributes */
7154  {
7155  InfoBuffer->All.LmPasswordPresent = FALSE;
7156  InfoBuffer->All.NtPasswordPresent = FALSE;
7157 
7158  /* Get the NT password */
7159  Length = 0;
7160  SampGetObjectAttribute(UserObject,
7161  L"NTPwd",
7162  NULL,
7163  NULL,
7164  &Length);
7165 
7166  if (Length == sizeof(ENCRYPTED_NT_OWF_PASSWORD))
7167  {
7169  if (InfoBuffer->All.NtOwfPassword.Buffer == NULL)
7170  {
7172  goto done;
7173  }
7174 
7175  InfoBuffer->All.NtOwfPassword.Length = sizeof(ENCRYPTED_NT_OWF_PASSWORD);
7177 
7178  Status = SampGetObjectAttribute(UserObject,
7179  L"NTPwd",
7180  NULL,
7181  (PVOID)InfoBuffer->All.NtOwfPassword.Buffer,
7182  &Length);
7183  if (!NT_SUCCESS(Status))
7184  goto done;
7185 
7186  if (memcmp(InfoBuffer->All.NtOwfPassword.Buffer,
7187  &EmptyNtHash,
7188  sizeof(ENCRYPTED_NT_OWF_PASSWORD)))
7189  InfoBuffer->All.NtPasswordPresent = TRUE;
7190  }
7191 
7192  /* Get the LM password */
7193  Length = 0;
7194  SampGetObjectAttribute(UserObject,
7195  L"LMPwd",
7196  NULL,
7197  NULL,
7198  &Length);
7199 
7200  if (Length == sizeof(ENCRYPTED_LM_OWF_PASSWORD))
7201  {
7203  if (InfoBuffer->All.LmOwfPassword.Buffer == NULL)
7204  {
7206  goto done;
7207  }
7208 
7209  InfoBuffer->All.LmOwfPassword.Length = sizeof(ENCRYPTED_LM_OWF_PASSWORD);
7211 
7212  Status = SampGetObjectAttribute(UserObject,
7213  L"LMPwd",
7214  NULL,
7215  (PVOID)InfoBuffer->All.LmOwfPassword.Buffer,
7216  &Length);
7217  if (!NT_SUCCESS(Status))
7218  goto done;
7219 
7220  if (memcmp(InfoBuffer->All.LmOwfPassword.Buffer,
7221  &EmptyLmHash,
7222  sizeof(ENCRYPTED_LM_OWF_PASSWORD)))
7223  InfoBuffer->All.LmPasswordPresent = TRUE;
7224  }
7225  }
7226 
7227  if (InfoBuffer->All.WhichFields & USER_ALL_PRIVATEDATA)
7228  {
7229  Status = SampGetObjectAttributeString(UserObject,
7230  L"PrivateData",
7231  &InfoBuffer->All.PrivateData);
7232  if (!NT_SUCCESS(Status))
7233  {
7234  TRACE("Status 0x%08lx\n", Status);
7235  goto done;
7236  }
7237  }
7238 
7239  if (InfoBuffer->All.WhichFields & USER_ALL_PASSWORDEXPIRED)
7240  {
7241  /* FIXME */
7242  }
7243 
7244  if (InfoBuffer->All.WhichFields & USER_ALL_SECURITYDESCRIPTOR)
7245  {
7246  Length = 0;
7247  SampGetObjectAttribute(UserObject,
7248  L"SecDesc",
7249  NULL,
7250  NULL,
7251  &Length);
7252 
7253  if (Length > 0)
7254  {
7256  if (InfoBuffer->All.SecurityDescriptor.SecurityDescriptor == NULL)
7257  {
7259  goto done;
7260  }
7261 
7262  InfoBuffer->All.SecurityDescriptor.Length = Length;
7263 
7264  Status = SampGetObjectAttribute(UserObject,
7265  L"SecDesc",
7266  NULL,
7268  &Length);
7269  if (!NT_SUCCESS(Status))
7270  goto done;
7271  }
7272  }
7273 
7274  *Buffer = InfoBuffer;
7275 
7276 done:
7277  if (!NT_SUCCESS(Status))
7278  {
7279  if (InfoBuffer != NULL)
7280  {
7281  if (InfoBuffer->All.UserName.Buffer != NULL)
7282  midl_user_free(InfoBuffer->All.UserName.Buffer);
7283 
7284  if (InfoBuffer->All.FullName.Buffer != NULL)
7285  midl_user_free(InfoBuffer->All.FullName.Buffer);
7286 
7287  if (InfoBuffer->All.AdminComment.Buffer != NULL)
7288  midl_user_free(InfoBuffer->All.AdminComment.Buffer);
7289 
7290  if (InfoBuffer->All.UserComment.Buffer != NULL)
7291  midl_user_free(InfoBuffer->All.UserComment.Buffer);
7292 
7293  if (InfoBuffer->All.HomeDirectory.Buffer != NULL)
7294  midl_user_free(InfoBuffer->All.HomeDirectory.Buffer);
7295 
7296  if (InfoBuffer->All.HomeDirectoryDrive.Buffer != NULL)
7298 
7299  if (InfoBuffer->All.ScriptPath.Buffer != NULL)
7300  midl_user_free(InfoBuffer->All.ScriptPath.Buffer);
7301 
7302  if (InfoBuffer->All.ProfilePath.Buffer != NULL)
7303  midl_user_free(InfoBuffer->All.ProfilePath.Buffer);
7304 
7305  if (InfoBuffer->All.WorkStations.Buffer != NULL)
7306  midl_user_free(InfoBuffer->All.WorkStations.Buffer);
7307 
7308  if (InfoBuffer->All.LogonHours.LogonHours != NULL)
7309  midl_user_free(InfoBuffer->All.LogonHours.LogonHours);
7310 
7311  if (InfoBuffer->All.Parameters.Buffer != NULL)
7312  midl_user_free(InfoBuffer->All.Parameters.Buffer);
7313 
7314  if (InfoBuffer->All.LmOwfPassword.Buffer != NULL)
7315  midl_user_free(InfoBuffer->All.LmOwfPassword.Buffer);
7316 
7317  if (InfoBuffer->All.NtOwfPassword.Buffer != NULL)
7318  midl_user_free(InfoBuffer->All.NtOwfPassword.Buffer);
7319 
7320  if (InfoBuffer->All.PrivateData.Buffer != NULL)
7321  midl_user_free(InfoBuffer->All.PrivateData.Buffer);
7322 
7323  if (InfoBuffer->All.SecurityDescriptor.SecurityDescriptor != NULL)
7325 
7326  midl_user_free(InfoBuffer);
7327  }
7328  }
7329 
7330  return Status;
7331 }
#define USER_ALL_READ_GENERAL_MASK
Definition: ntsam.h:228
#define USER_ALL_PARAMETERS
Definition: ntsam.h:217
RPC_SHORT_BLOB LmOwfPassword
Definition: msv1_0.h:127
RPC_UNICODE_STRING UserName
Definition: msv1_0.h:117
USHORT CountryCode
Definition: samsrv.h:109
#define TRUE
Definition: types.h:120
struct _SAM_USER_FIXED_DATA SAM_USER_FIXED_DATA
#define USER_ALL_ACCOUNTEXPIRES
Definition: ntsam.h:215
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
struct _SAM_DOMAIN_FIXED_DATA SAM_DOMAIN_FIXED_DATA
RPC_UNICODE_STRING Parameters
Definition: msv1_0.h:126
#define USER_ALL_LASTLOGON
Definition: ntsam.h:207
LARGE_INTEGER AccountExpires
Definition: samsrv.h:104
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
RPC_UNICODE_STRING ProfilePath
Definition: msv1_0.h:122
OLD_LARGE_INTEGER LastLogoff
Definition: msv1_0.h:112
unsigned long UserId
Definition: msv1_0.h:131
ULONG PrimaryGroupId
Definition: samsrv.h:107
#define USER_ALL_LOGONCOUNT
Definition: ntsam.h:211
LONG NTSTATUS
Definition: precomp.h:26
OLD_LARGE_INTEGER PasswordCanChange
Definition: msv1_0.h:115
#define USER_ALL_SECURITYDESCRIPTOR
Definition: ntsam.h:224
RPC_UNICODE_STRING ScriptPath
Definition: msv1_0.h:121
RPC_UNICODE_STRING HomeDirectory
Definition: msv1_0.h:119
OLD_LARGE_INTEGER PasswordLastSet
Definition: msv1_0.h:113
#define USER_ALL_READ_LOGON_MASK
Definition: ntsam.h:229
#define USER_ALL_LOGONHOURS
Definition: ntsam.h:209
unsigned short CodePage
Definition: msv1_0.h:139
unsigned short * Buffer
Definition: msv1_0.h:71
#define USER_ALL_READ_ACCOUNT_MASK
Definition: ntsam.h:230
LARGE_INTEGER MinPasswordAge
Definition: samsrv.h:74
#define USER_ALL_PRIVATEDATA
Definition: ntsam.h:222
RPC_UNICODE_STRING HomeDirectoryDrive
Definition: sam.idl:603
RPC_UNICODE_STRING PrivateData
Definition: msv1_0.h:129
ENCRYPTED_NT_OWF_PASSWORD EmptyNtHash
Definition: samsrv.c:26
NTSTATUS SampGetLogonHoursAttribute(IN PSAM_DB_OBJECT UserObject, IN OUT PSAMPR_LOGON_HOURS LogonHours)
Definition: user.c:619
RPC_UNICODE_STRING FullName
Definition: msv1_0.h:118
SAMPR_USER_ALL_INFORMATION All
Definition: msv1_0.h:172
#define USER_ALL_USERNAME
Definition: ntsam.h:196
unsigned long Length
Definition: msv1_0.h:76
unsigned short MaximumLength
Definition: msv1_0.h:70
struct _ENCRYPTED_LM_OWF_PASSWORD ENCRYPTED_LM_OWF_PASSWORD
#define USER_ALL_FULLNAME
Definition: ntsam.h:197
#define USER_READ_GENERAL
Definition: ntsam.h:126
static LARGE_INTEGER SampAddRelativeTimeToTime(IN LARGE_INTEGER AbsoluteTime, IN LARGE_INTEGER RelativeTime)
Definition: samrpc.c:63
SAMPR_SR_SECURITY_DESCRIPTOR SecurityDescriptor
Definition: msv1_0.h:130
unsigned long WhichFields
Definition: msv1_0.h:134
#define USER_ALL_PASSWORDCANCHANGE
Definition: ntsam.h:212
unsigned char * SecurityDescriptor
Definition: msv1_0.h:77
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
OLD_LARGE_INTEGER AccountExpires
Definition: msv1_0.h:114
OLD_LARGE_INTEGER LastLogon
Definition: msv1_0.h:111
#define USER_ALL_USERACCOUNTCONTROL
Definition: ntsam.h:216
#define USER_ALL_READ_PREFERENCES_MASK
Definition: ntsam.h:231
#define USER_ALL_LASTLOGOFF
Definition: ntsam.h:208
OLD_LARGE_INTEGER PasswordMustChange
Definition: msv1_0.h:116
#define TRACE(s)
Definition: solgame.cpp:4
#define USER_ALL_PRIMARYGROUPID
Definition: ntsam.h:199
#define USER_ALL_HOMEDIRECTORY
Definition: ntsam.h:202
LARGE_INTEGER PasswordLastSet
Definition: samsrv.h:103
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define USER_READ_ACCOUNT
Definition: ntsam.h:130
unsigned short LogonCount
Definition: msv1_0.h:137
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
BOOLEAN Trusted
Definition: samsrv.h:54
#define USER_ALL_ADMINCOMMENT
Definition: ntsam.h:200
#define USER_ALL_PASSWORDLASTSET
Definition: ntsam.h:214
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
SAMPR_LOGON_HOURS LogonHours
Definition: msv1_0.h:135
unsigned long PrimaryGroupId
Definition: msv1_0.h:132
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:514
static const WCHAR L[]
Definition: oid.c:1250
#define USER_ALL_NTPASSWORDPRESENT
Definition: ntsam.h:220
ULONG LowPart
Definition: typedefs.h:104
unsigned char LmPasswordPresent
Definition: msv1_0.h:140
LARGE_INTEGER LastLogon
Definition: samsrv.h:101
RPC_UNICODE_STRING UserComment
Definition: msv1_0.h:125
ACCESS_MASK Access
Definition: samsrv.h:49
Status
Definition: gdiplustypes.h:24
RPC_UNICODE_STRING AdminComment
Definition: msv1_0.h:123
ENCRYPTED_LM_OWF_PASSWORD EmptyLmHash
Definition: samsrv.c:27
USHORT BadPasswordCount
Definition: samsrv.h:111
struct _SAM_DB_OBJECT * ParentObject
Definition: samsrv.h:55
#define USER_ALL_SCRIPTPATH
Definition: ntsam.h:204
#define USER_ALL_USERID
Definition: ntsam.h:198
unsigned long UserAccountControl
Definition: msv1_0.h:133
LARGE_INTEGER MaxPasswordAge
Definition: samsrv.h:73
unsigned long LowPart
Definition: msv1_0.h:63
#define USER_ALL_HOMEDIRECTORYDRIVE
Definition: ntsam.h:203
#define USER_ALL_BADPASSWORDCOUNT
Definition: ntsam.h:210
#define USER_ALL_COUNTRYCODE
Definition: ntsam.h:218
#define USER_ALL_LMPASSWORDPRESENT
Definition: ntsam.h:221
#define USER_ALL_WORKSTATIONS
Definition: ntsam.h:206
#define USER_ALL_CODEPAGE
Definition: ntsam.h:219
#define USER_READ_PREFERENCES
Definition: ntsam.h:127
RPC_SHORT_BLOB NtOwfPassword
Definition: msv1_0.h:128
struct _ENCRYPTED_LM_OWF_PASSWORD ENCRYPTED_NT_OWF_PASSWORD
#define USER_ALL_PASSWORDMUSTCHANGE
Definition: ntsam.h:213
SAMPR_USER_HOME_INFORMATION Home
Definition: sam.idl:730
unsigned short Length
Definition: msv1_0.h:69
ULONG UserAccountControl
Definition: samsrv.h:108
unsigned int ULONG
Definition: retypes.h:1
unsigned short BadPasswordCount
Definition: msv1_0.h:136
#define USER_ALL_PROFILEPATH
Definition: ntsam.h:205
unsigned char * LogonHours
Definition: msv1_0.h:94
#define USER_ALL_USERCOMMENT
Definition: ntsam.h:201
#define USER_READ_LOGON
Definition: ntsam.h:129
LARGE_INTEGER LastLogoff
Definition: samsrv.h:102
RPC_UNICODE_STRING HomeDirectoryDrive
Definition: msv1_0.h:120
#define USER_ALL_PASSWORDEXPIRED
Definition: ntsam.h:223
#define USER_ALL_READ_TRUSTED_MASK
Definition: ntsam.h:232
unsigned char NtPasswordPresent
Definition: msv1_0.h:141
RPC_UNICODE_STRING WorkStations
Definition: msv1_0.h:124
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55
unsigned short CountryCode
Definition: msv1_0.h:138

Referenced by SamrQueryInformationUser().

◆ SampQueryUserControl()

static NTSTATUS SampQueryUserControl ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6591 of file samrpc.c.

6593 {
6594  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6595  SAM_USER_FIXED_DATA FixedData;
6596  ULONG Length = 0;
6597  NTSTATUS Status;
6598 
6599  *Buffer = NULL;
6600 
6601  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6602  if (InfoBuffer == NULL)
6604 
6605  Length = sizeof(SAM_USER_FIXED_DATA);
6606  Status = SampGetObjectAttribute(UserObject,
6607  L"F",
6608  NULL,
6609  (PVOID)&FixedData,
6610  &Length);
6611  if (!NT_SUCCESS(Status))
6612  goto done;
6613 
6614  InfoBuffer->Control.UserAccountControl = FixedData.UserAccountControl;
6615 
6616  *Buffer = InfoBuffer;
6617 
6618 done:
6619  if (!NT_SUCCESS(Status))
6620  {
6621  if (InfoBuffer != NULL)
6622  {
6623  midl_user_free(InfoBuffer);
6624  }
6625  }
6626 
6627  return Status;
6628 }
struct _SAM_USER_FIXED_DATA SAM_USER_FIXED_DATA
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:514
static const WCHAR L[]
Definition: oid.c:1250
USER_CONTROL_INFORMATION Control
Definition: sam.idl:736
Status
Definition: gdiplustypes.h:24
ULONG UserAccountControl
Definition: samsrv.h:108
unsigned int ULONG
Definition: retypes.h:1
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationUser().

◆ SampQueryUserExpires()

static NTSTATUS SampQueryUserExpires ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6633 of file samrpc.c.

6635 {
6636  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6637  SAM_USER_FIXED_DATA FixedData;
6638  ULONG Length = 0;
6639  NTSTATUS Status;
6640 
6641  *Buffer = NULL;
6642 
6643  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6644  if (InfoBuffer == NULL)
6646 
6647  Length = sizeof(SAM_USER_FIXED_DATA);
6648  Status = SampGetObjectAttribute(UserObject,
6649  L"F",
6650  NULL,
6651  (PVOID)&FixedData,
6652  &Length);
6653  if (!NT_SUCCESS(Status))
6654  goto done;
6655 
6656  InfoBuffer->Expires.AccountExpires.LowPart = FixedData.AccountExpires.LowPart;
6657  InfoBuffer->Expires.AccountExpires.HighPart = FixedData.AccountExpires.HighPart;
6658 
6659  *Buffer = InfoBuffer;
6660 
6661 done:
6662  if (!NT_SUCCESS(Status))
6663  {
6664  if (InfoBuffer != NULL)
6665  {
6666  midl_user_free(InfoBuffer);
6667  }
6668  }
6669 
6670  return Status;
6671 }
struct _SAM_USER_FIXED_DATA SAM_USER_FIXED_DATA
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
LARGE_INTEGER AccountExpires
Definition: samsrv.h:104
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
LARGE_INTEGER AccountExpires
Definition: ntsam.h:647
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
USER_EXPIRES_INFORMATION Expires
Definition: sam.idl:737
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:514
static const WCHAR L[]
Definition: oid.c:1250
ULONG LowPart
Definition: typedefs.h:104
Status
Definition: gdiplustypes.h:24
unsigned int ULONG
Definition: retypes.h:1
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationUser().

◆ SampQueryUserFullName()

static NTSTATUS SampQueryUserFullName ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6289 of file samrpc.c.

6291 {
6292  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6293  NTSTATUS Status;
6294 
6295  *Buffer = NULL;
6296 
6297  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6298  if (InfoBuffer == NULL)
6300 
6301  /* Get the FullName string */
6302  Status = SampGetObjectAttributeString(UserObject,
6303  L"FullName",
6304  &InfoBuffer->FullName.FullName);
6305  if (!NT_SUCCESS(Status))
6306  {
6307  TRACE("Status 0x%08lx\n", Status);
6308  goto done;
6309  }
6310 
6311  *Buffer = InfoBuffer;
6312 
6313 done:
6314  if (!NT_SUCCESS(Status))
6315  {
6316  if (InfoBuffer != NULL)
6317  {
6318  if (InfoBuffer->FullName.FullName.Buffer != NULL)
6319  midl_user_free(InfoBuffer->FullName.FullName.Buffer);
6320 
6321  midl_user_free(InfoBuffer);
6322  }
6323  }
6324 
6325  return Status;
6326 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
RPC_UNICODE_STRING FullName
Definition: sam.idl:591
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
static const WCHAR L[]
Definition: oid.c:1250
SAMPR_USER_F_NAME_INFORMATION FullName
Definition: sam.idl:728
Status
Definition: gdiplustypes.h:24
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by SamrQueryInformationUser().

◆ SampQueryUserGeneral()

static NTSTATUS SampQueryUserGeneral ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 5650 of file samrpc.c.

5652 {
5653  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
5654  SAM_USER_FIXED_DATA FixedData;
5655  ULONG Length = 0;
5656  NTSTATUS Status;
5657 
5658  *Buffer = NULL;
5659 
5660  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
5661  if (InfoBuffer == NULL)
5663 
5664  Length = sizeof(SAM_USER_FIXED_DATA);
5665  Status = SampGetObjectAttribute(UserObject,
5666  L"F",
5667  NULL,
5668  (PVOID)&FixedData,
5669  &Length);
5670  if (!NT_SUCCESS(Status))
5671  goto done;
5672 
5673  InfoBuffer->General.PrimaryGroupId = FixedData.PrimaryGroupId;
5674 
5675  /* Get the Name string */
5676  Status = SampGetObjectAttributeString(UserObject,
5677  L"Name",
5678  &InfoBuffer->General.UserName);
5679  if (!NT_SUCCESS(Status))
5680  {
5681  TRACE("Status 0x%08lx\n", Status);
5682  goto done;
5683  }
5684 
5685  /* Get the FullName string */
5686  Status = SampGetObjectAttributeString(UserObject,
5687  L"FullName",
5688  &InfoBuffer->General.FullName);
5689  if (!NT_SUCCESS(Status))
5690  {
5691  TRACE("Status 0x%08lx\n", Status);
5692  goto done;
5693  }
5694 
5695  /* Get the AdminComment string */
5696  Status = SampGetObjectAttributeString(UserObject,
5697  L"AdminComment",
5698  &InfoBuffer->General.AdminComment);
5699  if (!NT_SUCCESS(Status))
5700  {
5701  TRACE("Status 0x%08lx\n", Status);
5702  goto done;
5703  }
5704 
5705  /* Get the UserComment string */
5706  Status = SampGetObjectAttributeString(UserObject,
5707  L"UserComment",
5708  &InfoBuffer->General.UserComment);
5709  if (!NT_SUCCESS(Status))
5710  {
5711  TRACE("Status 0x%08lx\n", Status);
5712  goto done;
5713  }
5714 
5715  *Buffer = InfoBuffer;
5716 
5717 done:
5718  if (!NT_SUCCESS(Status))
5719  {
5720  if (InfoBuffer != NULL)
5721  {
5722  if (InfoBuffer->General.UserName.Buffer != NULL)
5723  midl_user_free(InfoBuffer->General.UserName.Buffer);
5724 
5725  if (InfoBuffer->General.FullName.Buffer != NULL)
5726  midl_user_free(InfoBuffer->General.FullName.Buffer);
5727 
5728  if (InfoBuffer->General.AdminComment.Buffer != NULL)
5730 
5731  if (InfoBuffer->General.UserComment.Buffer != NULL)
5733 
5734  midl_user_free(InfoBuffer);
5735  }
5736  }
5737 
5738  return Status;
5739 }
struct _SAM_USER_FIXED_DATA SAM_USER_FIXED_DATA
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
RPC_UNICODE_STRING AdminComment
Definition: sam.idl:523
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
ULONG PrimaryGroupId
Definition: samsrv.h:107
LONG NTSTATUS
Definition: precomp.h:26
SAMPR_USER_GENERAL_INFORMATION General
Definition: sam.idl:721
smooth NULL
Definition: ftsmooth.c:416
RPC_UNICODE_STRING FullName
Definition: sam.idl:521
Definition: bufpool.h:45
RPC_UNICODE_STRING UserComment
Definition: sam.idl:524
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:514
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
RPC_UNICODE_STRING UserName
Definition: sam.idl:520
unsigned int ULONG
Definition: retypes.h:1
unsigned long PrimaryGroupId
Definition: sam.idl:522
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by SamrQueryInformationUser().

◆ SampQueryUserHome()

static NTSTATUS SampQueryUserHome ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6372 of file samrpc.c.

6374 {
6375  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6376  NTSTATUS Status;
6377 
6378  *Buffer = NULL;
6379 
6380  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6381  if (InfoBuffer == NULL)
6383 
6384  /* Get the HomeDirectory string */
6385  Status = SampGetObjectAttributeString(UserObject,
6386  L"HomeDirectory",
6387  &InfoBuffer->Home.HomeDirectory);
6388  if (!NT_SUCCESS(Status))
6389  {
6390  TRACE("Status 0x%08lx\n", Status);
6391  goto done;
6392  }
6393 
6394  /* Get the HomeDirectoryDrive string */
6395  Status = SampGetObjectAttributeString(UserObject,
6396  L"HomeDirectoryDrive",
6397  &InfoBuffer->Home.HomeDirectoryDrive);
6398  if (!NT_SUCCESS(Status))
6399  {
6400  TRACE("Status 0x%08lx\n", Status);
6401  goto done;
6402  }
6403 
6404  *Buffer = InfoBuffer;
6405 
6406 done:
6407  if (!NT_SUCCESS(Status))
6408  {
6409  if (InfoBuffer != NULL)
6410  {
6411  if (InfoBuffer->Home.HomeDirectory.Buffer != NULL)
6412  midl_user_free(InfoBuffer->Home.HomeDirectory.Buffer);
6413 
6414  if (InfoBuffer->Home.HomeDirectoryDrive.Buffer != NULL)
6416 
6417  midl_user_free(InfoBuffer);
6418  }
6419  }
6420 
6421  return Status;
6422 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
RPC_UNICODE_STRING HomeDirectoryDrive
Definition: sam.idl:603
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:529
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
SAMPR_USER_HOME_INFORMATION Home
Definition: sam.idl:730
RPC_UNICODE_STRING HomeDirectory
Definition: sam.idl:602
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by SamrQueryInformationUser().

◆ SampQueryUserInternal1()

static NTSTATUS SampQueryUserInternal1 ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6676 of file samrpc.c.

6678 {
6679  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6680  ULONG Length = 0;
6682 
6683  /* Fail, if the caller is not a trusted caller */
6684  if (UserObject->Trusted == FALSE)
6686 
6687  *Buffer = NULL;
6688 
6689  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6690  if (InfoBuffer == NULL)
6692 
6693  InfoBuffer->Internal1.LmPasswordPresent = FALSE;
6694  InfoBuffer->Internal1.NtPasswordPresent = FALSE;
6695 
6696  /* Get the NT password */
6697  Length = 0;
6698  SampGetObjectAttribute(UserObject,
6699  L"NTPwd",
6700  NULL,
6701  NULL,
6702  &Length);
6703 
6704  if (Length == sizeof(ENCRYPTED_NT_OWF_PASSWORD))
6705  {
6706  Status = SampGetObjectAttribute(UserObject,
6707  L"NTPwd",
6708  NULL,
6709  (PVOID)&InfoBuffer->Internal1.EncryptedNtOwfPassword,
6710  &Length);
6711  if (!NT_SUCCESS(Status))
6712  goto done;
6713 
6714  if (memcmp(&InfoBuffer->Internal1.EncryptedNtOwfPassword,
6715  &EmptyNtHash,
6716  sizeof(ENCRYPTED_NT_OWF_PASSWORD)))
6717  InfoBuffer->Internal1.NtPasswordPresent = TRUE;
6718  }
6719 
6720 
6721  /* Get the LM password */
6722  Length = 0;
6723  SampGetObjectAttribute(UserObject,
6724  L"LMPwd",
6725  NULL,
6726  NULL,
6727  &Length);
6728 
6729  if (Length == sizeof(ENCRYPTED_LM_OWF_PASSWORD))
6730  {
6731  Status = SampGetObjectAttribute(UserObject,
6732  L"LMPwd",
6733  NULL,
6734  (PVOID)&InfoBuffer->Internal1.EncryptedLmOwfPassword,
6735  &Length);
6736  if (!NT_SUCCESS(Status))
6737  goto done;
6738 
6739  if (memcmp(&InfoBuffer->Internal1.EncryptedLmOwfPassword,
6740  &EmptyLmHash,
6741  sizeof(ENCRYPTED_LM_OWF_PASSWORD)))
6742  InfoBuffer->Internal1.LmPasswordPresent = TRUE;
6743  }
6744 
6745  InfoBuffer->Internal1.PasswordExpired = FALSE;
6746 
6747  *Buffer = InfoBuffer;
6748 
6749 done:
6750  if (!NT_SUCCESS(Status))
6751  {
6752  if (InfoBuffer != NULL)
6753  {
6754  midl_user_free(InfoBuffer);
6755  }
6756  }
6757 
6758  return Status;
6759 }
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
ENCRYPTED_NT_OWF_PASSWORD EmptyNtHash
Definition: samsrv.c:26
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
SAMPR_USER_INTERNAL1_INFORMATION Internal1
Definition: sam.idl:738
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ENCRYPTED_NT_OWF_PASSWORD EncryptedNtOwfPassword
Definition: sam.idl:640
BOOLEAN Trusted
Definition: samsrv.h:54
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:514
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:226
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
ENCRYPTED_LM_OWF_PASSWORD EmptyLmHash
Definition: samsrv.c:27
ENCRYPTED_LM_OWF_PASSWORD EncryptedLmOwfPassword
Definition: sam.idl:641
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2938
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationUser().

◆ SampQueryUserInternal2()

static NTSTATUS SampQueryUserInternal2 ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6764 of file samrpc.c.

6766 {
6767  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6768  SAM_USER_FIXED_DATA FixedData;
6769  ULONG Length = 0;
6770  NTSTATUS Status;
6771 
6772  *Buffer = NULL;
6773 
6774  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6775  if (InfoBuffer == NULL)
6777 
6778  Length = sizeof(SAM_USER_FIXED_DATA);