ReactOS  0.4.14-dev-342-gdc047f9
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 5096 of file samrpc.c.

5098 {
5099  PSAMPR_ALIAS_INFO_BUFFER InfoBuffer = NULL;
5100  NTSTATUS Status;
5101 
5102  *Buffer = NULL;
5103 
5104  InfoBuffer = midl_user_allocate(sizeof(SAMPR_ALIAS_INFO_BUFFER));
5105  if (InfoBuffer == NULL)
5107 
5108  Status = SampGetObjectAttributeString(AliasObject,
5109  L"Description",
5110  &InfoBuffer->AdminComment.AdminComment);
5111  if (!NT_SUCCESS(Status))
5112  {
5113  TRACE("Status 0x%08lx\n", Status);
5114  goto done;
5115  }
5116 
5117  *Buffer = InfoBuffer;
5118 
5119 done:
5120  if (!NT_SUCCESS(Status))
5121  {
5122  if (InfoBuffer != NULL)
5123  {
5124  if (InfoBuffer->AdminComment.AdminComment.Buffer != NULL)
5126 
5127  midl_user_free(InfoBuffer);
5128  }
5129  }
5130 
5131  return Status;
5132 }
#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 4973 of file samrpc.c.

4975 {
4976  PSAMPR_ALIAS_INFO_BUFFER InfoBuffer = NULL;
4977  HANDLE MembersKeyHandle = NULL;
4978  NTSTATUS Status;
4979 
4980  *Buffer = NULL;
4981 
4982  InfoBuffer = midl_user_allocate(sizeof(SAMPR_ALIAS_INFO_BUFFER));
4983  if (InfoBuffer == NULL)
4985 
4986  Status = SampGetObjectAttributeString(AliasObject,
4987  L"Name",
4988  &InfoBuffer->General.Name);
4989  if (!NT_SUCCESS(Status))
4990  {
4991  TRACE("Status 0x%08lx\n", Status);
4992  goto done;
4993  }
4994 
4995  Status = SampGetObjectAttributeString(AliasObject,
4996  L"Description",
4997  &InfoBuffer->General.AdminComment);
4998  if (!NT_SUCCESS(Status))
4999  {
5000  TRACE("Status 0x%08lx\n", Status);
5001  goto done;
5002  }
5003 
5004  /* Open the Members subkey */
5005  Status = SampRegOpenKey(AliasObject->KeyHandle,
5006  L"Members",
5007  KEY_READ,
5008  &MembersKeyHandle);
5009  if (NT_SUCCESS(Status))
5010  {
5011  /* Retrieve the number of members of the alias */
5012  Status = SampRegQueryKeyInfo(MembersKeyHandle,
5013  NULL,
5014  &InfoBuffer->General.MemberCount);
5015  if (!NT_SUCCESS(Status))
5016  {
5017  TRACE("Status 0x%08lx\n", Status);
5018  goto done;
5019  }
5020  }
5022  {
5023  InfoBuffer->General.MemberCount = 0;
5025  }
5026  else
5027  {
5028  TRACE("Status 0x%08lx\n", Status);
5029  goto done;
5030  }
5031 
5032  *Buffer = InfoBuffer;
5033 
5034 done:
5035  SampRegCloseKey(&MembersKeyHandle);
5036 
5037  if (!NT_SUCCESS(Status))
5038  {
5039  if (InfoBuffer != NULL)
5040  {
5041  if (InfoBuffer->General.Name.Buffer != NULL)
5042  midl_user_free(InfoBuffer->General.Name.Buffer);
5043 
5044  if (InfoBuffer->General.AdminComment.Buffer != NULL)
5046 
5047  midl_user_free(InfoBuffer);
5048  }
5049  }
5050 
5051  return Status;
5052 }
#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 5056 of file samrpc.c.

5058 {
5059  PSAMPR_ALIAS_INFO_BUFFER InfoBuffer = NULL;
5060  NTSTATUS Status;
5061 
5062  *Buffer = NULL;
5063 
5064  InfoBuffer = midl_user_allocate(sizeof(SAMPR_ALIAS_INFO_BUFFER));
5065  if (InfoBuffer == NULL)
5067 
5068  Status = SampGetObjectAttributeString(AliasObject,
5069  L"Name",
5070  &InfoBuffer->Name.Name);
5071  if (!NT_SUCCESS(Status))
5072  {
5073  TRACE("Status 0x%08lx\n", Status);
5074  goto done;
5075  }
5076 
5077  *Buffer = InfoBuffer;
5078 
5079 done:
5080  if (!NT_SUCCESS(Status))
5081  {
5082  if (InfoBuffer != NULL)
5083  {
5084  if (InfoBuffer->Name.Name.Buffer != NULL)
5085  midl_user_free(InfoBuffer->Name.Name.Buffer);
5086 
5087  midl_user_free(InfoBuffer);
5088  }
5089  }
5090 
5091  return Status;
5092 }
#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 4304 of file samrpc.c.

4306 {
4307  PSAMPR_GROUP_INFO_BUFFER InfoBuffer = NULL;
4308  NTSTATUS Status;
4309 
4310  *Buffer = NULL;
4311 
4312  InfoBuffer = midl_user_allocate(sizeof(SAMPR_GROUP_INFO_BUFFER));
4313  if (InfoBuffer == NULL)
4315 
4316  Status = SampGetObjectAttributeString(GroupObject,
4317  L"AdminComment",
4318  &InfoBuffer->AdminComment.AdminComment);
4319  if (!NT_SUCCESS(Status))
4320  {
4321  TRACE("Status 0x%08lx\n", Status);
4322  goto done;
4323  }
4324 
4325  *Buffer = InfoBuffer;
4326 
4327 done:
4328  if (!NT_SUCCESS(Status))
4329  {
4330  if (InfoBuffer != NULL)
4331  {
4332  if (InfoBuffer->AdminComment.AdminComment.Buffer != NULL)
4334 
4335  midl_user_free(InfoBuffer);
4336  }
4337  }
4338 
4339  return Status;
4340 }
#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 4260 of file samrpc.c.

