ReactOS  0.4.14-dev-376-gaedba84
lsarpc.c File Reference
#include "lsasrv.h"
Include dependency graph for lsarpc.c:

Go to the source code of this file.

Functions

NTSTATUS LsarStartRpcServer (VOID)
 
void __RPC_USER LSAPR_HANDLE_rundown (LSAPR_HANDLE hHandle)
 
NTSTATUS WINAPI LsarClose (LSAPR_HANDLE *ObjectHandle)
 
NTSTATUS WINAPI LsarDelete (LSAPR_HANDLE ObjectHandle)
 
NTSTATUS WINAPI LsarEnumeratePrivileges (LSAPR_HANDLE PolicyHandle, DWORD *EnumerationContext, PLSAPR_PRIVILEGE_ENUM_BUFFER EnumerationBuffer, DWORD PreferedMaximumLength)
 
NTSTATUS WINAPI LsarQuerySecurityObject (LSAPR_HANDLE ObjectHandle, SECURITY_INFORMATION SecurityInformation, PLSAPR_SR_SECURITY_DESCRIPTOR *SecurityDescriptor)
 
NTSTATUS WINAPI LsarSetSecurityObject (LSAPR_HANDLE ObjectHandle, SECURITY_INFORMATION SecurityInformation, PLSAPR_SR_SECURITY_DESCRIPTOR SecurityDescriptor)
 
NTSTATUS WINAPI LsarChangePassword (handle_t IDL_handle, PRPC_UNICODE_STRING String1, PRPC_UNICODE_STRING String2, PRPC_UNICODE_STRING String3, PRPC_UNICODE_STRING String4, PRPC_UNICODE_STRING String5)
 
NTSTATUS WINAPI LsarOpenPolicy (LPWSTR SystemName, PLSAPR_OBJECT_ATTRIBUTES ObjectAttributes, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *PolicyHandle)
 
NTSTATUS WINAPI LsarQueryInformationPolicy (LSAPR_HANDLE PolicyHandle, POLICY_INFORMATION_CLASS InformationClass, PLSAPR_POLICY_INFORMATION *PolicyInformation)
 
NTSTATUS WINAPI LsarSetInformationPolicy (LSAPR_HANDLE PolicyHandle, POLICY_INFORMATION_CLASS InformationClass, PLSAPR_POLICY_INFORMATION PolicyInformation)
 
NTSTATUS WINAPI LsarClearAuditLog (LSAPR_HANDLE ObjectHandle)
 
NTSTATUS LsarpCreateAccount (PLSA_DB_OBJECT PolicyObject, PRPC_SID AccountSid, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *AccountObject)
 
NTSTATUS WINAPI LsarCreateAccount (LSAPR_HANDLE PolicyHandle, PRPC_SID AccountSid, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *AccountHandle)
 
NTSTATUS WINAPI LsarEnumerateAccounts (LSAPR_HANDLE PolicyHandle, DWORD *EnumerationContext, PLSAPR_ACCOUNT_ENUM_BUFFER EnumerationBuffer, DWORD PreferedMaximumLength)
 
NTSTATUS WINAPI LsarCreateTrustedDomain (LSAPR_HANDLE PolicyHandle, PLSAPR_TRUST_INFORMATION TrustedDomainInformation, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *TrustedDomainHandle)
 
NTSTATUS WINAPI LsarEnumerateTrustedDomains (LSAPR_HANDLE PolicyHandle, DWORD *EnumerationContext, PLSAPR_TRUSTED_ENUM_BUFFER EnumerationBuffer, DWORD PreferedMaximumLength)
 
NTSTATUS WINAPI LsarLookupNames (LSAPR_HANDLE PolicyHandle, DWORD Count, PRPC_UNICODE_STRING Names, PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSAPR_TRANSLATED_SIDS TranslatedSids, LSAP_LOOKUP_LEVEL LookupLevel, DWORD *MappedCount)
 
NTSTATUS WINAPI LsarLookupSids (LSAPR_HANDLE PolicyHandle, PLSAPR_SID_ENUM_BUFFER SidEnumBuffer, PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSAPR_TRANSLATED_NAMES TranslatedNames, LSAP_LOOKUP_LEVEL LookupLevel, DWORD *MappedCount)
 
NTSTATUS WINAPI LsarCreateSecret (LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING SecretName, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *SecretHandle)
 
static NTSTATUS LsarpOpenAccount (IN PLSA_DB_OBJECT PolicyObject, IN PRPC_SID AccountSid, IN ACCESS_MASK DesiredAccess, OUT PLSA_DB_OBJECT *AccountObject)
 
NTSTATUS WINAPI LsarOpenAccount (LSAPR_HANDLE PolicyHandle, PRPC_SID AccountSid, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *AccountHandle)
 
NTSTATUS WINAPI LsarEnumeratePrivilegesAccount (LSAPR_HANDLE AccountHandle, PLSAPR_PRIVILEGE_SET *Privileges)
 
NTSTATUS WINAPI LsarAddPrivilegesToAccount (LSAPR_HANDLE AccountHandle, PLSAPR_PRIVILEGE_SET Privileges)
 
NTSTATUS WINAPI LsarRemovePrivilegesFromAccount (LSAPR_HANDLE AccountHandle, BOOLEAN AllPrivileges, PLSAPR_PRIVILEGE_SET Privileges)
 
NTSTATUS WINAPI LsarGetQuotasForAccount (LSAPR_HANDLE AccountHandle, PQUOTA_LIMITS QuotaLimits)
 
NTSTATUS WINAPI LsarSetQuotasForAccount (LSAPR_HANDLE AccountHandle, PQUOTA_LIMITS QuotaLimits)
 
NTSTATUS WINAPI LsarGetSystemAccessAccount (LSAPR_HANDLE AccountHandle, ACCESS_MASK *SystemAccess)
 
NTSTATUS WINAPI LsarSetSystemAccessAccount (LSAPR_HANDLE AccountHandle, ACCESS_MASK SystemAccess)
 
NTSTATUS WINAPI LsarOpenTrustedDomain (LSAPR_HANDLE PolicyHandle, PRPC_SID TrustedDomainSid, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *TrustedDomainHandle)
 
NTSTATUS WINAPI LsarQueryInfoTrustedDomain (LSAPR_HANDLE TrustedDomainHandle, TRUSTED_INFORMATION_CLASS InformationClass, PLSAPR_TRUSTED_DOMAIN_INFO *TrustedDomainInformation)
 
NTSTATUS WINAPI LsarSetInformationTrustedDomain (LSAPR_HANDLE TrustedDomainHandle, TRUSTED_INFORMATION_CLASS InformationClass, PLSAPR_TRUSTED_DOMAIN_INFO TrustedDomainInformation)
 
NTSTATUS WINAPI LsarOpenSecret (LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING SecretName, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *SecretHandle)
 
NTSTATUS WINAPI LsarSetSecret (LSAPR_HANDLE SecretHandle, PLSAPR_CR_CIPHER_VALUE EncryptedCurrentValue, PLSAPR_CR_CIPHER_VALUE EncryptedOldValue)
 
NTSTATUS WINAPI LsarQuerySecret (LSAPR_HANDLE SecretHandle, PLSAPR_CR_CIPHER_VALUE *EncryptedCurrentValue, PLARGE_INTEGER CurrentValueSetTime, PLSAPR_CR_CIPHER_VALUE *EncryptedOldValue, PLARGE_INTEGER OldValueSetTime)
 
NTSTATUS WINAPI LsarLookupPrivilegeValue (LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING Name, PLUID Value)
 
NTSTATUS WINAPI LsarLookupPrivilegeName (LSAPR_HANDLE PolicyHandle, PLUID Value, PRPC_UNICODE_STRING *Name)
 
NTSTATUS WINAPI LsarLookupPrivilegeDisplayName (LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING Name, USHORT ClientLanguage, USHORT ClientSystemDefaultLanguage, PRPC_UNICODE_STRING *DisplayName, USHORT *LanguageReturned)
 
NTSTATUS WINAPI LsarDeleteObject (LSAPR_HANDLE *ObjectHandle)
 
NTSTATUS WINAPI LsarEnumerateAccountsWithUserRight (LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING UserRight, PLSAPR_ACCOUNT_ENUM_BUFFER EnumerationBuffer)
 
NTSTATUS WINAPI LsarEnumerateAccountRights (LSAPR_HANDLE PolicyHandle, PRPC_SID AccountSid, PLSAPR_USER_RIGHT_SET UserRights)
 
NTSTATUS WINAPI LsarAddAccountRights (LSAPR_HANDLE PolicyHandle, PRPC_SID AccountSid, PLSAPR_USER_RIGHT_SET UserRights)
 
NTSTATUS WINAPI LsarRemoveAccountRights (LSAPR_HANDLE PolicyHandle, PRPC_SID AccountSid, BOOLEAN AllRights, PLSAPR_USER_RIGHT_SET UserRights)
 
NTSTATUS WINAPI LsarQueryTrustedDomainInfo (LSAPR_HANDLE PolicyHandle, PRPC_SID TrustedDomainSid, TRUSTED_INFORMATION_CLASS InformationClass, PLSAPR_TRUSTED_DOMAIN_INFO *TrustedDomainInformation)
 
NTSTATUS WINAPI LsarSetTrustedDomainInfo (LSAPR_HANDLE PolicyHandle, PRPC_SID TrustedDomainSid, TRUSTED_INFORMATION_CLASS InformationClass, PLSAPR_TRUSTED_DOMAIN_INFO TrustedDomainInformation)
 
NTSTATUS WINAPI LsarDeleteTrustedDomain (LSAPR_HANDLE PolicyHandle, PRPC_SID TrustedDomainSid)
 
NTSTATUS WINAPI LsarStorePrivateData (LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING KeyName, PLSAPR_CR_CIPHER_VALUE EncryptedData)
 
NTSTATUS WINAPI LsarRetrievePrivateData (LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING KeyName, PLSAPR_CR_CIPHER_VALUE *EncryptedData)
 
NTSTATUS WINAPI LsarOpenPolicy2 (LPWSTR SystemName, PLSAPR_OBJECT_ATTRIBUTES ObjectAttributes, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *PolicyHandle)
 
NTSTATUS WINAPI LsarGetUserName (LPWSTR SystemName, PRPC_UNICODE_STRING *UserName, PRPC_UNICODE_STRING *DomainName)
 
NTSTATUS WINAPI LsarQueryInformationPolicy2 (LSAPR_HANDLE PolicyHandle, POLICY_INFORMATION_CLASS InformationClass, PLSAPR_POLICY_INFORMATION *PolicyInformation)
 
NTSTATUS WINAPI LsarSetInformationPolicy2 (LSAPR_HANDLE PolicyHandle, POLICY_INFORMATION_CLASS InformationClass, PLSAPR_POLICY_INFORMATION PolicyInformation)
 
NTSTATUS WINAPI LsarQueryTrustedDomainInfoByName (LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING TrustedDomainName, POLICY_INFORMATION_CLASS InformationClass, PLSAPR_TRUSTED_DOMAIN_INFO *PolicyInformation)
 
NTSTATUS WINAPI LsarSetTrustedDomainInfoByName (LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING TrustedDomainName, POLICY_INFORMATION_CLASS InformationClass, PLSAPR_TRUSTED_DOMAIN_INFO PolicyInformation)
 
NTSTATUS WINAPI LsarEnumerateTrustedDomainsEx (LSAPR_HANDLE PolicyHandle, DWORD *EnumerationContext, PLSAPR_TRUSTED_ENUM_BUFFER_EX EnumerationBuffer, DWORD PreferedMaximumLength)
 
NTSTATUS WINAPI LsarCreateTrustedDomainEx (LSAPR_HANDLE PolicyHandle, PLSAPR_TRUSTED_DOMAIN_INFORMATION_EX TrustedDomainInformation, PLSAPR_TRUSTED_DOMAIN_AUTH_INFORMATION AuthentificationInformation, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *TrustedDomainHandle)
 
NTSTATUS WINAPI LsarSetPolicyReplicationHandle (PLSAPR_HANDLE PolicyHandle)
 
NTSTATUS WINAPI LsarQueryDomainInformationPolicy (LSAPR_HANDLE PolicyHandle, POLICY_INFORMATION_CLASS InformationClass, PLSAPR_POLICY_DOMAIN_INFORMATION *PolicyInformation)
 
NTSTATUS WINAPI LsarSetDomainInformationPolicy (LSAPR_HANDLE PolicyHandle, POLICY_INFORMATION_CLASS InformationClass, PLSAPR_POLICY_DOMAIN_INFORMATION PolicyInformation)
 
NTSTATUS WINAPI LsarOpenTrustedDomainByName (LSAPR_HANDLE PolicyHandle, PRPC_UNICODE_STRING TrustedDomainName, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *TrustedDomainHandle)
 
NTSTATUS WINAPI LsarTestCall (handle_t hBinding)
 
NTSTATUS WINAPI LsarLookupSids2 (LSAPR_HANDLE PolicyHandle, PLSAPR_SID_ENUM_BUFFER SidEnumBuffer, PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSAPR_TRANSLATED_NAMES_EX TranslatedNames, LSAP_LOOKUP_LEVEL LookupLevel, DWORD *MappedCount, DWORD LookupOptions, DWORD ClientRevision)
 
NTSTATUS WINAPI LsarLookupNames2 (LSAPR_HANDLE PolicyHandle, DWORD Count, PRPC_UNICODE_STRING Names, PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSAPR_TRANSLATED_SIDS_EX TranslatedSids, LSAP_LOOKUP_LEVEL LookupLevel, DWORD *MappedCount, DWORD LookupOptions, DWORD ClientRevision)
 
NTSTATUS WINAPI LsarCreateTrustedDomainEx2 (LSAPR_HANDLE PolicyHandle, PLSAPR_TRUSTED_DOMAIN_INFORMATION_EX TrustedDomainInformation, PLSAPR_TRUSTED_DOMAIN_AUTH_INFORMATION_INTERNAL AuthentificationInformation, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *TrustedDomainHandle)
 
NTSTATUS WINAPI CredrWrite (PLSAPR_SERVER_NAME SystemName)
 
NTSTATUS WINAPI CredrRead (PLSAPR_SERVER_NAME SystemName)
 
NTSTATUS WINAPI CredrEnumerate (PLSAPR_SERVER_NAME SystemName)
 
NTSTATUS WINAPI CredrWriteDomainCredentials (PLSAPR_SERVER_NAME SystemName)
 
NTSTATUS WINAPI CredrReadDomainCredentials (PLSAPR_SERVER_NAME SystemName)
 
NTSTATUS WINAPI CredrDelete (PLSAPR_SERVER_NAME SystemName, LPWSTR TargetName, DWORD Type, DWORD Flags)
 
NTSTATUS WINAPI CredrGetTargetInfo (PLSAPR_SERVER_NAME SystemName, LPWSTR TargetName, DWORD Flags, CREDPR_TARGET_INFORMATION *TargetInformation)
 
NTSTATUS WINAPI CredrProfileLoaded (PLSAPR_SERVER_NAME SystemName)
 
NTSTATUS WINAPI LsarLookupNames3 (LSAPR_HANDLE PolicyHandle, DWORD Count, PRPC_UNICODE_STRING Names, PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSAPR_TRANSLATED_SIDS_EX2 TranslatedSids, LSAP_LOOKUP_LEVEL LookupLevel, DWORD *MappedCount, DWORD LookupOptions, DWORD ClientRevision)
 
NTSTATUS WINAPI CredrGetSessionTypes (PLSAPR_SERVER_NAME SystemName, DWORD MaximumPersistCount, DWORD *MaximumPersist)
 
NTSTATUS WINAPI LsarRegisterAuditEvent (handle_t hBinding)
 
NTSTATUS WINAPI LsarGenAuditEvent (handle_t hBinding)
 
NTSTATUS WINAPI LsarUnregisterAuditEvent (handle_t hBinding)
 
NTSTATUS WINAPI LsarQueryForestTrustInformation (LSAPR_HANDLE PolicyHandle, PLSA_UNICODE_STRING TrustedDomainName, LSA_FOREST_TRUST_RECORD_TYPE HighestRecordType, PLSA_FOREST_TRUST_INFORMATION *ForestTrustInfo)
 
NTSTATUS WINAPI LsarSetForestTrustInformation (LSAPR_HANDLE PolicyHandle, PLSA_UNICODE_STRING TrustedDomainName, LSA_FOREST_TRUST_RECORD_TYPE HighestRecordType, PLSA_FOREST_TRUST_INFORMATION ForestTrustInfo, BOOLEAN CheckOnly, PLSA_FOREST_TRUST_COLLISION_INFORMATION *CollisionInfo)
 
NTSTATUS WINAPI CredrRename (PLSAPR_SERVER_NAME SystemName, LPWSTR OldTargetName, LPWSTR NewTargetName, DWORD Type, DWORD Flags)
 
NTSTATUS WINAPI LsarLookupSids3 (LSAPR_HANDLE PolicyHandle, PLSAPR_SID_ENUM_BUFFER SidEnumBuffer, PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSAPR_TRANSLATED_NAMES_EX TranslatedNames, LSAP_LOOKUP_LEVEL LookupLevel, DWORD *MappedCount, DWORD LookupOptions, DWORD ClientRevision)
 
NTSTATUS WINAPI LsarLookupNames4 (handle_t RpcHandle, DWORD Count, PRPC_UNICODE_STRING Names, PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSAPR_TRANSLATED_SIDS_EX2 TranslatedSids, LSAP_LOOKUP_LEVEL LookupLevel, DWORD *MappedCount, DWORD LookupOptions, DWORD ClientRevision)
 
NTSTATUS WINAPI LsarOpenPolicySce (LPWSTR SystemName, PLSAPR_OBJECT_ATTRIBUTES ObjectAttributes, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *PolicyHandle)
 
NTSTATUS WINAPI LsarAdtRegisterSecurityEventSource (handle_t hBinding)
 
NTSTATUS WINAPI LsarAdtUnregisterSecurityEventSource (handle_t hBinding)
 
NTSTATUS WINAPI LsarAdtReportSecurityEvent (handle_t hBinding)
 

Variables

static RTL_CRITICAL_SECTION PolicyHandleTableLock
 
static GENERIC_MAPPING LsapPolicyMapping
 
static GENERIC_MAPPING LsapAccountMapping
 
static GENERIC_MAPPING LsapSecretMapping
 

Function Documentation

◆ CredrDelete()

NTSTATUS WINAPI CredrDelete ( PLSAPR_SERVER_NAME  SystemName,
LPWSTR  TargetName,
DWORD  Type,
DWORD  Flags 
)

Definition at line 4099 of file lsarpc.c.

