ReactOS  0.4.15-dev-3440-g915569a
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:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLenum GLsizei len
Definition: glext.h:6722
#define HEAP_ZERO_MEMORY
Definition: compat.h:134

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:595
#define HeapFree(x, y, z)
Definition: compat.h:594

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:114

Referenced by SampQueryUserAll(), and SampQueryUserLogon().

◆ SampGetNumberOfAccounts()

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

Definition at line 960 of file samrpc.c.

963 {
964  HANDLE AccountKeyHandle = NULL;
965  HANDLE NamesKeyHandle = NULL;
967 
968  *Count = 0;
969 
970  Status = SampRegOpenKey(DomainObject->KeyHandle,
971  AccountType,
972  KEY_READ,
973  &AccountKeyHandle);
974  if (!NT_SUCCESS(Status))
975  return Status;
976 
977  Status = SampRegOpenKey(AccountKeyHandle,
978  L"Names",
979  KEY_READ,
980  &NamesKeyHandle);
981  if (!NT_SUCCESS(Status))
982  goto done;
983 
984  Status = SampRegQueryKeyInfo(NamesKeyHandle,
985  NULL,
986  Count);
987 
988 done:
989  SampRegCloseKey(&NamesKeyHandle);
990  SampRegCloseKey(&AccountKeyHandle);
991 
992  return Status;
993 }
#define KEY_READ
Definition: nt_native.h:1023
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS SampRegCloseKey(IN OUT PHANDLE KeyHandle)
Definition: registry.c:26
#define L(x)
Definition: ntvdm.h:50
NTSTATUS SampRegQueryKeyInfo(IN HANDLE KeyHandle, OUT PULONG SubKeyCount, OUT PULONG ValueCount)
Definition: registry.c:181
Status
Definition: gdiplustypes.h:24
int Count
Definition: noreturn.cpp:7
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
HANDLE KeyHandle
Definition: samsrv.h:52
NTSTATUS SampRegOpenKey(IN HANDLE ParentKeyHandle, IN LPCWSTR KeyName, IN ACCESS_MASK DesiredAccess, OUT PHANDLE KeyHandle)
Definition: registry.c:158
#define NULL
Definition: types.h:112

Referenced by SampQueryDomainGeneral(), and SampQueryDomainGeneral2().

◆ SampQueryAliasAdminComment()

static NTSTATUS SampQueryAliasAdminComment ( PSAM_DB_OBJECT  AliasObject,
PSAMPR_ALIAS_INFO_BUFFER Buffer 
)
static

Definition at line 5002 of file samrpc.c.

5004 {
5005  PSAMPR_ALIAS_INFO_BUFFER InfoBuffer = NULL;
5006  NTSTATUS Status;
5007 
5008  *Buffer = NULL;
5009 
5010  InfoBuffer = midl_user_allocate(sizeof(SAMPR_ALIAS_INFO_BUFFER));
5011  if (InfoBuffer == NULL)
5013 
5014  Status = SampGetObjectAttributeString(AliasObject,
5015  L"Description",
5016  &InfoBuffer->AdminComment.AdminComment);
5017  if (!NT_SUCCESS(Status))
5018  {
5019  TRACE("Status 0x%08lx\n", Status);
5020  goto done;
5021  }
5022 
5023  *Buffer = InfoBuffer;
5024 
5025 done:
5026  if (!NT_SUCCESS(Status))
5027  {
5028  if (InfoBuffer != NULL)
5029  {
5030  if (InfoBuffer->AdminComment.AdminComment.Buffer != NULL)
5032 
5033  midl_user_free(InfoBuffer);
5034  }
5035  }
5036 
5037  return Status;
5038 }
#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
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#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:531
RPC_UNICODE_STRING AdminComment
Definition: sam.idl:429
#define NULL
Definition: types.h:112
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:24

Referenced by SamrQueryInformationAlias().

◆ SampQueryAliasGeneral()

static NTSTATUS SampQueryAliasGeneral ( PSAM_DB_OBJECT  AliasObject,
PSAMPR_ALIAS_INFO_BUFFER Buffer 
)
static

Definition at line 4879 of file samrpc.c.

4881 {
4882  PSAMPR_ALIAS_INFO_BUFFER InfoBuffer = NULL;
4883  HANDLE MembersKeyHandle = NULL;
4884  NTSTATUS Status;
4885 
4886  *Buffer = NULL;
4887 
4888  InfoBuffer = midl_user_allocate(sizeof(SAMPR_ALIAS_INFO_BUFFER));
4889  if (InfoBuffer == NULL)
4891 
4892  Status = SampGetObjectAttributeString(AliasObject,
4893  L"Name",
4894  &InfoBuffer->General.Name);
4895  if (!NT_SUCCESS(Status))
4896  {
4897  TRACE("Status 0x%08lx\n", Status);
4898  goto done;
4899  }
4900 
4901  Status = SampGetObjectAttributeString(AliasObject,
4902  L"Description",
4903  &InfoBuffer->General.AdminComment);
4904  if (!NT_SUCCESS(Status))
4905  {
4906  TRACE("Status 0x%08lx\n", Status);
4907  goto done;
4908  }
4909 
4910  /* Open the Members subkey */
4911  Status = SampRegOpenKey(AliasObject->KeyHandle,
4912  L"Members",
4913  KEY_READ,
4914  &MembersKeyHandle);
4915  if (NT_SUCCESS(Status))
4916  {
4917  /* Retrieve the number of members of the alias */
4918  Status = SampRegQueryKeyInfo(MembersKeyHandle,
4919  NULL,
4920  &InfoBuffer->General.MemberCount);
4921  if (!NT_SUCCESS(Status))
4922  {
4923  TRACE("Status 0x%08lx\n", Status);
4924  goto done;
4925  }
4926  }
4928  {
4929  InfoBuffer->General.MemberCount = 0;
4931  }
4932  else
4933  {
4934  TRACE("Status 0x%08lx\n", Status);
4935  goto done;
4936  }
4937 
4938  *Buffer = InfoBuffer;
4939 
4940 done:
4941  SampRegCloseKey(&MembersKeyHandle);
4942 
4943  if (!NT_SUCCESS(Status))
4944  {
4945  if (InfoBuffer != NULL)
4946  {
4947  if (InfoBuffer->General.Name.Buffer != NULL)
4948  midl_user_free(InfoBuffer->General.Name.Buffer);
4949 
4950  if (InfoBuffer->General.AdminComment.Buffer != NULL)
4952 
4953  midl_user_free(InfoBuffer);
4954  }
4955  }
4956 
4957  return Status;
4958 }
#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
#define L(x)
Definition: ntvdm.h:50
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
Status
Definition: gdiplustypes.h:24
#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:531
HANDLE KeyHandle
Definition: samsrv.h:52
#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
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65
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:24

Referenced by SamrQueryInformationAlias().

◆ SampQueryAliasName()

static NTSTATUS SampQueryAliasName ( PSAM_DB_OBJECT  AliasObject,
PSAMPR_ALIAS_INFO_BUFFER Buffer 
)
static

Definition at line 4962 of file samrpc.c.

4964 {
4965  PSAMPR_ALIAS_INFO_BUFFER InfoBuffer = NULL;
4966  NTSTATUS Status;
4967 
4968  *Buffer = NULL;
4969 
4970  InfoBuffer = midl_user_allocate(sizeof(SAMPR_ALIAS_INFO_BUFFER));
4971  if (InfoBuffer == NULL)
4973 
4974  Status = SampGetObjectAttributeString(AliasObject,
4975  L"Name",
4976  &InfoBuffer->Name.Name);
4977  if (!NT_SUCCESS(Status))
4978  {
4979  TRACE("Status 0x%08lx\n", Status);
4980  goto done;
4981  }
4982 
4983  *Buffer = InfoBuffer;
4984 
4985 done:
4986  if (!NT_SUCCESS(Status))
4987  {
4988  if (InfoBuffer != NULL)
4989  {
4990  if (InfoBuffer->Name.Name.Buffer != NULL)
4991  midl_user_free(InfoBuffer->Name.Name.Buffer);
4992 
4993  midl_user_free(InfoBuffer);
4994  }
4995  }
4996 
4997  return Status;
4998 }
#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
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#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:531
#define NULL
Definition: types.h:112
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:24

Referenced by SamrQueryInformationAlias().

◆ SampQueryDomainGeneral()

static NTSTATUS SampQueryDomainGeneral ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 997 of file samrpc.c.