4262 {
4263  PSAMPR_GROUP_INFO_BUFFER InfoBuffer = NULL;
4264  SAM_GROUP_FIXED_DATA FixedData;
4265  ULONG Length = 0;
4266  NTSTATUS Status;
4267 
4268  *Buffer = NULL;
4269 
4270  InfoBuffer = midl_user_allocate(sizeof(SAMPR_GROUP_INFO_BUFFER));
4271  if (InfoBuffer == NULL)
4273 
4274  Length = sizeof(SAM_GROUP_FIXED_DATA);
4275  Status = SampGetObjectAttribute(GroupObject,
4276  L"F",
4277  NULL,
4278  (PVOID)&FixedData,
4279  &Length);
4280  if (!NT_SUCCESS(Status))
4281  {
4282  TRACE("Status 0x%08lx\n", Status);
4283  goto done;
4284  }
4285 
4286  InfoBuffer->Attribute.Attributes = FixedData.Attributes;
4287 
4288  *Buffer = InfoBuffer;
4289 
4290 done:
4291  if (!NT_SUCCESS(Status))
4292  {
4293  if (InfoBuffer != NULL)
4294  {
4295  midl_user_free(InfoBuffer);
4296  }
4297  }
4298 
4299  return Status;
4300 }
#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 4130 of file samrpc.c.

4132 {
4133  PSAMPR_GROUP_INFO_BUFFER InfoBuffer = NULL;
4134  SAM_GROUP_FIXED_DATA FixedData;
4135  ULONG MembersLength = 0;
4136  ULONG Length = 0;
4137  NTSTATUS Status;
4138 
4139  *Buffer = NULL;
4140 
4141  InfoBuffer = midl_user_allocate(sizeof(SAMPR_GROUP_INFO_BUFFER));
4142  if (InfoBuffer == NULL)
4144 
4145  Status = SampGetObjectAttributeString(GroupObject,
4146  L"Name",
4147  &InfoBuffer->General.Name);
4148  if (!NT_SUCCESS(Status))
4149  {
4150  TRACE("Status 0x%08lx\n", Status);
4151  goto done;
4152  }
4153 
4154  Status = SampGetObjectAttributeString(GroupObject,
4155  L"AdminComment",
4156  &InfoBuffer->General.AdminComment);
4157  if (!NT_SUCCESS(Status))
4158  {
4159  TRACE("Status 0x%08lx\n", Status);
4160  goto done;
4161  }
4162 
4163  Length = sizeof(SAM_GROUP_FIXED_DATA);
4164  Status = SampGetObjectAttribute(GroupObject,
4165  L"F",
4166  NULL,
4167  (PVOID)&FixedData,
4168  &Length);
4169  if (!NT_SUCCESS(Status))
4170  {
4171  TRACE("Status 0x%08lx\n", Status);
4172  goto done;
4173  }
4174 
4175  InfoBuffer->General.Attributes = FixedData.Attributes;
4176 
4177  Status = SampGetObjectAttribute(GroupObject,
4178  L"Members",
4179  NULL,
4180  NULL,
4181  &MembersLength);
4183  {
4184  TRACE("Status 0x%08lx\n", Status);
4185  goto done;
4186  }
4187 
4189  {
4190  InfoBuffer->General.MemberCount = 0;
4192  }
4193  else
4194  {
4195  InfoBuffer->General.MemberCount = MembersLength / sizeof(ULONG);
4196  }
4197 
4198  *Buffer = InfoBuffer;
4199 
4200 done:
4201  if (!NT_SUCCESS(Status))
4202  {
4203  if (InfoBuffer != NULL)
4204  {
4205  if (InfoBuffer->General.Name.Buffer != NULL)
4206  midl_user_free(InfoBuffer->General.Name.Buffer);
4207 
4208  if (InfoBuffer->General.AdminComment.Buffer != NULL)
4210 
4211  midl_user_free(InfoBuffer);
4212  }
4213  }
4214 
4215  return Status;
4216 }
#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 4220 of file samrpc.c.

4222 {
4223  PSAMPR_GROUP_INFO_BUFFER InfoBuffer = NULL;
4224  NTSTATUS Status;
4225 
4226  *Buffer = NULL;
4227 
4228  InfoBuffer = midl_user_allocate(sizeof(SAMPR_GROUP_INFO_BUFFER));
4229  if (InfoBuffer == NULL)
4231 
4232  Status = SampGetObjectAttributeString(GroupObject,
4233  L"Name",
4234  &InfoBuffer->Name.Name);
4235  if (!NT_SUCCESS(Status))
4236  {
4237  TRACE("Status 0x%08lx\n", Status);
4238  goto done;
4239  }
4240 
4241  *Buffer = InfoBuffer;
4242 
4243 done:
4244  if (!NT_SUCCESS(Status))
4245  {
4246  if (InfoBuffer != NULL)
4247  {
4248  if (InfoBuffer->Name.Name.Buffer != NULL)
4249  midl_user_free(InfoBuffer->Name.Name.Buffer);
4250 
4251  midl_user_free(InfoBuffer);
4252  }
4253  }
4254 
4255  return Status;
4256 }
#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 5970 of file samrpc.c.