4104 {
4105  UNIMPLEMENTED;
4106  return STATUS_NOT_IMPLEMENTED;
4107 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

◆ CredrEnumerate()

NTSTATUS WINAPI CredrEnumerate ( PLSAPR_SERVER_NAME  SystemName)

Definition at line 4066 of file lsarpc.c.

4068 {
4069  UNIMPLEMENTED;
4070  return STATUS_NOT_IMPLEMENTED;
4071 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

◆ CredrGetSessionTypes()

NTSTATUS WINAPI CredrGetSessionTypes ( PLSAPR_SERVER_NAME  SystemName,
DWORD  MaximumPersistCount,
DWORD MaximumPersist 
)

Definition at line 4178 of file lsarpc.c.

4182 {
4183  UNIMPLEMENTED;
4184  return STATUS_NOT_IMPLEMENTED;
4185 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

◆ CredrGetTargetInfo()

NTSTATUS WINAPI CredrGetTargetInfo ( PLSAPR_SERVER_NAME  SystemName,
LPWSTR  TargetName,
DWORD  Flags,
CREDPR_TARGET_INFORMATION TargetInformation 
)

Definition at line 4113 of file lsarpc.c.

4118 {
4119  UNIMPLEMENTED;
4120  return STATUS_NOT_IMPLEMENTED;
4121 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

◆ CredrProfileLoaded()

NTSTATUS WINAPI CredrProfileLoaded ( PLSAPR_SERVER_NAME  SystemName)

Definition at line 4127 of file lsarpc.c.

4129 {
4130  UNIMPLEMENTED;
4131  return STATUS_NOT_IMPLEMENTED;
4132 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

◆ CredrRead()

NTSTATUS WINAPI CredrRead ( PLSAPR_SERVER_NAME  SystemName)

Definition at line 4055 of file lsarpc.c.

4057 {
4058  UNIMPLEMENTED;
4059  return STATUS_NOT_IMPLEMENTED;
4060 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

◆ CredrReadDomainCredentials()

NTSTATUS WINAPI CredrReadDomainCredentials ( PLSAPR_SERVER_NAME  SystemName)

Definition at line 4088 of file lsarpc.c.

4090 {
4091  UNIMPLEMENTED;
4092  return STATUS_NOT_IMPLEMENTED;
4093 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

◆ CredrRename()

NTSTATUS WINAPI CredrRename ( PLSAPR_SERVER_NAME  SystemName,
LPWSTR  OldTargetName,
LPWSTR  NewTargetName,
DWORD  Type,
DWORD  Flags 
)

Definition at line 4254 of file lsarpc.c.

4260 {
4261  UNIMPLEMENTED;
4262  return STATUS_NOT_IMPLEMENTED;
4263 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

◆ CredrWrite()

NTSTATUS WINAPI CredrWrite ( PLSAPR_SERVER_NAME  SystemName)

Definition at line 4044 of file lsarpc.c.

4046 {
4047  UNIMPLEMENTED;
4048  return STATUS_NOT_IMPLEMENTED;
4049 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

◆ CredrWriteDomainCredentials()

NTSTATUS WINAPI CredrWriteDomainCredentials ( PLSAPR_SERVER_NAME  SystemName)

Definition at line 4077 of file lsarpc.c.

4079 {
4080  UNIMPLEMENTED;
4081  return STATUS_NOT_IMPLEMENTED;
4082 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

◆ LSAPR_HANDLE_rundown()

void __RPC_USER LSAPR_HANDLE_rundown ( LSAPR_HANDLE  hHandle)

Definition at line 116 of file lsarpc.c.

118 {
119 }

◆ LsarAddAccountRights()

NTSTATUS WINAPI LsarAddAccountRights ( LSAPR_HANDLE  PolicyHandle,
PRPC_SID  AccountSid,
PLSAPR_USER_RIGHT_SET  UserRights 
)

Definition at line 3003 of file lsarpc.c.

3007 {
3008  PLSA_DB_OBJECT PolicyObject;
3009  PLSA_DB_OBJECT AccountObject = NULL;
3010  ULONG ulNewPrivileges = 0, ulNewRights = 0;
3011  ACCESS_MASK SystemAccess = 0;
3012  ULONG Size, Value, i, j;
3013  PPRIVILEGE_SET PrivilegeSet = NULL;
3014  ULONG PrivilegeSetBufferSize = 0;
3015  ULONG PrivilegeCount;
3016  BOOLEAN bFound;
3017  PLUID pLuid;
3018  NTSTATUS Status;
3019 
3020  TRACE("LsarAddAccountRights(%p %p %p)\n",
3021  PolicyHandle, AccountSid, UserRights);
3022 
3023  /* Validate the AccountSid */
3024  if (!RtlValidSid(AccountSid))
3025  return STATUS_INVALID_PARAMETER;
3026 
3027  /* Validate the UserRights */
3028  if (UserRights == NULL)
3029  return STATUS_INVALID_PARAMETER;
3030 
3031  /* Validate the privilege and account right names */
3032  for (i = 0; i < UserRights->Entries; i++)
3033  {
3034  if (LsarpLookupPrivilegeValue(&UserRights->UserRights[i]) != NULL)
3035  {
3036  ulNewPrivileges++;
3037  }
3038  else
3039  {
3040  if (LsapLookupAccountRightValue(&UserRights->UserRights[i]) == 0)
3041  return STATUS_NO_SUCH_PRIVILEGE;
3042 
3043  ulNewRights++;
3044  }
3045  }
3046 
3047  TRACE("ulNewPrivileges: %lu\n", ulNewPrivileges);
3048  TRACE("ulNewRights: %lu\n", ulNewRights);
3049 
3050  /* Validate the PolicyHandle */
3051  Status = LsapValidateDbObject(PolicyHandle,
3054  &PolicyObject);
3055  if (!NT_SUCCESS(Status))
3056  {
3057  WARN("LsapValidateDbObject returned 0x%08lx\n", Status);
3058  return Status;
3059  }
3060 
3061  /* Open the account */
3062  Status = LsarpOpenAccount(PolicyObject,
3063  AccountSid,
3064  0,
3065  &AccountObject);
3067  {
3068  WARN("LsarpOpenAccount returned 0x%08lx\n", Status);
3069  goto done;
3070  }
3072  {
3073  /* Create a new account if it does not yet exist */
3074  Status = LsarpCreateAccount(PolicyObject,
3075  AccountSid,
3076  0,
3077  &AccountObject);
3078  if (!NT_SUCCESS(Status))
3079  {
3080  WARN("LsarpCreateAccount returned 0x%08lx\n", Status);
3081  goto done;
3082  }
3083  }
3084 
3085  if (ulNewPrivileges > 0)
3086  {
3087  Size = 0;
3088 
3089  /* Get the size of the Privilgs attribute */
3090  Status = LsapGetObjectAttribute(AccountObject,
3091  L"Privilgs",
3092  NULL,
3093  &Size);
3095  goto done;
3096 
3097  /* Calculate the required privilege set buffer size */
3098  if (Size == 0)
3099  PrivilegeSetBufferSize = sizeof(PRIVILEGE_SET) +
3100  (ulNewPrivileges - 1) * sizeof(LUID_AND_ATTRIBUTES);
3101  else
3102  PrivilegeSetBufferSize = Size +
3103  ulNewPrivileges * sizeof(LUID_AND_ATTRIBUTES);
3104 
3105  /* Allocate the privilege set buffer */
3106  PrivilegeSet = RtlAllocateHeap(RtlGetProcessHeap(),
3108  PrivilegeSetBufferSize);
3109  if (PrivilegeSet == NULL)
3110  return STATUS_NO_MEMORY;
3111 
3112  /* Get the privilege set */
3113  if (Size != 0)
3114  {
3115  Status = LsapGetObjectAttribute(AccountObject,
3116  L"Privilgs",
3117  PrivilegeSet,
3118  &Size);
3119  if (!NT_SUCCESS(Status))
3120  {
3121  WARN("LsapGetObjectAttribute() failed (Status 0x%08lx)\n", Status);
3122  goto done;
3123  }
3124  }
3125 
3126  PrivilegeCount = PrivilegeSet->PrivilegeCount;
3127  TRACE("Privilege count: %lu\n", PrivilegeCount);
3128 
3129  for (i = 0; i < UserRights->Entries; i++)
3130  {
3131  pLuid = LsarpLookupPrivilegeValue(&UserRights->UserRights[i]);
3132  if (pLuid == NULL)
3133  continue;
3134 
3135  bFound = FALSE;
3136  for (j = 0; j < PrivilegeSet->PrivilegeCount; j++)
3137  {
3138  if (RtlEqualLuid(&(PrivilegeSet->Privilege[j].Luid), pLuid))
3139  {
3140  bFound = TRUE;
3141  break;
3142  }
3143  }
3144 
3145  if (bFound == FALSE)
3146  {
3147  /* Copy the new privilege */
3148  RtlCopyMemory(&(PrivilegeSet->Privilege[PrivilegeSet->PrivilegeCount]),
3149  pLuid,
3150  sizeof(LUID));
3151  PrivilegeSet->PrivilegeCount++;
3152  }
3153  }
3154 
3155  /* Store the extended privilege set */
3156  if (PrivilegeCount != PrivilegeSet->PrivilegeCount)
3157  {
3158  Size = sizeof(PRIVILEGE_SET) +
3159  (PrivilegeSet->PrivilegeCount - 1) * sizeof(LUID_AND_ATTRIBUTES);
3160 
3161  Status = LsapSetObjectAttribute(AccountObject,
3162  L"Privilgs",
3163  PrivilegeSet,
3164  Size);
3165  if (!NT_SUCCESS(Status))
3166  {
3167  WARN("LsapSetObjectAttribute() failed (Status 0x%08lx)\n", Status);
3168  goto done;
3169  }
3170  }
3171  }
3172 
3173  if (ulNewRights > 0)
3174  {
3175  Size = sizeof(ACCESS_MASK);
3176 
3177  /* Get the system access flags, if the attribute exists */
3178  Status = LsapGetObjectAttribute(AccountObject,
3179  L"ActSysAc",
3180  &SystemAccess,
3181  &Size);
3183  goto done;
3184 
3185  /* Set the new access rights */
3186  for (i = 0; i < UserRights->Entries; i++)
3187  {
3188  Value = LsapLookupAccountRightValue(&UserRights->UserRights[i]);
3189  if (Value != 0)
3190  SystemAccess |= Value;
3191  }
3192 
3193  /* Set the system access flags */
3194  Status = LsapSetObjectAttribute(AccountObject,
3195  L"ActSysAc",
3196  &SystemAccess,
3197  sizeof(ACCESS_MASK));
3198  }
3199 
3200 done:
3201  if (PrivilegeSet != NULL)
3202  RtlFreeHeap(RtlGetProcessHeap(), 0, PrivilegeSet);
3203 
3204  if (AccountObject != NULL)
3205  LsapCloseDbObject(AccountObject);
3206 
3207  return Status;
3208 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
NTSTATUS LsapSetObjectAttribute(PLSA_DB_OBJECT DbObject, LPWSTR AttributeName, LPVOID AttributeData, ULONG AttributeSize)
Definition: database.c:959
struct _PRIVILEGE_SET PRIVILEGE_SET
ACCESS_MASK LsapLookupAccountRightValue(IN PRPC_UNICODE_STRING Name)
Definition: privileges.c:380
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define WARN(fmt,...)
Definition: debug.h:111
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
struct _LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES
NTSTATUS LsapCloseDbObject(PLSA_DB_OBJECT DbObject)
Definition: database.c:868
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define RtlEqualLuid(Luid1, Luid2)
Definition: rtlfuncs.h:301
unsigned char BOOLEAN
NTSTATUS LsarpCreateAccount(PLSA_DB_OBJECT PolicyObject, PRPC_SID AccountSid, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *AccountObject)
Definition: lsarpc.c:813
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI BOOLEAN NTAPI RtlValidSid(IN PSID Sid)
Definition: sid.c:21
PLUID LsarpLookupPrivilegeValue(IN PRPC_UNICODE_STRING Name)
Definition: privileges.c:227
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
#define POLICY_LOOKUP_NAMES
Definition: ntsecapi.h:72
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_SUCH_PRIVILEGE
Definition: ntstatus.h:318
static const WCHAR L[]
Definition: oid.c:1250
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
unsigned int ULONG
Definition: retypes.h:1
static NTSTATUS LsarpOpenAccount(IN PLSA_DB_OBJECT PolicyObject, IN PRPC_SID AccountSid, IN ACCESS_MASK DesiredAccess, OUT PLSA_DB_OBJECT *AccountObject)
Definition: lsarpc.c:1425
NTSTATUS LsapGetObjectAttribute(PLSA_DB_OBJECT DbObject, LPWSTR AttributeName, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:1010
PRPC_UNICODE_STRING UserRights
Definition: lsa.idl:393
ULONG ACCESS_MASK
Definition: nt_native.h:40

Referenced by LsaAddAccountRights().

◆ LsarAddPrivilegesToAccount()

NTSTATUS WINAPI LsarAddPrivilegesToAccount ( LSAPR_HANDLE  AccountHandle,
PLSAPR_PRIVILEGE_SET  Privileges 
)

Definition at line 1563 of file lsarpc.c.

1566 {
1567  PLSA_DB_OBJECT AccountObject;
1568  PPRIVILEGE_SET CurrentPrivileges = NULL;
1569  PPRIVILEGE_SET NewPrivileges = NULL;
1570  ULONG PrivilegeSetSize = 0;
1571  ULONG PrivilegeCount;
1572  ULONG i, j;
1573  BOOL bFound;
1574  NTSTATUS Status;
1575 
1576  TRACE("LsarAddPrivilegesToAccount(%p %p)\n",
1577  AccountHandle, Privileges);
1578 
1579  /* Validate the AccountHandle */
1580  Status = LsapValidateDbObject(AccountHandle,
1583  &AccountObject);
1584  if (!NT_SUCCESS(Status))
1585  {
1586  ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
1587  return Status;
1588  }
1589 
1590  /* Get the size of the Privilgs attribute */
1591  Status = LsapGetObjectAttribute(AccountObject,
1592  L"Privilgs",
1593  NULL,
1594  &PrivilegeSetSize);
1595  if (!NT_SUCCESS(Status) || PrivilegeSetSize == 0)
1596  {
1597  /* The Privilgs attribute does not exist */
1598 
1599  PrivilegeSetSize = sizeof(PRIVILEGE_SET) +
1600  (Privileges->PrivilegeCount - 1) * sizeof(LUID_AND_ATTRIBUTES);
1601  Status = LsapSetObjectAttribute(AccountObject,
1602  L"Privilgs",
1603  Privileges,
1604  PrivilegeSetSize);
1605  }
1606  else
1607  {
1608  /* The Privilgs attribute exists */
1609 
1610  /* Allocate memory for the stored privilege set */
1611  CurrentPrivileges = MIDL_user_allocate(PrivilegeSetSize);
1612  if (CurrentPrivileges == NULL)
1613  return STATUS_NO_MEMORY;
1614 
1615  /* Get the current privilege set */
1616  Status = LsapGetObjectAttribute(AccountObject,
1617  L"Privilgs",
1618  CurrentPrivileges,
1619  &PrivilegeSetSize);
1620  if (!NT_SUCCESS(Status))
1621  {
1622  TRACE("LsapGetObjectAttribute() failed (Status 0x%08lx)\n", Status);
1623  goto done;
1624  }
1625 
1626  PrivilegeCount = CurrentPrivileges->PrivilegeCount;
1627  TRACE("Current privilege count: %lu\n", PrivilegeCount);
1628 
1629  /* Calculate the number of privileges in the combined privilege set */
1630  for (i = 0; i < Privileges->PrivilegeCount; i++)
1631  {
1632  bFound = FALSE;
1633  for (j = 0; j < CurrentPrivileges->PrivilegeCount; j++)
1634  {
1635  if (RtlEqualLuid(&(Privileges->Privilege[i].Luid),
1636  &(CurrentPrivileges->Privilege[i].Luid)))
1637  {
1638  bFound = TRUE;
1639  break;
1640  }
1641  }
1642 
1643  if (bFound == FALSE)
1644  {
1645  TRACE("Found new privilege\n");
1646  PrivilegeCount++;
1647  }
1648  }
1649  TRACE("New privilege count: %lu\n", PrivilegeCount);
1650 
1651  /* Calculate the size of the new privilege set and allocate it */
1652  PrivilegeSetSize = sizeof(PRIVILEGE_SET) +
1653  (PrivilegeCount - 1) * sizeof(LUID_AND_ATTRIBUTES);
1654  NewPrivileges = MIDL_user_allocate(PrivilegeSetSize);
1655  if (NewPrivileges == NULL)
1656  {
1658  goto done;
1659  }
1660 
1661  /* Initialize the new privilege set */
1662  NewPrivileges->PrivilegeCount = PrivilegeCount;
1663  NewPrivileges->Control = 0;
1664 
1665  /* Copy all privileges from the current privilege set */
1666  RtlCopyLuidAndAttributesArray(CurrentPrivileges->PrivilegeCount,
1667  &(CurrentPrivileges->Privilege[0]),
1668  &(NewPrivileges->Privilege[0]));
1669 
1670  /* Add new privileges to the new privilege set */
1671  PrivilegeCount = CurrentPrivileges->PrivilegeCount;
1672  for (i = 0; i < Privileges->PrivilegeCount; i++)
1673  {
1674  bFound = FALSE;
1675  for (j = 0; j < CurrentPrivileges->PrivilegeCount; j++)
1676  {
1677  if (RtlEqualLuid(&(Privileges->Privilege[i].Luid),
1678  &(CurrentPrivileges->Privilege[i].Luid)))
1679  {
1680  /* Overwrite attributes if a matching privilege was found */
1681  NewPrivileges->Privilege[j].Attributes = Privileges->Privilege[i].Attributes;
1682 
1683  bFound = TRUE;
1684  break;
1685  }
1686  }
1687 
1688  if (bFound == FALSE)
1689  {
1690  /* Copy the new privilege */
1692  (PLUID_AND_ATTRIBUTES)&(Privileges->Privilege[i]),
1693  &(NewPrivileges->Privilege[PrivilegeCount]));
1694  PrivilegeCount++;
1695  }
1696  }
1697 
1698  /* Set the new privilege set */
1699  Status = LsapSetObjectAttribute(AccountObject,
1700  L"Privilgs",
1701  NewPrivileges,
1702  PrivilegeSetSize);
1703  }
1704 
1705 done:
1706  if (CurrentPrivileges != NULL)
1707  MIDL_user_free(CurrentPrivileges);
1708 
1709  if (NewPrivileges != NULL)
1710  MIDL_user_free(NewPrivileges);
1711 
1712  return Status;
1713 }
#define TRUE
Definition: types.h:120
NTSTATUS LsapSetObjectAttribute(PLSA_DB_OBJECT DbObject, LPWSTR AttributeName, LPVOID AttributeData, ULONG AttributeSize)
Definition: database.c:959
struct _PRIVILEGE_SET PRIVILEGE_SET
LONG NTSTATUS
Definition: precomp.h:26
struct _LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES
$ULONG Control
Definition: setypes.h:87
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
#define RtlEqualLuid(Luid1, Luid2)
Definition: rtlfuncs.h:301
NTSYSAPI VOID NTAPI RtlCopyLuidAndAttributesArray(ULONG Count, PLUID_AND_ATTRIBUTES Src, PLUID_AND_ATTRIBUTES Dest)
Definition: luid.c:33
smooth NULL
Definition: ftsmooth.c:416
$ULONG PrivilegeCount
Definition: setypes.h:86
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET * Privileges
Definition: sefuncs.h:13
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY]
Definition: setypes.h:88
unsigned int ULONG
Definition: retypes.h:1
void *__RPC_USER MIDL_user_allocate(SIZE_T size)
Definition: irotp.c:371
#define ACCOUNT_ADJUST_PRIVILEGES
Definition: ntlsa.h:29
void __RPC_USER MIDL_user_free(void *p)
Definition: irotp.c:376
NTSTATUS LsapGetObjectAttribute(PLSA_DB_OBJECT DbObject, LPWSTR AttributeName, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:1010

Referenced by LsaAddPrivilegesToAccount().

◆ LsarAdtRegisterSecurityEventSource()

NTSTATUS WINAPI LsarAdtRegisterSecurityEventSource ( handle_t  hBinding)

Definition at line 4360 of file lsarpc.c.

4362 {
4363  UNIMPLEMENTED;
4364  return STATUS_NOT_IMPLEMENTED;
4365 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

◆ LsarAdtReportSecurityEvent()

NTSTATUS WINAPI LsarAdtReportSecurityEvent ( handle_t  hBinding)

Definition at line 4382 of file lsarpc.c.

4384 {
4385  UNIMPLEMENTED;
4386  return STATUS_NOT_IMPLEMENTED;
4387 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

◆ LsarAdtUnregisterSecurityEventSource()

NTSTATUS WINAPI LsarAdtUnregisterSecurityEventSource ( handle_t  hBinding)

Definition at line 4371 of file lsarpc.c.

4373 {
4374  UNIMPLEMENTED;
4375  return STATUS_NOT_IMPLEMENTED;
4376 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

◆ LsarChangePassword()

NTSTATUS WINAPI LsarChangePassword ( handle_t  IDL_handle,
PRPC_UNICODE_STRING  String1,
PRPC_UNICODE_STRING  String2,
PRPC_UNICODE_STRING  String3,
PRPC_UNICODE_STRING  String4,
PRPC_UNICODE_STRING  String5 
)

Definition at line 479 of file lsarpc.c.

486 {
487  /* Deprecated */
488  return STATUS_NOT_IMPLEMENTED;
489 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225

◆ LsarClearAuditLog()

NTSTATUS WINAPI LsarClearAuditLog ( LSAPR_HANDLE  ObjectHandle)

Definition at line 804 of file lsarpc.c.

806 {
807  /* Deprecated */
808  return STATUS_NOT_IMPLEMENTED;
809 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225

Referenced by LsaClearAuditLog().

◆ LsarClose()

NTSTATUS WINAPI LsarClose ( LSAPR_HANDLE ObjectHandle)

Definition at line 125 of file lsarpc.c.

127 {
128  PLSA_DB_OBJECT DbObject;
130 
131  TRACE("LsarClose(%p)\n", ObjectHandle);
132 
133 // RtlEnterCriticalSection(&PolicyHandleTableLock);
134 
135  Status = LsapValidateDbObject(*ObjectHandle,
137  0,
138  &DbObject);
139  if (Status == STATUS_SUCCESS)
140  {
141  Status = LsapCloseDbObject(DbObject);
142  *ObjectHandle = NULL;
143  }
144 
145 // RtlLeaveCriticalSection(&PolicyHandleTableLock);
146 
147  return Status;
148 }
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS LsapCloseDbObject(PLSA_DB_OBJECT DbObject)
Definition: database.c:868
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
Status
Definition: gdiplustypes.h:24
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by DsRolepGetBasicInfo(), GetAccountDomainSid(), LsaClose(), LsapSetPrivileges(), and LsarEnumerateAccountRights().

◆ LsarCreateAccount()

NTSTATUS WINAPI LsarCreateAccount ( LSAPR_HANDLE  PolicyHandle,
PRPC_SID  AccountSid,
ACCESS_MASK  DesiredAccess,
LSAPR_HANDLE AccountHandle 
)

Definition at line 883 of file lsarpc.c.

888 {
889  PLSA_DB_OBJECT PolicyObject;
890  PLSA_DB_OBJECT AccountObject = NULL;
892 
893  TRACE("LsarCreateAccount(%p %p %lx %p)\n",
894  PolicyHandle, AccountSid, DesiredAccess, AccountHandle);
895 
896  /* Validate the AccountSid */
897  if (!RtlValidSid(AccountSid))
899 
900  /* Validate the PolicyHandle */
901  Status = LsapValidateDbObject(PolicyHandle,
904  &PolicyObject);
905  if (!NT_SUCCESS(Status))
906  {
907  ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
908  return Status;
909  }
910 
911 
912  Status = LsarpCreateAccount(PolicyObject,
913  AccountSid,
915  &AccountObject);
916  if (NT_SUCCESS(Status))
917  {
918  *AccountHandle = (LSAPR_HANDLE)AccountObject;
919  }
920 
921  return Status;
922 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
PVOID LSAPR_HANDLE
Definition: msv1_0.h:260
NTSTATUS LsarpCreateAccount(PLSA_DB_OBJECT PolicyObject, PRPC_SID AccountSid, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *AccountObject)
Definition: lsarpc.c:813
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI BOOLEAN NTAPI RtlValidSid(IN PSID Sid)
Definition: sid.c:21
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define POLICY_CREATE_ACCOUNT
Definition: ntsecapi.h:65

Referenced by LsaCreateAccount().

◆ LsarCreateSecret()

NTSTATUS WINAPI LsarCreateSecret ( LSAPR_HANDLE  PolicyHandle,
PRPC_UNICODE_STRING  SecretName,
ACCESS_MASK  DesiredAccess,
LSAPR_HANDLE SecretHandle 
)

Definition at line 1319 of file lsarpc.c.

1324 {
1325  PLSA_DB_OBJECT PolicyObject;
1326  PLSA_DB_OBJECT SecretObject = NULL;
1328  PSECURITY_DESCRIPTOR SecretSd = NULL;
1329  ULONG SecretSdSize;
1331 
1332  TRACE("LsarCreateSecret(%p %wZ %lx %p)\n",
1333  PolicyHandle, SecretName, DesiredAccess, SecretHandle);
1334 
1335  /* Validate the PolicyHandle */
1336  Status = LsapValidateDbObject(PolicyHandle,
1339  &PolicyObject);
1340  if (!NT_SUCCESS(Status))
1341  {
1342  ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
1343  return Status;
1344  }
1345 
1346  /* Get the current time */
1348  if (!NT_SUCCESS(Status))
1349  {
1350  ERR("NtQuerySystemTime failed (Status 0x%08lx)\n", Status);
1351  goto done;
1352  }
1353 
1354  /* Create a security descriptor for the secret */
1355  Status = LsapCreateSecretSd(&SecretSd,
1356  &SecretSdSize);
1357  if (!NT_SUCCESS(Status))
1358  {
1359  ERR("LsapCreateAccountSd returned 0x%08lx\n", Status);
1360  return Status;
1361  }
1362 
1363  /* Create the Secret object */
1364  Status = LsapCreateDbObject(PolicyObject,
1365  L"Secrets",
1366  SecretName->Buffer,
1368  DesiredAccess,
1369  PolicyObject->Trusted,
1370  &SecretObject);
1371  if (!NT_SUCCESS(Status))
1372  {
1373  ERR("LsapCreateDbObject failed (Status 0x%08lx)\n", Status);
1374  goto done;
1375  }
1376 
1377  /* Set the CurrentTime attribute */
1378  Status = LsapSetObjectAttribute(SecretObject,
1379  L"CurrentTime",
1380  (PVOID)&Time,
1381  sizeof(LARGE_INTEGER));
1382  if (!NT_SUCCESS(Status))
1383  {
1384  ERR("LsapSetObjectAttribute (CurrentTime) failed (Status 0x%08lx)\n", Status);
1385  goto done;
1386  }
1387 
1388  /* Set the OldTime attribute */
1389  Status = LsapSetObjectAttribute(SecretObject,
1390  L"OldTime",
1391  (PVOID)&Time,
1392  sizeof(LARGE_INTEGER));
1393  if (!NT_SUCCESS(Status))
1394  {
1395  ERR("LsapSetObjectAttribute (OldTime) failed (Status 0x%08lx)\n", Status);
1396  goto done;
1397  }
1398 
1399  /* Set the SecDesc attribute */
1400  Status = LsapSetObjectAttribute(SecretObject,
1401  L"SecDesc",
1402  SecretSd,
1403  SecretSdSize);
1404 
1405 done:
1406  if (SecretSd != NULL)
1407  RtlFreeHeap(RtlGetProcessHeap(), 0, SecretSd);
1408 
1409  if (!NT_SUCCESS(Status))
1410  {
1411  if (SecretObject != NULL)
1412  LsapCloseDbObject(SecretObject);
1413  }
1414  else
1415  {
1416  *SecretHandle = (LSAPR_HANDLE)SecretObject;
1417  }
1418 
1419  return STATUS_SUCCESS;
1420 }
NTSTATUS LsapSetObjectAttribute(PLSA_DB_OBJECT DbObject, LPWSTR AttributeName, LPVOID AttributeData, ULONG AttributeSize)
Definition: database.c:959
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
NTSTATUS LsapCloseDbObject(PLSA_DB_OBJECT DbObject)
Definition: database.c:868
BOOLEAN Trusted
Definition: lsasrv.h:63
PVOID LSAPR_HANDLE
Definition: msv1_0.h:260
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
#define POLICY_CREATE_SECRET
Definition: ntsecapi.h:66
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS NTAPI NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
Definition: time.c:417
NTSTATUS LsapCreateSecretSd(PSECURITY_DESCRIPTOR *SecretSd, PULONG SecretSdSize)
Definition: security.c:436
NTSTATUS LsapCreateDbObject(IN PLSA_DB_OBJECT ParentObject, IN LPWSTR ContainerName, IN LPWSTR ObjectName, IN LSA_DB_OBJECT_TYPE ObjectType, IN ACCESS_MASK DesiredAccess, IN BOOLEAN Trusted, OUT PLSA_DB_OBJECT *DbObject)
Definition: database.c:590
return STATUS_SUCCESS
Definition: btrfs.c:2938
static PLARGE_INTEGER Time
Definition: time.c:105
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by LsaCreateSecret().

◆ LsarCreateTrustedDomain()

NTSTATUS WINAPI LsarCreateTrustedDomain ( LSAPR_HANDLE  PolicyHandle,
PLSAPR_TRUST_INFORMATION  TrustedDomainInformation,
ACCESS_MASK  DesiredAccess,
LSAPR_HANDLE TrustedDomainHandle 
)

Definition at line 1158 of file lsarpc.c.

1163 {
1164  /* Fail, if we are not a domain controller */
1167 
1168  UNIMPLEMENTED;
1169  return STATUS_NOT_IMPLEMENTED;
1170 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
NT_PRODUCT_TYPE LsapProductType
Definition: lsasrv.c:13
#define STATUS_DIRECTORY_SERVICE_REQUIRED
Definition: ntstatus.h:790
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by LsaCreateTrustedDomain().

◆ LsarCreateTrustedDomainEx()

NTSTATUS WINAPI LsarCreateTrustedDomainEx ( LSAPR_HANDLE  PolicyHandle,
PLSAPR_TRUSTED_DOMAIN_INFORMATION_EX  TrustedDomainInformation,
PLSAPR_TRUSTED_DOMAIN_AUTH_INFORMATION  AuthentificationInformation,
ACCESS_MASK  DesiredAccess,
LSAPR_HANDLE TrustedDomainHandle 
)

Definition at line 3836 of file lsarpc.c.

3842 {
3843  /* Fail, if we are not a domain controller */
3846 
3847  UNIMPLEMENTED;
3848  return STATUS_NOT_IMPLEMENTED;
3849 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
NT_PRODUCT_TYPE LsapProductType
Definition: lsasrv.c:13
#define STATUS_DIRECTORY_SERVICE_REQUIRED
Definition: ntstatus.h:790
#define UNIMPLEMENTED
Definition: debug.h:114

◆ LsarCreateTrustedDomainEx2()

NTSTATUS WINAPI LsarCreateTrustedDomainEx2 ( LSAPR_HANDLE  PolicyHandle,
PLSAPR_TRUSTED_DOMAIN_INFORMATION_EX  TrustedDomainInformation,
PLSAPR_TRUSTED_DOMAIN_AUTH_INFORMATION_INTERNAL  AuthentificationInformation,
ACCESS_MASK  DesiredAccess,
LSAPR_HANDLE TrustedDomainHandle 
)

Definition at line 4025 of file lsarpc.c.

4031 {
4032  /* Fail, if we are not a domain controller */
4035 
4036  UNIMPLEMENTED;
4037  return STATUS_NOT_IMPLEMENTED;
4038 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
NT_PRODUCT_TYPE LsapProductType
Definition: lsasrv.c:13
#define STATUS_DIRECTORY_SERVICE_REQUIRED
Definition: ntstatus.h:790
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by LsaCreateTrustedDomainEx().

◆ LsarDelete()

NTSTATUS WINAPI LsarDelete ( LSAPR_HANDLE  ObjectHandle)

Definition at line 154 of file lsarpc.c.

156 {
157  TRACE("LsarDelete(%p)\n", ObjectHandle);
158 
159  return LsarDeleteObject(&ObjectHandle);
160 }
#define TRACE(s)
Definition: solgame.cpp:4
NTSTATUS WINAPI LsarDeleteObject(LSAPR_HANDLE *ObjectHandle)
Definition: lsarpc.c:2530

Referenced by LsaDelete().

◆ LsarDeleteObject()

NTSTATUS WINAPI LsarDeleteObject ( LSAPR_HANDLE ObjectHandle)

Definition at line 2530 of file lsarpc.c.

2532 {
2533  PLSA_DB_OBJECT DbObject;
2534  NTSTATUS Status;
2535 
2536  TRACE("LsarDeleteObject(%p)\n", ObjectHandle);
2537 
2538  if (ObjectHandle == NULL)
2539  return STATUS_INVALID_PARAMETER;
2540 
2541  /* Validate the ObjectHandle */
2542  Status = LsapValidateDbObject(*ObjectHandle,
2544  DELETE,
2545  &DbObject);
2546  if (!NT_SUCCESS(Status))
2547  {
2548  ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
2549  return Status;
2550  }
2551 
2552  /* You cannot delete the policy object */
2553  if (DbObject->ObjectType == LsaDbPolicyObject)
2554  return STATUS_INVALID_PARAMETER;
2555 
2556  /* Delete the database object */
2557  Status = LsapDeleteDbObject(DbObject);
2558  if (!NT_SUCCESS(Status))
2559  {
2560  ERR("LsapDeleteDbObject returned 0x%08lx\n", Status);
2561  return Status;
2562  }
2563 
2564  /* Invalidate the object handle */
2565  *ObjectHandle = NULL;
2566 
2567  return STATUS_SUCCESS;
2568 }
NTSTATUS LsapDeleteDbObject(IN PLSA_DB_OBJECT DbObject)
Definition: database.c:899
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
LSA_DB_OBJECT_TYPE ObjectType
Definition: lsasrv.h:59
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define DELETE
Definition: nt_native.h:57

Referenced by LsarDelete().

◆ LsarDeleteTrustedDomain()

NTSTATUS WINAPI LsarDeleteTrustedDomain ( LSAPR_HANDLE  PolicyHandle,
PRPC_SID  TrustedDomainSid 
)

Definition at line 3446 of file lsarpc.c.

3449 {
3450  /* Fail, if we are not a domain controller */
3453 
3454  UNIMPLEMENTED;
3455  return STATUS_NOT_IMPLEMENTED;
3456 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
NT_PRODUCT_TYPE LsapProductType
Definition: lsasrv.c:13
#define STATUS_DIRECTORY_SERVICE_REQUIRED
Definition: ntstatus.h:790
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by LsaDeleteTrustedDomain().

◆ LsarEnumerateAccountRights()

NTSTATUS WINAPI LsarEnumerateAccountRights ( LSAPR_HANDLE  PolicyHandle,
PRPC_SID  AccountSid,
PLSAPR_USER_RIGHT_SET  UserRights 
)

Definition at line 2853 of file lsarpc.c.

2857 {
2858  LSAPR_HANDLE AccountHandle;
2859  PLSAPR_PRIVILEGE_SET PrivilegeSet = NULL;
2860  PRPC_UNICODE_STRING RightsBuffer = NULL;
2861  PRPC_UNICODE_STRING PrivilegeString;
2862  ACCESS_MASK SystemAccess = 0;
2863  ULONG RightsCount = 0;
2864  ULONG Index;
2865  ULONG i;
2866  NTSTATUS Status;
2867 
2868  TRACE("LsarEnumerateAccountRights(%p %p %p)\n",
2869  PolicyHandle, AccountSid, UserRights);
2870 
2871  /* Open the account */
2872  Status = LsarOpenAccount(PolicyHandle,
2873  AccountSid,
2874  ACCOUNT_VIEW,
2875  &AccountHandle);
2876  if (!NT_SUCCESS(Status))
2877  {
2878  WARN("LsarOpenAccount returned 0x%08lx\n", Status);
2879  return Status;
2880  }
2881 
2882  /* Enumerate the privileges */
2883  Status = LsarEnumeratePrivilegesAccount(AccountHandle,
2884  &PrivilegeSet);
2886  {
2887  WARN("LsarEnumeratePrivilegesAccount returned 0x%08lx\n", Status);
2888  goto done;
2889  }
2890 
2891  /* Get account rights */
2892  Status = LsarGetSystemAccessAccount(AccountHandle,
2893  &SystemAccess);
2895  {
2896  WARN("LsarGetSystemAccessAccount returned 0x%08lx\n", Status);
2897  goto done;
2898  }
2899 
2900  RightsCount = PrivilegeSet->PrivilegeCount;
2901 
2902  /* Count account rights */
2903  for (i = 0; i < sizeof(ACCESS_MASK) * 8; i++)
2904  {
2905  if (SystemAccess & (1 << i))
2906  RightsCount++;
2907  }
2908 
2909  /* We are done if there are no rights to be enumerated */
2910  if (RightsCount == 0)
2911  {
2912  UserRights->Entries = 0;
2913  UserRights->UserRights = NULL;
2915  goto done;
2916  }
2917 
2918  /* Allocate a buffer for the account rights */
2919  RightsBuffer = MIDL_user_allocate(RightsCount * sizeof(RPC_UNICODE_STRING));
2920  if (RightsBuffer == NULL)
2921  {
2923  goto done;
2924  }
2925 
2926  /* Copy the privileges into the buffer */
2927  Index = 0;
2928  if (PrivilegeSet)
2929  {
2930  for (i = 0; i < PrivilegeSet->PrivilegeCount; i++)
2931  {
2932  PrivilegeString = NULL;
2933  Status = LsarLookupPrivilegeName(PolicyHandle,
2934  (PLUID)&PrivilegeSet->Privilege[i].Luid,
2935  &PrivilegeString);
2936  if (!NT_SUCCESS(Status))
2937  {
2938  WARN("LsarLookupPrivilegeName returned 0x%08lx\n", Status);
2939  goto done;
2940  }
2941 
2942  RightsBuffer[Index].Length = PrivilegeString->Length;
2943  RightsBuffer[Index].MaximumLength = PrivilegeString->MaximumLength;
2944  RightsBuffer[Index].Buffer = PrivilegeString->Buffer;
2945 
2946  MIDL_user_free(PrivilegeString);
2947  Index++;
2948  }
2949  }
2950 
2951  /* Copy account rights into the buffer */
2952  for (i = 0; i < sizeof(ACCESS_MASK) * 8; i++)
2953  {
2954  if (SystemAccess & (1 << i))
2955  {
2957  &PrivilegeString);
2958  if (!NT_SUCCESS(Status))
2959  {
2960  WARN("LsarLookupAccountRightName returned 0x%08lx\n", Status);
2961  goto done;
2962  }
2963 
2964  RightsBuffer[Index].Length = PrivilegeString->Length;
2965  RightsBuffer[Index].MaximumLength = PrivilegeString->MaximumLength;
2966  RightsBuffer[Index].Buffer = PrivilegeString->Buffer;
2967 
2968  MIDL_user_free(PrivilegeString);
2969  Index++;
2970  }
2971  }
2972 
2973  UserRights->Entries = RightsCount;
2974  UserRights->UserRights = (PRPC_UNICODE_STRING)RightsBuffer;
2975 
2976 done:
2977  if (!NT_SUCCESS(Status))
2978  {
2979  if (RightsBuffer != NULL)
2980  {
2981  for (Index = 0; Index < RightsCount; Index++)
2982  {
2983  if (RightsBuffer[Index].Buffer != NULL)
2984  MIDL_user_free(RightsBuffer[Index].Buffer);
2985  }
2986 
2987  MIDL_user_free(RightsBuffer);
2988  }
2989  }
2990 
2991  if (PrivilegeSet != NULL)
2992  MIDL_user_free(PrivilegeSet);
2993 
2994  LsarClose(&AccountHandle);
2995 
2996  return Status;
2997 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define WARN(fmt,...)
Definition: debug.h:111
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS WINAPI LsarEnumeratePrivilegesAccount(LSAPR_HANDLE AccountHandle, PLSAPR_PRIVILEGE_SET *Privileges)
Definition: lsarpc.c:1504
#define ACCOUNT_VIEW
Definition: ntlsa.h:28
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LSAPR_LUID_AND_ATTRIBUTES Privilege[*]
Definition: lsa.idl:528
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
NTSTATUS WINAPI LsarOpenAccount(LSAPR_HANDLE PolicyHandle, PRPC_SID AccountSid, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *AccountHandle)
Definition: lsarpc.c:1465
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
DWORD PrivilegeCount
Definition: lsa.idl:526
static const UCHAR Index[8]
Definition: usbohci.c:18
NTSTATUS WINAPI LsarClose(LSAPR_HANDLE *ObjectHandle)
Definition: lsarpc.c:125
NTSTATUS WINAPI LsarLookupPrivilegeName(LSAPR_HANDLE PolicyHandle, PLUID Value, PRPC_UNICODE_STRING *Name)
Definition: lsarpc.c:2464
unsigned short Length
Definition: msv1_0.h:53
Status
Definition: gdiplustypes.h:24
NTSTATUS LsapLookupAccountRightName(ULONG RightValue, PRPC_UNICODE_STRING *Name)
Definition: privileges.c:343
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
struct _RPC_UNICODE_STRING * PRPC_UNICODE_STRING
unsigned int ULONG
Definition: retypes.h:1
void *__RPC_USER MIDL_user_allocate(SIZE_T size)
Definition: irotp.c:371
return STATUS_SUCCESS
Definition: btrfs.c:2938
void __RPC_USER MIDL_user_free(void *p)
Definition: irotp.c:376
NTSTATUS WINAPI LsarGetSystemAccessAccount(LSAPR_HANDLE AccountHandle, ACCESS_MASK *SystemAccess)
Definition: lsarpc.c:1977
PRPC_UNICODE_STRING UserRights
Definition: lsa.idl:393
ULONG ACCESS_MASK
Definition: nt_native.h:40
unsigned short MaximumLength
Definition: msv1_0.h:54
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by LsaEnumerateAccountRights().

◆ LsarEnumerateAccounts()

NTSTATUS WINAPI LsarEnumerateAccounts ( LSAPR_HANDLE  PolicyHandle,
DWORD EnumerationContext,
PLSAPR_ACCOUNT_ENUM_BUFFER  EnumerationBuffer,
DWORD  PreferedMaximumLength 
)

Definition at line 928 of file lsarpc.c.

933 {
934  LSAPR_ACCOUNT_ENUM_BUFFER EnumBuffer = {0, NULL};
935  PLSA_DB_OBJECT PolicyObject = NULL;
936  PWSTR AccountKeyBuffer = NULL;
937  HANDLE AccountsKeyHandle = NULL;
938  HANDLE AccountKeyHandle;
939  HANDLE SidKeyHandle;
940  ULONG AccountKeyBufferSize;
941  ULONG EnumIndex;
942  ULONG EnumCount;
945  ULONG i;
947 
948  TRACE("LsarEnumerateAccount(%p %p %p %lu)\n",
949  PolicyHandle, EnumerationContext, EnumerationBuffer, PreferedMaximumLength);
950 
951  if (EnumerationContext == NULL ||
952  EnumerationBuffer == NULL)
954 
955  EnumerationBuffer->EntriesRead = 0;
956  EnumerationBuffer->Information = NULL;
957 
958  /* Validate the PolicyHandle */
959  Status = LsapValidateDbObject(PolicyHandle,
962  &PolicyObject);
963  if (!NT_SUCCESS(Status))
964  {
965  ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
966  return Status;
967  }
968 
969  Status = LsapRegOpenKey(PolicyObject->KeyHandle,
970  L"Accounts",
971  KEY_READ,
972  &AccountsKeyHandle);
973  if (!NT_SUCCESS(Status))
974  return Status;
975 
976  Status = LsapRegQueryKeyInfo(AccountsKeyHandle,
977  NULL,
978  &AccountKeyBufferSize,
979  NULL);
980  if (!NT_SUCCESS(Status))
981  {
982  ERR("LsapRegQueryKeyInfo returned 0x%08lx\n", Status);
983  return Status;
984  }
985 
986  AccountKeyBufferSize += sizeof(WCHAR);
987  AccountKeyBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, AccountKeyBufferSize);
988  if (AccountKeyBuffer == NULL)
989  {
990  return STATUS_NO_MEMORY;
991  }
992 
993  EnumIndex = *EnumerationContext;
994  EnumCount = 0;
995  RequiredLength = 0;
996 
997  while (TRUE)
998  {
999  Status = LsapRegEnumerateSubKey(AccountsKeyHandle,
1000  EnumIndex,
1001  AccountKeyBufferSize,
1002  AccountKeyBuffer);
1003  if (!NT_SUCCESS(Status))
1004  break;
1005 
1006  TRACE("EnumIndex: %lu\n", EnumIndex);
1007  TRACE("Account key name: %S\n", AccountKeyBuffer);
1008 
1009  Status = LsapRegOpenKey(AccountsKeyHandle,
1010  AccountKeyBuffer,
1011  KEY_READ,
1012  &AccountKeyHandle);
1013  TRACE("LsapRegOpenKey returned %08lX\n", Status);
1014  if (NT_SUCCESS(Status))
1015  {
1016  Status = LsapRegOpenKey(AccountKeyHandle,
1017  L"Sid",
1018  KEY_READ,
1019  &SidKeyHandle);
1020  TRACE("LsapRegOpenKey returned %08lX\n", Status);
1021  if (NT_SUCCESS(Status))
1022  {
1023  DataLength = 0;
1024  Status = LsapRegQueryValue(SidKeyHandle,
1025  NULL,
1026  NULL,
1027  NULL,
1028  &DataLength);
1029  TRACE("LsapRegQueryValue returned %08lX\n", Status);
1030  if (NT_SUCCESS(Status))
1031  {
1032  TRACE("Data length: %lu\n", DataLength);
1033 
1034  if ((RequiredLength + DataLength + sizeof(LSAPR_ACCOUNT_INFORMATION)) > PreferedMaximumLength)
1035  break;
1036 
1038  EnumCount++;
1039  }
1040 
1041  LsapRegCloseKey(SidKeyHandle);
1042  }
1043 
1044  LsapRegCloseKey(AccountKeyHandle);
1045  }
1046 
1047  EnumIndex++;
1048  }
1049 
1050  TRACE("EnumCount: %lu\n", EnumCount);
1051  TRACE("RequiredLength: %lu\n", RequiredLength);
1052 
1053  EnumBuffer.EntriesRead = EnumCount;
1054  EnumBuffer.Information = midl_user_allocate(EnumCount * sizeof(LSAPR_ACCOUNT_INFORMATION));
1055  if (EnumBuffer.Information == NULL)
1056  {
1058  goto done;
1059  }
1060 
1061  EnumIndex = *EnumerationContext;
1062  for (i = 0; i < EnumCount; i++, EnumIndex++)
1063  {
1064  Status = LsapRegEnumerateSubKey(AccountsKeyHandle,
1065  EnumIndex,
1066  AccountKeyBufferSize,
1067  AccountKeyBuffer);
1068  if (!NT_SUCCESS(Status))
1069  break;
1070 
1071  TRACE("EnumIndex: %lu\n", EnumIndex);
1072  TRACE("Account key name: %S\n", AccountKeyBuffer);
1073 
1074  Status = LsapRegOpenKey(AccountsKeyHandle,
1075  AccountKeyBuffer,
1076  KEY_READ,
1077  &AccountKeyHandle);
1078  TRACE("LsapRegOpenKey returned %08lX\n", Status);
1079  if (NT_SUCCESS(Status))
1080  {
1081  Status = LsapRegOpenKey(AccountKeyHandle,
1082  L"Sid",
1083  KEY_READ,
1084  &SidKeyHandle);
1085  TRACE("LsapRegOpenKey returned %08lX\n", Status);
1086  if (NT_SUCCESS(Status))
1087  {
1088  DataLength = 0;
1089  Status = LsapRegQueryValue(SidKeyHandle,
1090  NULL,
1091  NULL,
1092  NULL,
1093  &DataLength);
1094  TRACE("LsapRegQueryValue returned %08lX\n", Status);
1095  if (NT_SUCCESS(Status))
1096  {
1098  if (EnumBuffer.Information[i].Sid == NULL)
1099  {
1100  LsapRegCloseKey(AccountKeyHandle);
1102  goto done;
1103  }
1104 
1105  Status = LsapRegQueryValue(SidKeyHandle,
1106  NULL,
1107  NULL,
1108  EnumBuffer.Information[i].Sid,
1109  &DataLength);
1110  TRACE("SampRegQueryValue returned %08lX\n", Status);
1111  }
1112 
1113  LsapRegCloseKey(SidKeyHandle);
1114  }
1115 
1116  LsapRegCloseKey(AccountKeyHandle);
1117 
1118  if (!NT_SUCCESS(Status))
1119  goto done;
1120  }
1121  }
1122 
1123  if (NT_SUCCESS(Status))
1124  {
1125  *EnumerationContext += EnumCount;
1126  EnumerationBuffer->EntriesRead = EnumBuffer.EntriesRead;
1127  EnumerationBuffer->Information = EnumBuffer.Information;
1128  }
1129 
1130 done:
1131  if (!NT_SUCCESS(Status))
1132  {
1133  if (EnumBuffer.Information)
1134  {
1135  for (i = 0; i < EnumBuffer.EntriesRead; i++)
1136  {
1137  if (EnumBuffer.Information[i].Sid != NULL)
1138  midl_user_free(EnumBuffer.Information[i].Sid);
1139  }
1140 
1141  midl_user_free(EnumBuffer.Information);
1142  }
1143  }
1144 
1145  if (AccountKeyBuffer != NULL)
1146  RtlFreeHeap(RtlGetProcessHeap(), 0, AccountKeyBuffer);
1147 
1148  if (AccountsKeyHandle != NULL)
1149  LsapRegCloseKey(AccountsKeyHandle);
1150 
1151  return Status;
1152 }
#define midl_user_free
Definition: rpc.h:45
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
NTSTATUS LsapRegQueryKeyInfo(IN HANDLE KeyHandle, OUT PULONG SubKeyCount, OUT PULONG MaxSubKeyNameLength, OUT PULONG ValueCount)
Definition: registry.c:176
#define KEY_READ
Definition: nt_native.h:1023
#define midl_user_allocate
Definition: rpc.h:44
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define POLICY_VIEW_LOCAL_INFORMATION
Definition: ntsecapi.h:61
uint16_t * PWSTR
Definition: typedefs.h:54
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
NTSTATUS LsapRegCloseKey(IN HANDLE KeyHandle)
Definition: registry.c:23
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HANDLE KeyHandle
Definition: lsasrv.h:62
smooth NULL
Definition: ftsmooth.c:416
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _LSAPR_ACCOUNT_INFORMATION LSAPR_ACCOUNT_INFORMATION
static const WCHAR L[]
Definition: oid.c:1250
NTSTATUS LsapRegOpenKey(IN HANDLE ParentKeyHandle, IN LPCWSTR KeyName, IN ACCESS_MASK DesiredAccess, OUT HANDLE KeyHandle)
Definition: registry.c:153
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS LsapRegQueryValue(IN HANDLE KeyHandle, IN LPWSTR ValueName, OUT PULONG Type OPTIONAL, OUT LPVOID Data OPTIONAL, IN OUT PULONG DataLength OPTIONAL)
Definition: registry.c:331
_In_ ULONG _Out_opt_ PULONG RequiredLength
Definition: wmifuncs.h:29
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
PLSAPR_ACCOUNT_INFORMATION Information
Definition: lsa.idl:97
unsigned int ULONG
Definition: retypes.h:1
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA _Inout_ PULONG DataLength
Definition: hidpi.h:333
return STATUS_SUCCESS
Definition: btrfs.c:2938
NTSTATUS LsapRegEnumerateSubKey(IN HANDLE KeyHandle, IN ULONG Index, IN ULONG Length, OUT LPWSTR Buffer)
Definition: registry.c:96

Referenced by LsaEnumerateAccounts().

◆ LsarEnumerateAccountsWithUserRight()

NTSTATUS WINAPI LsarEnumerateAccountsWithUserRight ( LSAPR_HANDLE  PolicyHandle,
PRPC_UNICODE_STRING  UserRight,
PLSAPR_ACCOUNT_ENUM_BUFFER  EnumerationBuffer 
)

Definition at line 2574 of file lsarpc.c.

2578 {
2579  PLSA_DB_OBJECT PolicyObject;
2580  ACCESS_MASK AccountRight = 0;
2581  PLUID Luid = NULL;
2582  ULONG AccountKeyBufferSize;
2583  PWSTR AccountKeyBuffer = NULL;
2584  HKEY AccountsKeyHandle = NULL;
2585  HKEY AccountKeyHandle = NULL;
2586  HKEY AttributeKeyHandle;
2587  ACCESS_MASK SystemAccess;
2588  PPRIVILEGE_SET PrivilegeSet;
2589  PLSAPR_ACCOUNT_INFORMATION EnumBuffer = NULL, ReturnBuffer;
2590  ULONG SubKeyCount = 0;
2591  ULONG EnumIndex, EnumCount;
2592  ULONG Size, i;
2593  BOOL Found;
2594  NTSTATUS Status;
2595 
2596  TRACE("LsarEnumerateAccountsWithUserRights(%p %wZ %p)\n",
2597  PolicyHandle, UserRight, EnumerationBuffer);
2598 
2599  /* Validate the privilege and account right names */
2600  if (UserRight != NULL)
2601  {
2602  Luid = LsarpLookupPrivilegeValue(UserRight);
2603  if (Luid == NULL)
2604  {
2605  AccountRight = LsapLookupAccountRightValue(UserRight);
2606  if (AccountRight == 0)
2607  return STATUS_NO_SUCH_PRIVILEGE;
2608  }
2609  }
2610 
2611  if (EnumerationBuffer == NULL)
2612  return STATUS_INVALID_PARAMETER;
2613 
2614  EnumerationBuffer->EntriesRead = 0;
2615  EnumerationBuffer->Information = NULL;
2616 
2617  /* Validate the PolicyHandle */
2618  Status = LsapValidateDbObject(PolicyHandle,
2621  &PolicyObject);
2622  if (!NT_SUCCESS(Status))
2623  {
2624  ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
2625  return Status;
2626  }
2627 
2628  Status = LsapRegOpenKey(PolicyObject->KeyHandle,
2629  L"Accounts",
2630  KEY_READ,
2631  &AccountsKeyHandle);
2632  if (!NT_SUCCESS(Status))
2633  {
2634  ERR("LsapRegOpenKey returned 0x%08lx\n", Status);
2635  return Status;
2636  }
2637 
2638  Status = LsapRegQueryKeyInfo(AccountsKeyHandle,
2639  &SubKeyCount,
2640  &AccountKeyBufferSize,
2641  NULL);
2642  if (!NT_SUCCESS(Status))
2643  {
2644  ERR("LsapRegOpenKey returned 0x%08lx\n", Status);
2645  return Status;
2646  }
2647 
2648  AccountKeyBufferSize += sizeof(WCHAR);
2649  AccountKeyBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, AccountKeyBufferSize);
2650  if (AccountKeyBuffer == NULL)
2651  {
2653  }
2654 
2655  EnumBuffer = RtlAllocateHeap(RtlGetProcessHeap(),
2657  SubKeyCount * sizeof(LSAPR_ACCOUNT_INFORMATION));
2658  if (EnumBuffer == NULL)
2659  {
2661  goto done;
2662  }
2663 
2664  EnumCount = 0;
2665  EnumIndex = 0;
2666  while (TRUE)
2667  {
2668  Found = FALSE;
2669 
2670  Status = LsapRegEnumerateSubKey(AccountsKeyHandle,
2671  EnumIndex,
2672  AccountKeyBufferSize,
2673  AccountKeyBuffer);
2674  if (!NT_SUCCESS(Status))
2675  {
2678  break;
2679  }
2680 
2681  TRACE("EnumIndex: %lu\n", EnumIndex);
2682  TRACE("Account key name: %S\n", AccountKeyBuffer);
2683 
2684  Status = LsapRegOpenKey(AccountsKeyHandle,
2685  AccountKeyBuffer,
2686  KEY_READ,
2687  &AccountKeyHandle);
2688  if (NT_SUCCESS(Status))
2689  {
2690  if (Luid != NULL || AccountRight != 0)
2691  {
2692  Status = LsapRegOpenKey(AccountKeyHandle,
2693  (Luid != NULL) ? L"Privilgs" : L"ActSysAc",
2694  KEY_READ,
2695  &AttributeKeyHandle);
2696  if (NT_SUCCESS(Status))
2697  {
2698  if (Luid != NULL)
2699  {
2700  Size = 0;
2701  LsapRegQueryValue(AttributeKeyHandle,
2702  NULL,
2703  NULL,
2704  NULL,
2705  &Size);
2706  if (Size != 0)
2707  {
2708  PrivilegeSet = RtlAllocateHeap(RtlGetProcessHeap(), 0, Size);
2709  if (PrivilegeSet)
2710  {
2711  if (LsapRegQueryValue(AttributeKeyHandle,
2712  NULL,
2713  NULL,
2714  PrivilegeSet,
2715  &Size) == STATUS_SUCCESS)
2716  {
2717  for (i = 0; i < PrivilegeSet->PrivilegeCount; i++)
2718  {
2719  if (RtlEqualLuid(&(PrivilegeSet->Privilege[i].Luid), Luid))
2720  {
2721  TRACE("%S got the privilege!\n", AccountKeyBuffer);
2722  Found = TRUE;
2723  break;
2724  }
2725  }
2726  }
2727 
2728  RtlFreeHeap(RtlGetProcessHeap(), 0, PrivilegeSet);
2729  }
2730  }
2731  }
2732  else if (AccountRight != 0)
2733  {
2734  SystemAccess = 0;
2735  Size = sizeof(ACCESS_MASK);
2736  LsapRegQueryValue(AttributeKeyHandle,
2737  NULL,
2738  NULL,
2739  &SystemAccess,
2740  &Size);
2741  if (SystemAccess & AccountRight)
2742  {
2743  TRACE("%S got the account right!\n", AccountKeyBuffer);
2744  Found = TRUE;
2745  }
2746  }
2747 
2748  LsapRegCloseKey(AttributeKeyHandle);
2749  }
2750  }
2751  else
2752  {
2753  /* enumerate all accounts */
2754  Found = TRUE;
2755  }
2756 
2757  if (Found == TRUE)
2758  {
2759  TRACE("Add account: %S\n", AccountKeyBuffer);
2760 
2761  Status = LsapRegOpenKey(AccountKeyHandle,
2762  L"Sid",
2763  KEY_READ,
2764  &AttributeKeyHandle);
2765  if (NT_SUCCESS(Status))
2766  {
2767  Size = 0;
2768  LsapRegQueryValue(AttributeKeyHandle,
2769  NULL,
2770  NULL,
2771  NULL,
2772  &Size);
2773  if (Size != 0)
2774  {
2775  EnumBuffer[EnumCount].Sid = midl_user_allocate(Size);
2776  if (EnumBuffer[EnumCount].Sid != NULL)
2777  {
2778  Status = LsapRegQueryValue(AttributeKeyHandle,
2779  NULL,
2780  NULL,
2781  EnumBuffer[EnumCount].Sid,
2782  &Size);
2783  if (NT_SUCCESS(Status))
2784  {
2785  EnumCount++;
2786  }
2787  else
2788  {
2789  TRACE("SampRegQueryValue returned %08lX\n", Status);
2790  midl_user_free(EnumBuffer[EnumCount].Sid);
2791  EnumBuffer[EnumCount].Sid = NULL;
2792  }
2793  }
2794  }
2795 
2796  LsapRegCloseKey(AttributeKeyHandle);
2797  }
2798  }
2799 
2800  LsapRegCloseKey(AccountKeyHandle);
2801  }
2802 
2803  EnumIndex++;
2804  }
2805 
2806  TRACE("EnumCount: %lu\n", EnumCount);
2807 
2808  if (NT_SUCCESS(Status) && EnumCount != 0)
2809  {
2810  ReturnBuffer = midl_user_allocate(EnumCount * sizeof(LSAPR_ACCOUNT_INFORMATION));
2811  if (ReturnBuffer == NULL)
2812  {
2814  goto done;
2815  }
2816 
2817  RtlCopyMemory(ReturnBuffer,
2818  EnumBuffer,
2819  EnumCount * sizeof(LSAPR_ACCOUNT_INFORMATION));
2820 
2821  EnumerationBuffer->EntriesRead = EnumCount;
2822  EnumerationBuffer->Information = ReturnBuffer;
2823  }
2824 
2825 done:
2826  if (EnumBuffer != NULL)
2827  {
2828  if (Status != STATUS_SUCCESS)
2829  {
2830  for (i = 0; i < EnumCount; i++)
2831  {
2832  if (EnumBuffer[i].Sid != NULL)
2833  midl_user_free(EnumBuffer[i].Sid);
2834  }
2835  }
2836 
2837  RtlFreeHeap(RtlGetProcessHeap(), 0, EnumBuffer);
2838  }
2839 
2840  if (AccountKeyBuffer != NULL)
2841  RtlFreeHeap(RtlGetProcessHeap(), 0, AccountKeyBuffer);
2842 
2843  if (Status == STATUS_SUCCESS && EnumCount == 0)
2845 
2846  return Status;
2847 }
#define midl_user_free
Definition: rpc.h:45
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_NO_MORE_ENTRIES
Definition: ntstatus.h:193
NTSTATUS LsapRegQueryKeyInfo(IN HANDLE KeyHandle, OUT PULONG SubKeyCount, OUT PULONG MaxSubKeyNameLength, OUT PULONG ValueCount)
Definition: registry.c:176
#define KEY_READ
Definition: nt_native.h:1023
ACCESS_MASK LsapLookupAccountRightValue(IN PRPC_UNICODE_STRING Name)
Definition: privileges.c:380
#define midl_user_allocate
Definition: rpc.h:44
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define POLICY_VIEW_LOCAL_INFORMATION
Definition: ntsecapi.h:61
uint16_t * PWSTR
Definition: typedefs.h:54
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
NTSTATUS LsapRegCloseKey(IN HANDLE KeyHandle)
Definition: registry.c:23
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
#define RtlEqualLuid(Luid1, Luid2)
Definition: rtlfuncs.h:301
HANDLE KeyHandle
Definition: lsasrv.h:62
smooth NULL
Definition: ftsmooth.c:416
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
Definition: rtlfuncs.h:1104
return Found
Definition: dirsup.c:1270
PLUID LsarpLookupPrivilegeValue(IN PRPC_UNICODE_STRING Name)
Definition: privileges.c:227
$ULONG PrivilegeCount
Definition: setypes.h:86
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
#define POLICY_LOOKUP_NAMES
Definition: ntsecapi.h:72
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_SUCH_PRIVILEGE
Definition: ntstatus.h:318
static const WCHAR L[]
Definition: oid.c:1250
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
NTSTATUS LsapRegOpenKey(IN HANDLE ParentKeyHandle, IN LPCWSTR KeyName, IN ACCESS_MASK DesiredAccess, OUT HANDLE KeyHandle)
Definition: registry.c:153
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS LsapRegQueryValue(IN HANDLE KeyHandle, IN LPWSTR ValueName, OUT PULONG Type OPTIONAL, OUT LPVOID Data OPTIONAL, IN OUT PULONG DataLength OPTIONAL)
Definition: registry.c:331
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
PLSAPR_ACCOUNT_INFORMATION Information
Definition: lsa.idl:97
LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY]
Definition: setypes.h:88
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2938
ULONG ACCESS_MASK
Definition: nt_native.h:40
NTSTATUS LsapRegEnumerateSubKey(IN HANDLE KeyHandle, IN ULONG Index, IN ULONG Length, OUT LPWSTR Buffer)
Definition: registry.c:96

Referenced by LsaEnumerateAccountsWithUserRight().

◆ LsarEnumeratePrivileges()

NTSTATUS WINAPI LsarEnumeratePrivileges ( LSAPR_HANDLE  PolicyHandle,
DWORD EnumerationContext,
PLSAPR_PRIVILEGE_ENUM_BUFFER  EnumerationBuffer,
DWORD  PreferedMaximumLength 
)

Definition at line 166 of file lsarpc.c.

171 {
172  PLSA_DB_OBJECT PolicyObject;
174 
175  TRACE("LsarEnumeratePrivileges(%p %p %p %lu)\n",
176  PolicyHandle, EnumerationContext, EnumerationBuffer,
177  PreferedMaximumLength);
178 
179  Status = LsapValidateDbObject(PolicyHandle,
182  &PolicyObject);
183  if (!NT_SUCCESS(Status))
184  return Status;
185 
186  if (EnumerationContext == NULL)
188 
189  return LsarpEnumeratePrivileges(EnumerationContext,
190  EnumerationBuffer,
191  PreferedMaximumLength);
192 }
NTSTATUS LsarpEnumeratePrivileges(DWORD *EnumerationContext, PLSAPR_PRIVILEGE_ENUM_BUFFER EnumerationBuffer, DWORD PreferedMaximumLength)
Definition: privileges.c:246
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define POLICY_VIEW_LOCAL_INFORMATION
Definition: ntsecapi.h:61
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823

Referenced by LsaEnumeratePrivileges().

◆ LsarEnumeratePrivilegesAccount()

NTSTATUS WINAPI LsarEnumeratePrivilegesAccount ( LSAPR_HANDLE  AccountHandle,
PLSAPR_PRIVILEGE_SET Privileges 
)

Definition at line 1504 of file lsarpc.c.

1507 {
1508  PLSA_DB_OBJECT AccountObject;
1509  ULONG PrivilegeSetSize = 0;
1510  PLSAPR_PRIVILEGE_SET PrivilegeSet = NULL;
1511  NTSTATUS Status;
1512 
1513  TRACE("LsarEnumeratePrivilegesAccount(%p %p)\n",
1514  AccountHandle, Privileges);
1515 
1516  *Privileges = NULL;
1517 
1518  /* Validate the AccountHandle */
1519  Status = LsapValidateDbObject(AccountHandle,
1521  ACCOUNT_VIEW,
1522  &AccountObject);
1523  if (!NT_SUCCESS(Status))
1524  {
1525  ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
1526  return Status;
1527  }
1528 
1529  /* Get the size of the privilege set */
1530  Status = LsapGetObjectAttribute(AccountObject,
1531  L"Privilgs",
1532  NULL,
1533  &PrivilegeSetSize);
1534  if (!NT_SUCCESS(Status))
1535  return Status;
1536 
1537  /* Allocate a buffer for the privilege set */
1538  PrivilegeSet = MIDL_user_allocate(PrivilegeSetSize);
1539  if (PrivilegeSet == NULL)
1540  return STATUS_NO_MEMORY;
1541 
1542  /* Get the privilege set */
1543  Status = LsapGetObjectAttribute(AccountObject,
1544  L"Privilgs",
1545  PrivilegeSet,
1546  &PrivilegeSetSize);
1547  if (!NT_SUCCESS(Status))
1548  {
1549  MIDL_user_free(PrivilegeSet);
1550  return Status;
1551  }
1552 
1553  /* Return a pointer to the privilege set */
1554  *Privileges = PrivilegeSet;
1555 
1556  return STATUS_SUCCESS;
1557 }
LONG NTSTATUS
Definition: precomp.h:26
#define ACCOUNT_VIEW
Definition: ntlsa.h:28
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET * Privileges
Definition: sefuncs.h:13
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
unsigned int ULONG
Definition: retypes.h:1
void *__RPC_USER MIDL_user_allocate(SIZE_T size)
Definition: irotp.c:371
return STATUS_SUCCESS
Definition: btrfs.c:2938
void __RPC_USER MIDL_user_free(void *p)
Definition: irotp.c:376
NTSTATUS LsapGetObjectAttribute(PLSA_DB_OBJECT DbObject, LPWSTR AttributeName, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:1010

Referenced by LsaEnumeratePrivilegesOfAccount(), LsapSetPrivileges(), and LsarEnumerateAccountRights().

◆ LsarEnumerateTrustedDomains()

NTSTATUS WINAPI LsarEnumerateTrustedDomains ( LSAPR_HANDLE  PolicyHandle,
DWORD EnumerationContext,
PLSAPR_TRUSTED_ENUM_BUFFER  EnumerationBuffer,
DWORD  PreferedMaximumLength 
)

Definition at line 1176 of file lsarpc.c.

1181 {
1182  /* FIXME: We are not running an AD yet */
1183  EnumerationBuffer->EntriesRead = 0;
1184  EnumerationBuffer->Information = NULL;
1185  return STATUS_NO_MORE_ENTRIES;
1186 }
#define STATUS_NO_MORE_ENTRIES
Definition: ntstatus.h:193
smooth NULL
Definition: ftsmooth.c:416
PLSAPR_TRUST_INFORMATION Information
Definition: lsa.idl:344

Referenced by LsaEnumerateTrustedDomains().

◆ LsarEnumerateTrustedDomainsEx()

NTSTATUS WINAPI LsarEnumerateTrustedDomainsEx ( LSAPR_HANDLE  PolicyHandle,
DWORD EnumerationContext,
PLSAPR_TRUSTED_ENUM_BUFFER_EX  EnumerationBuffer,
DWORD  PreferedMaximumLength 
)

Definition at line 3816 of file lsarpc.c.

3821 {
3822  /* Fail, if we are not a domain controller */
3825 
3826  /* FIXME: We are not running an AD yet */
3827  EnumerationBuffer->EntriesRead = 0;
3828  EnumerationBuffer->EnumerationBuffer = NULL;
3829  return STATUS_NO_MORE_ENTRIES;
3830 }
#define STATUS_NO_MORE_ENTRIES
Definition: ntstatus.h:193
PLSAPR_TRUSTED_DOMAIN_INFORMATION_EX EnumerationBuffer
Definition: lsa.idl:442
NT_PRODUCT_TYPE LsapProductType
Definition: lsasrv.c:13
smooth NULL
Definition: ftsmooth.c:416
#define STATUS_DIRECTORY_SERVICE_REQUIRED
Definition: ntstatus.h:790

Referenced by LsaEnumerateTrustedDomainsEx().

◆ LsarGenAuditEvent()

NTSTATUS WINAPI LsarGenAuditEvent ( handle_t  hBinding)

Definition at line 4202 of file lsarpc.c.

4204 {
4205  UNIMPLEMENTED;
4206  return STATUS_NOT_IMPLEMENTED;
4207 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

◆ LsarGetQuotasForAccount()

NTSTATUS WINAPI LsarGetQuotasForAccount ( LSAPR_HANDLE  AccountHandle,
PQUOTA_LIMITS  QuotaLimits 
)

Definition at line 1878 of file lsarpc.c.

1881 {
1882  PLSA_DB_OBJECT AccountObject;
1883  ULONG Size;
1884  NTSTATUS Status;
1885 
1886  TRACE("LsarGetQuotasForAccount(%p %p)\n",
1887  AccountHandle, QuotaLimits);
1888 
1889  /* Validate the account handle */
1890  Status = LsapValidateDbObject(AccountHandle,
1892  ACCOUNT_VIEW,
1893  &AccountObject);
1894  if (!NT_SUCCESS(Status))
1895  {
1896  ERR("Invalid handle (Status %lx)\n", Status);
1897  return Status;
1898  }
1899 
1900  /* Get the quota attribute */
1901  Status = LsapGetObjectAttribute(AccountObject,
1902  L"DefQuota",
1903  QuotaLimits,
1904  &Size);
1905 
1906  return Status;
1907 }
LONG NTSTATUS
Definition: precomp.h:26
#define ACCOUNT_VIEW
Definition: ntlsa.h:28
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR L[]
Definition: oid.c:1250
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS LsapGetObjectAttribute(PLSA_DB_OBJECT DbObject, LPWSTR AttributeName, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:1010

Referenced by LsaGetQuotasForAccount().

◆ LsarGetSystemAccessAccount()

NTSTATUS WINAPI LsarGetSystemAccessAccount ( LSAPR_HANDLE  AccountHandle,
ACCESS_MASK SystemAccess 
)

Definition at line 1977 of file lsarpc.c.

1980 {
1981  PLSA_DB_OBJECT AccountObject;
1982  ULONG Size = sizeof(ACCESS_MASK);
1983  NTSTATUS Status;
1984 
1985  TRACE("LsarGetSystemAccessAccount(%p %p)\n",
1986  AccountHandle, SystemAccess);
1987 
1988  /* Validate the account handle */
1989  Status = LsapValidateDbObject(AccountHandle,
1991  ACCOUNT_VIEW,
1992  &AccountObject);
1993  if (!NT_SUCCESS(Status))
1994  {
1995  ERR("Invalid handle (Status %lx)\n", Status);
1996  return Status;
1997  }
1998 
1999  /* Get the system access flags */
2000  Status = LsapGetObjectAttribute(AccountObject,
2001  L"ActSysAc",
2002  SystemAccess,
2003  &Size);
2004 
2005  return Status;
2006 }
LONG NTSTATUS
Definition: precomp.h:26
#define ACCOUNT_VIEW
Definition: ntlsa.h:28
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR L[]
Definition: oid.c:1250
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS LsapGetObjectAttribute(PLSA_DB_OBJECT DbObject, LPWSTR AttributeName, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:1010
ULONG ACCESS_MASK
Definition: nt_native.h:40

Referenced by LsaGetSystemAccessAccount(), and LsarEnumerateAccountRights().

◆ LsarGetUserName()

NTSTATUS WINAPI LsarGetUserName ( LPWSTR  SystemName,
PRPC_UNICODE_STRING UserName,
PRPC_UNICODE_STRING DomainName 
)

Definition at line 3739 of file lsarpc.c.

3743 {
3744  UNIMPLEMENTED;
3745  return STATUS_NOT_IMPLEMENTED;
3746 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by LsaGetRemoteUserName(), and LsaGetUserName().

◆ LsarLookupNames()

NTSTATUS WINAPI LsarLookupNames ( LSAPR_HANDLE  PolicyHandle,
DWORD  Count,
PRPC_UNICODE_STRING  Names,
PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains,
PLSAPR_TRANSLATED_SIDS  TranslatedSids,
LSAP_LOOKUP_LEVEL  LookupLevel,
DWORD MappedCount 
)

Definition at line 1192 of file lsarpc.c.

1200 {
1201  LSAPR_TRANSLATED_SIDS_EX2 TranslatedSidsEx2;
1202  ULONG i;
1203  NTSTATUS Status;
1204 
1205  TRACE("LsarLookupNames(%p %lu %p %p %p %d %p)\n",
1206  PolicyHandle, Count, Names, ReferencedDomains, TranslatedSids,
1207  LookupLevel, MappedCount);
1208 
1209  TranslatedSids->Entries = 0;
1210  TranslatedSids->Sids = NULL;
1211  *ReferencedDomains = NULL;
1212 
1213  if (Count == 0)
1214  return STATUS_NONE_MAPPED;
1215 
1216  TranslatedSidsEx2.Entries = 0;
1217  TranslatedSidsEx2.Sids = NULL;
1218 
1220  Names,
1221  ReferencedDomains,
1222  &TranslatedSidsEx2,
1223  LookupLevel,
1224  MappedCount,
1225  0,
1226  0);
1227  if (!NT_SUCCESS(Status))
1228  return Status;
1229 
1230  TranslatedSids->Entries = TranslatedSidsEx2.Entries;
1231  TranslatedSids->Sids = MIDL_user_allocate(TranslatedSids->Entries * sizeof(LSA_TRANSLATED_SID));
1232  if (TranslatedSids->Sids == NULL)
1233  {
1234  MIDL_user_free(TranslatedSidsEx2.Sids);
1235  MIDL_user_free(*ReferencedDomains);
1236  *ReferencedDomains = NULL;
1238  }
1239 
1240  for (i = 0; i < TranslatedSidsEx2.Entries; i++)
1241  {
1242  TranslatedSids->Sids[i].Use = TranslatedSidsEx2.Sids[i].Use;
1243  TranslatedSids->Sids[i].RelativeId = LsapGetRelativeIdFromSid(TranslatedSidsEx2.Sids[i].Sid);
1244  TranslatedSids->Sids[i].DomainIndex = TranslatedSidsEx2.Sids[i].DomainIndex;
1245  }
1246 
1247  MIDL_user_free(TranslatedSidsEx2.Sids);
1248 
1249  return STATUS_SUCCESS;
1250 }
PWSTR Names[NAMES_COUNT]
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
LONG NTSTATUS
Definition: precomp.h:26
SID_NAME_USE Use
Definition: ntsecapi.h:408
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
PLSA_TRANSLATED_SID Sids
Definition: lsa.idl:144
#define STATUS_NONE_MAPPED
Definition: ntstatus.h:337
NTSTATUS LsapLookupNames(DWORD Count, PRPC_UNICODE_STRING Names, PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSAPR_TRANSLATED_SIDS_EX2 TranslatedSids, LSAP_LOOKUP_LEVEL LookupLevel, DWORD *MappedCount, DWORD LookupOptions, DWORD ClientRevision)
Definition: lookup.c:1753
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
PLSAPR_TRANSLATED_SID_EX2 Sids
Definition: lsa.idl:210
ULONG LsapGetRelativeIdFromSid(PSID Sid_)
Definition: lookup.c:978
SID_NAME_USE Use
Definition: lsa.idl:202
Status
Definition: gdiplustypes.h:24
unsigned int ULONG
Definition: retypes.h:1
void *__RPC_USER MIDL_user_allocate(SIZE_T size)
Definition: irotp.c:371
return STATUS_SUCCESS
Definition: btrfs.c:2938
void __RPC_USER MIDL_user_free(void *p)
Definition: irotp.c:376

Referenced by LsaLookupNames().

◆ LsarLookupNames2()

NTSTATUS WINAPI LsarLookupNames2 ( LSAPR_HANDLE  PolicyHandle,
DWORD  Count,
PRPC_UNICODE_STRING  Names,
PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains,
PLSAPR_TRANSLATED_SIDS_EX  TranslatedSids,
LSAP_LOOKUP_LEVEL  LookupLevel,
DWORD MappedCount,
DWORD  LookupOptions,
DWORD  ClientRevision 
)

Definition at line 3958 of file lsarpc.c.

3968 {
3969  LSAPR_TRANSLATED_SIDS_EX2 TranslatedSidsEx2;
3970  ULONG i;
3971  NTSTATUS Status;
3972 
3973  TRACE("LsarLookupNames2(%p %lu %p %p %p %d %p %lu %lu)\n",
3974  PolicyHandle, Count, Names, ReferencedDomains, TranslatedSids,
3975  LookupLevel, MappedCount, LookupOptions, ClientRevision);
3976 
3977  TranslatedSids->Entries = 0;
3978  TranslatedSids->Sids = NULL;
3979  *ReferencedDomains = NULL;
3980 
3981  if (Count == 0)
3982  return STATUS_NONE_MAPPED;
3983 
3984  TranslatedSidsEx2.Entries = 0;
3985  TranslatedSidsEx2.Sids = NULL;
3986 
3988  Names,
3989  ReferencedDomains,
3990  &TranslatedSidsEx2,
3991  LookupLevel,
3992  MappedCount,
3993  LookupOptions,
3994  ClientRevision);
3995  if (!NT_SUCCESS(Status))
3996  return Status;
3997 
3998  TranslatedSids->Entries = TranslatedSidsEx2.Entries;
3999  TranslatedSids->Sids = MIDL_user_allocate(TranslatedSids->Entries * sizeof(LSA_TRANSLATED_SID));
4000  if (TranslatedSids->Sids == NULL)
4001  {
4002  MIDL_user_free(TranslatedSidsEx2.Sids);
4003  MIDL_user_free(*ReferencedDomains);
4004  *ReferencedDomains = NULL;
4006  }
4007 
4008  for (i = 0; i < TranslatedSidsEx2.Entries; i++)
4009  {
4010  TranslatedSids->Sids[i].Use = TranslatedSidsEx2.Sids[i].Use;
4011  TranslatedSids->Sids[i].RelativeId = LsapGetRelativeIdFromSid(TranslatedSidsEx2.Sids[i].Sid);
4012  TranslatedSids->Sids[i].DomainIndex = TranslatedSidsEx2.Sids[i].DomainIndex;
4013  TranslatedSids->Sids[i].Flags = TranslatedSidsEx2.Sids[i].Flags;
4014  }
4015 
4016  MIDL_user_free(TranslatedSidsEx2.Sids);
4017 
4018  return STATUS_SUCCESS;
4019 }
PWSTR Names[NAMES_COUNT]
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
LONG NTSTATUS
Definition: precomp.h:26
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define STATUS_NONE_MAPPED
Definition: ntstatus.h:337
NTSTATUS LsapLookupNames(DWORD Count, PRPC_UNICODE_STRING Names, PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSAPR_TRANSLATED_SIDS_EX2 TranslatedSids, LSAP_LOOKUP_LEVEL LookupLevel, DWORD *MappedCount, DWORD LookupOptions, DWORD ClientRevision)
Definition: lookup.c:1753
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PLSAPR_TRANSLATED_SID_EX Sids
Definition: lsa.idl:198
smooth NULL
Definition: ftsmooth.c:416
SID_NAME_USE Use
Definition: lsa.idl:190
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
PLSAPR_TRANSLATED_SID_EX2 Sids
Definition: lsa.idl:210
ULONG LsapGetRelativeIdFromSid(PSID Sid_)
Definition: lookup.c:978
SID_NAME_USE Use
Definition: lsa.idl:202
Status
Definition: gdiplustypes.h:24
unsigned int ULONG
Definition: retypes.h:1
void *__RPC_USER MIDL_user_allocate(SIZE_T size)
Definition: irotp.c:371
return STATUS_SUCCESS
Definition: btrfs.c:2938
void __RPC_USER MIDL_user_free(void *p)
Definition: irotp.c:376

◆ LsarLookupNames3()

NTSTATUS WINAPI LsarLookupNames3 ( LSAPR_HANDLE  PolicyHandle,
DWORD  Count,
PRPC_UNICODE_STRING  Names,
PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains,
PLSAPR_TRANSLATED_SIDS_EX2  TranslatedSids,
LSAP_LOOKUP_LEVEL  LookupLevel,
DWORD MappedCount,
DWORD  LookupOptions,
DWORD  ClientRevision 
)

Definition at line 4138 of file lsarpc.c.

4148 {
4149  NTSTATUS Status;
4150 
4151  TRACE("LsarLookupNames3(%p %lu %p %p %p %d %p %lu %lu)\n",
4152  PolicyHandle, Count, Names, ReferencedDomains, TranslatedSids,
4153  LookupLevel, MappedCount, LookupOptions, ClientRevision);
4154 
4155  TranslatedSids->Entries = 0;
4156  TranslatedSids->Sids = NULL;
4157  *ReferencedDomains = NULL;
4158 
4159  if (Count == 0)
4160  return STATUS_NONE_MAPPED;
4161 
4163  Names,
4164  ReferencedDomains,
4165  TranslatedSids,
4166  LookupLevel,
4167  MappedCount,
4168  LookupOptions,
4169  ClientRevision);
4170 
4171  return Status;
4172 }
PWSTR Names[NAMES_COUNT]
LONG NTSTATUS
Definition: precomp.h:26
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define STATUS_NONE_MAPPED
Definition: ntstatus.h:337
NTSTATUS LsapLookupNames(DWORD Count, PRPC_UNICODE_STRING Names, PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSAPR_TRANSLATED_SIDS_EX2 TranslatedSids, LSAP_LOOKUP_LEVEL LookupLevel, DWORD *MappedCount, DWORD LookupOptions, DWORD ClientRevision)
Definition: lookup.c:1753
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
PLSAPR_TRANSLATED_SID_EX2 Sids
Definition: lsa.idl:210
Status
Definition: gdiplustypes.h:24

Referenced by LsaLookupNames2().

◆ LsarLookupNames4()

NTSTATUS WINAPI LsarLookupNames4 ( handle_t  RpcHandle,
DWORD  Count,
PRPC_UNICODE_STRING  Names,
PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains,
PLSAPR_TRANSLATED_SIDS_EX2  TranslatedSids,
LSAP_LOOKUP_LEVEL  LookupLevel,
DWORD MappedCount,
DWORD  LookupOptions,
DWORD  ClientRevision 
)

Definition at line 4306 of file lsarpc.c.

4316 {
4317  NTSTATUS Status;
4318 
4319  TRACE("LsarLookupNames4(%p %lu %p %p %p %d %p %lu %lu)\n",
4320  RpcHandle, Count, Names, ReferencedDomains, TranslatedSids,
4321  LookupLevel, MappedCount, LookupOptions, ClientRevision);
4322 
4323  TranslatedSids->Entries = 0;
4324  TranslatedSids->Sids = NULL;
4325  *ReferencedDomains = NULL;
4326 
4327  if (Count == 0)
4328  return STATUS_NONE_MAPPED;
4329 
4331  Names,
4332  ReferencedDomains,
4333  TranslatedSids,
4334  LookupLevel,
4335  MappedCount,
4336  LookupOptions,
4337  ClientRevision);
4338 
4339  return Status;
4340 }
PWSTR Names[NAMES_COUNT]
LONG NTSTATUS
Definition: precomp.h:26
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define STATUS_NONE_MAPPED
Definition: ntstatus.h:337
NTSTATUS LsapLookupNames(DWORD Count, PRPC_UNICODE_STRING Names, PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSAPR_TRANSLATED_SIDS_EX2 TranslatedSids, LSAP_LOOKUP_LEVEL LookupLevel, DWORD *MappedCount, DWORD LookupOptions, DWORD ClientRevision)
Definition: lookup.c:1753
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
PLSAPR_TRANSLATED_SID_EX2 Sids
Definition: lsa.idl:210
Status
Definition: gdiplustypes.h:24

◆ LsarLookupPrivilegeDisplayName()

NTSTATUS WINAPI LsarLookupPrivilegeDisplayName ( LSAPR_HANDLE  PolicyHandle,
PRPC_UNICODE_STRING  Name,
USHORT  ClientLanguage,
USHORT  ClientSystemDefaultLanguage,
PRPC_UNICODE_STRING DisplayName,
USHORT LanguageReturned 
)

Definition at line 2494 of file lsarpc.c.

2501 {
2502  NTSTATUS Status;
2503 
2504  TRACE("LsarLookupPrivilegeDisplayName(%p, %p, %u, %u, %p, %p)\n",
2505  PolicyHandle, Name, ClientLanguage, ClientSystemDefaultLanguage, DisplayName, LanguageReturned);
2506 
2507  Status = LsapValidateDbObject(PolicyHandle,
2510  NULL);
2511  if (!NT_SUCCESS(Status))
2512  {
2513  ERR("Invalid handle\n");
2514  return Status;
2515  }
2516 
2518  ClientLanguage,
2519  ClientSystemDefaultLanguage,
2520  DisplayName,
2521  LanguageReturned);
2522 
2523  return Status;
2524 }
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
#define POLICY_LOOKUP_NAMES
Definition: ntsecapi.h:72
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823
NTSTATUS LsarpLookupPrivilegeDisplayName(PRPC_UNICODE_STRING Name, USHORT ClientLanguage, USHORT ClientSystemDefaultLanguage, PRPC_UNICODE_STRING *DisplayName, USHORT *LanguageReturned)
Definition: privileges.c:125

Referenced by LsaLookupPrivilegeDisplayName().

◆ LsarLookupPrivilegeName()

NTSTATUS WINAPI LsarLookupPrivilegeName ( LSAPR_HANDLE  PolicyHandle,
PLUID  Value,
PRPC_UNICODE_STRING Name 
)

Definition at line 2464 of file lsarpc.c.

2468 {
2469  NTSTATUS Status;
2470 
2471  TRACE("LsarLookupPrivilegeName(%p, %p, %p)\n",
2472  PolicyHandle, Value, Name);
2473 
2474  Status = LsapValidateDbObject(PolicyHandle,
2477  NULL);
2478  if (!NT_SUCCESS(Status))
2479  {
2480  ERR("Invalid handle\n");
2481  return Status;
2482  }
2483 
2485  Name);
2486 
2487  return Status;
2488 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS LsarpLookupPrivilegeName(PLUID Value, PRPC_UNICODE_STRING *Name)
Definition: privileges.c:80
smooth NULL
Definition: ftsmooth.c:416
#define POLICY_LOOKUP_NAMES
Definition: ntsecapi.h:72
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823

Referenced by LsaLookupPrivilegeName(), and LsarEnumerateAccountRights().

◆ LsarLookupPrivilegeValue()

NTSTATUS WINAPI LsarLookupPrivilegeValue ( LSAPR_HANDLE  PolicyHandle,
PRPC_UNICODE_STRING  Name,
PLUID  Value 
)

Definition at line 2428 of file lsarpc.c.

2432 {
2433  PLUID pValue;
2434  NTSTATUS Status;
2435 
2436  TRACE("LsarLookupPrivilegeValue(%p, %wZ, %p)\n",
2437  PolicyHandle, Name, Value);
2438 
2439  Status = LsapValidateDbObject(PolicyHandle,
2442  NULL);
2443  if (!NT_SUCCESS(Status))
2444  {
2445  ERR("Invalid handle (Status %lx)\n", Status);
2446  return Status;
2447  }
2448 
2449  TRACE("Privilege: %wZ\n", Name);
2450 
2451  pValue = LsarpLookupPrivilegeValue(Name);
2452  if (pValue == NULL)
2453  return STATUS_NO_SUCH_PRIVILEGE;
2454 
2455  RtlCopyLuid(Value, pValue);
2456 
2457  return STATUS_SUCCESS;
2458 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI void WINAPI RtlCopyLuid(PLUID, const LUID *)
smooth NULL
Definition: ftsmooth.c:416
PLUID LsarpLookupPrivilegeValue(IN PRPC_UNICODE_STRING Name)
Definition: privileges.c:227
#define POLICY_LOOKUP_NAMES
Definition: ntsecapi.h:72
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_SUCH_PRIVILEGE
Definition: ntstatus.h:318
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by LsaLookupPrivilegeValue().

◆ LsarLookupSids()

NTSTATUS WINAPI LsarLookupSids ( LSAPR_HANDLE  PolicyHandle,
PLSAPR_SID_ENUM_BUFFER  SidEnumBuffer,
PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains,
PLSAPR_TRANSLATED_NAMES  TranslatedNames,
LSAP_LOOKUP_LEVEL  LookupLevel,
DWORD MappedCount 
)

Definition at line 1256 of file lsarpc.c.

1263 {
1264  LSAPR_TRANSLATED_NAMES_EX TranslatedNamesEx;
1265  ULONG i;
1266  NTSTATUS Status;
1267 
1268  TRACE("LsarLookupSids(%p %p %p %p %d %p)\n",
1269  PolicyHandle, SidEnumBuffer, ReferencedDomains, TranslatedNames,
1270  LookupLevel, MappedCount);
1271 
1272  /* FIXME: Fail, if there is an invalid SID in the SidEnumBuffer */
1273 
1274  TranslatedNames->Entries = SidEnumBuffer->Entries;
1275  TranslatedNames->Names = NULL;
1276  *ReferencedDomains = NULL;
1277 
1278  TranslatedNamesEx.Entries = SidEnumBuffer->Entries;
1279  TranslatedNamesEx.Names = NULL;
1280 
1281  Status = LsapLookupSids(SidEnumBuffer,
1282  ReferencedDomains,
1283  &TranslatedNamesEx,
1284  LookupLevel,
1285  MappedCount,
1286  0,
1287  0);
1288  if (!NT_SUCCESS(Status))
1289  return Status;
1290 
1291  TranslatedNames->Entries = SidEnumBuffer->Entries;
1292  TranslatedNames->Names = MIDL_user_allocate(SidEnumBuffer->Entries * sizeof(LSAPR_TRANSLATED_NAME));
1293  if (TranslatedNames->Names == NULL)
1294  {
1295  MIDL_user_free(TranslatedNamesEx.Names);
1296  MIDL_user_free(*ReferencedDomains);
1297  *ReferencedDomains = NULL;
1299  }
1300 
1301  for (i = 0; i < TranslatedNamesEx.Entries; i++)
1302  {
1303  TranslatedNames->Names[i].Use = TranslatedNamesEx.Names[i].Use;
1304  TranslatedNames->Names[i].Name.Length = TranslatedNamesEx.Names[i].Name.Length;
1305  TranslatedNames->Names[i].Name.MaximumLength = TranslatedNamesEx.Names[i].Name.MaximumLength;
1306  TranslatedNames->Names[i].Name.Buffer = TranslatedNamesEx.Names[i].Name.Buffer;
1307  TranslatedNames->Names[i].DomainIndex = TranslatedNamesEx.Names[i].DomainIndex;
1308  }
1309 
1310  MIDL_user_free(TranslatedNamesEx.Names);
1311 
1312  return Status;
1313 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
SID_NAME_USE Use
Definition: lsa.idl:167
LONG NTSTATUS
Definition: precomp.h:26
RPC_UNICODE_STRING Name
Definition: lsa.idl:168
PLSAPR_TRANSLATED_NAME_EX Names
Definition: lsa.idl:186
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
NTSTATUS LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer, PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSAPR_TRANSLATED_NAMES_EX TranslatedNames, LSAP_LOOKUP_LEVEL LookupLevel, DWORD *MappedCount, DWORD LookupOptions, DWORD ClientRevision)
Definition: lookup.c:2339
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
PLSAPR_TRANSLATED_NAME Names
Definition: lsa.idl:174
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
RPC_UNICODE_STRING Name
Definition: lsa.idl:179
unsigned short Length
Definition: msv1_0.h:53
Status
Definition: gdiplustypes.h:24
SID_NAME_USE Use
Definition: lsa.idl:178
unsigned int ULONG
Definition: retypes.h:1
void *__RPC_USER MIDL_user_allocate(SIZE_T size)
Definition: irotp.c:371
void __RPC_USER MIDL_user_free(void *p)
Definition: irotp.c:376
unsigned short MaximumLength
Definition: msv1_0.h:54
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by LsaLookupSids().

◆ LsarLookupSids2()

NTSTATUS WINAPI LsarLookupSids2 ( LSAPR_HANDLE  PolicyHandle,
PLSAPR_SID_ENUM_BUFFER  SidEnumBuffer,
PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains,
PLSAPR_TRANSLATED_NAMES_EX  TranslatedNames,
LSAP_LOOKUP_LEVEL  LookupLevel,
DWORD MappedCount,
DWORD  LookupOptions,
DWORD  ClientRevision 
)

Definition at line 3921 of file lsarpc.c.

3930 {
3931  NTSTATUS Status;
3932 
3933  TRACE("LsarLookupSids2(%p %p %p %p %d %p %lu %lu)\n",
3934  PolicyHandle, SidEnumBuffer, ReferencedDomains, TranslatedNames,
3935  LookupLevel, MappedCount, LookupOptions, ClientRevision);
3936 
3937  TranslatedNames->Entries = SidEnumBuffer->Entries;
3938  TranslatedNames->Names = NULL;
3939  *ReferencedDomains = NULL;
3940 
3941  /* FIXME: Fail, if there is an invalid SID in the SidEnumBuffer */
3942 
3943  Status = LsapLookupSids(SidEnumBuffer,
3944  ReferencedDomains,
3945  TranslatedNames,
3946  LookupLevel,
3947  MappedCount,
3948  LookupOptions,
3949  ClientRevision);
3950 
3951  return Status;
3952 }
LONG NTSTATUS
Definition: precomp.h:26
PLSAPR_TRANSLATED_NAME_EX Names
Definition: lsa.idl:186
NTSTATUS LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer, PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSAPR_TRANSLATED_NAMES_EX TranslatedNames, LSAP_LOOKUP_LEVEL LookupLevel, DWORD *MappedCount, DWORD LookupOptions, DWORD ClientRevision)
Definition: lookup.c:2339
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
Status
Definition: gdiplustypes.h:24

◆ LsarLookupSids3()

NTSTATUS WINAPI LsarLookupSids3 ( LSAPR_HANDLE  PolicyHandle,
PLSAPR_SID_ENUM_BUFFER  SidEnumBuffer,
PLSAPR_REFERENCED_DOMAIN_LIST ReferencedDomains,
PLSAPR_TRANSLATED_NAMES_EX  TranslatedNames,
LSAP_LOOKUP_LEVEL  LookupLevel,
DWORD MappedCount,
DWORD  LookupOptions,
DWORD  ClientRevision 
)

Definition at line 4269 of file lsarpc.c.

4278 {
4279  NTSTATUS Status;
4280 
4281  TRACE("LsarLookupSids3(%p %p %p %p %d %p %lu %lu)\n",
4282  PolicyHandle, SidEnumBuffer, ReferencedDomains, TranslatedNames,
4283  LookupLevel, MappedCount, LookupOptions, ClientRevision);
4284 
4285  TranslatedNames->Entries = SidEnumBuffer->Entries;
4286  TranslatedNames->Names = NULL;
4287  *ReferencedDomains = NULL;
4288 
4289  /* FIXME: Fail, if there is an invalid SID in the SidEnumBuffer */
4290 
4291  Status = LsapLookupSids(SidEnumBuffer,
4292  ReferencedDomains,
4293  TranslatedNames,
4294  LookupLevel,
4295  MappedCount,
4296  LookupOptions,
4297  ClientRevision);
4298 
4299  return Status;
4300 }
LONG NTSTATUS
Definition: precomp.h:26
PLSAPR_TRANSLATED_NAME_EX Names
Definition: lsa.idl:186
NTSTATUS LsapLookupSids(PLSAPR_SID_ENUM_BUFFER SidEnumBuffer, PLSAPR_REFERENCED_DOMAIN_LIST *ReferencedDomains, PLSAPR_TRANSLATED_NAMES_EX TranslatedNames, LSAP_LOOKUP_LEVEL LookupLevel, DWORD *MappedCount, DWORD LookupOptions, DWORD ClientRevision)
Definition: lookup.c:2339
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
Status
Definition: gdiplustypes.h:24

◆ LsarOpenAccount()

NTSTATUS WINAPI LsarOpenAccount ( LSAPR_HANDLE  PolicyHandle,
PRPC_SID  AccountSid,
ACCESS_MASK  DesiredAccess,
LSAPR_HANDLE AccountHandle 
)

Definition at line 1465 of file lsarpc.c.

1470 {
1471  PLSA_DB_OBJECT PolicyObject;
1472  NTSTATUS Status;
1473 
1474  TRACE("LsarOpenAccount(%p %p %lx %p)\n",
1475  PolicyHandle, AccountSid, DesiredAccess, AccountHandle);
1476 
1477  /* Validate the AccountSid */
1478  if (!RtlValidSid(AccountSid))
1479  return STATUS_INVALID_PARAMETER;
1480 
1481  /* Validate the PolicyHandle */
1482  Status = LsapValidateDbObject(PolicyHandle,
1484  0,
1485  &PolicyObject);
1486  if (!NT_SUCCESS(Status))
1487  {
1488  ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
1489  return Status;
1490  }
1491 
1492 
1493  /* Open the Account object */
1494  return LsarpOpenAccount(PolicyObject,
1495  AccountSid,
1496  DesiredAccess,
1497  (PLSA_DB_OBJECT *)AccountHandle);
1498 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI BOOLEAN NTAPI RtlValidSid(IN PSID Sid)
Definition: sid.c:21
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
static NTSTATUS LsarpOpenAccount(IN PLSA_DB_OBJECT PolicyObject, IN PRPC_SID AccountSid, IN ACCESS_MASK DesiredAccess, OUT PLSA_DB_OBJECT *AccountObject)
Definition: lsarpc.c:1425

Referenced by LsaOpenAccount(), LsapSetPrivileges(), and LsarEnumerateAccountRights().

◆ LsarOpenPolicy()

NTSTATUS WINAPI LsarOpenPolicy ( LPWSTR  SystemName,
PLSAPR_OBJECT_ATTRIBUTES  ObjectAttributes,
ACCESS_MASK  DesiredAccess,
LSAPR_HANDLE PolicyHandle 
)

Definition at line 495 of file lsarpc.c.

500 {
501  PLSA_DB_OBJECT PolicyObject;
503 
504  TRACE("LsarOpenPolicy(%S %p %lx %p)\n",
505  SystemName, ObjectAttributes, DesiredAccess, PolicyHandle);
506 
508 
510  NULL,
511  L"Policy",
514  FALSE,
515  &PolicyObject);
516 
518 
519  if (NT_SUCCESS(Status))
520  *PolicyHandle = (LSAPR_HANDLE)PolicyObject;
521 
522  TRACE("LsarOpenPolicy done!\n");
523 
524  return Status;
525 }
NTSTATUS LsapOpenDbObject(IN PLSA_DB_OBJECT ParentObject, IN LPWSTR ContainerName, IN LPWSTR ObjectName, IN LSA_DB_OBJECT_TYPE ObjectType, IN ACCESS_MASK DesiredAccess, IN BOOLEAN Trusted, OUT PLSA_DB_OBJECT *DbObject)
Definition: database.c:710
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
PVOID LSAPR_HANDLE
Definition: msv1_0.h:260
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
static RTL_CRITICAL_SECTION PolicyHandleTableLock
Definition: lsarpc.c:14

Referenced by DsRolepGetBasicInfo(), LsaOpenPolicy(), LsapSetPrivileges(), and LsarOpenPolicy2().

◆ LsarOpenPolicy2()

NTSTATUS WINAPI LsarOpenPolicy2 ( LPWSTR  SystemName,
PLSAPR_OBJECT_ATTRIBUTES  ObjectAttributes,
ACCESS_MASK  DesiredAccess,
LSAPR_HANDLE PolicyHandle 
)

Definition at line 3723 of file lsarpc.c.

3728 {
3729  return LsarOpenPolicy(SystemName,
3731  DesiredAccess,
3732  PolicyHandle);
3733 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
NTSTATUS WINAPI LsarOpenPolicy(LPWSTR SystemName, PLSAPR_OBJECT_ATTRIBUTES ObjectAttributes, ACCESS_MASK DesiredAccess, LSAPR_HANDLE *PolicyHandle)
Definition: lsarpc.c:495

◆ LsarOpenPolicySce()

NTSTATUS WINAPI LsarOpenPolicySce ( LPWSTR  SystemName,
PLSAPR_OBJECT_ATTRIBUTES  ObjectAttributes,
ACCESS_MASK  DesiredAccess,
LSAPR_HANDLE PolicyHandle 
)

Definition at line 4346 of file lsarpc.c.

4351 {
4352  UNIMPLEMENTED;
4353  return STATUS_NOT_IMPLEMENTED;
4354 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by LsaOpenPolicySce().

◆ LsarOpenSecret()

NTSTATUS WINAPI LsarOpenSecret ( LSAPR_HANDLE  PolicyHandle,
PRPC_UNICODE_STRING  SecretName,
ACCESS_MASK  DesiredAccess,
LSAPR_HANDLE SecretHandle 
)

Definition at line 2090 of file lsarpc.c.

2095 {
2096  PLSA_DB_OBJECT PolicyObject;
2097  PLSA_DB_OBJECT SecretObject = NULL;
2099 
2100  TRACE("LsarOpenSecret(%p %wZ %lx %p)\n",
2101  PolicyHandle, SecretName, DesiredAccess, SecretHandle);
2102 
2103  /* Validate the PolicyHandle */
2104  Status = LsapValidateDbObject(PolicyHandle,
2106  0,
2107  &PolicyObject);
2108  if (!NT_SUCCESS(Status))
2109  {
2110  ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
2111  return Status;
2112  }
2113 
2114  /* Create the secret object */
2115  Status = LsapOpenDbObject(PolicyObject,
2116  L"Secrets",
2117  SecretName->Buffer,
2119  DesiredAccess,
2120  PolicyObject->Trusted,
2121  &SecretObject);
2122  if (!NT_SUCCESS(Status))
2123  {
2124  ERR("LsapOpenDbObject failed (Status 0x%08lx)\n", Status);
2125  goto done;
2126  }
2127 
2128 done:
2129  if (!NT_SUCCESS(Status))
2130  {
2131  if (SecretObject != NULL)
2132  LsapCloseDbObject(SecretObject);
2133  }
2134  else
2135  {
2136  *SecretHandle = (LSAPR_HANDLE)SecretObject;
2137  }
2138 
2139  return Status;
2140 }
NTSTATUS LsapOpenDbObject(IN PLSA_DB_OBJECT ParentObject, IN LPWSTR ContainerName, IN LPWSTR ObjectName, IN LSA_DB_OBJECT_TYPE ObjectType, IN ACCESS_MASK DesiredAccess, IN BOOLEAN Trusted, OUT PLSA_DB_OBJECT *DbObject)
Definition: database.c:710
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS LsapCloseDbObject(PLSA_DB_OBJECT DbObject)
Definition: database.c:868
BOOLEAN Trusted
Definition: lsasrv.h:63
PVOID LSAPR_HANDLE
Definition: msv1_0.h:260
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
return STATUS_SUCCESS
Definition: btrfs.c:2938
wchar_t * Buffer
Definition: msv1_0.h:55

Referenced by LsaOpenSecret().

◆ LsarOpenTrustedDomain()

NTSTATUS WINAPI LsarOpenTrustedDomain ( LSAPR_HANDLE  PolicyHandle,
PRPC_SID  TrustedDomainSid,
ACCESS_MASK  DesiredAccess,
LSAPR_HANDLE TrustedDomainHandle 
)

Definition at line 2046 of file lsarpc.c.

2051 {
2052  /* Fail, if we are not a domain controller */
2055 
2056  UNIMPLEMENTED;
2057  return STATUS_NOT_IMPLEMENTED;
2058 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
NT_PRODUCT_TYPE LsapProductType
Definition: lsasrv.c:13
#define STATUS_DIRECTORY_SERVICE_REQUIRED
Definition: ntstatus.h:790
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by LsaOpenTrustedDomain().

◆ LsarOpenTrustedDomainByName()

NTSTATUS WINAPI LsarOpenTrustedDomainByName ( LSAPR_HANDLE  PolicyHandle,
PRPC_UNICODE_STRING  TrustedDomainName,
ACCESS_MASK  DesiredAccess,
LSAPR_HANDLE TrustedDomainHandle 
)

Definition at line 3892 of file lsarpc.c.

3897 {
3898  /* Fail, if we are not a domain controller */
3901 
3902  UNIMPLEMENTED;
3903  return STATUS_NOT_IMPLEMENTED;
3904 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
NT_PRODUCT_TYPE LsapProductType
Definition: lsasrv.c:13
#define STATUS_DIRECTORY_SERVICE_REQUIRED
Definition: ntstatus.h:790
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by LsaOpenTrustedDomainByName().

◆ LsarpCreateAccount()

NTSTATUS LsarpCreateAccount ( PLSA_DB_OBJECT  PolicyObject,
PRPC_SID  AccountSid,
ACCESS_MASK  DesiredAccess,
PLSA_DB_OBJECT AccountObject 
)

Definition at line 813 of file lsarpc.c.

818 {
819  LPWSTR SidString = NULL;
820  PSECURITY_DESCRIPTOR AccountSd = NULL;
821  ULONG AccountSdSize;
823 
824  /* Create SID string */
825  if (!ConvertSidToStringSid((PSID)AccountSid,
826  &SidString))
827  {
828  ERR("ConvertSidToStringSid failed\n");
830  }
831 
832  /* Create a security descriptor for the account */
833  Status = LsapCreateAccountSd(&AccountSd,
834  &AccountSdSize);
835  if (!NT_SUCCESS(Status))
836  {
837  ERR("LsapCreateAccountSd returned 0x%08lx\n", Status);
838  goto done;
839  }
840 
841  /* Create the Account object */
842  Status = LsapCreateDbObject(PolicyObject,
843  L"Accounts",
844  SidString,
847  PolicyObject->Trusted,
848  AccountObject);
849  if (!NT_SUCCESS(Status))
850  {
851  ERR("LsapCreateDbObject failed (Status 0x%08lx)\n", Status);
852  goto done;
853  }
854 
855  /* Set the Sid attribute */
856  Status = LsapSetObjectAttribute(*AccountObject,
857  L"Sid",
858  (PVOID)AccountSid,
859  GetLengthSid(AccountSid));
860  if (!NT_SUCCESS(Status))
861  goto done;
862 
863  /* Set the SecDesc attribute */
864  Status = LsapSetObjectAttribute(*AccountObject,
865  L"SecDesc",
866  AccountSd,
867  AccountSdSize);
868 
869 done:
870  if (SidString != NULL)
871  LocalFree(SidString);
872 
873  if (AccountSd != NULL)
874  RtlFreeHeap(RtlGetProcessHeap(), 0, AccountSd);
875 
876  return Status;
877 }
NTSTATUS LsapSetObjectAttribute(PLSA_DB_OBJECT DbObject, LPWSTR AttributeName, LPVOID AttributeData, ULONG AttributeSize)
Definition: database.c:959
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
BOOLEAN Trusted
Definition: lsasrv.h:63
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS LsapCreateAccountSd(PSECURITY_DESCRIPTOR *AccountSd, PULONG AccountSdSize)
Definition: security.c:268
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
DWORD WINAPI GetLengthSid(PSID pSid)
Definition: security.c:798
#define ConvertSidToStringSid
Definition: sddl.h:160
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
unsigned int ULONG
Definition: retypes.h:1
WCHAR * LPWSTR
Definition: xmlstorage.h:184
NTSTATUS LsapCreateDbObject(IN PLSA_DB_OBJECT ParentObject, IN LPWSTR ContainerName, IN LPWSTR ObjectName, IN LSA_DB_OBJECT_TYPE ObjectType, IN ACCESS_MASK DesiredAccess, IN BOOLEAN Trusted, OUT PLSA_DB_OBJECT *DbObject)
Definition: database.c:590
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by LsarAddAccountRights(), and LsarCreateAccount().

◆ LsarpOpenAccount()

static NTSTATUS LsarpOpenAccount ( IN PLSA_DB_OBJECT  PolicyObject,
IN PRPC_SID  AccountSid,
IN ACCESS_MASK  DesiredAccess,
OUT PLSA_DB_OBJECT AccountObject 
)
static

Definition at line 1425 of file lsarpc.c.

1430 {
1431  LPWSTR SidString = NULL;
1433 
1434  /* Create SID string */
1435  if (!ConvertSidToStringSid((PSID)AccountSid,
1436  &SidString))
1437  {
1438  ERR("ConvertSidToStringSid failed\n");
1439  return STATUS_INVALID_PARAMETER;
1440  }
1441 
1442  /* Create the Account object */
1443  Status = LsapOpenDbObject(PolicyObject,
1444  L"Accounts",
1445  SidString,
1447  DesiredAccess,
1448  PolicyObject->Trusted,
1449  AccountObject);
1450  if (!NT_SUCCESS(Status))
1451  {
1452  ERR("LsapOpenDbObject(Accounts/%S) failed (Status 0x%08lx)\n", SidString, Status);
1453  }
1454 
1455  if (SidString != NULL)
1456  LocalFree(SidString);
1457 
1458  return Status;
1459 }
NTSTATUS LsapOpenDbObject(IN PLSA_DB_OBJECT ParentObject, IN LPWSTR ContainerName, IN LPWSTR ObjectName, IN LSA_DB_OBJECT_TYPE ObjectType, IN ACCESS_MASK DesiredAccess, IN BOOLEAN Trusted, OUT PLSA_DB_OBJECT *DbObject)
Definition: database.c:710
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ConvertSidToStringSid
Definition: sddl.h:160
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
WCHAR * LPWSTR
Definition: xmlstorage.h:184
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by LsarAddAccountRights(), LsarOpenAccount(), and LsarRemoveAccountRights().

◆ LsarQueryDomainInformationPolicy()

NTSTATUS WINAPI LsarQueryDomainInformationPolicy ( LSAPR_HANDLE  PolicyHandle,
POLICY_INFORMATION_CLASS  InformationClass,
PLSAPR_POLICY_DOMAIN_INFORMATION PolicyInformation 
)

Definition at line 3866 of file lsarpc.c.

3870 {
3871  UNIMPLEMENTED;
3872  return STATUS_NOT_IMPLEMENTED;
3873 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by LsaQueryDomainInformationPolicy().

◆ LsarQueryForestTrustInformation()

NTSTATUS WINAPI LsarQueryForestTrustInformation ( LSAPR_HANDLE  PolicyHandle,
PLSA_UNICODE_STRING  TrustedDomainName,
LSA_FOREST_TRUST_RECORD_TYPE  HighestRecordType,
PLSA_FOREST_TRUST_INFORMATION ForestTrustInfo 
)

Definition at line 4224 of file lsarpc.c.

4229 {
4230  UNIMPLEMENTED;
4231  return STATUS_NOT_IMPLEMENTED;
4232 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by LsaQueryForestTrustInformation().

◆ LsarQueryInformationPolicy()

NTSTATUS WINAPI LsarQueryInformationPolicy ( LSAPR_HANDLE  PolicyHandle,
POLICY_INFORMATION_CLASS  InformationClass,
PLSAPR_POLICY_INFORMATION PolicyInformation 
)

Definition at line 531 of file lsarpc.c.

535 {
536  PLSA_DB_OBJECT PolicyObject;
539 
540  TRACE("LsarQueryInformationPolicy(%p,0x%08x,%p)\n",
541  PolicyHandle, InformationClass, PolicyInformation);
542 
543  if (PolicyInformation)
544  {
545  TRACE("*PolicyInformation %p\n", *PolicyInformation);
546  }
547 
548  switch (InformationClass)
549  {
554  break;
555 
566  break;
567 
570  break;
571 
572  default:
573  ERR("Invalid InformationClass!\n");
575  }
576 
577  Status = LsapValidateDbObject(PolicyHandle,
580  &PolicyObject);
581  if (!NT_SUCCESS(Status))
582  return Status;
583 
584  switch (InformationClass)
585  {
586  case PolicyAuditLogInformation: /* 1 */
587  Status = LsarQueryAuditLog(PolicyObject,
588  PolicyInformation);
589  break;
590 
591  case PolicyAuditEventsInformation: /* 2 */
592  Status = LsarQueryAuditEvents(PolicyObject,
593  PolicyInformation);
594  break;
595 
596  case PolicyPrimaryDomainInformation: /* 3 */
597  Status = LsarQueryPrimaryDomain(PolicyObject,
598  PolicyInformation);
599  break;
600 
601  case PolicyPdAccountInformation: /* 4 */
602  Status = LsarQueryPdAccount(PolicyObject,
603  PolicyInformation);
604  break;
605 
606  case PolicyAccountDomainInformation: /* 5 */
607  Status = LsarQueryAccountDomain(PolicyObject,
608  PolicyInformation);
609  break;
610 
611  case PolicyLsaServerRoleInformation: /* 6 */
612  Status = LsarQueryServerRole(PolicyObject,
613  PolicyInformation);
614  break;
615 
616  case PolicyReplicaSourceInformation: /* 7 */
617  Status = LsarQueryReplicaSource(PolicyObject,
618  PolicyInformation);
619  break;
620 
621  case PolicyDefaultQuotaInformation: /* 8 */
622  Status = LsarQueryDefaultQuota(PolicyObject,
623  PolicyInformation);
624  break;
625 
626  case PolicyModificationInformation: /* 9 */
627  Status = LsarQueryModification(PolicyObject,
628  PolicyInformation);
629  break;
630 
631  case PolicyAuditFullQueryInformation: /* 11 (0xB) */
632  Status = LsarQueryAuditFull(PolicyObject,
633  PolicyInformation);
634  break;
635 
636  case PolicyDnsDomainInformation: /* 12 (0xC) */
637  Status = LsarQueryDnsDomain(PolicyObject,
638  PolicyInformation);
639  break;
640 
641  case PolicyDnsDomainInformationInt: /* 13 (0xD) */
642  Status = LsarQueryDnsDomainInt(PolicyObject,
643  PolicyInformation);
644  break;
645 
646  case PolicyLocalAccountDomainInformation: /* 14 (0xE) */
647  Status = LsarQueryLocalAccountDomain(PolicyObject,
648  PolicyInformation);
649  break;
650 
651  default:
652  ERR("Invalid InformationClass!\n");
654  }
655 
656  return Status;
657 }
NTSTATUS LsarQueryModification(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:478
NTSTATUS LsarQueryDefaultQuota(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:446
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define POLICY_VIEW_LOCAL_INFORMATION
Definition: ntsecapi.h:61
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS LsarQueryAuditEvents(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:70
NTSTATUS LsarQueryDnsDomain(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:542
#define POLICY_VIEW_AUDIT_INFORMATION
Definition: ntsecapi.h:62
NTSTATUS LsarQueryAccountDomain(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:289
NTSTATUS LsarQueryServerRole(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:398
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS LsarQueryAuditLog(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:38
NTSTATUS LsarQueryLocalAccountDomain(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:769
Status
Definition: gdiplustypes.h:24
NTSTATUS LsarQueryReplicaSource(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:436
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS LsarQueryPdAccount(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:267
NTSTATUS LsarQueryPrimaryDomain(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:157
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
NTSTATUS LsarQueryAuditFull(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:510
NTSTATUS LsarQueryDnsDomainInt(PLSA_DB_OBJECT PolicyObject, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: policy.c:759
#define POLICY_GET_PRIVATE_INFORMATION
Definition: ntsecapi.h:63
_In_ FILTER_INFORMATION_CLASS InformationClass
Definition: fltkernel.h:1714
ULONG ACCESS_MASK
Definition: nt_native.h:40

Referenced by DsRolepGetBasicInfo(), GetAccountDomainSid(), LsaQueryInformationPolicy(), and LsarQueryInformationPolicy2().

◆ LsarQueryInformationPolicy2()

NTSTATUS WINAPI LsarQueryInformationPolicy2 ( LSAPR_HANDLE  PolicyHandle,
POLICY_INFORMATION_CLASS  InformationClass,
PLSAPR_POLICY_INFORMATION PolicyInformation 
)

Definition at line 3752 of file lsarpc.c.

3756 {
3757  return LsarQueryInformationPolicy(PolicyHandle,
3759  PolicyInformation);
3760 }
NTSTATUS WINAPI LsarQueryInformationPolicy(LSAPR_HANDLE PolicyHandle, POLICY_INFORMATION_CLASS InformationClass, PLSAPR_POLICY_INFORMATION *PolicyInformation)
Definition: lsarpc.c:531
_In_ FILTER_INFORMATION_CLASS InformationClass
Definition: fltkernel.h:1714

◆ LsarQueryInfoTrustedDomain()

NTSTATUS WINAPI LsarQueryInfoTrustedDomain ( LSAPR_HANDLE  TrustedDomainHandle,
TRUSTED_INFORMATION_CLASS  InformationClass,
PLSAPR_TRUSTED_DOMAIN_INFO TrustedDomainInformation 
)

Definition at line 2064 of file lsarpc.c.

2068 {
2069  UNIMPLEMENTED;
2070  return STATUS_NOT_IMPLEMENTED;
2071 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by LsaQueryInfoTrustedDomain().

◆ LsarQuerySecret()

NTSTATUS WINAPI LsarQuerySecret ( LSAPR_HANDLE  SecretHandle,
PLSAPR_CR_CIPHER_VALUE EncryptedCurrentValue,
PLARGE_INTEGER  CurrentValueSetTime,
PLSAPR_CR_CIPHER_VALUE EncryptedOldValue,
PLARGE_INTEGER  OldValueSetTime 
)

Definition at line 2246 of file lsarpc.c.

2252 {
2253  PLSA_DB_OBJECT SecretObject;
2254  PLSAPR_CR_CIPHER_VALUE EncCurrentValue = NULL;
2255  PLSAPR_CR_CIPHER_VALUE EncOldValue = NULL;
2256  PBYTE CurrentValue = NULL;
2257  PBYTE OldValue = NULL;
2258  ULONG CurrentValueLength = 0;
2259  ULONG OldValueLength = 0;
2260  ULONG BufferSize;
2261  NTSTATUS Status;
2262 
2263  TRACE("LsarQuerySecret(%p %p %p %p %p)\n", SecretHandle,
2264  EncryptedCurrentValue, CurrentValueSetTime,
2265  EncryptedOldValue, OldValueSetTime);
2266 
2267  /* Validate the SecretHandle */
2268  Status = LsapValidateDbObject(SecretHandle,
2271  &SecretObject);
2272  if (!NT_SUCCESS(Status))
2273  {
2274  ERR("LsapValidateDbObject returned 0x%08lx\n", Status);
2275  return Status;
2276  }
2277 
2278  if (EncryptedCurrentValue != NULL)
2279  {
2280  CurrentValueLength = 0;
2281 
2282  /* Get the size of the current value */
2283  Status = LsapGetObjectAttribute(SecretObject,
2284  L"CurrentValue",
2285  NULL,
2286  &CurrentValueLength);
2287  if (!NT_SUCCESS(Status))
2288  goto done;
2289 
2290  /* Allocate a buffer for the current value */
2291  CurrentValue = midl_user_allocate(CurrentValueLength);
2292  if (CurrentValue == NULL)
2293  {
2295  goto done;
2296  }
2297 
2298  /* Get the current value */
2299  Status = LsapGetObjectAttribute(SecretObject,
2300  L"CurrentValue",
2301  CurrentValue,
2302  &CurrentValueLength);
2303  if (!NT_SUCCESS(Status))
2304  goto done;
2305 
2306  /* Allocate a buffer for the encrypted current value */
2307  EncCurrentValue = midl_user_allocate(sizeof(LSAPR_CR_CIPHER_VALUE));
2308  if (EncCurrentValue == NULL)
2309  {
2311  goto done;
2312  }
2313 
2314  /* FIXME: Encrypt the current value */
2315  EncCurrentValue->Length = (USHORT)(CurrentValueLength - sizeof(WCHAR));
2316  EncCurrentValue->MaximumLength = (USHORT)CurrentValueLength;
2317  EncCurrentValue->Buffer = (PBYTE)CurrentValue;
2318  }
2319 
2320  if (CurrentValueSetTime != NULL)
2321  {
2322  BufferSize = sizeof(LARGE_INTEGER);
2323 
2324  /* Get the current value time */
2325  Status = LsapGetObjectAttribute(SecretObject,
2326  L"CurrentTime",
2327  (PBYTE)CurrentValueSetTime,
2328  &BufferSize);
2329  if (!NT_SUCCESS(Status))
2330  goto done;
2331  }
2332 
2333  if (EncryptedOldValue != NULL)
2334  {
2335  OldValueLength = 0;
2336 
2337  /* Get the size of the old value */
2338  Status = LsapGetObjectAttribute(SecretObject,
2339  L"OldValue",
2340  NULL,
2341  &OldValueLength);
2342  if (!NT_SUCCESS(Status))
2343  goto done;
2344 
2345  /* Allocate a buffer for the old value */
2346  OldValue = midl_user_allocate(OldValueLength);
2347  if (OldValue == NULL)
2348  {
2350  goto done;
2351  }
2352 
2353  /* Get the old value */
2354  Status = LsapGetObjectAttribute(SecretObject,
2355  L"OldValue",
2356  OldValue,
2357  &OldValueLength);
2358  if (!NT_SUCCESS(Status))
2359  goto done;
2360 
2361  /* Allocate a buffer for the encrypted old value */
2362  EncOldValue = midl_user_allocate(sizeof(LSAPR_CR_CIPHER_VALUE) + OldValueLength);
2363  if (EncOldValue == NULL)
2364  {
2366  goto done;
2367  }
2368 
2369  /* FIXME: Encrypt the old value */
2370  EncOldValue->Length = (USHORT)(OldValueLength - sizeof(WCHAR));
2371  EncOldValue->MaximumLength = (USHORT)OldValueLength;
2372  EncOldValue->Buffer = (PBYTE)OldValue;
2373  }
2374 
2375  if (OldValueSetTime != NULL)
2376  {
2377  BufferSize = sizeof(LARGE_INTEGER);
2378 
2379  /* Get the old value time */
2380  Status = LsapGetObjectAttribute(SecretObject,
2381  L"OldTime",
2382  (PBYTE)OldValueSetTime,
2383  &BufferSize);
2384  if (!NT_SUCCESS(Status))
2385  goto done;
2386  }
2387 
2388 
2389 done:
2390  if (NT_SUCCESS(Status))
2391  {
2392  if (EncryptedCurrentValue != NULL)
2393  *EncryptedCurrentValue = EncCurrentValue;
2394 
2395  if (EncryptedOldValue != NULL)
2396  *EncryptedOldValue = EncOldValue;
2397  }
2398  else
2399  {
2400  if (EncryptedCurrentValue != NULL)
2401  *EncryptedCurrentValue = NULL;
2402 
2403  if (EncryptedOldValue != NULL)
2404  *EncryptedOldValue = NULL;
2405 
2406  if (EncCurrentValue != NULL)
2407  midl_user_free(EncCurrentValue);
2408 
2409  if (EncOldValue != NULL)
2410  midl_user_free(EncOldValue);
2411 
2412  if (CurrentValue != NULL)
2413  midl_user_free(CurrentValue);
2414 
2415  if (OldValue != NULL)
2416  midl_user_free(OldValue);
2417  }
2418 
2419  TRACE("LsarQuerySecret done (Status 0x%08lx)\n", Status);
2420 
2421  return Status;
2422 }
#define midl_user_free
Definition: rpc.h:45
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define SECRET_QUERY_VALUE
Definition: ntlsa.h:39
#define midl_user_allocate
Definition: rpc.h:44
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define BufferSize
Definition: classpnp.h:419
union _LARGE_INTEGER LARGE_INTEGER
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
unsigned short USHORT
Definition: pedump.c:61
NTSTATUS LsapValidateDbObject(LSAPR_HANDLE Handle, LSA_DB_OBJECT_TYPE ObjectType, ACCESS_MASK DesiredAccess, PLSA_DB_OBJECT *DbObject)
Definition: database.c:823
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS LsapGetObjectAttribute(PLSA_DB_OBJECT DbObject, LPWSTR AttributeName, LPVOID AttributeData, PULONG AttributeSize)
Definition: database.c:1010
BYTE * PBYTE
Definition: pedump.c:66

Referenced by LsaQuerySecret().

◆ LsarQuerySecurityObject()

NTSTATUS WINAPI LsarQuerySecurityObject ( LSAPR_HANDLE  ObjectHandle,
SECURITY_INFORMATION  SecurityInformation,
PLSAPR_SR_SECURITY_DESCRIPTOR SecurityDescriptor 
)

Definition at line 198 of file lsarpc.c.

202 {
203  PLSA_DB_OBJECT DbObject = NULL;
204  PSECURITY_DESCRIPTOR RelativeSd = NULL;
205  PSECURITY_DESCRIPTOR ResultSd = NULL;
208  ULONG RelativeSdSize = 0;
209  ULONG ResultSdSize = 0;
211 
212  TRACE("LsarQuerySecurityObject(%p %lx %p)\n",
213  ObjectHandle, SecurityInformation, SecurityDescriptor);
214 
215  if (SecurityDescriptor == NULL)
217 
219 
224 
227 
228  /* Validate the ObjectHandle */
229  Status = LsapValidateDbObject(ObjectHandle,
232  &DbObject);
233  if (!NT_SUCCESS(Status))
234  return Status;
235 
236  /* Get the size of the SD */
237  Status = LsapGetObjectAttribute(DbObject,
238  L"SecDesc",
239  NULL,
240  &RelativeSdSize);
241  if (!NT_SUCCESS(Status))
242  return Status;
243 
244  /* Allocate a buffer for the SD */
245  RelativeSd = MIDL_user_allocate(RelativeSdSize);
246  if (RelativeSd == NULL)
248 
249  /* Get the SD */
250  Status = LsapGetObjectAttribute(DbObject,
251  L"SecDesc",
252  RelativeSd,
253  &RelativeSdSize);
254  if (!NT_SUCCESS(Status))
255  goto done;
256 
257  /* Invalidate the SD information that was not requested */
259  ((PISECURITY_DESCRIPTOR)RelativeSd)->Owner = NULL;
260 
262  ((PISECURITY_DESCRIPTOR)RelativeSd)->Group = NULL;
263 
265  ((PISECURITY_DESCRIPTOR)RelativeSd)->Control &= ~SE_DACL_PRESENT;
266 
268  ((PISECURITY_DESCRIPTOR)RelativeSd)->Control &= ~SE_SACL_PRESENT;
269 
270  /* Calculate the required SD size */
271  Status = RtlMakeSelfRelativeSD(RelativeSd,
272  NULL,
273  &ResultSdSize);
275  goto done;
276 
277  /* Allocate a buffer for the new SD */
278  ResultSd = MIDL_user_allocate(ResultSdSize);
279  if (ResultSd == NULL)
280  {
282  goto done;
283  }
284 
285  /* Build the new SD */
286  Status = RtlMakeSelfRelativeSD(RelativeSd,
287  ResultSd,
288  &ResultSdSize);
289  if (!NT_SUCCESS(Status))
290  goto done;
291 
292  /* Allocate the SD data buffer */
294  if (SdData == NULL)
295  {
297  goto done;
298  }
299 
300  /* Fill the SD data buffer and return it to the caller */
301  SdData->Length = RelativeSdSize;
302  SdData->SecurityDescriptor = (PBYTE)ResultSd;
303 
304  *SecurityDescriptor = SdData;
305 
306 done:
307  if (!NT_SUCCESS(Status))
308  {
309  if (ResultSd != NULL)
310  MIDL_user_free(ResultSd);
311  }
312 
313  if (RelativeSd != NULL)
314  MIDL_user_free(RelativeSd);
315 
316  return Status;
317 }
#define SE_SACL_PRESENT
Definition: setypes.h:769
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define ACCESS_SYSTEM_SECURITY
Definition: nt_native.h:77
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
Definition: wsk.h:182
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_opt_ PSID Group
Definition: rtlfuncs.h:1606