999 {
1000  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1001  SAM_DOMAIN_FIXED_DATA FixedData;
1002  ULONG Length = 0;
1003  NTSTATUS Status;
1004 
1005  *Buffer = NULL;
1006 
1007  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1008  if (InfoBuffer == NULL)
1010 
1011  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1012  Status = SampGetObjectAttribute(DomainObject,
1013  L"F",
1014  NULL,
1015  (PVOID)&FixedData,
1016  &Length);
1017  if (!NT_SUCCESS(Status))
1018  goto done;
1019 
1020  InfoBuffer->General.ForceLogoff.LowPart = FixedData.ForceLogoff.LowPart;
1021  InfoBuffer->General.ForceLogoff.HighPart = FixedData.ForceLogoff.HighPart;
1024  InfoBuffer->General.DomainServerState = FixedData.DomainServerState;
1025  InfoBuffer->General.DomainServerRole = FixedData.DomainServerRole;
1027 
1028  /* Get the OemInformation string */
1029  Status = SampGetObjectAttributeString(DomainObject,
1030  L"OemInformation",
1031  &InfoBuffer->General.OemInformation);
1032  if (!NT_SUCCESS(Status))
1033  {
1034  TRACE("Status 0x%08lx\n", Status);
1035  goto done;
1036  }
1037 
1038  /* Get the Name string */
1039  Status = SampGetObjectAttributeString(DomainObject,
1040  L"Name",
1041  &InfoBuffer->General.DomainName);
1042  if (!NT_SUCCESS(Status))
1043  {
1044  TRACE("Status 0x%08lx\n", Status);
1045  goto done;
1046  }
1047 
1048  /* Get the ReplicaSourceNodeName string */
1049  Status = SampGetObjectAttributeString(DomainObject,
1050  L"ReplicaSourceNodeName",
1051  &InfoBuffer->General.ReplicaSourceNodeName);
1052  if (!NT_SUCCESS(Status))
1053  {
1054  TRACE("Status 0x%08lx\n", Status);
1055  goto done;
1056  }
1057 
1058  /* Get the number of Users in the Domain */
1059  Status = SampGetNumberOfAccounts(DomainObject,
1060  L"Users",
1061  &InfoBuffer->General.UserCount);
1062  if (!NT_SUCCESS(Status))
1063  {
1064  TRACE("Status 0x%08lx\n", Status);
1065  goto done;
1066  }
1067 
1068  /* Get the number of Groups in the Domain */
1069  Status = SampGetNumberOfAccounts(DomainObject,
1070  L"Groups",
1071  &InfoBuffer->General.GroupCount);
1072  if (!NT_SUCCESS(Status))
1073  {
1074  TRACE("Status 0x%08lx\n", Status);
1075  goto done;
1076  }
1077 
1078  /* Get the number of Aliases in the Domain */
1079  Status = SampGetNumberOfAccounts(DomainObject,
1080  L"Aliases",
1081  &InfoBuffer->General.AliasCount);
1082  if (!NT_SUCCESS(Status))
1083  {
1084  TRACE("Status 0x%08lx\n", Status);
1085  goto done;
1086  }
1087 
1088  *Buffer = InfoBuffer;
1089 
1090 done:
1091  if (!NT_SUCCESS(Status))
1092  {
1093  if (InfoBuffer != NULL)
1094  {
1095  if (InfoBuffer->General.OemInformation.Buffer != NULL)
1097 
1098  if (InfoBuffer->General.DomainName.Buffer != NULL)
1099  midl_user_free(InfoBuffer->General.DomainName.Buffer);
1100 
1101  if (InfoBuffer->General.ReplicaSourceNodeName.Buffer != NULL)
1103 
1104  midl_user_free(InfoBuffer);
1105  }
1106  }
1107 
1108  return Status;
1109 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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:85
LARGE_INTEGER DomainModifiedCount
Definition: samsrv.h:73
RPC_UNICODE_STRING OemInformation
Definition: sam.idl:204
RPC_UNICODE_STRING DomainName
Definition: sam.idl:205
BOOLEAN UasCompatibilityRequired
Definition: samsrv.h:87
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
LARGE_INTEGER ForceLogoff
Definition: samsrv.h:76
SAMPR_DOMAIN_GENERAL_INFORMATION General
Definition: sam.idl:268
Status
Definition: gdiplustypes.h:24
#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:531
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
ULONG LowPart
Definition: typedefs.h:106
OLD_LARGE_INTEGER DomainModifiedCount
Definition: sam.idl:207
unsigned long LowPart
Definition: msv1_0.h:32
unsigned char UasCompatibilityRequired
Definition: sam.idl:210
#define NULL
Definition: types.h:112
unsigned long DomainServerRole
Definition: sam.idl:209
DOMAIN_SERVER_ROLE DomainServerRole
Definition: samsrv.h:86
static NTSTATUS SampGetNumberOfAccounts(PSAM_DB_OBJECT DomainObject, LPCWSTR AccountType, PULONG Count)
Definition: samrpc.c:960
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:24

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainGeneral2()

static NTSTATUS SampQueryDomainGeneral2 ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1404 of file samrpc.c.

1406 {
1407  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1408  SAM_DOMAIN_FIXED_DATA FixedData;
1409  ULONG Length = 0;
1410  NTSTATUS Status;
1411 
1412  *Buffer = NULL;
1413 
1414  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1415  if (InfoBuffer == NULL)
1417 
1418  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1419  Status = SampGetObjectAttribute(DomainObject,
1420  L"F",
1421  NULL,
1422  (PVOID)&FixedData,
1423  &Length);
1424  if (!NT_SUCCESS(Status))
1425  goto done;
1426 
1427  InfoBuffer->General2.I1.ForceLogoff.LowPart = FixedData.ForceLogoff.LowPart;
1428  InfoBuffer->General2.I1.ForceLogoff.HighPart = FixedData.ForceLogoff.HighPart;
1431  InfoBuffer->General2.I1.DomainServerState = FixedData.DomainServerState;
1432  InfoBuffer->General2.I1.DomainServerRole = FixedData.DomainServerRole;
1434 
1435  InfoBuffer->General2.LockoutDuration = FixedData.LockoutDuration;
1437  InfoBuffer->General2.LockoutThreshold = FixedData.LockoutThreshold;
1438 
1439  /* Get the OemInformation string */
1440  Status = SampGetObjectAttributeString(DomainObject,
1441  L"OemInformation",
1442  &InfoBuffer->General2.I1.OemInformation);
1443  if (!NT_SUCCESS(Status))
1444  {
1445  TRACE("Status 0x%08lx\n", Status);
1446  goto done;
1447  }
1448 
1449  /* Get the Name string */
1450  Status = SampGetObjectAttributeString(DomainObject,
1451  L"Name",
1452  &InfoBuffer->General2.I1.DomainName);
1453  if (!NT_SUCCESS(Status))
1454  {
1455  TRACE("Status 0x%08lx\n", Status);
1456  goto done;
1457  }
1458 
1459  /* Get the ReplicaSourceNodeName string */
1460  Status = SampGetObjectAttributeString(DomainObject,
1461  L"ReplicaSourceNodeName",
1462  &InfoBuffer->General2.I1.ReplicaSourceNodeName);
1463  if (!NT_SUCCESS(Status))
1464  {
1465  TRACE("Status 0x%08lx\n", Status);
1466  goto done;
1467  }
1468 
1469  /* Get the number of Users in the Domain */
1470  Status = SampGetNumberOfAccounts(DomainObject,
1471  L"Users",
1472  &InfoBuffer->General2.I1.UserCount);
1473  if (!NT_SUCCESS(Status))
1474  {
1475  TRACE("Status 0x%08lx\n", Status);
1476  goto done;
1477  }
1478 
1479  /* Get the number of Groups in the Domain */
1480  Status = SampGetNumberOfAccounts(DomainObject,
1481  L"Groups",
1482  &InfoBuffer->General2.I1.GroupCount);
1483  if (!NT_SUCCESS(Status))
1484  {
1485  TRACE("Status 0x%08lx\n", Status);
1486  goto done;
1487  }
1488 
1489  /* Get the number of Aliases in the Domain */
1490  Status = SampGetNumberOfAccounts(DomainObject,
1491  L"Aliases",
1492  &InfoBuffer->General2.I1.AliasCount);
1493  if (!NT_SUCCESS(Status))
1494  {
1495  TRACE("Status 0x%08lx\n", Status);
1496  goto done;
1497  }
1498 
1499  *Buffer = InfoBuffer;
1500 
1501 done:
1502  if (!NT_SUCCESS(Status))
1503  {
1504  if (InfoBuffer != NULL)
1505  {
1506  if (InfoBuffer->General2.I1.OemInformation.Buffer != NULL)
1508 
1509  if (InfoBuffer->General2.I1.DomainName.Buffer != NULL)
1511 
1512  if (InfoBuffer->General2.I1.ReplicaSourceNodeName.Buffer != NULL)
1514 
1515  midl_user_free(InfoBuffer);
1516  }
1517  }
1518 
1519  return Status;
1520 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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:85
LARGE_INTEGER DomainModifiedCount
Definition: samsrv.h:73
RPC_UNICODE_STRING OemInformation
Definition: sam.idl:204
RPC_UNICODE_STRING DomainName
Definition: sam.idl:205
BOOLEAN UasCompatibilityRequired
Definition: samsrv.h:87
#define L(x)
Definition: ntvdm.h:50
SAMPR_DOMAIN_GENERAL_INFORMATION I1
Definition: sam.idl:218
LARGE_INTEGER LockoutObservationWindow
Definition: samsrv.h:78
Definition: bufpool.h:45
LARGE_INTEGER ForceLogoff
Definition: samsrv.h:76
Status
Definition: gdiplustypes.h:24
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:531
LARGE_INTEGER LockoutDuration
Definition: samsrv.h:77
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
ULONG LowPart
Definition: typedefs.h:106
OLD_LARGE_INTEGER DomainModifiedCount
Definition: sam.idl:207
unsigned long LowPart
Definition: msv1_0.h:32
unsigned char UasCompatibilityRequired
Definition: sam.idl:210
#define NULL
Definition: types.h:112
SAMPR_DOMAIN_GENERAL_INFORMATION2 General2
Definition: sam.idl:276
USHORT LockoutThreshold
Definition: samsrv.h:84
unsigned long DomainServerRole
Definition: sam.idl:209
DOMAIN_SERVER_ROLE DomainServerRole
Definition: samsrv.h:86
static NTSTATUS SampGetNumberOfAccounts(PSAM_DB_OBJECT DomainObject, LPCWSTR AccountType, PULONG Count)
Definition: samrpc.c:960
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:24

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainLockout()

static NTSTATUS SampQueryDomainLockout ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1524 of file samrpc.c.

1526 {
1527  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1528  SAM_DOMAIN_FIXED_DATA FixedData;
1529  ULONG Length = 0;
1530  NTSTATUS Status;
1531 
1532  *Buffer = NULL;
1533 
1534  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1535  if (InfoBuffer == NULL)
1537 
1538  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1539  Status = SampGetObjectAttribute(DomainObject,
1540  L"F",
1541  NULL,
1542  (PVOID)&FixedData,
1543  &Length);
1544  if (!NT_SUCCESS(Status))
1545  goto done;
1546 
1547  InfoBuffer->Lockout.LockoutDuration = FixedData.LockoutDuration;
1549  InfoBuffer->Lockout.LockoutThreshold = FixedData.LockoutThreshold;
1550 
1551  *Buffer = InfoBuffer;
1552 
1553 done:
1554  if (!NT_SUCCESS(Status))
1555  {
1556  if (InfoBuffer != NULL)
1557  {
1558  midl_user_free(InfoBuffer);
1559  }
1560  }
1561 
1562  return Status;
1563 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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
#define L(x)
Definition: ntvdm.h:50
LARGE_INTEGER LockoutObservationWindow
Definition: samsrv.h:78
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned short LockoutThreshold
Definition: sam.idl:244
LARGE_INTEGER LockoutDuration
Definition: samsrv.h:77
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
LARGE_INTEGER LockoutDuration
Definition: sam.idl:242
#define NULL
Definition: types.h:112
USHORT LockoutThreshold
Definition: samsrv.h:84
unsigned int ULONG
Definition: retypes.h:1
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainLogoff()

static NTSTATUS SampQueryDomainLogoff ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1113 of file samrpc.c.

1115 {
1116  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1117  SAM_DOMAIN_FIXED_DATA FixedData;
1118  ULONG Length = 0;
1119  NTSTATUS Status;
1120 
1121  *Buffer = NULL;
1122 
1123  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1124  if (InfoBuffer == NULL)
1126 
1127  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1128  Status = SampGetObjectAttribute(DomainObject,
1129  L"F",
1130  NULL,
1131  (PVOID)&FixedData,
1132  &Length);
1133  if (!NT_SUCCESS(Status))
1134  goto done;
1135 
1136  InfoBuffer->Logoff.ForceLogoff.LowPart = FixedData.ForceLogoff.LowPart;
1137  InfoBuffer->Logoff.ForceLogoff.HighPart = FixedData.ForceLogoff.HighPart;
1138 
1139  *Buffer = InfoBuffer;
1140 
1141 done:
1142  if (!NT_SUCCESS(Status))
1143  {
1144  if (InfoBuffer != NULL)
1145  {
1146  midl_user_free(InfoBuffer);
1147  }
1148  }
1149 
1150  return Status;
1151 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
LARGE_INTEGER ForceLogoff
Definition: samsrv.h:76
DOMAIN_LOGOFF_INFORMATION Logoff
Definition: sam.idl:269
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
ULONG LowPart
Definition: typedefs.h:106
LARGE_INTEGER ForceLogoff
Definition: ntsam.h:399
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainModified()

static NTSTATUS SampQueryDomainModified ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1319 of file samrpc.c.

1321 {
1322  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1323  SAM_DOMAIN_FIXED_DATA FixedData;
1324  ULONG Length = 0;
1325  NTSTATUS Status;
1326 
1327  *Buffer = NULL;
1328 
1329  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1330  if (InfoBuffer == NULL)
1332 
1333  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1334  Status = SampGetObjectAttribute(DomainObject,
1335  L"F",
1336  NULL,
1337  (PVOID)&FixedData,
1338  &Length);
1339  if (!NT_SUCCESS(Status))
1340  goto done;
1341 
1344  InfoBuffer->Modified.CreationTime.LowPart = FixedData.CreationTime.LowPart;
1345  InfoBuffer->Modified.CreationTime.HighPart = FixedData.CreationTime.HighPart;
1346 
1347  *Buffer = InfoBuffer;
1348 
1349 done:
1350  if (!NT_SUCCESS(Status))
1351  {
1352  if (InfoBuffer != NULL)
1353  {
1354  midl_user_free(InfoBuffer);
1355  }
1356  }
1357 
1358  return Status;
1359 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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:73
LARGE_INTEGER CreationTime
Definition: ntsam.h:425
#define L(x)
Definition: ntvdm.h:50
DOMAIN_MODIFIED_INFORMATION Modified
Definition: sam.idl:274
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
ULONG LowPart
Definition: typedefs.h:106
#define NULL
Definition: types.h:112
LARGE_INTEGER DomainModifiedCount
Definition: ntsam.h:424
LARGE_INTEGER CreationTime
Definition: samsrv.h:72
unsigned int ULONG
Definition: retypes.h:1
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainModified2()

static NTSTATUS SampQueryDomainModified2 ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1567 of file samrpc.c.

1569 {
1570  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1571  SAM_DOMAIN_FIXED_DATA FixedData;
1572  ULONG Length = 0;
1573  NTSTATUS Status;
1574 
1575  *Buffer = NULL;
1576 
1577  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1578  if (InfoBuffer == NULL)
1580 
1581  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1582  Status = SampGetObjectAttribute(DomainObject,
1583  L"F",
1584  NULL,
1585  (PVOID)&FixedData,
1586  &Length);
1587  if (!NT_SUCCESS(Status))
1588  goto done;
1589 
1592  InfoBuffer->Modified2.CreationTime.LowPart = FixedData.CreationTime.LowPart;
1593  InfoBuffer->Modified2.CreationTime.HighPart = FixedData.CreationTime.HighPart;
1596 
1597  *Buffer = InfoBuffer;
1598 
1599 done:
1600  if (!NT_SUCCESS(Status))
1601  {
1602  if (InfoBuffer != NULL)
1603  {
1604  midl_user_free(InfoBuffer);
1605  }
1606  }
1607 
1608  return Status;
1609 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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:73
#define L(x)
Definition: ntvdm.h:50
LARGE_INTEGER DomainModifiedCount
Definition: ntsam.h:457
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
LARGE_INTEGER CreationTime
Definition: ntsam.h:458
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
ULONG LowPart
Definition: typedefs.h:106
DOMAIN_MODIFIED_INFORMATION2 Modified2
Definition: sam.idl:278
#define NULL
Definition: types.h:112
LARGE_INTEGER ModifiedCountAtLastPromotion
Definition: samsrv.h:79
LARGE_INTEGER CreationTime
Definition: samsrv.h:72
unsigned int ULONG
Definition: retypes.h:1
LARGE_INTEGER ModifiedCountAtLastPromotion
Definition: ntsam.h:459
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainName()

static NTSTATUS SampQueryDomainName ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1196 of file samrpc.c.

1198 {
1199  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1200  NTSTATUS Status;
1201 
1202  *Buffer = NULL;
1203 
1204  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1205  if (InfoBuffer == NULL)
1207 
1208  /* Get the Name string */
1209  Status = SampGetObjectAttributeString(DomainObject,
1210  L"Name",
1211  &InfoBuffer->Name.DomainName);
1212  if (!NT_SUCCESS(Status))
1213  {
1214  TRACE("Status 0x%08lx\n", Status);
1215  goto done;
1216  }
1217 
1218  *Buffer = InfoBuffer;
1219 
1220 done:
1221  if (!NT_SUCCESS(Status))
1222  {
1223  if (InfoBuffer != NULL)
1224  {
1225  if (InfoBuffer->Name.DomainName.Buffer != NULL)
1226  midl_user_free(InfoBuffer->Name.DomainName.Buffer);
1227 
1228  midl_user_free(InfoBuffer);
1229  }
1230  }
1231 
1232  return Status;
1233 }
#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
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#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:531
#define NULL
Definition: types.h:112
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:24

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainOem()

static NTSTATUS SampQueryDomainOem ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1155 of file samrpc.c.

1157 {
1158  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1159  NTSTATUS Status;
1160 
1161  *Buffer = NULL;
1162 
1163  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1164  if (InfoBuffer == NULL)
1166 
1167  /* Get the OemInformation string */
1168  Status = SampGetObjectAttributeString(DomainObject,
1169  L"OemInformation",
1170  &InfoBuffer->Oem.OemInformation);
1171  if (!NT_SUCCESS(Status))
1172  {
1173  TRACE("Status 0x%08lx\n", Status);
1174  goto done;
1175  }
1176 
1177  *Buffer = InfoBuffer;
1178 
1179 done:
1180  if (!NT_SUCCESS(Status))
1181  {
1182  if (InfoBuffer != NULL)
1183  {
1184  if (InfoBuffer->Oem.OemInformation.Buffer != NULL)
1185  midl_user_free(InfoBuffer->Oem.OemInformation.Buffer);
1186 
1187  midl_user_free(InfoBuffer);
1188  }
1189  }
1190 
1191  return Status;
1192 }
#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
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#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:531
RPC_UNICODE_STRING OemInformation
Definition: sam.idl:227
#define NULL
Definition: types.h:112
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:24

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainPassword()

static NTSTATUS SampQueryDomainPassword ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 913 of file samrpc.c.

915 {
916  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
917  SAM_DOMAIN_FIXED_DATA FixedData;
918  ULONG Length = 0;
920 
921  *Buffer = NULL;
922 
923  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
924  if (InfoBuffer == NULL)
926 
927  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
928  Status = SampGetObjectAttribute(DomainObject,
929  L"F",
930  NULL,
931  (PVOID)&FixedData,
932  &Length);
933  if (!NT_SUCCESS(Status))
934  goto done;
935 
936  InfoBuffer->Password.MinPasswordLength = FixedData.MinPasswordLength;
937  InfoBuffer->Password.PasswordHistoryLength = FixedData.PasswordHistoryLength;
938  InfoBuffer->Password.PasswordProperties = FixedData.PasswordProperties;
939  InfoBuffer->Password.MaxPasswordAge.LowPart = FixedData.MaxPasswordAge.LowPart;
940  InfoBuffer->Password.MaxPasswordAge.HighPart = FixedData.MaxPasswordAge.HighPart;
941  InfoBuffer->Password.MinPasswordAge.LowPart = FixedData.MinPasswordAge.LowPart;
942  InfoBuffer->Password.MinPasswordAge.HighPart = FixedData.MinPasswordAge.HighPart;
943 
944  *Buffer = InfoBuffer;
945 
946 done:
947  if (!NT_SUCCESS(Status))
948  {
949  if (InfoBuffer != NULL)
950  {
951  midl_user_free(InfoBuffer);
952  }
953  }
954 
955  return Status;
956 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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:82
LONG NTSTATUS
Definition: precomp.h:26
LARGE_INTEGER MinPasswordAge
Definition: samsrv.h:75
#define L(x)
Definition: ntvdm.h:50
ULONG PasswordProperties
Definition: samsrv.h:81
LARGE_INTEGER MinPasswordAge
Definition: ntsam.h:376
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
DOMAIN_PASSWORD_INFORMATION Password
Definition: sam.idl:267
LARGE_INTEGER MaxPasswordAge
Definition: ntsam.h:375
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
ULONG LowPart
Definition: typedefs.h:106
LARGE_INTEGER MaxPasswordAge
Definition: samsrv.h:74
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
USHORT PasswordHistoryLength
Definition: samsrv.h:83
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainReplication()

static NTSTATUS SampQueryDomainReplication ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1237 of file samrpc.c.

1239 {
1240  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1241  NTSTATUS Status;
1242 
1243  *Buffer = NULL;
1244 
1245  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1246  if (InfoBuffer == NULL)
1248 
1249  /* Get the ReplicaSourceNodeName string */
1250  Status = SampGetObjectAttributeString(DomainObject,
1251  L"ReplicaSourceNodeName",
1252  &InfoBuffer->Replication.ReplicaSourceNodeName);
1253  if (!NT_SUCCESS(Status))
1254  {
1255  TRACE("Status 0x%08lx\n", Status);
1256  goto done;
1257  }
1258 
1259  *Buffer = InfoBuffer;
1260 
1261 done:
1262  if (!NT_SUCCESS(Status))
1263  {
1264  if (InfoBuffer != NULL)
1265  {
1266  if (InfoBuffer->Replication.ReplicaSourceNodeName.Buffer != NULL)
1268 
1269  midl_user_free(InfoBuffer);
1270  }
1271  }
1272 
1273  return Status;
1274 }
#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
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#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:531
RPC_UNICODE_STRING ReplicaSourceNodeName
Definition: sam.idl:237
#define NULL
Definition: types.h:112
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:24

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainServerRole()

static NTSTATUS SampQueryDomainServerRole ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1278 of file samrpc.c.

1280 {
1281  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1282  SAM_DOMAIN_FIXED_DATA FixedData;
1283  ULONG Length = 0;
1284  NTSTATUS Status;
1285 
1286  *Buffer = NULL;
1287 
1288  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1289  if (InfoBuffer == NULL)
1291 
1292  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1293  Status = SampGetObjectAttribute(DomainObject,
1294  L"F",
1295  NULL,
1296  (PVOID)&FixedData,
1297  &Length);
1298  if (!NT_SUCCESS(Status))
1299  goto done;
1300 
1301  InfoBuffer->Role.DomainServerRole = FixedData.DomainServerRole;
1302 
1303  *Buffer = InfoBuffer;
1304 
1305 done:
1306  if (!NT_SUCCESS(Status))
1307  {
1308  if (InfoBuffer != NULL)
1309  {
1310  midl_user_free(InfoBuffer);
1311  }
1312  }
1313 
1314  return Status;
1315 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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:419
LONG NTSTATUS
Definition: precomp.h:26
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
#define NULL
Definition: types.h:112
DOMAIN_SERVER_ROLE_INFORMATION Role
Definition: sam.idl:272
DOMAIN_SERVER_ROLE DomainServerRole
Definition: samsrv.h:86
unsigned int ULONG
Definition: retypes.h:1
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationDomain2().

◆ SampQueryDomainState()

static NTSTATUS SampQueryDomainState ( PSAM_DB_OBJECT  DomainObject,
PSAMPR_DOMAIN_INFO_BUFFER Buffer 
)
static

Definition at line 1363 of file samrpc.c.

1365 {
1366  PSAMPR_DOMAIN_INFO_BUFFER InfoBuffer = NULL;
1367  SAM_DOMAIN_FIXED_DATA FixedData;
1368  ULONG Length = 0;
1369  NTSTATUS Status;
1370 
1371  *Buffer = NULL;
1372 
1373  InfoBuffer = midl_user_allocate(sizeof(SAMPR_DOMAIN_INFO_BUFFER));
1374  if (InfoBuffer == NULL)
1376 
1377  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
1378  Status = SampGetObjectAttribute(DomainObject,
1379  L"F",
1380  NULL,
1381  (PVOID)&FixedData,
1382  &Length);
1383  if (!NT_SUCCESS(Status))
1384  goto done;
1385 
1386  InfoBuffer->State.DomainServerState = FixedData.DomainServerState;
1387 
1388  *Buffer = InfoBuffer;
1389 
1390 done:
1391  if (!NT_SUCCESS(Status))
1392  {
1393  if (InfoBuffer != NULL)
1394  {
1395  midl_user_free(InfoBuffer);
1396  }
1397  }
1398 
1399  return Status;
1400 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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:430
LONG NTSTATUS
Definition: precomp.h:26
DOMAIN_STATE_INFORMATION State
Definition: sam.idl:275
DOMAIN_SERVER_ENABLE_STATE DomainServerState
Definition: samsrv.h:85
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationDomain2().

◆ SampQueryGroupAdminComment()

static NTSTATUS SampQueryGroupAdminComment ( PSAM_DB_OBJECT  GroupObject,
PSAMPR_GROUP_INFO_BUFFER Buffer 
)
static

Definition at line 4210 of file samrpc.c.

4212 {
4213  PSAMPR_GROUP_INFO_BUFFER InfoBuffer = NULL;
4214  NTSTATUS Status;
4215 
4216  *Buffer = NULL;
4217 
4218  InfoBuffer = midl_user_allocate(sizeof(SAMPR_GROUP_INFO_BUFFER));
4219  if (InfoBuffer == NULL)
4221 
4222  Status = SampGetObjectAttributeString(GroupObject,
4223  L"AdminComment",
4224  &InfoBuffer->AdminComment.AdminComment);
4225  if (!NT_SUCCESS(Status))
4226  {
4227  TRACE("Status 0x%08lx\n", Status);
4228  goto done;
4229  }
4230 
4231  *Buffer = InfoBuffer;
4232 
4233 done:
4234  if (!NT_SUCCESS(Status))
4235  {
4236  if (InfoBuffer != NULL)
4237  {
4238  if (InfoBuffer->AdminComment.AdminComment.Buffer != NULL)
4240 
4241  midl_user_free(InfoBuffer);
4242  }
4243  }
4244 
4245  return Status;
4246 }
#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
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
SAMPR_GROUP_ADM_COMMENT_INFORMATION AdminComment
Definition: sam.idl:411
Status
Definition: gdiplustypes.h:24
#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:531
#define NULL
Definition: types.h:112
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:24

Referenced by SamrQueryInformationGroup().

◆ SampQueryGroupAttribute()

static NTSTATUS SampQueryGroupAttribute ( PSAM_DB_OBJECT  GroupObject,
PSAMPR_GROUP_INFO_BUFFER Buffer 
)
static

Definition at line 4166 of file samrpc.c.

4168 {
4169  PSAMPR_GROUP_INFO_BUFFER InfoBuffer = NULL;
4170  SAM_GROUP_FIXED_DATA FixedData;
4171  ULONG Length = 0;
4172  NTSTATUS Status;
4173 
4174  *Buffer = NULL;
4175 
4176  InfoBuffer = midl_user_allocate(sizeof(SAMPR_GROUP_INFO_BUFFER));
4177  if (InfoBuffer == NULL)
4179 
4180  Length = sizeof(SAM_GROUP_FIXED_DATA);
4181  Status = SampGetObjectAttribute(GroupObject,
4182  L"F",
4183  NULL,
4184  (PVOID)&FixedData,
4185  &Length);
4186  if (!NT_SUCCESS(Status))
4187  {
4188  TRACE("Status 0x%08lx\n", Status);
4189  goto done;
4190  }
4191 
4192  InfoBuffer->Attribute.Attributes = FixedData.Attributes;
4193 
4194  *Buffer = InfoBuffer;
4195 
4196 done:
4197  if (!NT_SUCCESS(Status))
4198  {
4199  if (InfoBuffer != NULL)
4200  {
4201  midl_user_free(InfoBuffer);
4202  }
4203  }
4204 
4205  return Status;
4206 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _SAM_GROUP_FIXED_DATA SAM_GROUP_FIXED_DATA
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
#define NULL
Definition: types.h:112
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 4036 of file samrpc.c.

4038 {
4039  PSAMPR_GROUP_INFO_BUFFER InfoBuffer = NULL;
4040  SAM_GROUP_FIXED_DATA FixedData;
4041  ULONG MembersLength = 0;
4042  ULONG Length = 0;
4043  NTSTATUS Status;
4044 
4045  *Buffer = NULL;
4046 
4047  InfoBuffer = midl_user_allocate(sizeof(SAMPR_GROUP_INFO_BUFFER));
4048  if (InfoBuffer == NULL)
4050 
4051  Status = SampGetObjectAttributeString(GroupObject,
4052  L"Name",
4053  &InfoBuffer->General.Name);
4054  if (!NT_SUCCESS(Status))
4055  {
4056  TRACE("Status 0x%08lx\n", Status);
4057  goto done;
4058  }
4059 
4060  Status = SampGetObjectAttributeString(GroupObject,
4061  L"AdminComment",
4062  &InfoBuffer->General.AdminComment);
4063  if (!NT_SUCCESS(Status))
4064  {
4065  TRACE("Status 0x%08lx\n", Status);
4066  goto done;
4067  }
4068 
4069  Length = sizeof(SAM_GROUP_FIXED_DATA);
4070  Status = SampGetObjectAttribute(GroupObject,
4071  L"F",
4072  NULL,
4073  (PVOID)&FixedData,
4074  &Length);
4075  if (!NT_SUCCESS(Status))
4076  {
4077  TRACE("Status 0x%08lx\n", Status);
4078  goto done;
4079  }
4080 
4081  InfoBuffer->General.Attributes = FixedData.Attributes;
4082 
4083  Status = SampGetObjectAttribute(GroupObject,
4084  L"Members",
4085  NULL,
4086  NULL,
4087  &MembersLength);
4089  {
4090  TRACE("Status 0x%08lx\n", Status);
4091  goto done;
4092  }
4093 
4095  {
4096  InfoBuffer->General.MemberCount = 0;
4098  }
4099  else
4100  {
4101  InfoBuffer->General.MemberCount = MembersLength / sizeof(ULONG);
4102  }
4103 
4104  *Buffer = InfoBuffer;
4105 
4106 done:
4107  if (!NT_SUCCESS(Status))
4108  {
4109  if (InfoBuffer != NULL)
4110  {
4111  if (InfoBuffer->General.Name.Buffer != NULL)
4112  midl_user_free(InfoBuffer->General.Name.Buffer);
4113 
4114  if (InfoBuffer->General.AdminComment.Buffer != NULL)
4116 
4117  midl_user_free(InfoBuffer);
4118  }
4119  }
4120 
4121  return Status;
4122 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
#define L(x)
Definition: ntvdm.h:50
RPC_UNICODE_STRING Name
Definition: sam.idl:379
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#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:531
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
RPC_UNICODE_STRING AdminComment
Definition: sam.idl:382
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:24

Referenced by SamrQueryInformationGroup().

◆ SampQueryGroupName()

static NTSTATUS SampQueryGroupName ( PSAM_DB_OBJECT  GroupObject,
PSAMPR_GROUP_INFO_BUFFER Buffer 
)
static

Definition at line 4126 of file samrpc.c.

4128 {
4129  PSAMPR_GROUP_INFO_BUFFER InfoBuffer = NULL;
4130  NTSTATUS Status;
4131 
4132  *Buffer = NULL;
4133 
4134  InfoBuffer = midl_user_allocate(sizeof(SAMPR_GROUP_INFO_BUFFER));
4135  if (InfoBuffer == NULL)
4137 
4138  Status = SampGetObjectAttributeString(GroupObject,
4139  L"Name",
4140  &InfoBuffer->Name.Name);
4141  if (!NT_SUCCESS(Status))
4142  {
4143  TRACE("Status 0x%08lx\n", Status);
4144  goto done;
4145  }
4146 
4147  *Buffer = InfoBuffer;
4148 
4149 done:
4150  if (!NT_SUCCESS(Status))
4151  {
4152  if (InfoBuffer != NULL)
4153  {
4154  if (InfoBuffer->Name.Name.Buffer != NULL)
4155  midl_user_free(InfoBuffer->Name.Name.Buffer);
4156 
4157  midl_user_free(InfoBuffer);
4158  }
4159  }
4160 
4161  return Status;
4162 }
#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
#define L(x)
Definition: ntvdm.h:50
SAMPR_GROUP_NAME_INFORMATION Name
Definition: sam.idl:409
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#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:531
#define NULL
Definition: types.h:112
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:24

Referenced by SamrQueryInformationGroup().

◆ SampQueryUserAccount()

static NTSTATUS SampQueryUserAccount ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 5876 of file samrpc.c.

5878 {
5879  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
5880  SAM_USER_FIXED_DATA FixedData;
5881  ULONG Length = 0;
5882  NTSTATUS Status;
5883 
5884  *Buffer = NULL;
5885 
5886  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
5887  if (InfoBuffer == NULL)
5889 
5890  Length = sizeof(SAM_USER_FIXED_DATA);
5891  Status = SampGetObjectAttribute(UserObject,
5892  L"F",
5893  NULL,
5894  (PVOID)&FixedData,
5895  &Length);
5896  if (!NT_SUCCESS(Status))
5897  goto done;
5898 
5899  InfoBuffer->Account.UserId = FixedData.UserId;
5900  InfoBuffer->Account.PrimaryGroupId = FixedData.PrimaryGroupId;
5901  InfoBuffer->Account.LastLogon.LowPart = FixedData.LastLogon.LowPart;
5902  InfoBuffer->Account.LastLogon.HighPart = FixedData.LastLogon.HighPart;
5903  InfoBuffer->Account.LastLogoff.LowPart = FixedData.LastLogoff.LowPart;
5904  InfoBuffer->Account.LastLogoff.HighPart = FixedData.LastLogoff.HighPart;
5905  InfoBuffer->Account.PasswordLastSet.LowPart = FixedData.PasswordLastSet.LowPart;
5906  InfoBuffer->Account.PasswordLastSet.HighPart = FixedData.PasswordLastSet.HighPart;
5907  InfoBuffer->Account.AccountExpires.LowPart = FixedData.AccountExpires.LowPart;
5908  InfoBuffer->Account.AccountExpires.HighPart = FixedData.AccountExpires.HighPart;
5909  InfoBuffer->Account.BadPasswordCount = FixedData.BadPasswordCount;
5910  InfoBuffer->Account.LogonCount = FixedData.LogonCount;
5911  InfoBuffer->Account.UserAccountControl = FixedData.UserAccountControl;
5912 
5913  /* Get the Name string */
5914  Status = SampGetObjectAttributeString(UserObject,
5915  L"Name",
5916  &InfoBuffer->Account.UserName);
5917  if (!NT_SUCCESS(Status))
5918  {
5919  TRACE("Status 0x%08lx\n", Status);
5920  goto done;
5921  }
5922 
5923  /* Get the FullName string */
5924  Status = SampGetObjectAttributeString(UserObject,
5925  L"FullName",
5926  &InfoBuffer->Account.FullName);
5927  if (!NT_SUCCESS(Status))
5928  {
5929  TRACE("Status 0x%08lx\n", Status);
5930  goto done;
5931  }
5932 
5933  /* Get the HomeDirectory string */
5934  Status = SampGetObjectAttributeString(UserObject,
5935  L"HomeDirectory",
5936  &InfoBuffer->Account.HomeDirectory);
5937  if (!NT_SUCCESS(Status))
5938  {
5939  TRACE("Status 0x%08lx\n", Status);
5940  goto done;
5941  }
5942 
5943  /* Get the HomeDirectoryDrive string */
5944  Status = SampGetObjectAttributeString(UserObject,
5945  L"HomeDirectoryDrive",
5946  &InfoBuffer->Account.HomeDirectoryDrive);
5947  if (!NT_SUCCESS(Status))
5948  {
5949  TRACE("Status 0x%08lx\n", Status);
5950  goto done;
5951  }
5952 
5953  /* Get the ScriptPath string */
5954  Status = SampGetObjectAttributeString(UserObject,
5955  L"ScriptPath",
5956  &InfoBuffer->Account.ScriptPath);
5957  if (!NT_SUCCESS(Status))
5958  {
5959  TRACE("Status 0x%08lx\n", Status);
5960  goto done;
5961  }
5962 
5963  /* Get the ProfilePath string */
5964  Status = SampGetObjectAttributeString(UserObject,
5965  L"ProfilePath",
5966  &InfoBuffer->Account.ProfilePath);
5967  if (!NT_SUCCESS(Status))
5968  {
5969  TRACE("Status 0x%08lx\n", Status);
5970  goto done;
5971  }
5972 
5973  /* Get the AdminComment string */
5974  Status = SampGetObjectAttributeString(UserObject,
5975  L"AdminComment",
5976  &InfoBuffer->Account.AdminComment);
5977  if (!NT_SUCCESS(Status))
5978  {
5979  TRACE("Status 0x%08lx\n", Status);
5980  goto done;
5981  }
5982 
5983  /* Get the WorkStations string */
5984  Status = SampGetObjectAttributeString(UserObject,
5985  L"WorkStations",
5986  &InfoBuffer->Account.WorkStations);
5987  if (!NT_SUCCESS(Status))
5988  {
5989  TRACE("Status 0x%08lx\n", Status);
5990  goto done;
5991  }
5992 
5993  /* Get the LogonHours attribute */
5994  Status = SampGetLogonHoursAttribute(UserObject,
5995  &InfoBuffer->Account.LogonHours);
5996  if (!NT_SUCCESS(Status))
5997  {
5998  TRACE("Status 0x%08lx\n", Status);
5999  goto done;
6000  }
6001 
6002  *Buffer = InfoBuffer;
6003 
6004 done:
6005  if (!NT_SUCCESS(Status))
6006  {
6007  if (InfoBuffer != NULL)
6008  {
6009  if (InfoBuffer->Account.UserName.Buffer != NULL)
6010  midl_user_free(InfoBuffer->Account.UserName.Buffer);
6011 
6012  if (InfoBuffer->Account.FullName.Buffer != NULL)
6013  midl_user_free(InfoBuffer->Account.FullName.Buffer);
6014 
6015  if (InfoBuffer->Account.HomeDirectory.Buffer != NULL)
6017 
6018  if (InfoBuffer->Account.HomeDirectoryDrive.Buffer != NULL)
6020 
6021  if (InfoBuffer->Account.ScriptPath.Buffer != NULL)
6022  midl_user_free(InfoBuffer->Account.ScriptPath.Buffer);
6023 
6024  if (InfoBuffer->Account.ProfilePath.Buffer != NULL)
6026 
6027  if (InfoBuffer->Account.AdminComment.Buffer != NULL)
6029 
6030  if (InfoBuffer->Account.WorkStations.Buffer != NULL)
6032 
6033  if (InfoBuffer->Account.LogonHours.LogonHours != NULL)
6035 
6036  midl_user_free(InfoBuffer);
6037  }
6038  }
6039 
6040  return Status;
6041 }
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
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
LARGE_INTEGER AccountExpires
Definition: samsrv.h:105
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:108
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
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
SAMPR_LOGON_HOURS LogonHours
Definition: sam.idl:576
SAMPR_USER_ACCOUNT_INFORMATION Account
Definition: sam.idl:725
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
LARGE_INTEGER PasswordLastSet
Definition: samsrv.h:104
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:531
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:516
ULONG LowPart
Definition: typedefs.h:106
RPC_UNICODE_STRING HomeDirectoryDrive
Definition: sam.idl:569
LARGE_INTEGER LastLogon
Definition: samsrv.h:102
RPC_UNICODE_STRING UserName
Definition: sam.idl:564
USHORT BadPasswordCount
Definition: samsrv.h:112
OLD_LARGE_INTEGER LastLogon
Definition: sam.idl:574
unsigned long PrimaryGroupId
Definition: sam.idl:567
unsigned long LowPart
Definition: msv1_0.h:32
#define NULL
Definition: types.h:112
ULONG UserAccountControl
Definition: samsrv.h:109
unsigned int ULONG
Definition: retypes.h:1
unsigned char * LogonHours
Definition: msv1_0.h:63
RPC_UNICODE_STRING WorkStations
Definition: sam.idl:573
LARGE_INTEGER LastLogoff
Definition: samsrv.h:103
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:24
OLD_LARGE_INTEGER AccountExpires
Definition: sam.idl:580

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserAccountName()

static NTSTATUS SampQueryUserAccountName ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6145 of file samrpc.c.

6147 {
6148  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6149  NTSTATUS Status;
6150 
6151  *Buffer = NULL;
6152 
6153  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6154  if (InfoBuffer == NULL)
6156 
6157  /* Get the Name string */
6158  Status = SampGetObjectAttributeString(UserObject,
6159  L"Name",
6160  &InfoBuffer->AccountName.UserName);
6161  if (!NT_SUCCESS(Status))
6162  {
6163  TRACE("Status 0x%08lx\n", Status);
6164  goto done;
6165  }
6166 
6167  *Buffer = InfoBuffer;
6168 
6169 done:
6170  if (!NT_SUCCESS(Status))
6171  {
6172  if (InfoBuffer != NULL)
6173  {
6174  if (InfoBuffer->AccountName.UserName.Buffer != NULL)
6176 
6177  midl_user_free(InfoBuffer);
6178  }
6179  }
6180 
6181  return Status;
6182 }
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
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#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:531
#define NULL
Definition: types.h:112
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:24

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserAdminComment()

static NTSTATUS SampQueryUserAdminComment ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6405 of file samrpc.c.

6407 {
6408  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6409  NTSTATUS Status;
6410 
6411  *Buffer = NULL;
6412 
6413  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6414  if (InfoBuffer == NULL)
6416 
6417  /* Get the AdminComment string */
6418  Status = SampGetObjectAttributeString(UserObject,
6419  L"AdminComment",
6420  &InfoBuffer->AdminComment.AdminComment);
6421  if (!NT_SUCCESS(Status))
6422  {
6423  TRACE("Status 0x%08lx\n", Status);
6424  goto done;
6425  }
6426 
6427  *Buffer = InfoBuffer;
6428 
6429 done:
6430  if (!NT_SUCCESS(Status))
6431  {
6432  if (InfoBuffer != NULL)
6433  {
6434  if (InfoBuffer->AdminComment.AdminComment.Buffer != NULL)
6436 
6437  midl_user_free(InfoBuffer);
6438  }
6439  }
6440 
6441  return Status;
6442 }
#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
#define L(x)
Definition: ntvdm.h:50
RPC_UNICODE_STRING AdminComment
Definition: sam.idl:618
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#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:531
SAMPR_USER_ADMIN_COMMENT_INFORMATION AdminComment
Definition: sam.idl:733
#define NULL
Definition: types.h:112
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:24

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserAll()

static NTSTATUS SampQueryUserAll ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6749 of file samrpc.c.

6751 {
6752  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6753  SAM_DOMAIN_FIXED_DATA DomainFixedData;
6754  SAM_USER_FIXED_DATA FixedData;
6755  LARGE_INTEGER PasswordCanChange;
6756  LARGE_INTEGER PasswordMustChange;
6757  ULONG Length = 0;
6758  NTSTATUS Status;
6759 
6760  *Buffer = NULL;
6761 
6762  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6763  if (InfoBuffer == NULL)
6765 
6766  /* Get the fixed size domain data */
6767  Length = sizeof(SAM_DOMAIN_FIXED_DATA);
6769  L"F",
6770  NULL,
6771  (PVOID)&DomainFixedData,
6772  &Length);
6773  if (!NT_SUCCESS(Status))
6774  goto done;
6775 
6776  /* Get the fixed size user data */
6777  Length = sizeof(SAM_USER_FIXED_DATA);
6778  Status = SampGetObjectAttribute(UserObject,
6779  L"F",
6780  NULL,
6781  (PVOID)&FixedData,
6782  &Length);
6783  if (!NT_SUCCESS(Status))
6784  goto done;
6785 
6786  /* Set the fields to be returned */
6787  if (UserObject->Trusted)
6788  {
6794  }
6795  else
6796  {
6797  InfoBuffer->All.WhichFields = 0;
6798 
6799  if (UserObject->Access & USER_READ_GENERAL)
6801 
6802  if (UserObject->Access & USER_READ_LOGON)
6803  InfoBuffer->All.WhichFields |= USER_ALL_READ_LOGON_MASK;
6804 
6805  if (UserObject->Access & USER_READ_ACCOUNT)
6807 
6808  if (UserObject->Access & USER_READ_PREFERENCES)
6810  }
6811 
6812  /* Fail, if no fields are to be returned */
6813  if (InfoBuffer->All.WhichFields == 0)
6814  {
6816  goto done;
6817  }
6818 
6819  /* Get the UserName attribute */
6820  if (InfoBuffer->All.WhichFields & USER_ALL_USERNAME)
6821  {
6822  Status = SampGetObjectAttributeString(UserObject,
6823  L"Name",
6824  &InfoBuffer->All.UserName);
6825  if (!NT_SUCCESS(Status))
6826  {
6827  TRACE("Status 0x%08lx\n", Status);
6828  goto done;
6829  }
6830  }
6831 
6832  /* Get the FullName attribute */
6833  if (InfoBuffer->All.WhichFields & USER_ALL_FULLNAME)
6834  {
6835  Status = SampGetObjectAttributeString(UserObject,
6836  L"FullName",
6837  &InfoBuffer->All.FullName);
6838  if (!NT_SUCCESS(Status))
6839  {
6840  TRACE("Status 0x%08lx\n", Status);
6841  goto done;
6842  }
6843  }
6844 
6845  /* Get the UserId attribute */
6846  if (InfoBuffer->All.WhichFields & USER_ALL_USERID)
6847  {
6848  InfoBuffer->All.UserId = FixedData.UserId;
6849  }
6850 
6851  /* Get the PrimaryGroupId attribute */
6852  if (InfoBuffer->All.WhichFields & USER_ALL_PRIMARYGROUPID)
6853  {
6854  InfoBuffer->All.PrimaryGroupId = FixedData.PrimaryGroupId;
6855  }
6856 
6857  /* Get the AdminComment attribute */
6858  if (InfoBuffer->All.WhichFields & USER_ALL_ADMINCOMMENT)
6859  {
6860  Status = SampGetObjectAttributeString(UserObject,
6861  L"AdminComment",
6862  &InfoBuffer->All.AdminComment);
6863  if (!NT_SUCCESS(Status))
6864  {
6865  TRACE("Status 0x%08lx\n", Status);
6866  goto done;
6867  }
6868  }
6869 
6870  /* Get the UserComment attribute */
6871  if (InfoBuffer->All.WhichFields & USER_ALL_USERCOMMENT)
6872  {
6873  Status = SampGetObjectAttributeString(UserObject,
6874  L"UserComment",
6875  &InfoBuffer->All.UserComment);
6876  if (!NT_SUCCESS(Status))
6877  {
6878  TRACE("Status 0x%08lx\n", Status);
6879  goto done;
6880  }
6881  }
6882 
6883  /* Get the HomeDirectory attribute */
6884  if (InfoBuffer->All.WhichFields & USER_ALL_HOMEDIRECTORY)
6885  {
6886  Status = SampGetObjectAttributeString(UserObject,
6887  L"HomeDirectory",
6888  &InfoBuffer->All.HomeDirectory);
6889  if (!NT_SUCCESS(Status))
6890  {
6891  TRACE("Status 0x%08lx\n", Status);
6892  goto done;
6893  }
6894  }
6895 
6896  /* Get the HomeDirectoryDrive attribute */
6897  if (InfoBuffer->All.WhichFields & USER_ALL_HOMEDIRECTORYDRIVE)
6898  {
6899  Status = SampGetObjectAttributeString(UserObject,
6900  L"HomeDirectoryDrive",
6901  &InfoBuffer->Home.HomeDirectoryDrive);
6902  if (!NT_SUCCESS(Status))
6903  {
6904  TRACE("Status 0x%08lx\n", Status);
6905  goto done;
6906  }
6907  }
6908 
6909  /* Get the ScriptPath attribute */
6910  if (InfoBuffer->All.WhichFields & USER_ALL_SCRIPTPATH)
6911  {
6912  Status = SampGetObjectAttributeString(UserObject,
6913  L"ScriptPath",
6914  &InfoBuffer->All.ScriptPath);
6915  if (!NT_SUCCESS(Status))
6916  {
6917  TRACE("Status 0x%08lx\n", Status);
6918  goto done;
6919  }
6920  }
6921 
6922  /* Get the ProfilePath attribute */
6923  if (InfoBuffer->All.WhichFields & USER_ALL_PROFILEPATH)
6924  {
6925  Status = SampGetObjectAttributeString(UserObject,
6926  L"ProfilePath",
6927  &InfoBuffer->All.ProfilePath);
6928  if (!NT_SUCCESS(Status))
6929  {
6930  TRACE("Status 0x%08lx\n", Status);
6931  goto done;
6932  }
6933  }
6934 
6935  /* Get the WorkStations attribute */
6936  if (InfoBuffer->All.WhichFields & USER_ALL_WORKSTATIONS)
6937  {
6938  Status = SampGetObjectAttributeString(UserObject,
6939  L"WorkStations",
6940  &InfoBuffer->All.WorkStations);
6941  if (!NT_SUCCESS(Status))
6942  {
6943  TRACE("Status 0x%08lx\n", Status);
6944  goto done;
6945  }
6946  }
6947 
6948  /* Get the LastLogon attribute */
6949  if (InfoBuffer->All.WhichFields & USER_ALL_LASTLOGON)
6950  {
6951  InfoBuffer->All.LastLogon.LowPart = FixedData.LastLogon.LowPart;
6952  InfoBuffer->All.LastLogon.HighPart = FixedData.LastLogon.HighPart;
6953  }
6954 
6955  /* Get the LastLogoff attribute */
6956  if (InfoBuffer->All.WhichFields & USER_ALL_LASTLOGOFF)
6957  {
6958  InfoBuffer->All.LastLogoff.LowPart = FixedData.LastLogoff.LowPart;
6959  InfoBuffer->All.LastLogoff.HighPart = FixedData.LastLogoff.HighPart;
6960  }
6961 
6962  /* Get the LogonHours attribute */
6963  if (InfoBuffer->All.WhichFields & USER_ALL_LOGONHOURS)
6964  {
6965  Status = SampGetLogonHoursAttribute(UserObject,
6966  &InfoBuffer->All.LogonHours);
6967  if (!NT_SUCCESS(Status))
6968  {
6969  TRACE("Status 0x%08lx\n", Status);
6970  goto done;
6971  }
6972  }
6973 
6974  /* Get the BadPasswordCount attribute */
6975  if (InfoBuffer->All.WhichFields & USER_ALL_BADPASSWORDCOUNT)
6976  {
6977  InfoBuffer->All.BadPasswordCount = FixedData.BadPasswordCount;
6978  }
6979 
6980  /* Get the LogonCount attribute */
6981  if (InfoBuffer->All.WhichFields & USER_ALL_LOGONCOUNT)
6982  {
6983  InfoBuffer->All.LogonCount = FixedData.LogonCount;
6984  }
6985 
6986  /* Get the PasswordCanChange attribute */
6987  if (InfoBuffer->All.WhichFields & USER_ALL_PASSWORDCANCHANGE)
6988  {
6989  PasswordCanChange = SampAddRelativeTimeToTime(FixedData.PasswordLastSet,
6990  DomainFixedData.MinPasswordAge);
6991  InfoBuffer->All.PasswordCanChange.LowPart = PasswordCanChange.LowPart;
6992  InfoBuffer->All.PasswordCanChange.HighPart = PasswordCanChange.HighPart;
6993  }
6994 
6995  /* Get the PasswordMustChange attribute */
6996  if (InfoBuffer->All.WhichFields & USER_ALL_PASSWORDMUSTCHANGE)
6997  {
6998  PasswordMustChange = SampAddRelativeTimeToTime(FixedData.PasswordLastSet,
6999  DomainFixedData.MaxPasswordAge);
7000  InfoBuffer->All.PasswordMustChange.LowPart = PasswordMustChange.LowPart;
7001  InfoBuffer->All.PasswordMustChange.HighPart = PasswordMustChange.HighPart;
7002  }
7003 
7004  /* Get the PasswordLastSet attribute */
7005  if (InfoBuffer->All.WhichFields & USER_ALL_PASSWORDLASTSET)
7006  {
7007  InfoBuffer->All.PasswordLastSet.LowPart = FixedData.PasswordLastSet.LowPart;
7008  InfoBuffer->All.PasswordLastSet.HighPart = FixedData.PasswordLastSet.HighPart;
7009  }
7010 
7011  /* Get the AccountExpires attribute */
7012  if (InfoBuffer->All.WhichFields & USER_ALL_ACCOUNTEXPIRES)
7013  {
7014  InfoBuffer->All.AccountExpires.LowPart = FixedData.AccountExpires.LowPart;
7015  InfoBuffer->All.AccountExpires.HighPart = FixedData.AccountExpires.HighPart;
7016  }
7017 
7018  /* Get the UserAccountControl attribute */
7019  if (InfoBuffer->All.WhichFields & USER_ALL_USERACCOUNTCONTROL)
7020  {
7021  InfoBuffer->All.UserAccountControl = FixedData.UserAccountControl;
7022  }
7023 
7024  /* Get the Parameters attribute */
7025  if (InfoBuffer->All.WhichFields & USER_ALL_PARAMETERS)
7026  {
7027  Status = SampGetObjectAttributeString(UserObject,
7028  L"Parameters",
7029  &InfoBuffer->All.Parameters);
7030  if (!NT_SUCCESS(Status))
7031  {
7032  TRACE("Status 0x%08lx\n", Status);
7033  goto done;
7034  }
7035  }
7036 
7037  /* Get the CountryCode attribute */
7038  if (InfoBuffer->All.WhichFields & USER_ALL_COUNTRYCODE)
7039  {
7040  InfoBuffer->All.CountryCode = FixedData.CountryCode;
7041  }
7042 
7043  /* Get the CodePage attribute */
7044  if (InfoBuffer->All.WhichFields & USER_ALL_CODEPAGE)
7045  {
7046  InfoBuffer->All.CodePage = FixedData.CodePage;
7047  }
7048 
7049  /* Get the LmPassword and NtPassword attributes */
7051  {
7052  InfoBuffer->All.LmPasswordPresent = FALSE;
7053  InfoBuffer->All.NtPasswordPresent = FALSE;
7054 
7055  /* Get the NT password */
7056  Length = 0;
7057  SampGetObjectAttribute(UserObject,
7058  L"NTPwd",
7059  NULL,
7060  NULL,
7061  &Length);
7062 
7063  if (Length == sizeof(ENCRYPTED_NT_OWF_PASSWORD))
7064  {
7066  if (InfoBuffer->All.NtOwfPassword.Buffer == NULL)
7067  {
7069  goto done;
7070  }
7071 
7072  InfoBuffer->All.NtOwfPassword.Length = sizeof(ENCRYPTED_NT_OWF_PASSWORD);
7074 
7075  Status = SampGetObjectAttribute(UserObject,
7076  L"NTPwd",
7077  NULL,
7078  (PVOID)InfoBuffer->All.NtOwfPassword.Buffer,
7079  &Length);
7080  if (!NT_SUCCESS(Status))
7081  goto done;
7082 
7083  if (memcmp(InfoBuffer->All.NtOwfPassword.Buffer,
7084  &EmptyNtHash,
7085  sizeof(ENCRYPTED_NT_OWF_PASSWORD)))
7086  InfoBuffer->All.NtPasswordPresent = TRUE;
7087  }
7088 
7089  /* Get the LM password */
7090  Length = 0;
7091  SampGetObjectAttribute(UserObject,
7092  L"LMPwd",
7093  NULL,
7094  NULL,
7095  &Length);
7096 
7097  if (Length == sizeof(ENCRYPTED_LM_OWF_PASSWORD))
7098  {
7100  if (InfoBuffer->All.LmOwfPassword.Buffer == NULL)
7101  {
7103  goto done;
7104  }
7105 
7106  InfoBuffer->All.LmOwfPassword.Length = sizeof(ENCRYPTED_LM_OWF_PASSWORD);
7108 
7109  Status = SampGetObjectAttribute(UserObject,
7110  L"LMPwd",
7111  NULL,
7112  (PVOID)InfoBuffer->All.LmOwfPassword.Buffer,
7113  &Length);
7114  if (!NT_SUCCESS(Status))
7115  goto done;
7116 
7117  if (memcmp(InfoBuffer->All.LmOwfPassword.Buffer,
7118  &EmptyLmHash,
7119  sizeof(ENCRYPTED_LM_OWF_PASSWORD)))
7120  InfoBuffer->All.LmPasswordPresent = TRUE;
7121  }
7122  }
7123 
7124  if (InfoBuffer->All.WhichFields & USER_ALL_PRIVATEDATA)
7125  {
7126  Status = SampGetObjectAttributeString(UserObject,
7127  L"PrivateData",
7128  &InfoBuffer->All.PrivateData);
7129  if (!NT_SUCCESS(Status))
7130  {
7131  TRACE("Status 0x%08lx\n", Status);
7132  goto done;
7133  }
7134  }
7135 
7136  if (InfoBuffer->All.WhichFields & USER_ALL_PASSWORDEXPIRED)
7137  {
7138  /* FIXME */
7139  }
7140 
7141  if (InfoBuffer->All.WhichFields & USER_ALL_SECURITYDESCRIPTOR)
7142  {
7143  Length = 0;
7144  SampGetObjectAttribute(UserObject,
7145  L"SecDesc",
7146  NULL,
7147  NULL,
7148  &Length);
7149 
7150  if (Length > 0)
7151  {
7153  if (InfoBuffer->All.SecurityDescriptor.SecurityDescriptor == NULL)
7154  {
7156  goto done;
7157  }
7158 
7159  InfoBuffer->All.SecurityDescriptor.Length = Length;
7160 
7161  Status = SampGetObjectAttribute(UserObject,
7162  L"SecDesc",
7163  NULL,
7165  &Length);
7166  if (!NT_SUCCESS(Status))
7167  goto done;
7168  }
7169  }
7170 
7171  *Buffer = InfoBuffer;
7172 
7173 done:
7174  if (!NT_SUCCESS(Status))
7175  {
7176  if (InfoBuffer != NULL)
7177  {
7178  if (InfoBuffer->All.UserName.Buffer != NULL)
7179  midl_user_free(InfoBuffer->All.UserName.Buffer);
7180 
7181  if (InfoBuffer->All.FullName.Buffer != NULL)
7182  midl_user_free(InfoBuffer->All.FullName.Buffer);
7183 
7184  if (InfoBuffer->All.AdminComment.Buffer != NULL)
7185  midl_user_free(InfoBuffer->All.AdminComment.Buffer);
7186 
7187  if (InfoBuffer->All.UserComment.Buffer != NULL)
7188  midl_user_free(InfoBuffer->All.UserComment.Buffer);
7189 
7190  if (InfoBuffer->All.HomeDirectory.Buffer != NULL)
7191  midl_user_free(InfoBuffer->All.HomeDirectory.Buffer);
7192 
7193  if (InfoBuffer->All.HomeDirectoryDrive.Buffer != NULL)
7195 
7196  if (InfoBuffer->All.ScriptPath.Buffer != NULL)
7197  midl_user_free(InfoBuffer->All.ScriptPath.Buffer);
7198 
7199  if (InfoBuffer->All.ProfilePath.Buffer != NULL)
7200  midl_user_free(InfoBuffer->All.ProfilePath.Buffer);
7201 
7202  if (InfoBuffer->All.WorkStations.Buffer != NULL)
7203  midl_user_free(InfoBuffer->All.WorkStations.Buffer);
7204 
7205  if (InfoBuffer->All.LogonHours.LogonHours != NULL)
7206  midl_user_free(InfoBuffer->All.LogonHours.LogonHours);
7207 
7208  if (InfoBuffer->All.Parameters.Buffer != NULL)
7209  midl_user_free(InfoBuffer->All.Parameters.Buffer);
7210 
7211  if (InfoBuffer->All.LmOwfPassword.Buffer != NULL)
7212  midl_user_free(InfoBuffer->All.LmOwfPassword.Buffer);
7213 
7214  if (InfoBuffer->All.NtOwfPassword.Buffer != NULL)
7215  midl_user_free(InfoBuffer->All.NtOwfPassword.Buffer);
7216 
7217  if (InfoBuffer->All.PrivateData.Buffer != NULL)
7218  midl_user_free(InfoBuffer->All.PrivateData.Buffer);
7219 
7220  if (InfoBuffer->All.SecurityDescriptor.SecurityDescriptor != NULL)
7222 
7223  midl_user_free(InfoBuffer);
7224  }
7225  }
7226 
7227  return Status;
7228 }
#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:96
RPC_UNICODE_STRING UserName
Definition: msv1_0.h:86
USHORT CountryCode
Definition: samsrv.h:110
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
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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:95
#define USER_ALL_LASTLOGON
Definition: ntsam.h:207
LARGE_INTEGER AccountExpires
Definition: samsrv.h:105
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
#define TRUE
Definition: types.h:120
RPC_UNICODE_STRING ProfilePath
Definition: msv1_0.h:91
OLD_LARGE_INTEGER LastLogoff
Definition: msv1_0.h:81
unsigned long UserId
Definition: msv1_0.h:100
ULONG PrimaryGroupId
Definition: samsrv.h:108
#define USER_ALL_LOGONCOUNT
Definition: ntsam.h:211
LONG NTSTATUS
Definition: precomp.h:26
OLD_LARGE_INTEGER PasswordCanChange
Definition: msv1_0.h:84
#define USER_ALL_SECURITYDESCRIPTOR
Definition: ntsam.h:224
RPC_UNICODE_STRING ScriptPath
Definition: msv1_0.h:90
RPC_UNICODE_STRING HomeDirectory
Definition: msv1_0.h:88
OLD_LARGE_INTEGER PasswordLastSet
Definition: msv1_0.h:82
#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:108
unsigned short * Buffer
Definition: msv1_0.h:40
#define USER_ALL_READ_ACCOUNT_MASK
Definition: ntsam.h:230
LARGE_INTEGER MinPasswordAge
Definition: samsrv.h:75
#define USER_ALL_PRIVATEDATA
Definition: ntsam.h:222
RPC_UNICODE_STRING HomeDirectoryDrive
Definition: sam.idl:603
RPC_UNICODE_STRING PrivateData
Definition: msv1_0.h:98
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:87
SAMPR_USER_ALL_INFORMATION All
Definition: msv1_0.h:141
#define USER_ALL_USERNAME
Definition: ntsam.h:196
unsigned long Length
Definition: msv1_0.h:45
unsigned short MaximumLength
Definition: msv1_0.h:39
struct _ENCRYPTED_LM_OWF_PASSWORD ENCRYPTED_LM_OWF_PASSWORD
#define L(x)
Definition: ntvdm.h:50
#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
#define FALSE
Definition: types.h:117
SAMPR_SR_SECURITY_DESCRIPTOR SecurityDescriptor
Definition: msv1_0.h:99
unsigned long WhichFields
Definition: msv1_0.h:103
#define USER_ALL_PASSWORDCANCHANGE
Definition: ntsam.h:212
unsigned char * SecurityDescriptor
Definition: msv1_0.h:46
Definition: bufpool.h:45
OLD_LARGE_INTEGER AccountExpires
Definition: msv1_0.h:83
OLD_LARGE_INTEGER LastLogon
Definition: msv1_0.h:80
#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
Status
Definition: gdiplustypes.h:24
OLD_LARGE_INTEGER PasswordMustChange
Definition: msv1_0.h:85
#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:104
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define USER_READ_ACCOUNT
Definition: ntsam.h:130
unsigned short LogonCount
Definition: msv1_0.h:106
NTSTATUS SampGetObjectAttributeString(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PRPC_UNICODE_STRING String)
Definition: database.c:531
BOOLEAN Trusted
Definition: samsrv.h:55
#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
SAMPR_LOGON_HOURS LogonHours
Definition: msv1_0.h:104
unsigned long PrimaryGroupId
Definition: msv1_0.h:101
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
#define USER_ALL_NTPASSWORDPRESENT
Definition: ntsam.h:220
ULONG LowPart
Definition: typedefs.h:106
unsigned char LmPasswordPresent
Definition: msv1_0.h:109
LARGE_INTEGER LastLogon
Definition: samsrv.h:102
RPC_UNICODE_STRING UserComment
Definition: msv1_0.h:94
ACCESS_MASK Access
Definition: samsrv.h:50
RPC_UNICODE_STRING AdminComment
Definition: msv1_0.h:92
ENCRYPTED_LM_OWF_PASSWORD EmptyLmHash
Definition: samsrv.c:27
USHORT BadPasswordCount
Definition: samsrv.h:112
struct _SAM_DB_OBJECT * ParentObject
Definition: samsrv.h:56
#define USER_ALL_SCRIPTPATH
Definition: ntsam.h:204
#define USER_ALL_USERID
Definition: ntsam.h:198
unsigned long UserAccountControl
Definition: msv1_0.h:102
LARGE_INTEGER MaxPasswordAge
Definition: samsrv.h:74
unsigned long LowPart
Definition: msv1_0.h:32
#define USER_ALL_HOMEDIRECTORYDRIVE
Definition: ntsam.h:203
#define NULL
Definition: types.h:112
#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:97
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:38
ULONG UserAccountControl
Definition: samsrv.h:109
unsigned int ULONG
Definition: retypes.h:1
unsigned short BadPasswordCount
Definition: msv1_0.h:105
#define USER_ALL_PROFILEPATH
Definition: ntsam.h:205
unsigned char * LogonHours
Definition: msv1_0.h:63
#define USER_ALL_USERCOMMENT
Definition: ntsam.h:201
#define USER_READ_LOGON
Definition: ntsam.h:129
LARGE_INTEGER LastLogoff
Definition: samsrv.h:103
RPC_UNICODE_STRING HomeDirectoryDrive
Definition: msv1_0.h:89
#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:110
RPC_UNICODE_STRING WorkStations
Definition: msv1_0.h:93
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:24
unsigned short CountryCode
Definition: msv1_0.h:107

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserControl()

static NTSTATUS SampQueryUserControl ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6488 of file samrpc.c.

6490 {
6491  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6492  SAM_USER_FIXED_DATA FixedData;
6493  ULONG Length = 0;
6494  NTSTATUS Status;
6495 
6496  *Buffer = NULL;
6497 
6498  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6499  if (InfoBuffer == NULL)
6501 
6502  Length = sizeof(SAM_USER_FIXED_DATA);
6503  Status = SampGetObjectAttribute(UserObject,
6504  L"F",
6505  NULL,
6506  (PVOID)&FixedData,
6507  &Length);
6508  if (!NT_SUCCESS(Status))
6509  goto done;
6510 
6511  InfoBuffer->Control.UserAccountControl = FixedData.UserAccountControl;
6512 
6513  *Buffer = InfoBuffer;
6514 
6515 done:
6516  if (!NT_SUCCESS(Status))
6517  {
6518  if (InfoBuffer != NULL)
6519  {
6520  midl_user_free(InfoBuffer);
6521  }
6522  }
6523 
6524  return Status;
6525 }
struct _SAM_USER_FIXED_DATA SAM_USER_FIXED_DATA
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
USER_CONTROL_INFORMATION Control
Definition: sam.idl:736
#define NULL
Definition: types.h:112
ULONG UserAccountControl
Definition: samsrv.h:109
unsigned int ULONG
Definition: retypes.h:1
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserExpires()

static NTSTATUS SampQueryUserExpires ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6530 of file samrpc.c.

6532 {
6533  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6534  SAM_USER_FIXED_DATA FixedData;
6535  ULONG Length = 0;
6536  NTSTATUS Status;
6537 
6538  *Buffer = NULL;
6539 
6540  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6541  if (InfoBuffer == NULL)
6543 
6544  Length = sizeof(SAM_USER_FIXED_DATA);
6545  Status = SampGetObjectAttribute(UserObject,
6546  L"F",
6547  NULL,
6548  (PVOID)&FixedData,
6549  &Length);
6550  if (!NT_SUCCESS(Status))
6551  goto done;
6552 
6553  InfoBuffer->Expires.AccountExpires.LowPart = FixedData.AccountExpires.LowPart;
6554  InfoBuffer->Expires.AccountExpires.HighPart = FixedData.AccountExpires.HighPart;
6555 
6556  *Buffer = InfoBuffer;
6557 
6558 done:
6559  if (!NT_SUCCESS(Status))
6560  {
6561  if (InfoBuffer != NULL)
6562  {
6563  midl_user_free(InfoBuffer);
6564  }
6565  }
6566 
6567  return Status;
6568 }
struct _SAM_USER_FIXED_DATA SAM_USER_FIXED_DATA
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
LARGE_INTEGER AccountExpires
Definition: samsrv.h:105
void __RPC_USER midl_user_free(void __RPC_FAR *ptr)
Definition: samrpc.c:120
LONG NTSTATUS
Definition: precomp.h:26
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
LARGE_INTEGER AccountExpires
Definition: ntsam.h:675
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
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:516
ULONG LowPart
Definition: typedefs.h:106
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserFullName()

static NTSTATUS SampQueryUserFullName ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6186 of file samrpc.c.

6188 {
6189  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6190  NTSTATUS Status;
6191 
6192  *Buffer = NULL;
6193 
6194  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6195  if (InfoBuffer == NULL)
6197 
6198  /* Get the FullName string */
6199  Status = SampGetObjectAttributeString(UserObject,
6200  L"FullName",
6201  &InfoBuffer->FullName.FullName);
6202  if (!NT_SUCCESS(Status))
6203  {
6204  TRACE("Status 0x%08lx\n", Status);
6205  goto done;
6206  }
6207 
6208  *Buffer = InfoBuffer;
6209 
6210 done:
6211  if (!NT_SUCCESS(Status))
6212  {
6213  if (InfoBuffer != NULL)
6214  {
6215  if (InfoBuffer->FullName.FullName.Buffer != NULL)
6216  midl_user_free(InfoBuffer->FullName.FullName.Buffer);
6217 
6218  midl_user_free(InfoBuffer);
6219  }
6220  }
6221 
6222  return Status;
6223 }
#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
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#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:531
SAMPR_USER_F_NAME_INFORMATION FullName
Definition: sam.idl:728
#define NULL
Definition: types.h:112
void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len)
Definition: samrpc.c:114
wchar_t * Buffer
Definition: msv1_0.h:24

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserGeneral()

static NTSTATUS SampQueryUserGeneral ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 5547 of file samrpc.c.

5549 {
5550  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
5551  SAM_USER_FIXED_DATA FixedData;
5552  ULONG Length = 0;
5553  NTSTATUS Status;
5554 
5555  *Buffer = NULL;
5556 
5557  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
5558  if (InfoBuffer == NULL)
5560 
5561  Length = sizeof(SAM_USER_FIXED_DATA);
5562  Status = SampGetObjectAttribute(UserObject,
5563  L"F",
5564  NULL,
5565  (PVOID)&FixedData,
5566  &Length);
5567  if (!NT_SUCCESS(Status))
5568  goto done;
5569 
5570  InfoBuffer->General.PrimaryGroupId = FixedData.PrimaryGroupId;
5571 
5572  /* Get the Name string */
5573  Status = SampGetObjectAttributeString(UserObject,
5574  L"Name",
5575  &InfoBuffer->General.UserName);
5576  if (!NT_SUCCESS(Status))
5577  {
5578  TRACE("Status 0x%08lx\n", Status);
5579  goto done;
5580  }
5581 
5582  /* Get the FullName string */
5583  Status = SampGetObjectAttributeString(UserObject,
5584  L"FullName",
5585  &InfoBuffer->General.FullName);
5586  if (!NT_SUCCESS(Status))
5587  {
5588  TRACE("Status 0x%08lx\n", Status);
5589  goto done;
5590  }
5591 
5592  /* Get the AdminComment string */
5593  Status = SampGetObjectAttributeString(UserObject,
5594  L"AdminComment",
5595  &InfoBuffer->General.AdminComment);
5596  if (!NT_SUCCESS(Status))
5597  {
5598  TRACE("Status 0x%08lx\n", Status);
5599  goto done;
5600  }
5601 
5602  /* Get the UserComment string */
5603  Status = SampGetObjectAttributeString(UserObject,
5604  L"UserComment",
5605  &InfoBuffer->General.UserComment);
5606  if (!NT_SUCCESS(Status))
5607  {
5608  TRACE("Status 0x%08lx\n", Status);
5609  goto done;
5610  }
5611 
5612  *Buffer = InfoBuffer;
5613 
5614 done:
5615  if (!NT_SUCCESS(Status))
5616  {
5617  if (InfoBuffer != NULL)
5618  {
5619  if (InfoBuffer->General.UserName.Buffer != NULL)
5620  midl_user_free(InfoBuffer->General.UserName.Buffer);
5621 
5622  if (InfoBuffer->General.FullName.Buffer != NULL)
5623  midl_user_free(InfoBuffer->General.FullName.Buffer);
5624 
5625  if (InfoBuffer->General.AdminComment.Buffer != NULL)
5627 
5628  if (InfoBuffer->General.UserComment.Buffer != NULL)
5630 
5631  midl_user_free(InfoBuffer);
5632  }
5633  }
5634 
5635  return Status;
5636 }
struct _SAM_USER_FIXED_DATA SAM_USER_FIXED_DATA
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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:108
LONG NTSTATUS
Definition: precomp.h:26
#define L(x)
Definition: ntvdm.h:50
SAMPR_USER_GENERAL_INFORMATION General
Definition: sam.idl:721
RPC_UNICODE_STRING FullName
Definition: sam.idl:521
Definition: bufpool.h:45
RPC_UNICODE_STRING UserComment
Definition: sam.idl:524
Status
Definition: gdiplustypes.h:24
#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:531
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
#define NULL
Definition: types.h:112
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:24

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserHome()

static NTSTATUS SampQueryUserHome ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6269 of file samrpc.c.

6271 {
6272  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6273  NTSTATUS Status;
6274 
6275  *Buffer = NULL;
6276 
6277  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6278  if (InfoBuffer == NULL)
6280 
6281  /* Get the HomeDirectory string */
6282  Status = SampGetObjectAttributeString(UserObject,
6283  L"HomeDirectory",
6284  &InfoBuffer->Home.HomeDirectory);
6285  if (!NT_SUCCESS(Status))
6286  {
6287  TRACE("Status 0x%08lx\n", Status);
6288  goto done;
6289  }
6290 
6291  /* Get the HomeDirectoryDrive string */
6292  Status = SampGetObjectAttributeString(UserObject,
6293  L"HomeDirectoryDrive",
6294  &InfoBuffer->Home.HomeDirectoryDrive);
6295  if (!NT_SUCCESS(Status))
6296  {
6297  TRACE("Status 0x%08lx\n", Status);
6298  goto done;
6299  }
6300 
6301  *Buffer = InfoBuffer;
6302 
6303 done:
6304  if (!NT_SUCCESS(Status))
6305  {
6306  if (InfoBuffer != NULL)
6307  {
6308  if (InfoBuffer->Home.HomeDirectory.Buffer != NULL)
6309  midl_user_free(InfoBuffer->Home.HomeDirectory.Buffer);
6310 
6311  if (InfoBuffer->Home.HomeDirectoryDrive.Buffer != NULL)
6313 
6314  midl_user_free(InfoBuffer);
6315  }
6316  }
6317 
6318  return Status;
6319 }
#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
#define L(x)
Definition: ntvdm.h:50
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
#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:531
#define NULL
Definition: types.h:112
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:24

Referenced by SamrQueryInformationUser2().

◆ SampQueryUserInternal1()

static NTSTATUS SampQueryUserInternal1 ( PSAM_DB_OBJECT  UserObject,
PSAMPR_USER_INFO_BUFFER Buffer 
)
static

Definition at line 6573 of file samrpc.c.

6575 {
6576  PSAMPR_USER_INFO_BUFFER InfoBuffer = NULL;
6577  ULONG Length = 0;
6579 
6580  /* Fail, if the caller is not a trusted caller */
6581  if (UserObject->Trusted == FALSE)
6583 
6584  *Buffer = NULL;
6585 
6586  InfoBuffer = midl_user_allocate(sizeof(SAMPR_USER_INFO_BUFFER));
6587  if (InfoBuffer == NULL)
6589 
6590  InfoBuffer->Internal1.LmPasswordPresent = FALSE;
6591  InfoBuffer->Internal1.NtPasswordPresent = FALSE;
6592 
6593  /* Get the NT password */
6594  Length = 0;
6595  SampGetObjectAttribute(UserObject,
6596  L"NTPwd",
6597  NULL,
6598  NULL,
6599  &Length);
6600 
6601  if (Length == sizeof(ENCRYPTED_NT_OWF_PASSWORD))
6602  {
6603  Status = SampGetObjectAttribute(UserObject,
6604  L"NTPwd",
6605  NULL,
6606  (PVOID)&InfoBuffer->Internal1.EncryptedNtOwfPassword,
6607  &Length);
6608  if (!NT_SUCCESS(Status))
6609  goto done;
6610 
6611  if (memcmp(&InfoBuffer->Internal1.EncryptedNtOwfPassword,
6612  &EmptyNtHash,
6613  sizeof(ENCRYPTED_NT_OWF_PASSWORD)))
6614  InfoBuffer->Internal1.NtPasswordPresent = TRUE;
6615  }
6616 
6617 
6618  /* Get the LM password */
6619  Length = 0;
6620  SampGetObjectAttribute(UserObject,
6621  L"LMPwd",
6622  NULL,
6623  NULL,
6624  &Length);
6625 
6626  if (Length == sizeof(ENCRYPTED_LM_OWF_PASSWORD))
6627  {
6628  Status = SampGetObjectAttribute(UserObject,
6629  L"LMPwd",
6630  NULL,
6631  (PVOID)&InfoBuffer->Internal1.EncryptedLmOwfPassword,
6632  &Length);
6633  if (!NT_SUCCESS(Status))
6634  goto done;
6635 
6636  if (memcmp(&InfoBuffer->Internal1.EncryptedLmOwfPassword,
6637  &EmptyLmHash,
6638  sizeof(ENCRYPTED_LM_OWF_PASSWORD)))
6639  InfoBuffer->Internal1.LmPasswordPresent = TRUE;
6640  }
6641 
6642  InfoBuffer->Internal1.PasswordExpired = FALSE;
6643 
6644  *Buffer = InfoBuffer;
6645 
6646 done:
6647  if (!NT_SUCCESS(Status))
6648  {
6649  if (InfoBuffer != NULL)
6650  {
6651  midl_user_free(InfoBuffer);
6652  }
6653  }
6654 
6655  return Status;
6656 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
ENCRYPTED_NT_OWF_PASSWORD EmptyNtHash
Definition: samsrv.c:26
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
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:55
NTSTATUS SampGetObjectAttribute(PSAM_DB_OBJECT DbObject, LPWSTR AttributeName, PULONG AttributeType, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:516
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:240
ENCRYPTED_LM_OWF_PASSWORD EmptyLmHash
Definition: samsrv.c:27
ENCRYPTED_LM_OWF_PASSWORD EncryptedLmOwfPassword
Definition: sam.idl:641
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1