5972 {
5973  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
5974  SAM_USER_FIXED_DATA FixedData;
5975  ULONG Length = 0;
5976  NTSTATUS Status;
5977 
5978  *Buffer = NULL;
5979 
5980  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
5981  if (InfoBuffer == NULL)
5983 
5984  Length = sizeof(SAM_USER_FIXED_DATA);
5985  Status = SampGetObjectAttribute(UserObject,
5986  L"F",
5987  NULL,
5988  (PVOID)&FixedData,
5989  &Length);
5990  if (!NT_SUCCESS(Status))
5991  goto done;
5992 
5993  InfoBuffer->Account.UserId = FixedData.UserId;
5994  InfoBuffer->Account.PrimaryGroupId = FixedData.PrimaryGroupId;
5995  InfoBuffer->Account.LastLogon.LowPart = FixedData.LastLogon.LowPart;
5996  InfoBuffer->Account.LastLogon.HighPart = FixedData.LastLogon.HighPart;
5997  InfoBuffer->Account.LastLogoff.LowPart = FixedData.LastLogoff.LowPart;
5998  InfoBuffer->Account.LastLogoff.HighPart = FixedData.LastLogoff.HighPart;
5999  InfoBuffer->Account.PasswordLastSet.LowPart = FixedData.PasswordLastSet.LowPart;
6000  InfoBuffer->Account.PasswordLastSet.HighPart = FixedData.PasswordLastSet.HighPart;
6001  InfoBuffer->Account.AccountExpires.LowPart = FixedData.AccountExpires.LowPart;
6002  InfoBuffer->Account.AccountExpires.HighPart = FixedData.AccountExpires.HighPart;
6003  InfoBuffer->Account.BadPasswordCount = FixedData.BadPasswordCount;
6004  InfoBuffer->Account.LogonCount = FixedData.LogonCount;
6005  InfoBuffer->Account.UserAccountControl = FixedData.UserAccountControl;
6006 
6007  /* Get the Name string */
6008  Status = SampGetObjectAttributeString(UserObject,
6009  L"Name",
6010  &InfoBuffer->Account.UserName);
6011  if (!NT_SUCCESS(Status))
6012  {
6013  TRACE("Status 0x%08lx\n", Status);
6014  goto done;
6015  }
6016 
6017  /* Get the FullName string */
6018  Status = SampGetObjectAttributeString(UserObject,
6019  L"FullName",
6020  &InfoBuffer->Account.FullName);
6021  if (!NT_SUCCESS(Status))
6022  {
6023  TRACE("Status 0x%08lx\n", Status);
6024  goto done;
6025  }
6026 
6027  /* Get the HomeDirectory string */
6028  Status = SampGetObjectAttributeString(UserObject,
6029  L"HomeDirectory",
6030  &InfoBuffer->Account.HomeDirectory);
6031  if (!NT_SUCCESS(Status))
6032  {
6033  TRACE("Status 0x%08lx\n", Status);
6034  goto done;
6035  }
6036 
6037  /* Get the HomeDirectoryDrive string */
6038  Status = SampGetObjectAttributeString(UserObject,
6039  L"HomeDirectoryDrive",
6040  &InfoBuffer->Account.HomeDirectoryDrive);
6041  if (!NT_SUCCESS(Status))
6042  {
6043  TRACE("Status 0x%08lx\n", Status);
6044  goto done;
6045  }
6046 
6047  /* Get the ScriptPath string */
6048  Status = SampGetObjectAttributeString(UserObject,
6049  L"ScriptPath",
6050  &InfoBuffer->Account.ScriptPath);
6051  if (!NT_SUCCESS(Status))
6052  {
6053  TRACE("Status 0x%08lx\n", Status);
6054  goto done;
6055  }
6056 
6057  /* Get the ProfilePath string */
6058  Status = SampGetObjectAttributeString(UserObject,
6059  L"ProfilePath",
6060  &InfoBuffer->Account.ProfilePath);
6061  if (!NT_SUCCESS(Status))
6062  {
6063  TRACE("Status 0x%08lx\n", Status);
6064  goto done;
6065  }
6066 
6067  /* Get the AdminComment string */
6068  Status = SampGetObjectAttributeString(UserObject,
6069  L"AdminComment",
6070  &InfoBuffer->Account.AdminComment);
6071  if (!NT_SUCCESS(Status))
6072  {
6073  TRACE("Status 0x%08lx\n", Status);
6074  goto done;
6075  }
6076 
6077  /* Get the WorkStations string */
6078  Status = SampGetObjectAttributeString(UserObject,
6079  L"WorkStations",
6080  &InfoBuffer->Account.WorkStations);
6081  if (!NT_SUCCESS(Status))
6082  {
6083  TRACE("Status 0x%08lx\n", Status);
6084  goto done;
6085  }
6086 
6087  /* Get the LogonHours attribute */
6088  Status = SampGetLogonHoursAttribute(UserObject,
6089  &InfoBuffer->Account.LogonHours);
6090  if (!NT_SUCCESS(Status))
6091  {
6092  TRACE("Status 0x%08lx\n", Status);
6093  goto done;
6094  }
6095 
6096  *Buffer = InfoBuffer;
6097 
6098 done:
6099  if (!NT_SUCCESS(Status))
6100  {
6101  if (InfoBuffer != NULL)
6102  {
6103  if (InfoBuffer->Account.UserName.Buffer != NULL)
6104  midl_user_free(InfoBuffer->Account.UserName.Buffer);
6105 
6106  if (InfoBuffer->Account.FullName.Buffer != NULL)
6107  midl_user_free(InfoBuffer->Account.FullName.Buffer);
6108 
6109  if (InfoBuffer->Account.HomeDirectory.Buffer != NULL)
6111 
6112  if (InfoBuffer->Account.HomeDirectoryDrive.Buffer != NULL)
6114 
6115  if (InfoBuffer->Account.ScriptPath.Buffer != NULL)
6116  midl_user_free(InfoBuffer->Account.ScriptPath.Buffer);
6117 
6118  if (InfoBuffer->Account.ProfilePath.Buffer != NULL)
6120 
6121  if (InfoBuffer->Account.AdminComment.Buffer != NULL)
6123 
6124  if (InfoBuffer->Account.WorkStations.Buffer != NULL)
6126 
6127  if (InfoBuffer->Account.LogonHours.LogonHours != NULL)
6129 
6130  midl_user_free(InfoBuffer);
6131  }
6132  }
6133 
6134  return Status;
6135 }
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 6239 of file samrpc.c.

6241 {
6242  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6243  NTSTATUS Status;
6244 
6245  *Buffer = NULL;
6246 
6247  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6248  if (InfoBuffer == NULL)
6250 
6251  /* Get the Name string */
6252  Status = SampGetObjectAttributeString(UserObject,
6253  L"Name",
6254  &InfoBuffer->AccountName.UserName);
6255  if (!NT_SUCCESS(Status))
6256  {
6257  TRACE("Status 0x%08lx\n", Status);
6258  goto done;
6259  }
6260 
6261  *Buffer = InfoBuffer;
6262 
6263 done:
6264  if (!NT_SUCCESS(Status))
6265  {
6266  if (InfoBuffer != NULL)
6267  {
6268  if (InfoBuffer->AccountName.UserName.Buffer != NULL)
6270 
6271  midl_user_free(InfoBuffer);
6272  }
6273  }
6274 
6275  return Status;
6276 }
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 6499 of file samrpc.c.

6501 {
6502  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6503  NTSTATUS Status;
6504 
6505  *Buffer = NULL;
6506 
6507  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6508  if (InfoBuffer == NULL)
6510 
6511  /* Get the AdminComment string */
6512  Status = SampGetObjectAttributeString(UserObject,
6513  L"AdminComment",
6514  &InfoBuffer->AdminComment.AdminComment);
6515  if (!NT_SUCCESS(Status))
6516  {
6517  TRACE("Status 0x%08lx\n", Status);
6518  goto done;
6519  }
6520 
6521  *Buffer = InfoBuffer;
6522 
6523 done:
6524  if (!NT_SUCCESS(Status))
6525  {
6526  if (InfoBuffer != NULL)
6527  {
6528  if (InfoBuffer->AdminComment.AdminComment.Buffer != NULL)
6530 
6531  midl_user_free(InfoBuffer);
6532  }
6533  }
6534 
6535  return Status;
6536 }
#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 6843 of file samrpc.c.

6845 {
6846  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6847  SAM_DOMAIN_FIXED_DATA DomainFixedData;
6848  SAM_USER_FIXED_DATA FixedData;
6849  LARGE_INTEGER PasswordCanChange;
6850  LARGE_INTEGER PasswordMustChange;
6851  ULONG Length = 0;
6852  NTSTATUS Status;
6853 
6854  *Buffer = NULL;
6855 
6856  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6857  if (InfoBuffer == NULL)
6859 
6860  /* Get the fixed size domain data */
6861  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
6863  L"F",
6864  NULL,
6865  (PVOID)&DomainFixedData,
6866  &Length);
6867  if (!NT_SUCCESS(Status))
6868  goto done;
6869 
6870  /* Get the fixed size user data */
6871  Length = sizeof(SAM_USER_FIXED_DATA);
6872  Status = SampGetObjectAttribute(UserObject,
6873  L"F",
6874  NULL,
6875  (PVOID)&FixedData,
6876  &Length);
6877  if (!NT_SUCCESS(Status))
6878  goto done;
6879 
6880  /* Set the fields to be returned */
6881  if (UserObject->Trusted)
6882  {
6888  }
6889  else
6890  {
6891  InfoBuffer->All.WhichFields = 0;
6892 
6893  if (UserObject->Access & USER_READ_GENERAL)
6895 
6896  if (UserObject->Access & USER_READ_LOGON)
6897  InfoBuffer->All.WhichFields |= USER_ALL_READ_LOGON_MASK;
6898 
6899  if (UserObject->Access & USER_READ_ACCOUNT)
6901 
6902  if (UserObject->Access & USER_READ_PREFERENCES)
6904  }
6905 
6906  /* Fail, if no fields are to be returned */
6907  if (InfoBuffer->All.WhichFields == 0)
6908  {
6910  goto done;
6911  }
6912 
6913  /* Get the UserName attribute */
6914  if (InfoBuffer->All.WhichFields & USER_ALL_USERNAME)
6915  {
6916  Status = SampGetObjectAttributeString(UserObject,
6917  L"Name",
6918  &InfoBuffer->All.UserName);
6919  if (!NT_SUCCESS(Status))
6920  {
6921  TRACE("Status 0x%08lx\n", Status);
6922  goto done;
6923  }
6924  }
6925 
6926  /* Get the FullName attribute */
6927  if (InfoBuffer->All.WhichFields & USER_ALL_FULLNAME)
6928  {
6929  Status = SampGetObjectAttributeString(UserObject,
6930  L"FullName",
6931  &InfoBuffer->All.FullName);
6932  if (!NT_SUCCESS(Status))
6933  {
6934  TRACE("Status 0x%08lx\n", Status);
6935  goto done;
6936  }
6937  }
6938 
6939  /* Get the UserId attribute */
6940  if (InfoBuffer->All.WhichFields & USER_ALL_USERID)
6941  {
6942  InfoBuffer->All.UserId = FixedData.UserId;
6943  }
6944 
6945  /* Get the PrimaryGroupId attribute */
6946  if (InfoBuffer->All.WhichFields & USER_ALL_PRIMARYGROUPID)
6947  {
6948  InfoBuffer->All.PrimaryGroupId = FixedData.PrimaryGroupId;
6949  }
6950 
6951  /* Get the AdminComment attribute */
6952  if (InfoBuffer->All.WhichFields & USER_ALL_ADMINCOMMENT)
6953  {
6954  Status = SampGetObjectAttributeString(UserObject,
6955  L"AdminComment",
6956  &InfoBuffer->All.AdminComment);
6957  if (!NT_SUCCESS(Status))
6958  {
6959  TRACE("Status 0x%08lx\n", Status);
6960  goto done;
6961  }
6962  }
6963 
6964  /* Get the UserComment attribute */
6965  if (InfoBuffer->All.WhichFields & USER_ALL_USERCOMMENT)
6966  {
6967  Status = SampGetObjectAttributeString(UserObject,
6968  L"UserComment",
6969  &InfoBuffer->All.UserComment);
6970  if (!NT_SUCCESS(Status))
6971  {
6972  TRACE("Status 0x%08lx\n", Status);
6973  goto done;
6974  }
6975  }
6976 
6977  /* Get the HomeDirectory attribute */
6978  if (InfoBuffer->All.WhichFields & USER_ALL_HOMEDIRECTORY)
6979  {
6980  Status = SampGetObjectAttributeString(UserObject,
6981  L"HomeDirectory",
6982  &InfoBuffer->All.HomeDirectory);
6983  if (!NT_SUCCESS(Status))
6984  {
6985  TRACE("Status 0x%08lx\n", Status);
6986  goto done;
6987  }
6988  }
6989 
6990  /* Get the HomeDirectoryDrive attribute */
6991  if (InfoBuffer->All.WhichFields & USER_ALL_HOMEDIRECTORYDRIVE)
6992  {
6993  Status = SampGetObjectAttributeString(UserObject,
6994  L"HomeDirectoryDrive",
6995  &InfoBuffer->Home.HomeDirectoryDrive);
6996  if (!NT_SUCCESS(Status))
6997  {
6998  TRACE("Status 0x%08lx\n", Status);
6999  goto done;
7000  }
7001  }
7002 
7003  /* Get the ScriptPath attribute */
7004  if (InfoBuffer->All.WhichFields & USER_ALL_SCRIPTPATH)
7005  {
7006  Status = SampGetObjectAttributeString(UserObject,
7007  L"ScriptPath",
7008  &InfoBuffer->All.ScriptPath);
7009  if (!NT_SUCCESS(Status))
7010  {
7011  TRACE("Status 0x%08lx\n", Status);
7012  goto done;
7013  }
7014  }
7015 
7016  /* Get the ProfilePath attribute */
7017  if (InfoBuffer->All.WhichFields & USER_ALL_PROFILEPATH)
7018  {
7019  Status = SampGetObjectAttributeString(UserObject,
7020  L"ProfilePath",
7021  &InfoBuffer->All.ProfilePath);
7022  if (!NT_SUCCESS(Status))
7023  {
7024  TRACE("Status 0x%08lx\n", Status);
7025  goto done;
7026  }
7027  }
7028 
7029  /* Get the WorkStations attribute */
7030  if (InfoBuffer->All.WhichFields & USER_ALL_WORKSTATIONS)
7031  {
7032  Status = SampGetObjectAttributeString(UserObject,
7033  L"WorkStations",
7034  &InfoBuffer->All.WorkStations);
7035  if (!NT_SUCCESS(Status))
7036  {
7037  TRACE("Status 0x%08lx\n", Status);
7038  goto done;
7039  }
7040  }
7041 
7042  /* Get the LastLogon attribute */
7043  if (InfoBuffer->All.WhichFields & USER_ALL_LASTLOGON)
7044  {
7045  InfoBuffer->All.LastLogon.LowPart = FixedData.LastLogon.LowPart;
7046  InfoBuffer->All.LastLogon.HighPart = FixedData.LastLogon.HighPart;
7047  }
7048 
7049  /* Get the LastLogoff attribute */
7050  if (InfoBuffer->All.WhichFields & USER_ALL_LASTLOGOFF)
7051  {
7052  InfoBuffer->All.LastLogoff.LowPart = FixedData.LastLogoff.LowPart;
7053  InfoBuffer->All.LastLogoff.HighPart = FixedData.LastLogoff.HighPart;
7054  }
7055 
7056  /* Get the LogonHours attribute */
7057  if (InfoBuffer->All.WhichFields & USER_ALL_LOGONHOURS)
7058  {
7059  Status = SampGetLogonHoursAttribute(UserObject,
7060  &InfoBuffer->All.LogonHours);
7061  if (!NT_SUCCESS(Status))
7062  {
7063  TRACE("Status 0x%08lx\n", Status);
7064  goto done;
7065  }
7066  }
7067 
7068  /* Get the BadPasswordCount attribute */
7069  if (InfoBuffer->All.WhichFields & USER_ALL_BADPASSWORDCOUNT)
7070  {
7071  InfoBuffer->All.BadPasswordCount = FixedData.BadPasswordCount;
7072  }
7073 
7074  /* Get the LogonCount attribute */
7075  if (InfoBuffer->All.WhichFields & USER_ALL_LOGONCOUNT)
7076  {
7077  InfoBuffer->All.LogonCount = FixedData.LogonCount;
7078  }
7079 
7080  /* Get the PasswordCanChange attribute */
7081  if (InfoBuffer->All.WhichFields & USER_ALL_PASSWORDCANCHANGE)
7082  {
7083  PasswordCanChange = SampAddRelativeTimeToTime(FixedData.PasswordLastSet,
7084  DomainFixedData.MinPasswordAge);
7085  InfoBuffer->All.PasswordCanChange.LowPart = PasswordCanChange.LowPart;
7086  InfoBuffer->All.PasswordCanChange.HighPart = PasswordCanChange.HighPart;
7087  }
7088 
7089  /* Get the PasswordMustChange attribute */
7090  if (InfoBuffer->All.WhichFields & USER_ALL_PASSWORDMUSTCHANGE)
7091  {
7092  PasswordMustChange = SampAddRelativeTimeToTime(FixedData.PasswordLastSet,
7093  DomainFixedData.MaxPasswordAge);
7094  InfoBuffer->All.PasswordMustChange.LowPart = PasswordMustChange.LowPart;
7095  InfoBuffer->All.PasswordMustChange.HighPart = PasswordMustChange.HighPart;
7096  }
7097 
7098  /* Get the PasswordLastSet attribute */
7099  if (InfoBuffer->All.WhichFields & USER_ALL_PASSWORDLASTSET)
7100  {
7101  InfoBuffer->All.PasswordLastSet.LowPart = FixedData.PasswordLastSet.LowPart;
7102  InfoBuffer->All.PasswordLastSet.HighPart = FixedData.PasswordLastSet.HighPart;
7103  }
7104 
7105  /* Get the AccountExpires attribute */
7106  if (InfoBuffer->All.WhichFields & USER_ALL_ACCOUNTEXPIRES)
7107  {
7108  InfoBuffer->All.AccountExpires.LowPart = FixedData.AccountExpires.LowPart;
7109  InfoBuffer->All.AccountExpires.HighPart = FixedData.AccountExpires.HighPart;
7110  }
7111 
7112  /* Get the UserAccountControl attribute */
7113  if (InfoBuffer->All.WhichFields & USER_ALL_USERACCOUNTCONTROL)
7114  {
7115  InfoBuffer->All.UserAccountControl = FixedData.UserAccountControl;
7116  }
7117 
7118  /* Get the Parameters attribute */
7119  if (InfoBuffer->All.WhichFields & USER_ALL_PARAMETERS)
7120  {
7121  Status = SampGetObjectAttributeString(UserObject,
7122  L"Parameters",
7123  &InfoBuffer->All.Parameters);
7124  if (!NT_SUCCESS(Status))
7125  {
7126  TRACE("Status 0x%08lx\n", Status);
7127  goto done;
7128  }
7129  }
7130 
7131  /* Get the CountryCode attribute */
7132  if (InfoBuffer->All.WhichFields & USER_ALL_COUNTRYCODE)
7133  {
7134  InfoBuffer->All.CountryCode = FixedData.CountryCode;
7135  }
7136 
7137  /* Get the CodePage attribute */
7138  if (InfoBuffer->All.WhichFields & USER_ALL_CODEPAGE)
7139  {
7140  InfoBuffer->All.CodePage = FixedData.CodePage;
7141  }
7142 
7143  /* Get the LmPassword and NtPassword attributes */
7145  {
7146  InfoBuffer->All.LmPasswordPresent = FALSE;
7147  InfoBuffer->All.NtPasswordPresent = FALSE;
7148 
7149  /* Get the NT password */
7150  Length = 0;
7151  SampGetObjectAttribute(UserObject,
7152  L"NTPwd",
7153  NULL,
7154  NULL,
7155  &Length);
7156 
7157  if (Length == sizeof(ENCRYPTED_NT_OWF_PASSWORD))
7158  {
7160  if (InfoBuffer->All.NtOwfPassword.Buffer == NULL)
7161  {
7163  goto done;
7164  }
7165 
7166  InfoBuffer->All.NtOwfPassword.Length = sizeof(ENCRYPTED_NT_OWF_PASSWORD);
7168 
7169  Status = SampGetObjectAttribute(UserObject,
7170  L"NTPwd",
7171  NULL,
7172  (PVOID)InfoBuffer->All.NtOwfPassword.Buffer,
7173  &Length);
7174  if (!NT_SUCCESS(Status))
7175  goto done;
7176 
7177  if (memcmp(InfoBuffer->All.NtOwfPassword.Buffer,
7178  &EmptyNtHash,
7179  sizeof(ENCRYPTED_NT_OWF_PASSWORD)))
7180  InfoBuffer->All.NtPasswordPresent = TRUE;
7181  }
7182 
7183  /* Get the LM password */
7184  Length = 0;
7185  SampGetObjectAttribute(UserObject,
7186  L"LMPwd",
7187  NULL,
7188  NULL,
7189  &Length);
7190 
7191  if (Length == sizeof(ENCRYPTED_LM_OWF_PASSWORD))
7192  {
7194  if (InfoBuffer->All.LmOwfPassword.Buffer == NULL)
7195  {
7197  goto done;
7198  }
7199 
7200  InfoBuffer->All.LmOwfPassword.Length = sizeof(ENCRYPTED_LM_OWF_PASSWORD);
7202 
7203  Status = SampGetObjectAttribute(UserObject,
7204  L"LMPwd",
7205  NULL,
7206  (PVOID)InfoBuffer->All.LmOwfPassword.Buffer,
7207  &Length);
7208  if (!NT_SUCCESS(Status))
7209  goto done;
7210 
7211  if (memcmp(InfoBuffer->All.LmOwfPassword.Buffer,
7212  &EmptyLmHash,
7213  sizeof(ENCRYPTED_LM_OWF_PASSWORD)))
7214  InfoBuffer->All.LmPasswordPresent = TRUE;
7215  }
7216  }
7217 
7218  if (InfoBuffer->All.WhichFields & USER_ALL_PRIVATEDATA)
7219  {
7220  Status = SampGetObjectAttributeString(UserObject,
7221  L"PrivateData",
7222  &InfoBuffer->All.PrivateData);
7223  if (!NT_SUCCESS(Status))
7224  {
7225  TRACE("Status 0x%08lx\n", Status);
7226  goto done;
7227  }
7228  }
7229 
7230  if (InfoBuffer->All.WhichFields & USER_ALL_PASSWORDEXPIRED)
7231  {
7232  /* FIXME */
7233  }
7234 
7235  if (InfoBuffer->All.WhichFields & USER_ALL_SECURITYDESCRIPTOR)
7236  {
7237  Length = 0;
7238  SampGetObjectAttribute(UserObject,
7239  L"SecDesc",
7240  NULL,
7241  NULL,
7242  &Length);
7243 
7244  if (Length > 0)
7245  {
7247  if (InfoBuffer->All.SecurityDescriptor.SecurityDescriptor == NULL)
7248  {
7250  goto done;
7251  }
7252 
7253  InfoBuffer->All.SecurityDescriptor.Length = Length;
7254 
7255  Status = SampGetObjectAttribute(UserObject,
7256  L"SecDesc",
7257  NULL,
7259  &Length);
7260  if (!NT_SUCCESS(Status))
7261  goto done;
7262  }
7263  }
7264 
7265  *Buffer = InfoBuffer;
7266 
7267 done:
7268  if (!NT_SUCCESS(Status))
7269  {
7270  if (InfoBuffer != NULL)
7271  {
7272  if (InfoBuffer->All.UserName.Buffer != NULL)
7273  midl_user_free(InfoBuffer->All.UserName.Buffer);
7274 
7275  if (InfoBuffer->All.FullName.Buffer != NULL)
7276  midl_user_free(InfoBuffer->All.FullName.Buffer);
7277 
7278  if (InfoBuffer->All.AdminComment.Buffer != NULL)
7279  midl_user_free(InfoBuffer->All.AdminComment.Buffer);
7280 
7281  if (InfoBuffer->All.UserComment.Buffer != NULL)
7282  midl_user_free(InfoBuffer->All.UserComment.Buffer);
7283 
7284  if (InfoBuffer->All.HomeDirectory.Buffer != NULL)
7285  midl_user_free(InfoBuffer->All.HomeDirectory.Buffer);
7286 
7287  if (InfoBuffer->All.HomeDirectoryDrive.Buffer != NULL)
7289 
7290  if (InfoBuffer->All.ScriptPath.Buffer != NULL)
7291  midl_user_free(InfoBuffer->All.ScriptPath.Buffer);
7292 
7293  if (InfoBuffer->All.ProfilePath.Buffer != NULL)
7294  midl_user_free(InfoBuffer->All.ProfilePath.Buffer);
7295 
7296  if (InfoBuffer->All.WorkStations.Buffer != NULL)
7297  midl_user_free(InfoBuffer->All.WorkStations.Buffer);
7298 
7299  if (InfoBuffer->All.LogonHours.LogonHours != NULL)
7300  midl_user_free(InfoBuffer->All.LogonHours.LogonHours);
7301 
7302  if (InfoBuffer->All.Parameters.Buffer != NULL)
7303  midl_user_free(InfoBuffer->All.Parameters.Buffer);
7304 
7305  if (InfoBuffer->All.LmOwfPassword.Buffer != NULL)
7306  midl_user_free(InfoBuffer->All.LmOwfPassword.Buffer);
7307 
7308  if (InfoBuffer->All.NtOwfPassword.Buffer != NULL)
7309  midl_user_free(InfoBuffer->All.NtOwfPassword.Buffer);
7310 
7311  if (InfoBuffer->All.PrivateData.Buffer != NULL)
7312  midl_user_free(InfoBuffer->All.PrivateData.Buffer);
7313 
7314  if (InfoBuffer->All.SecurityDescriptor.SecurityDescriptor != NULL)
7316 
7317  midl_user_free(InfoBuffer);
7318  }
7319  }
7320 
7321  return Status;
7322 }
#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 6582 of file samrpc.c.

6584 {
6585  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6586  SAM_USER_FIXED_DATA FixedData;
6587  ULONG Length = 0;
6588  NTSTATUS Status;
6589 
6590  *Buffer = NULL;
6591 
6592  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6593  if (InfoBuffer == NULL)
6595 
6596  Length = sizeof(SAM_USER_FIXED_DATA);
6597  Status = SampGetObjectAttribute(UserObject,
6598  L"F",
6599  NULL,
6600  (PVOID)&FixedData,
6601  &Length);
6602  if (!NT_SUCCESS(Status))
6603  goto done;
6604 
6605  InfoBuffer->Control.UserAccountControl = FixedData.UserAccountControl;
6606 
6607  *Buffer = InfoBuffer;
6608 
6609 done:
6610  if (!NT_SUCCESS(Status))
6611  {
6612  if (InfoBuffer != NULL)
6613  {
6614  midl_user_free(InfoBuffer);
6615  }
6616  }
6617 
6618  return Status;
6619 }
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 6624 of file samrpc.c.

6626 {
6627  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6628  SAM_USER_FIXED_DATA FixedData;
6629  ULONG Length = 0;
6630  NTSTATUS Status;
6631 
6632  *Buffer = NULL;
6633 
6634  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6635  if (InfoBuffer == NULL)
6637 
6638  Length = sizeof(SAM_USER_FIXED_DATA);
6639  Status = SampGetObjectAttribute(UserObject,
6640  L"F",
6641  NULL,
6642  (PVOID)&FixedData,
6643  &Length);
6644  if (!NT_SUCCESS(Status))
6645  goto done;
6646 
6647  InfoBuffer->Expires.AccountExpires.LowPart = FixedData.AccountExpires.LowPart;
6648  InfoBuffer->Expires.AccountExpires.HighPart = FixedData.AccountExpires.HighPart;
6649 
6650  *Buffer = InfoBuffer;
6651 
6652 done:
6653  if (!NT_SUCCESS(Status))
6654  {
6655  if (InfoBuffer != NULL)
6656  {
6657  midl_user_free(InfoBuffer);
6658  }
6659  }
6660 
6661  return Status;
6662 }
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 6280 of file samrpc.c.

6282 {
6283  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6284  NTSTATUS Status;
6285 
6286  *Buffer = NULL;
6287 
6288  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6289  if (InfoBuffer == NULL)
6291 
6292  /* Get the FullName string */
6293  Status = SampGetObjectAttributeString(UserObject,
6294  L"FullName",
6295  &InfoBuffer->FullName.FullName);
6296  if (!NT_SUCCESS(Status))
6297  {
6298  TRACE("Status 0x%08lx\n", Status);
6299  goto done;
6300  }
6301 
6302  *Buffer = InfoBuffer;
6303 
6304 done:
6305  if (!NT_SUCCESS(Status))
6306  {
6307  if (InfoBuffer != NULL)
6308  {
6309  if (InfoBuffer->FullName.FullName.Buffer != NULL)
6310  midl_user_free(InfoBuffer->FullName.FullName.Buffer);
6311 
6312  midl_user_free(InfoBuffer);
6313  }
6314  }
6315 
6316  return Status;
6317 }
#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 5641 of file samrpc.c.

5643 {
5644  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
5645  SAM_USER_FIXED_DATA FixedData;
5646  ULONG Length = 0;
5647  NTSTATUS Status;
5648 
5649  *Buffer = NULL;
5650 
5651  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
5652  if (InfoBuffer == NULL)
5654 
5655  Length = sizeof(SAM_USER_FIXED_DATA);
5656  Status = SampGetObjectAttribute(UserObject,
5657  L"F",
5658  NULL,
5659  (PVOID)&FixedData,
5660  &Length);
5661  if (!NT_SUCCESS(Status))
5662  goto done;
5663 
5664  InfoBuffer->General.PrimaryGroupId = FixedData.PrimaryGroupId;
5665 
5666  /* Get the Name string */
5667  Status = SampGetObjectAttributeString(UserObject,
5668  L"Name",
5669  &InfoBuffer->General.UserName);
5670  if (!NT_SUCCESS(Status))
5671  {
5672  TRACE("Status 0x%08lx\n", Status);
5673  goto done;
5674  }
5675 
5676  /* Get the FullName string */
5677  Status = SampGetObjectAttributeString(UserObject,
5678  L"FullName",
5679  &InfoBuffer->General.FullName);
5680  if (!NT_SUCCESS(Status))
5681  {
5682  TRACE("Status 0x%08lx\n", Status);
5683  goto done;
5684  }
5685 
5686  /* Get the AdminComment string */
5687  Status = SampGetObjectAttributeString(UserObject,
5688  L"AdminComment",
5689  &InfoBuffer->General.AdminComment);
5690  if (!NT_SUCCESS(Status))
5691  {
5692  TRACE("Status 0x%08lx\n", Status);
5693  goto done;
5694  }
5695 
5696  /* Get the UserComment string */
5697  Status = SampGetObjectAttributeString(UserObject,
5698  L"UserComment",
5699  &InfoBuffer->General.UserComment);
5700  if (!NT_SUCCESS(Status))
5701  {
5702  TRACE("Status 0x%08lx\n", Status);
5703  goto done;
5704  }
5705 
5706  *Buffer = InfoBuffer;
5707 
5708 done:
5709  if (!NT_SUCCESS(Status))
5710  {
5711  if (InfoBuffer != NULL)
5712  {
5713  if (InfoBuffer->General.UserName.Buffer != NULL)
5714  midl_user_free(InfoBuffer->General.UserName.Buffer);
5715 
5716  if (InfoBuffer->General.FullName.Buffer != NULL)
5717  midl_user_free(InfoBuffer->General.FullName.Buffer);
5718 
5719  if (InfoBuffer->General.AdminComment.Buffer != NULL)
5721 
5722  if (InfoBuffer->General.UserComment.Buffer != NULL)
5724 
5725  midl_user_free(InfoBuffer);
5726  }
5727  }
5728 
5729  return Status;
5730 }
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 6363 of file samrpc.c.

6365 {
6366  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6367  NTSTATUS Status;
6368 
6369  *Buffer = NULL;
6370 
6371  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6372  if (InfoBuffer == NULL)
6374 
6375  /* Get the HomeDirectory string */
6376  Status = SampGetObjectAttributeString(UserObject,
6377  L"HomeDirectory",
6378  &InfoBuffer->Home.HomeDirectory);
6379  if (!NT_SUCCESS(Status))
6380  {
6381  TRACE("Status 0x%08lx\n", Status);
6382  goto done;
6383  }
6384 
6385  /* Get the HomeDirectoryDrive string */
6386  Status = SampGetObjectAttributeString(UserObject,
6387  L"HomeDirectoryDrive",
6388  &InfoBuffer->Home.HomeDirectoryDrive);
6389  if (!NT_SUCCESS(Status))
6390  {
6391  TRACE("Status 0x%08lx\n", Status);
6392  goto done;
6393  }
6394 
6395  *Buffer = InfoBuffer;
6396 
6397 done:
6398  if (!NT_SUCCESS(Status))
6399  {
6400  if (InfoBuffer != NULL)
6401  {
6402  if (InfoBuffer->Home.HomeDirectory.Buffer != NULL)
6403  midl_user_free(InfoBuffer->Home.HomeDirectory.Buffer);
6404 
6405  if (InfoBuffer->Home.HomeDirectoryDrive.Buffer != NULL)
6407 
6408  midl_user_free(InfoBuffer);
6409  }
6410  }
6411 
6412  return Status;
6413 }
#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 6667 of file samrpc.c.

6669 {
6670  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6671  ULONG Length = 0;
6673 
6674  /* Fail, if the caller is not a trusted caller */
6675  if (UserObject->Trusted == FALSE)
6677 
6678  *Buffer = NULL;
6679 
6680  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6681  if (InfoBuffer == NULL)
6683 
6684  InfoBuffer->Internal1.LmPasswordPresent = FALSE;
6685  InfoBuffer->Internal1.NtPasswordPresent = FALSE;
6686 
6687  /* Get the NT password */
6688  Length = 0;
6689  SampGetObjectAttribute(UserObject,
6690  L"NTPwd",
6691  NULL,
6692  NULL,
6693  &Length);
6694 
6695  if (Length == sizeof(ENCRYPTED_NT_OWF_PASSWORD))
6696  {
6697  Status = SampGetObjectAttribute(UserObject,
6698  L"NTPwd",
6699  NULL,
6700  (PVOID)&InfoBuffer->Internal1.EncryptedNtOwfPassword,
6701  &Length);
6702  if (!NT_SUCCESS(Status))
6703  goto done;
6704 
6705  if (memcmp(&InfoBuffer->Internal1.EncryptedNtOwfPassword,
6706  &EmptyNtHash,
6707  sizeof(ENCRYPTED_NT_OWF_PASSWORD)))
6708  InfoBuffer->Internal1.NtPasswordPresent = TRUE;
6709  }
6710 
6711 
6712  /* Get the LM password */
6713  Length = 0;
6714  SampGetObjectAttribute(UserObject,
6715  L"LMPwd",
6716  NULL,
6717  NULL,
6718  &Length);
6719 
6720  if (Length == sizeof(ENCRYPTED_LM_OWF_PASSWORD))
6721  {
6722  Status = SampGetObjectAttribute(UserObject,
6723  L"LMPwd",
6724  NULL,
6725  (PVOID)&InfoBuffer->Internal1.EncryptedLmOwfPassword,
6726  &Length);
6727  if (!NT_SUCCESS(Status))
6728  goto done;
6729 
6730  if (memcmp(&InfoBuffer->Internal1.EncryptedLmOwfPassword,
6731  &EmptyLmHash,
6732  sizeof(ENCRYPTED_LM_OWF_PASSWORD)))
6733  InfoBuffer->Internal1.LmPasswordPresent = TRUE;
6734  }
6735 
6736  InfoBuffer->Internal1.PasswordExpired = FALSE;
6737 
6738  *Buffer = InfoBuffer;
6739 
6740 done:
6741  if (!NT_SUCCESS(Status))
6742  {
6743  if (InfoBuffer != NULL)
6744  {
6745  midl_user_free(InfoBuffer);
6746  }
6747  }
6748 
6749  return Status;
6750 }
#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 6755 of file samrpc.c.

6757 {
6758  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6759  SAM_USER_FIXED_DATA FixedData;
6760  ULONG Length = 0;
6761  NTSTATUS Status;
6762 
6763  *Buffer = NULL;
6764 
6765  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6766  if (InfoBuffer == NULL)
6768 
6769  Length = sizeof(SAM_USER_FIXED_DATA);
6770  Status = SampGetObjectAttribute(UserObject,
6771  L"F",
6772  NULL,
6773  (PVOID)&FixedData,
6774  &Length);
6775  if (!NT_SUCCESS(Status))
6776  goto done;
6777 
6778  InfoBuffer->Internal2.Flags = 0;
6779  InfoBuffer->Internal2.LastLogon.LowPart = FixedData.LastLogon.LowPart;
6780  InfoBuffer->Internal2.LastLogon.HighPart = FixedData.LastLogon.HighPart;
6781  InfoBuffer->Internal2.LastLogoff.LowPart = FixedData.LastLogoff.LowPart;
6782  InfoBuffer->Internal2.LastLogoff.HighPart = FixedData.LastLogoff.HighPart;
6783  InfoBuffer->Internal2.BadPasswordCount = FixedData.BadPasswordCount;
6784  InfoBuffer->Internal2.LogonCount = FixedData.LogonCount;
6785 
6786  *Buffer = InfoBuffer;
6787