ReactOS  0.4.14-dev-593-g1793dcc
security.c File Reference
#include <advapi32.h>
#include <sddl.h>
Include dependency graph for security.c:

Go to the source code of this file.

Classes

struct  _ACEFLAG
 
union  _MAX_SID
 
struct  WELLKNOWNSID
 
struct  WELLKNOWNRID
 

Macros

#define ADS_RIGHT_DS_CREATE_CHILD   0x0001
 
#define ADS_RIGHT_DS_DELETE_CHILD   0x0002
 
#define ADS_RIGHT_ACTRL_DS_LIST   0x0004
 
#define ADS_RIGHT_DS_SELF   0x0008
 
#define ADS_RIGHT_DS_READ_PROP   0x0010
 
#define ADS_RIGHT_DS_WRITE_PROP   0x0020
 
#define ADS_RIGHT_DS_DELETE_TREE   0x0040
 
#define ADS_RIGHT_DS_LIST_OBJECT   0x0080
 
#define ADS_RIGHT_DS_CONTROL_ACCESS   0x0100
 

Typedefs

typedef struct _ACEFLAG ACEFLAG
 
typedef struct _ACEFLAGLPACEFLAG
 
typedef struct _MAX_SID MAX_SID
 
typedef struct WELLKNOWNSID WELLKNOWNSID
 
typedef struct WELLKNOWNRID WELLKNOWNRID
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (advapi)
 
static BOOL ParseStringSidToSid (LPCWSTR StringSid, PSID pSid, LPDWORD cBytes)
 
static const chardebugstr_sid (PSID sid)
 
static __inline BOOL set_ntstatus (NTSTATUS status)
 
static LPWSTR SERV_dup (LPCSTR str)
 
BOOL ADVAPI_IsLocalComputer (LPCWSTR ServerName)
 
BOOL ADVAPI_GetComputerSid (PSID sid)
 
BOOL WINAPI OpenProcessToken (HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
 
BOOL WINAPI OpenThreadToken (HANDLE ThreadHandle, DWORD DesiredAccess, BOOL OpenAsSelf, HANDLE *TokenHandle)
 
BOOL WINAPI AdjustTokenGroups (HANDLE TokenHandle, BOOL ResetToDefault, PTOKEN_GROUPS NewState, DWORD BufferLength, PTOKEN_GROUPS PreviousState, PDWORD ReturnLength)
 
BOOL WINAPI AdjustTokenPrivileges (HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
 
BOOL WINAPI GetTokenInformation (HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
 
BOOL WINAPI SetTokenInformation (HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength)
 
BOOL WINAPI SetThreadToken (IN PHANDLE ThreadHandle OPTIONAL, IN HANDLE TokenHandle)
 
BOOL WINAPI CreateRestrictedToken (HANDLE baseToken, DWORD flags, DWORD nDisableSids, PSID_AND_ATTRIBUTES disableSids, DWORD nDeletePrivs, PLUID_AND_ATTRIBUTES deletePrivs, DWORD nRestrictSids, PSID_AND_ATTRIBUTES restrictSids, PHANDLE newToken)
 
BOOL WINAPI AllocateAndInitializeSid (PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid)
 
PVOID WINAPI FreeSid (PSID pSid)
 
BOOL WINAPI CopySid (DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid)
 
BOOL WINAPI CreateWellKnownSid (IN WELL_KNOWN_SID_TYPE WellKnownSidType, IN PSID DomainSid OPTIONAL, OUT PSID pSid, IN OUT DWORD *cbSid)
 
BOOL WINAPI IsWellKnownSid (IN PSID pSid, IN WELL_KNOWN_SID_TYPE WellKnownSidType)
 
BOOL WINAPI IsValidSid (PSID pSid)
 
BOOL WINAPI EqualSid (PSID pSid1, PSID pSid2)
 
BOOL WINAPI EqualPrefixSid (PSID pSid1, PSID pSid2)
 
DWORD WINAPI GetSidLengthRequired (UCHAR nSubAuthorityCount)
 
BOOL WINAPI InitializeSid (PSID Sid, PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount)
 
PSID_IDENTIFIER_AUTHORITY WINAPI GetSidIdentifierAuthority (PSID pSid)
 
PDWORD WINAPI GetSidSubAuthority (PSID pSid, DWORD nSubAuthority)
 
PUCHAR WINAPI GetSidSubAuthorityCount (PSID pSid)
 
DWORD WINAPI GetLengthSid (PSID pSid)
 
BOOL WINAPI InitializeSecurityDescriptor (PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision)
 
BOOL WINAPI MakeAbsoluteSD (PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, LPDWORD lpdwAbsoluteSecurityDescriptorSize, PACL pDacl, LPDWORD lpdwDaclSize, PACL pSacl, LPDWORD lpdwSaclSize, PSID pOwner, LPDWORD lpdwOwnerSize, PSID pPrimaryGroup, LPDWORD lpdwPrimaryGroupSize)
 
BOOL WINAPI GetKernelObjectSecurity (HANDLE Handle, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded)
 
BOOL WINAPI InitializeAcl (PACL pAcl, DWORD nAclLength, DWORD dwAclRevision)
 
BOOL WINAPI ImpersonateNamedPipeClient (HANDLE hNamedPipe)
 
BOOL WINAPI AddAccessAllowedAce (PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid)
 
BOOL WINAPI AddAccessAllowedAceEx (PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, PSID pSid)
 
BOOL WINAPI AddAccessDeniedAce (PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid)
 
BOOL WINAPI AddAccessDeniedAceEx (PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, PSID pSid)
 
BOOL WINAPI AddAce (PACL pAcl, DWORD dwAceRevision, DWORD dwStartingAceIndex, LPVOID pAceList, DWORD nAceListLength)
 
BOOL WINAPI DeleteAce (PACL pAcl, DWORD dwAceIndex)
 
BOOL WINAPI FindFirstFreeAce (PACL pAcl, LPVOID *pAce)
 
BOOL WINAPI GetAce (PACL pAcl, DWORD dwAceIndex, LPVOID *pAce)
 
BOOL WINAPI GetAclInformation (PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass)
 
BOOL WINAPI IsValidAcl (PACL pAcl)
 
BOOL WINAPI AllocateLocallyUniqueId (PLUID Luid)
 
BOOL WINAPI LookupPrivilegeDisplayNameA (LPCSTR lpSystemName, LPCSTR lpName, LPSTR lpDisplayName, LPDWORD cchDisplayName, LPDWORD lpLanguageId)
 
BOOL WINAPI LookupPrivilegeNameA (LPCSTR lpSystemName, PLUID lpLuid, LPSTR lpName, LPDWORD cchName)
 
BOOL WINAPI GetFileSecurityA (LPCSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded)
 
BOOL WINAPI GetFileSecurityW (LPCWSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded)
 
BOOL WINAPI SetFileSecurityA (LPCSTR lpFileName, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor)
 
BOOL WINAPI SetFileSecurityW (LPCWSTR lpFileName, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor)
 
BOOL WINAPI QueryWindows31FilesMigration (DWORD x1)
 
BOOL WINAPI SynchronizeWindows31FilesAndWindowsNTRegistry (DWORD x1, DWORD x2, DWORD x3, DWORD x4)
 
BOOL WINAPI RevertToSelf (VOID)
 
BOOL WINAPI ImpersonateSelf (SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
 
BOOL WINAPI AccessCheck (IN PSECURITY_DESCRIPTOR pSecurityDescriptor, IN HANDLE ClientToken, IN DWORD DesiredAccess, IN PGENERIC_MAPPING GenericMapping, OUT PPRIVILEGE_SET PrivilegeSet OPTIONAL, IN OUT LPDWORD PrivilegeSetLength, OUT LPDWORD GrantedAccess, OUT LPBOOL AccessStatus)
 
BOOL WINAPI AccessCheckByType (PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID PrincipalSelfSid, HANDLE ClientToken, DWORD DesiredAccess, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL AccessStatus)
 
BOOL WINAPI SetKernelObjectSecurity (HANDLE Handle, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor)
 
BOOL WINAPI AddAuditAccessAce (PACL pAcl, DWORD dwAceRevision, DWORD dwAccessMask, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure)
 
BOOL WINAPI AddAuditAccessAceEx (PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD dwAccessMask, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure)
 
BOOL WINAPI LookupAccountNameA (LPCSTR SystemName, LPCSTR AccountName, PSID Sid, LPDWORD SidLength, LPSTR ReferencedDomainName, LPDWORD hReferencedDomainNameLength, PSID_NAME_USE SidNameUse)
 
BOOL WINAPI PrivilegeCheck (HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult)
 
DWORD WINAPI GetSecurityInfoExA (HANDLE hObject, SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, LPCSTR lpProvider, LPCSTR lpProperty, PACTRL_ACCESSA *ppAccessList, PACTRL_AUDITA *ppAuditList, LPSTR *lppOwner, LPSTR *lppGroup)
 
DWORD WINAPI GetSecurityInfoExW (HANDLE hObject, SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, LPCWSTR lpProvider, LPCWSTR lpProperty, PACTRL_ACCESSW *ppAccessList, PACTRL_AUDITW *ppAuditList, LPWSTR *lppOwner, LPWSTR *lppGroup)
 
VOID WINAPI BuildExplicitAccessWithNameA (PEXPLICIT_ACCESSA pExplicitAccess, LPSTR pTrusteeName, DWORD AccessPermissions, ACCESS_MODE AccessMode, DWORD Inheritance)
 
VOID WINAPI BuildExplicitAccessWithNameW (PEXPLICIT_ACCESSW pExplicitAccess, LPWSTR pTrusteeName, DWORD AccessPermissions, ACCESS_MODE AccessMode, DWORD Inheritance)
 
VOID WINAPI BuildTrusteeWithObjectsAndNameA (PTRUSTEEA pTrustee, POBJECTS_AND_NAME_A pObjName, SE_OBJECT_TYPE ObjectType, LPSTR ObjectTypeName, LPSTR InheritedObjectTypeName, LPSTR Name)
 
VOID WINAPI BuildTrusteeWithObjectsAndNameW (PTRUSTEEW pTrustee, POBJECTS_AND_NAME_W pObjName, SE_OBJECT_TYPE ObjectType, LPWSTR ObjectTypeName, LPWSTR InheritedObjectTypeName, LPWSTR Name)
 
VOID WINAPI BuildTrusteeWithObjectsAndSidA (PTRUSTEEA pTrustee, POBJECTS_AND_SID pObjSid, GUID *pObjectGuid, GUID *pInheritedObjectGuid, PSID pSid)
 
VOID WINAPI BuildTrusteeWithObjectsAndSidW (PTRUSTEEW pTrustee, POBJECTS_AND_SID pObjSid, GUID *pObjectGuid, GUID *pInheritedObjectGuid, PSID pSid)
 
VOID WINAPI BuildTrusteeWithSidA (PTRUSTEE_A pTrustee, PSID pSid)
 
VOID WINAPI BuildTrusteeWithSidW (PTRUSTEE_W pTrustee, PSID pSid)
 
VOID WINAPI BuildTrusteeWithNameA (PTRUSTEE_A pTrustee, LPSTR name)
 
VOID WINAPI BuildTrusteeWithNameW (PTRUSTEE_W pTrustee, LPWSTR name)
 
TRUSTEE_FORM WINAPI GetTrusteeFormA (PTRUSTEEA pTrustee)
 
TRUSTEE_FORM WINAPI GetTrusteeFormW (PTRUSTEEW pTrustee)
 
LPSTR WINAPI GetTrusteeNameA (PTRUSTEE_A pTrustee)
 
LPWSTR WINAPI GetTrusteeNameW (PTRUSTEE_W pTrustee)
 
TRUSTEE_TYPE WINAPI GetTrusteeTypeA (PTRUSTEE_A pTrustee)
 
TRUSTEE_TYPE WINAPI GetTrusteeTypeW (PTRUSTEE_W pTrustee)
 
BOOL WINAPI SetAclInformation (PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass)
 
DWORD WINAPI SetNamedSecurityInfoA (LPSTR pObjectName, SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, PSID psidOwner, PSID psidGroup, PACL pDacl, PACL pSacl)
 
BOOL WINAPI AreAllAccessesGranted (DWORD GrantedAccess, DWORD DesiredAccess)
 
BOOL WINAPI AreAnyAccessesGranted (DWORD GrantedAccess, DWORD DesiredAccess)
 
static DWORD ParseAclStringFlags (LPCWSTR *StringAcl)
 
static BYTE ParseAceStringType (LPCWSTR *StringAcl)
 
static BYTE ParseAceStringFlags (LPCWSTR *StringAcl)
 
static DWORD ParseAceStringRights (LPCWSTR *StringAcl)
 
static BOOL ParseStringAclToAcl (LPCWSTR StringAcl, LPDWORD lpdwFlags, PACL pAcl, LPDWORD cBytes)
 
static BOOL ParseStringSecurityDescriptorToSecurityDescriptor (LPCWSTR StringSecurityDescriptor, SECURITY_DESCRIPTOR_RELATIVE *SecurityDescriptor, LPDWORD cBytes)
 
BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorA (LPCSTR StringSecurityDescriptor, DWORD StringSDRevision, PSECURITY_DESCRIPTOR *SecurityDescriptor, PULONG SecurityDescriptorSize)
 
BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorW (LPCWSTR StringSecurityDescriptor, DWORD StringSDRevision, PSECURITY_DESCRIPTOR *SecurityDescriptor, PULONG SecurityDescriptorSize)
 
static void DumpString (LPCWSTR string, int cch, WCHAR **pwptr, ULONG *plen)
 
static BOOL DumpSidNumeric (PSID psid, WCHAR **pwptr, ULONG *plen)
 
static BOOL DumpSid (PSID psid, WCHAR **pwptr, ULONG *plen)
 
static void DumpRights (DWORD mask, WCHAR **pwptr, ULONG *plen)
 
static BOOL DumpAce (LPVOID pace, WCHAR **pwptr, ULONG *plen)
 
static BOOL DumpAcl (PACL pacl, WCHAR **pwptr, ULONG *plen, BOOL protected, BOOL autoInheritReq, BOOL autoInherited)
 
static BOOL DumpOwner (PSECURITY_DESCRIPTOR SecurityDescriptor, WCHAR **pwptr, ULONG *plen)
 
static BOOL DumpGroup (PSECURITY_DESCRIPTOR SecurityDescriptor, WCHAR **pwptr, ULONG *plen)
 
static BOOL DumpDacl (PSECURITY_DESCRIPTOR SecurityDescriptor, WCHAR **pwptr, ULONG *plen)
 
static BOOL DumpSacl (PSECURITY_DESCRIPTOR SecurityDescriptor, WCHAR **pwptr, ULONG *plen)
 
BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorW (PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD SDRevision, SECURITY_INFORMATION RequestedInformation, LPWSTR *OutputString, PULONG OutputLen)
 
BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorA (PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD SDRevision, SECURITY_INFORMATION Information, LPSTR *OutputString, PULONG OutputLen)
 
BOOL WINAPI ConvertStringSidToSidW (LPCWSTR StringSid, PSID *Sid)
 
BOOL WINAPI ConvertStringSidToSidA (LPCSTR StringSid, PSID *Sid)
 
BOOL WINAPI ConvertSidToStringSidW (PSID Sid, LPWSTR *StringSid)
 
BOOL WINAPI ConvertSidToStringSidA (PSID Sid, LPSTR *StringSid)
 
BOOL WINAPI CreateProcessWithLogonW (LPCWSTR lpUsername, LPCWSTR lpDomain, LPCWSTR lpPassword, DWORD dwLogonFlags, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
 
BOOL WINAPI CreateProcessWithTokenW (HANDLE token, DWORD logon_flags, LPCWSTR application_name, LPWSTR command_line, DWORD creation_flags, void *environment, LPCWSTR current_directory, STARTUPINFOW *startup_info, PROCESS_INFORMATION *process_information)
 
BOOL WINAPI DuplicateTokenEx (IN HANDLE ExistingTokenHandle, IN DWORD dwDesiredAccess, IN LPSECURITY_ATTRIBUTES lpTokenAttributes OPTIONAL, IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, IN TOKEN_TYPE TokenType, OUT PHANDLE DuplicateTokenHandle)
 
BOOL WINAPI DuplicateToken (IN HANDLE ExistingTokenHandle, IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, OUT PHANDLE DuplicateTokenHandle)
 
static DWORD ComputeStringSidSize (LPCWSTR StringSid)
 
DWORD WINAPI GetNamedSecurityInfoA (LPSTR pObjectName, SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, PSID *ppsidOwner, PSID *ppsidGroup, PACL *ppDacl, PACL *ppSacl, PSECURITY_DESCRIPTOR *ppSecurityDescriptor)
 
BOOL WINAPI GetWindowsAccountDomainSid (PSID sid, PSID domain_sid, DWORD *size)
 
BOOL WINAPI EqualDomainSid (IN PSID pSid1, IN PSID pSid2, OUT BOOL *pfEqual)
 

Variables

static const WELLKNOWNSID WellKnownSids []
 
static const WELLKNOWNRID WellKnownRids []
 
static const SID sidWorld = { SID_REVISION, 1, { SECURITY_WORLD_SID_AUTHORITY} , { SECURITY_WORLD_RID } }
 
static const WCHAR SDDL_NO_READ_UP [] = {'N','R',0}
 
static const WCHAR SDDL_NO_WRITE_UP [] = {'N','W',0}
 
static const WCHAR SDDL_NO_EXECUTE_UP [] = {'N','X',0}
 
static const WCHAR SDDL_ACCESS_ALLOWED [] = {'A',0}
 
static const WCHAR SDDL_ACCESS_DENIED [] = {'D',0}
 
static const WCHAR SDDL_OBJECT_ACCESS_ALLOWED [] = {'O','A',0}
 
static const WCHAR SDDL_OBJECT_ACCESS_DENIED [] = {'O','D',0}
 
static const WCHAR SDDL_AUDIT [] = {'A','U',0}
 
static const WCHAR SDDL_ALARM [] = {'A','L',0}
 
static const WCHAR SDDL_MANDATORY_LABEL [] = {'M','L',0}
 
static const WCHAR SDDL_OBJECT_AUDIT [] = {'O','U',0}
 
static const WCHAR SDDL_OBJECT_ALARM [] = {'O','L',0}
 
static const WCHAR SDDL_CONTAINER_INHERIT [] = {'C','I',0}
 
static const WCHAR SDDL_OBJECT_INHERIT [] = {'O','I',0}
 
static const WCHAR SDDL_NO_PROPAGATE [] = {'N','P',0}
 
static const WCHAR SDDL_INHERIT_ONLY [] = {'I','O',0}
 
static const WCHAR SDDL_INHERITED [] = {'I','D',0}
 
static const WCHAR SDDL_AUDIT_SUCCESS [] = {'S','A',0}
 
static const WCHAR SDDL_AUDIT_FAILURE [] = {'F','A',0}
 
static const ACEFLAG AceType []
 
static const ACEFLAG AceFlags []
 
static const ACEFLAG AceRights []
 
static const LPCWSTR AceRightBitNames [32]
 

Macro Definition Documentation

◆ ADS_RIGHT_ACTRL_DS_LIST

#define ADS_RIGHT_ACTRL_DS_LIST   0x0004

Definition at line 157 of file security.c.

◆ ADS_RIGHT_DS_CONTROL_ACCESS

#define ADS_RIGHT_DS_CONTROL_ACCESS   0x0100

Definition at line 163 of file security.c.

◆ ADS_RIGHT_DS_CREATE_CHILD

#define ADS_RIGHT_DS_CREATE_CHILD   0x0001

Definition at line 155 of file security.c.

◆ ADS_RIGHT_DS_DELETE_CHILD

#define ADS_RIGHT_DS_DELETE_CHILD   0x0002

Definition at line 156 of file security.c.

◆ ADS_RIGHT_DS_DELETE_TREE

#define ADS_RIGHT_DS_DELETE_TREE   0x0040

Definition at line 161 of file security.c.

◆ ADS_RIGHT_DS_LIST_OBJECT

#define ADS_RIGHT_DS_LIST_OBJECT   0x0080

Definition at line 162 of file security.c.

◆ ADS_RIGHT_DS_READ_PROP

#define ADS_RIGHT_DS_READ_PROP   0x0010

Definition at line 159 of file security.c.

◆ ADS_RIGHT_DS_SELF

#define ADS_RIGHT_DS_SELF   0x0008

Definition at line 158 of file security.c.

◆ ADS_RIGHT_DS_WRITE_PROP

#define ADS_RIGHT_DS_WRITE_PROP   0x0020

Definition at line 160 of file security.c.

Typedef Documentation

◆ ACEFLAG

◆ LPACEFLAG

◆ MAX_SID

◆ WELLKNOWNRID

◆ WELLKNOWNSID

Function Documentation

◆ AccessCheck()

BOOL WINAPI AccessCheck ( IN PSECURITY_DESCRIPTOR  pSecurityDescriptor,
IN HANDLE  ClientToken,
IN DWORD  DesiredAccess,
IN PGENERIC_MAPPING  GenericMapping,
OUT PPRIVILEGE_SET PrivilegeSet  OPTIONAL,
IN OUT LPDWORD  PrivilegeSetLength,
OUT LPDWORD  GrantedAccess,
OUT LPBOOL  AccessStatus 
)

Definition at line 1529 of file security.c.

1537 {
1538  NTSTATUS Status;
1539  NTSTATUS NtAccessStatus;
1540 
1541  /* Do the access check */
1542  Status = NtAccessCheck(pSecurityDescriptor,
1543  ClientToken,
1544  DesiredAccess,
1546  PrivilegeSet,
1547  (PULONG)PrivilegeSetLength,
1549  &NtAccessStatus);
1550 
1551  /* See if the access check operation succeeded */
1552  if (!NT_SUCCESS(Status))
1553  {
1554  /* Check failed */
1556  return FALSE;
1557  }
1558 
1559  /* Now check the access status */
1560  if (!NT_SUCCESS(NtAccessStatus))
1561  {
1562  /* Access denied */
1563  SetLastError(RtlNtStatusToDosError(NtAccessStatus));
1564  *AccessStatus = FALSE;
1565  }
1566  else
1567  {
1568  /* Access granted */
1569  *AccessStatus = TRUE;
1570  }
1571 
1572  /* Check succeeded */
1573  return TRUE;
1574 }
#define TRUE
Definition: types.h:120
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET _In_ PGENERIC_MAPPING _In_ KPROCESSOR_MODE _Out_ PACCESS_MASK _Out_ PNTSTATUS AccessStatus
Definition: sefuncs.h:13
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:417
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
static GENERIC_MAPPING GenericMapping
Definition: SeInheritance.c:11
NTSTATUS NTAPI NtAccessCheck(IN PSECURITY_DESCRIPTOR SecurityDescriptor, IN HANDLE TokenHandle, IN ACCESS_MASK DesiredAccess, IN PGENERIC_MAPPING GenericMapping, OUT PPRIVILEGE_SET PrivilegeSet OPTIONAL, IN OUT PULONG PrivilegeSetLength, OUT PACCESS_MASK GrantedAccess, OUT PNTSTATUS AccessStatus)
Definition: accesschk.c:529
_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 * PULONG
Definition: retypes.h:1
ACCESS_MASK * PACCESS_MASK
Definition: nt_native.h:41
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET _In_ PGENERIC_MAPPING _In_ KPROCESSOR_MODE _Out_ PACCESS_MASK GrantedAccess
Definition: sefuncs.h:13

Referenced by test_AccessCheck(), test_default_handle_security(), and test_FileSecurity().

◆ AccessCheckByType()

BOOL WINAPI AccessCheckByType ( PSECURITY_DESCRIPTOR  pSecurityDescriptor,
PSID  PrincipalSelfSid,
HANDLE  ClientToken,
DWORD  DesiredAccess,
POBJECT_TYPE_LIST  ObjectTypeList,
DWORD  ObjectTypeListLength,
PGENERIC_MAPPING  GenericMapping,
PPRIVILEGE_SET  PrivilegeSet,
LPDWORD  PrivilegeSetLength,
LPDWORD  GrantedAccess,
LPBOOL  AccessStatus 
)

Definition at line 1579 of file security.c.

1591 {
1592  FIXME("stub\n");
1593 
1594  *AccessStatus = TRUE;
1595 
1596  return !*AccessStatus;
1597 }
#define TRUE
Definition: types.h:120
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET _In_ PGENERIC_MAPPING _In_ KPROCESSOR_MODE _Out_ PACCESS_MASK _Out_ PNTSTATUS AccessStatus
Definition: sefuncs.h:13
#define FIXME(fmt,...)
Definition: debug.h:110

◆ AddAccessAllowedAce()

BOOL WINAPI AddAccessAllowedAce ( PACL  pAcl,
DWORD  dwAceRevision,
DWORD  AccessMask,
PSID  pSid 
)

Definition at line 918 of file security.c.

922 {
924 
927  AccessMask,
928  pSid);
929  if (!NT_SUCCESS(Status))
930  {
932  return FALSE;
933  }
934 
935  return TRUE;
936 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI NTSTATUS WINAPI RtlAddAccessAllowedAce(PACL, DWORD, DWORD, PSID)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ACCESS_MASK AccessMask
Definition: exfuncs.h:186
#define SetLastError(x)
Definition: compat.h:417
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
_In_ ULONG dwAceRevision
Definition: rtlfuncs.h:1115
static PSID pSid
Definition: security.c:74

Referenced by AccRewriteSetEntriesInAcl(), AddAceToDesktop(), convert_nfs4acl_2_dacl(), CreateDefaultSecurityDescriptor(), CreateWindowStationAndDesktops(), GetShellSecurityDescriptor(), test_AccessCheck(), test_AddMandatoryAce(), test_GetExplicitEntriesFromAclW(), test_process_security(), test_SetEntriesInAclA(), and test_SetEntriesInAclW().

◆ AddAccessAllowedAceEx()

BOOL WINAPI AddAccessAllowedAceEx ( PACL  pAcl,
DWORD  dwAceRevision,
DWORD  AceFlags,
DWORD  AccessMask,
PSID  pSid 
)

Definition at line 942 of file security.c.

947 {
949 
952  AceFlags,
953  AccessMask,
954  pSid);
955  if (!NT_SUCCESS(Status))
956  {
958  return FALSE;
959  }
960 
961  return TRUE;
962 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI NTSTATUS WINAPI RtlAddAccessAllowedAceEx(PACL, DWORD, DWORD, DWORD, PSID)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ACCESS_MASK AccessMask
Definition: exfuncs.h:186
#define SetLastError(x)
Definition: compat.h:417
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
_In_ ULONG dwAceRevision
Definition: rtlfuncs.h:1115
static PSID pSid
Definition: security.c:74
static const ACEFLAG AceFlags[]
Definition: security.c:2300

Referenced by get_sd(), and GetShellSecurityDescriptor().

◆ AddAccessDeniedAce()

BOOL WINAPI AddAccessDeniedAce ( PACL  pAcl,
DWORD  dwAceRevision,
DWORD  AccessMask,
PSID  pSid 
)

Definition at line 969 of file security.c.

973 {
975 
978  AccessMask,
979  pSid);
980  if (!NT_SUCCESS(Status))
981  {
983  return FALSE;
984  }
985 
986  return TRUE;
987 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ACCESS_MASK AccessMask
Definition: exfuncs.h:186
#define SetLastError(x)
Definition: compat.h:417
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
_In_ ULONG dwAceRevision
Definition: rtlfuncs.h:1115
static PSID pSid
Definition: security.c:74
NTSYSAPI NTSTATUS NTAPI RtlAddAccessDeniedAce(_Inout_ PACL Acl, _In_ ULONG Revision, _In_ ACCESS_MASK AccessMask, _In_ PSID Sid)

Referenced by AccRewriteSetEntriesInAcl(), convert_nfs4acl_2_dacl(), GetShellSecurityDescriptor(), test_AccessCheck(), and test_process_security().

◆ AddAccessDeniedAceEx()

BOOL WINAPI AddAccessDeniedAceEx ( PACL  pAcl,
DWORD  dwAceRevision,
DWORD  AceFlags,
DWORD  AccessMask,
PSID  pSid 
)

Definition at line 993 of file security.c.

998 {
1000 
1002  dwAceRevision,
1003  AceFlags,
1004  AccessMask,
1005  pSid);
1006  if (!NT_SUCCESS(Status))
1007  {
1009  return FALSE;
1010  }
1011 
1012  return TRUE;
1013 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ACCESS_MASK AccessMask
Definition: exfuncs.h:186
#define SetLastError(x)
Definition: compat.h:417
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
_In_ ULONG dwAceRevision
Definition: rtlfuncs.h:1115
static PSID pSid
Definition: security.c:74
NTSYSAPI NTSTATUS NTAPI RtlAddAccessDeniedAceEx(_Inout_ PACL Acl, _In_ ULONG Revision, _In_ ULONG Flags, _In_ ACCESS_MASK AccessMask, _In_ PSID Sid)
static const ACEFLAG AceFlags[]
Definition: security.c:2300

Referenced by GetShellSecurityDescriptor().

◆ AddAce()

BOOL WINAPI AddAce ( PACL  pAcl,
DWORD  dwAceRevision,
DWORD  dwStartingAceIndex,
LPVOID  pAceList,
DWORD  nAceListLength 
)

Definition at line 1020 of file security.c.

1025 {
1026  NTSTATUS Status;
1027 
1028  Status = RtlAddAce(pAcl,
1029  dwAceRevision,
1030  dwStartingAceIndex,
1031  pAceList,
1032  nAceListLength);
1033  if (!NT_SUCCESS(Status))
1034  {
1036  return FALSE;
1037  }
1038 
1039  return TRUE;
1040 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:417
NTSYSAPI NTSTATUS NTAPI RtlAddAce(_Inout_ PACL Acl, _In_ ULONG AceRevision, _In_ ULONG StartingAceIndex, _In_reads_bytes_(AceListLength) PVOID AceList, _In_ ULONG AceListLength)
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
_In_ ULONG dwAceRevision
Definition: rtlfuncs.h:1115

Referenced by AddAceToWindowStation(), and test_AddAce().

◆ AddAuditAccessAce()

BOOL WINAPI AddAuditAccessAce ( PACL  pAcl,
DWORD  dwAceRevision,
DWORD  dwAccessMask,
PSID  pSid,
BOOL  bAuditSuccess,
BOOL  bAuditFailure 
)

Definition at line 1627 of file security.c.

1633 {
1634  NTSTATUS Status;
1635 
1637  dwAceRevision,
1638  dwAccessMask,
1639  pSid,
1640  bAuditSuccess,
1641  bAuditFailure);
1642  if (!NT_SUCCESS(Status))
1643  {
1645  return FALSE;
1646  }
1647 
1648  return TRUE;
1649 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:417
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
NTSYSAPI NTSTATUS NTAPI RtlAddAuditAccessAce(_Inout_ PACL Acl, _In_ ULONG Revision, _In_ ACCESS_MASK AccessMask, _In_ PSID Sid, _In_ BOOLEAN Success, _In_ BOOLEAN Failure)
_In_ ULONG dwAceRevision
Definition: rtlfuncs.h:1115
static PSID pSid
Definition: security.c:74

◆ AddAuditAccessAceEx()

BOOL WINAPI AddAuditAccessAceEx ( PACL  pAcl,
DWORD  dwAceRevision,
DWORD  AceFlags,
DWORD  dwAccessMask,
PSID  pSid,
BOOL  bAuditSuccess,
BOOL  bAuditFailure 
)

Definition at line 1655 of file security.c.

1662 {
1663  NTSTATUS Status;
1664 
1666  dwAceRevision,
1667  AceFlags,
1668  dwAccessMask,
1669  pSid,
1670  bAuditSuccess,
1671  bAuditFailure);
1672  if (!NT_SUCCESS(Status))
1673  {
1675  return FALSE;
1676  }
1677 
1678  return TRUE;
1679 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:417
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
_In_ ULONG dwAceRevision
Definition: rtlfuncs.h:1115
static PSID pSid
Definition: security.c:74
NTSYSAPI NTSTATUS NTAPI RtlAddAuditAccessAceEx(_Inout_ PACL Acl, _In_ ULONG Revision, _In_ ULONG Flags, _In_ ACCESS_MASK AccessMask, _In_ PSID Sid, _In_ BOOLEAN Success, _In_ BOOLEAN Failure)
static const ACEFLAG AceFlags[]
Definition: security.c:2300

◆ AdjustTokenGroups()

BOOL WINAPI AdjustTokenGroups ( HANDLE  TokenHandle,
BOOL  ResetToDefault,
PTOKEN_GROUPS  NewState,
DWORD  BufferLength,
PTOKEN_GROUPS  PreviousState,
PDWORD  ReturnLength 
)

Definition at line 348 of file security.c.

354 {
356 
358  ResetToDefault,
359  NewState,
360  BufferLength,
363  if (!NT_SUCCESS(Status))
364  {
366  return FALSE;
367  }
368 
369  return TRUE;
370 }
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONG BufferLength
Definition: usbdlib.h:225
NTSTATUS NTAPI NtAdjustGroupsToken(IN HANDLE TokenHandle, IN BOOLEAN ResetToDefault, IN PTOKEN_GROUPS NewState, IN ULONG BufferLength, OUT PTOKEN_GROUPS PreviousState OPTIONAL, OUT PULONG ReturnLength)
Definition: token.c:3083
_In_ ACCESS_MASK _In_ ULONG _Out_ PHANDLE TokenHandle
Definition: psfuncs.h:715
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:417
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
_In_ PLARGE_INTEGER _In_opt_ PTIMER_APC_ROUTINE _In_opt_ PVOID _In_ BOOLEAN _In_opt_ LONG _Out_opt_ PBOOLEAN PreviousState
Definition: zwfuncs.h:428
unsigned int * PULONG
Definition: retypes.h:1

◆ AdjustTokenPrivileges()

BOOL WINAPI AdjustTokenPrivileges ( HANDLE  TokenHandle,
BOOL  DisableAllPrivileges,
PTOKEN_PRIVILEGES  NewState,
DWORD  BufferLength,
PTOKEN_PRIVILEGES  PreviousState,
PDWORD  ReturnLength 
)

Definition at line 376 of file security.c.

382 {
384 
386  DisableAllPrivileges,
387  NewState,
388  BufferLength,
392  {
394  return TRUE;
395  }
396 
397  if (!NT_SUCCESS(Status))
398  {
400  return FALSE;
401  }
402 
403  /* AdjustTokenPrivileges is documented to do this */
405 
406  return TRUE;
407 }
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
#define STATUS_NOT_ALL_ASSIGNED
Definition: ntstatus.h:85
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONG BufferLength
Definition: usbdlib.h:225
_In_ ACCESS_MASK _In_ ULONG _Out_ PHANDLE TokenHandle
Definition: psfuncs.h:715
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:417
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
_In_ PLARGE_INTEGER _In_opt_ PTIMER_APC_ROUTINE _In_opt_ PVOID _In_ BOOLEAN _In_opt_ LONG _Out_opt_ PBOOLEAN PreviousState
Definition: zwfuncs.h:428
unsigned int * PULONG
Definition: retypes.h:1
#define ERROR_NOT_ALL_ASSIGNED
Definition: winerror.h:782
_Must_inspect_result_ __kernel_entry NTSTATUS NTAPI NtAdjustPrivilegesToken(_In_ HANDLE TokenHandle, _In_ BOOLEAN DisableAllPrivileges, _In_opt_ PTOKEN_PRIVILEGES NewState, _In_ ULONG BufferLength, _Out_writes_bytes_to_opt_(BufferLength, *ReturnLength) PTOKEN_PRIVILEGES PreviousState, _When_(PreviousState!=NULL, _Out_) PULONG ReturnLength)
Definition: token.c:3219

Referenced by AcquireRemoveRestorePrivilege(), AddDeviceW(), EnablePrivilege(), EnableProcessPrivileges(), CShellCommandSACL::Execute(), FormatEx2(), InstallReactOS(), named_pipe_client_func(), PauseBalanceW(), Privilege(), pSetupEnablePrivilege(), RecvSubvolGUIW(), RecvSubvolW(), RemoveDeviceW(), ResetStatsW(), ResizeDeviceW(), ScmEnableBackupRestorePrivileges(), SendSubvolGUIW(), SendSubvolW(), set_privilege(), set_privileges(), SetDriverLoadPrivilege(), SetPrivilege(), ShowScrubW(), ShutdownSystem(), StartBalanceW(), StartScrubW(), StopBalanceW(), StopScrubW(), SystemSetLocalTime(), SystemSetTime(), test8(), test_AdjustTokenPrivileges(), test_SetFileValidData(), test_system_security_access(), UpdateDriver(), WinMain(), and wWinMain().

◆ ADVAPI_GetComputerSid()

BOOL ADVAPI_GetComputerSid ( PSID  sid)

Definition at line 275 of file security.c.

276 {
277  static const struct /* same fields as struct SID */
278  {
279  BYTE Revision;
282  DWORD SubAuthority[4];
283  } computer_sid =
285 
286  memcpy( sid, &computer_sid, sizeof(computer_sid) );
287  return TRUE;
288 }
#define TRUE
Definition: types.h:120
#define SID_REVISION
Definition: setypes.h:453
FT_UInt sid
Definition: cffcmap.c:139
_In_ ULONG Revision
Definition: rtlfuncs.h:1104
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:526
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
_In_ PSID_IDENTIFIER_AUTHORITY _In_ UCHAR SubAuthorityCount
Definition: rtlfuncs.h:1487
_In_ PSID_IDENTIFIER_AUTHORITY IdentifierAuthority
Definition: rtlfuncs.h:1487
#define SECURITY_NT_NON_UNIQUE
Definition: setypes.h:549

Referenced by ComputeStringSidSize(), and ParseStringSidToSid().

◆ ADVAPI_IsLocalComputer()

BOOL ADVAPI_IsLocalComputer ( LPCWSTR  ServerName)

Definition at line 253 of file security.c.

254 {
256  BOOL Result;
257  LPWSTR buf;
258 
259  if (!ServerName || !ServerName[0])
260  return TRUE;
261 
262  buf = heap_alloc(dwSize * sizeof(WCHAR));
264  if (Result && (ServerName[0] == '\\') && (ServerName[1] == '\\'))
265  ServerName += 2;
266  Result = Result && !lstrcmpW(ServerName, buf);
267  heap_free(buf);
268 
269  return Result;
270 }
#define TRUE
Definition: types.h:120
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:440
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
unsigned int BOOL
Definition: ntddk_ex.h:94
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240
WCHAR * LPWSTR
Definition: xmlstorage.h:184
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ AllocateAndInitializeSid()

BOOL WINAPI AllocateAndInitializeSid ( PSID_IDENTIFIER_AUTHORITY  pIdentifierAuthority,
BYTE  nSubAuthorityCount,
DWORD  nSubAuthority0,
DWORD  nSubAuthority1,
DWORD  nSubAuthority2,
DWORD  nSubAuthority3,
DWORD  nSubAuthority4,
DWORD  nSubAuthority5,
DWORD  nSubAuthority6,
DWORD  nSubAuthority7,
PSID pSid 
)

Definition at line 553 of file security.c.

560 {
562  pIdentifierAuthority, nSubAuthorityCount,
563  nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3,
564  nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7,
565  pSid ));
566 }
NTSYSAPI NTSTATUS NTAPI RtlAllocateAndInitializeSid(IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority, IN UCHAR SubAuthorityCount, IN ULONG SubAuthority0, IN ULONG SubAuthority1, IN ULONG SubAuthority2, IN ULONG SubAuthority3, IN ULONG SubAuthority4, IN ULONG SubAuthority5, IN ULONG SubAuthority6, IN ULONG SubAuthority7, OUT PSID *Sid)
Definition: sid.c:290
static __inline BOOL set_ntstatus(NTSTATUS status)
Definition: security.c:229
static PSID pSid
Definition: security.c:74

Referenced by check_wellknown_name(), CheckForGuestsAndAdmins(), CreateDefaultSecurityDescriptor(), CreateLogoffSecurityAttributes(), GetShellSecurityDescriptor(), is_process_limited(), is_token_admin(), IsNTAdmin(), IsUserAdmin(), PerfDataInitialize(), pSetupIsUserAdmin(), SHTestTokenMembership(), test_AccessCheck(), test_AddMandatoryAce(), test_CreateWellKnownSid(), test_EqualSid(), test_GetExplicitEntriesFromAclW(), test_GetNamedSecurityInfoA(), test_GetSecurityInfo(), test_LookupAccountSid(), test_process_security(), test_reg_create_key(), test_reg_open_key(), test_SetEntriesInAclA(), test_SetEntriesInAclW(), test_sid(), and test_trustee().

◆ AllocateLocallyUniqueId()

BOOL WINAPI AllocateLocallyUniqueId ( PLUID  Luid)

Definition at line 1097 of file security.c.

1098 {
1099  NTSTATUS Status;
1100 
1102  if (!NT_SUCCESS (Status))
1103  {
1105  return FALSE;
1106  }
1107 
1108  return TRUE;
1109 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI NtAllocateLocallyUniqueId(OUT LUID *LocallyUniqueId)
Definition: uuid.c:353
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:417
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)

Referenced by CookupNodeId(), LogonUserExW(), MyLogonUser(), and wined3d_adapter_init().

◆ AreAllAccessesGranted()

BOOL WINAPI AreAllAccessesGranted ( DWORD  GrantedAccess,
DWORD  DesiredAccess 
)

Definition at line 2208 of file security.c.

2210 {
2212  DesiredAccess);
2213 }
unsigned int BOOL
Definition: ntddk_ex.h:94
_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
NTSYSAPI BOOLEAN NTAPI RtlAreAllAccessesGranted(ACCESS_MASK GrantedAccess, ACCESS_MASK DesiredAccess)
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET _In_ PGENERIC_MAPPING _In_ KPROCESSOR_MODE _Out_ PACCESS_MASK GrantedAccess
Definition: sefuncs.h:13

◆ AreAnyAccessesGranted()

BOOL WINAPI AreAnyAccessesGranted ( DWORD  GrantedAccess,
DWORD  DesiredAccess 
)

Definition at line 2220 of file security.c.

2222 {
2224  DesiredAccess);
2225 }
NTSYSAPI BOOLEAN NTAPI RtlAreAnyAccessesGranted(ACCESS_MASK GrantedAccess, ACCESS_MASK DesiredAccess)
unsigned int BOOL
Definition: ntddk_ex.h:94
_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
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET _In_ PGENERIC_MAPPING _In_ KPROCESSOR_MODE _Out_ PACCESS_MASK GrantedAccess
Definition: sefuncs.h:13

◆ BuildExplicitAccessWithNameA()

VOID WINAPI BuildExplicitAccessWithNameA ( PEXPLICIT_ACCESSA  pExplicitAccess,
LPSTR  pTrusteeName,
DWORD  AccessPermissions,
ACCESS_MODE  AccessMode,
DWORD  Inheritance 
)

Definition at line 1806 of file security.c.

1811 {
1812  pExplicitAccess->grfAccessPermissions = AccessPermissions;
1813  pExplicitAccess->grfAccessMode = AccessMode;
1814  pExplicitAccess->grfInheritance = Inheritance;
1815 
1816  pExplicitAccess->Trustee.pMultipleTrustee = NULL;
1818  pExplicitAccess->Trustee.TrusteeForm = TRUSTEE_IS_NAME;
1819  pExplicitAccess->Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN;
1820  pExplicitAccess->Trustee.ptstrName = pTrusteeName;
1821 }
TRUSTEE_TYPE TrusteeType
Definition: accctrl.h:207
ACCESS_MODE grfAccessMode
Definition: accctrl.h:333
MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation
Definition: accctrl.h:205
struct _TRUSTEE_A * pMultipleTrustee
Definition: accctrl.h:204
TRUSTEE_A Trustee
Definition: accctrl.h:335
LPSTR ptstrName
Definition: accctrl.h:208
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode
Definition: mmfuncs.h:396
smooth NULL
Definition: ftsmooth.c:416
DWORD grfInheritance
Definition: accctrl.h:334
DWORD grfAccessPermissions
Definition: accctrl.h:332
TRUSTEE_FORM TrusteeForm
Definition: accctrl.h:206

◆ BuildExplicitAccessWithNameW()

VOID WINAPI BuildExplicitAccessWithNameW ( PEXPLICIT_ACCESSW  pExplicitAccess,
LPWSTR  pTrusteeName,
DWORD  AccessPermissions,
ACCESS_MODE  AccessMode,
DWORD  Inheritance 
)

Definition at line 1828 of file security.c.

1833 {
1834  pExplicitAccess->grfAccessPermissions = AccessPermissions;
1835  pExplicitAccess->grfAccessMode = AccessMode;
1836  pExplicitAccess->grfInheritance = Inheritance;
1837 
1838  pExplicitAccess->Trustee.pMultipleTrustee = NULL;
1840  pExplicitAccess->Trustee.TrusteeForm = TRUSTEE_IS_NAME;
1841  pExplicitAccess->Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN;
1842  pExplicitAccess->Trustee.ptstrName = pTrusteeName;
1843 }
TRUSTEE_FORM TrusteeForm
Definition: accctrl.h:215
TRUSTEE_TYPE TrusteeType
Definition: accctrl.h:216
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode
Definition: mmfuncs.h:396
smooth NULL
Definition: ftsmooth.c:416
DWORD grfInheritance
Definition: accctrl.h:342
ACCESS_MODE grfAccessMode
Definition: accctrl.h:341
struct _TRUSTEE_W * pMultipleTrustee
Definition: accctrl.h:213
TRUSTEE_W Trustee
Definition: accctrl.h:343
MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation
Definition: accctrl.h:214
LPWSTR ptstrName
Definition: accctrl.h:217
DWORD grfAccessPermissions
Definition: accctrl.h:340

◆ BuildTrusteeWithNameA()

VOID WINAPI BuildTrusteeWithNameA ( PTRUSTEE_A  pTrustee,
LPSTR  name 
)

Definition at line 2051 of file security.c.

2053 {
2054  TRACE("%p %s\n", pTrustee, name);
2055 
2056  pTrustee->pMultipleTrustee = NULL;
2058  pTrustee->TrusteeForm = TRUSTEE_IS_NAME;
2059  pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
2060  pTrustee->ptstrName = name;
2061 }
TRUSTEE_TYPE TrusteeType
Definition: accctrl.h:207
MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation
Definition: accctrl.h:205
struct _TRUSTEE_A * pMultipleTrustee
Definition: accctrl.h:204
LPSTR ptstrName
Definition: accctrl.h:208
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
Definition: name.c:38
TRUSTEE_FORM TrusteeForm
Definition: accctrl.h:206
GLuint const GLchar * name
Definition: glext.h:6031

◆ BuildTrusteeWithNameW()

VOID WINAPI BuildTrusteeWithNameW ( PTRUSTEE_W  pTrustee,
LPWSTR  name 
)

Definition at line 2067 of file security.c.

2069 {
2070  TRACE("%p %s\n", pTrustee, name);
2071 
2072  pTrustee->pMultipleTrustee = NULL;
2074  pTrustee->TrusteeForm = TRUSTEE_IS_NAME;
2075  pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
2076  pTrustee->ptstrName = name;
2077 }
TRUSTEE_FORM TrusteeForm
Definition: accctrl.h:215
TRUSTEE_TYPE TrusteeType
Definition: accctrl.h:216
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
struct _TRUSTEE_W * pMultipleTrustee
Definition: accctrl.h:213
MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation
Definition: accctrl.h:214
LPWSTR ptstrName
Definition: accctrl.h:217
Definition: name.c:38
GLuint const GLchar * name
Definition: glext.h:6031

◆ BuildTrusteeWithObjectsAndNameA()

VOID WINAPI BuildTrusteeWithObjectsAndNameA ( PTRUSTEEA  pTrustee,
POBJECTS_AND_NAME_A  pObjName,
SE_OBJECT_TYPE  ObjectType,
LPSTR  ObjectTypeName,
LPSTR  InheritedObjectTypeName,
LPSTR  Name 
)

Definition at line 1848 of file security.c.

1851 {
1852  DWORD ObjectsPresent = 0;
1853 
1854  TRACE("%p %p 0x%08x %p %p %s\n", pTrustee, pObjName,
1856 
1857  /* Fill the OBJECTS_AND_NAME structure */
1859  if (ObjectTypeName != NULL)
1860  {
1861  ObjectsPresent |= ACE_OBJECT_TYPE_PRESENT;
1862  }
1863 
1866  {
1867  ObjectsPresent |= ACE_INHERITED_OBJECT_TYPE_PRESENT;
1868  }
1869 
1870  pObjName->ObjectsPresent = ObjectsPresent;
1871  pObjName->ptstrName = Name;
1872 
1873  /* Fill the TRUSTEE structure */
1874  pTrustee->pMultipleTrustee = NULL;
1877  pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
1878  pTrustee->ptstrName = (LPSTR)pObjName;
1879 }
static POBJECTS_AND_NAME_A SE_OBJECT_TYPE LPSTR ObjectTypeName
Definition: security.c:77
ObjectType
Definition: metafile.c:80
TRUSTEE_TYPE TrusteeType
Definition: accctrl.h:207
#define ACE_OBJECT_TYPE_PRESENT
Definition: winnt_old.h:106
static POBJECTS_AND_NAME_A SE_OBJECT_TYPE LPSTR LPSTR InheritedObjectTypeName
Definition: security.c:77
MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation
Definition: accctrl.h:205
static LPSTR(WINAPI *pGetTrusteeNameA)(PTRUSTEEA pTrustee)
DWORD ObjectsPresent
Definition: accctrl.h:356
struct _TRUSTEE_A * pMultipleTrustee
Definition: accctrl.h:204
static POBJECTS_AND_NAME_A SE_OBJECT_TYPE LPSTR LPSTR LPSTR Name
Definition: security.c:77
LPSTR ptstrName
Definition: accctrl.h:208
#define ACE_INHERITED_OBJECT_TYPE_PRESENT
Definition: winnt_old.h:107
smooth NULL
Definition: ftsmooth.c:416
SE_OBJECT_TYPE ObjectType
Definition: accctrl.h:357
static POBJECTS_AND_NAME_A pObjName
Definition: security.c:77
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
static POBJECTS_AND_NAME_A SE_OBJECT_TYPE ObjectType
Definition: security.c:77
LPSTR InheritedObjectTypeName
Definition: accctrl.h:359
TRUSTEE_FORM TrusteeForm
Definition: accctrl.h:206

◆ BuildTrusteeWithObjectsAndNameW()

VOID WINAPI BuildTrusteeWithObjectsAndNameW ( PTRUSTEEW  pTrustee,
POBJECTS_AND_NAME_W  pObjName,
SE_OBJECT_TYPE  ObjectType,
LPWSTR  ObjectTypeName,
LPWSTR  InheritedObjectTypeName,
LPWSTR  Name 
)

Definition at line 1884 of file security.c.

1887 {
1888  DWORD ObjectsPresent = 0;
1889 
1890  TRACE("%p %p 0x%08x %p %p %s\n", pTrustee, pObjName,
1892 
1893  /* Fill the OBJECTS_AND_NAME structure */
1895  if (ObjectTypeName != NULL)
1896  {
1897  ObjectsPresent |= ACE_OBJECT_TYPE_PRESENT;
1898  }
1899 
1902  {
1903  ObjectsPresent |= ACE_INHERITED_OBJECT_TYPE_PRESENT;
1904  }
1905 
1906  pObjName->ObjectsPresent = ObjectsPresent;
1907  pObjName->ptstrName = Name;
1908 
1909  /* Fill the TRUSTEE structure */
1910  pTrustee->pMultipleTrustee = NULL;
1913  pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
1914  pTrustee->ptstrName = (LPWSTR)pObjName;
1915 }
static POBJECTS_AND_NAME_A SE_OBJECT_TYPE LPSTR ObjectTypeName
Definition: security.c:77
ObjectType
Definition: metafile.c:80
#define ACE_OBJECT_TYPE_PRESENT
Definition: winnt_old.h:106
TRUSTEE_FORM TrusteeForm
Definition: accctrl.h:215
static POBJECTS_AND_NAME_A SE_OBJECT_TYPE LPSTR LPSTR InheritedObjectTypeName
Definition: security.c:77
DWORD ObjectsPresent
Definition: accctrl.h:356
TRUSTEE_TYPE TrusteeType
Definition: accctrl.h:216
static POBJECTS_AND_NAME_A SE_OBJECT_TYPE LPSTR LPSTR LPSTR Name
Definition: security.c:77
#define debugstr_w
Definition: kernel32.h:32
#define ACE_INHERITED_OBJECT_TYPE_PRESENT
Definition: winnt_old.h:107
smooth NULL
Definition: ftsmooth.c:416
SE_OBJECT_TYPE ObjectType
Definition: accctrl.h:357
static POBJECTS_AND_NAME_A pObjName
Definition: security.c:77
#define TRACE(s)
Definition: solgame.cpp:4
struct _TRUSTEE_W * pMultipleTrustee
Definition: accctrl.h:213
unsigned long DWORD
Definition: ntddk_ex.h:95
static POBJECTS_AND_NAME_A SE_OBJECT_TYPE ObjectType
Definition: security.c:77
MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation
Definition: accctrl.h:214
LPWSTR ptstrName
Definition: accctrl.h:217
LPSTR InheritedObjectTypeName
Definition: accctrl.h:359
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ BuildTrusteeWithObjectsAndSidA()

VOID WINAPI BuildTrusteeWithObjectsAndSidA ( PTRUSTEEA  pTrustee,
POBJECTS_AND_SID  pObjSid,
GUID pObjectGuid,
GUID pInheritedObjectGuid,
PSID  pSid 
)

Definition at line 1921 of file security.c.

1926 {
1927  DWORD ObjectsPresent = 0;
1928 
1929  TRACE("%p %p %p %p %p\n", pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid);
1930 
1931  /* Fill the OBJECTS_AND_SID structure */
1932  if (pObjectGuid != NULL)
1933  {
1935  ObjectsPresent |= ACE_OBJECT_TYPE_PRESENT;
1936  }
1937  else
1938  {
1940  sizeof(GUID));
1941  }
1942 
1943  if (pInheritedObjectGuid != NULL)
1944  {
1946  ObjectsPresent |= ACE_INHERITED_OBJECT_TYPE_PRESENT;
1947  }
1948  else
1949  {
1951  sizeof(GUID));
1952  }
1953 
1954  pObjSid->ObjectsPresent = ObjectsPresent;
1955  pObjSid->pSid = pSid;
1956 
1957  /* Fill the TRUSTEE structure */
1958  pTrustee->pMultipleTrustee = NULL;
1961  pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
1962  pTrustee->ptstrName = (LPSTR) pObjSid;
1963 }
GUID ObjectTypeGuid
Definition: accctrl.h:349
TRUSTEE_TYPE TrusteeType
Definition: accctrl.h:207
#define ACE_OBJECT_TYPE_PRESENT
Definition: winnt_old.h:106
MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation
Definition: accctrl.h:205
static LPSTR(WINAPI *pGetTrusteeNameA)(PTRUSTEEA pTrustee)
struct _TRUSTEE_A * pMultipleTrustee
Definition: accctrl.h:204
#define ZeroMemory
Definition: winbase.h:1642
LPSTR ptstrName
Definition: accctrl.h:208
#define ACE_INHERITED_OBJECT_TYPE_PRESENT
Definition: winnt_old.h:107
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static POBJECTS_AND_SID pObjSid
Definition: security.c:83
static POBJECTS_AND_SID GUID GUID * pInheritedObjectGuid
Definition: security.c:83
unsigned long DWORD
Definition: ntddk_ex.h:95
static POBJECTS_AND_SID GUID * pObjectGuid
Definition: security.c:83
static PSID pSid
Definition: security.c:74
GUID InheritedObjectTypeGuid
Definition: accctrl.h:350
DWORD ObjectsPresent
Definition: accctrl.h:348
TRUSTEE_FORM TrusteeForm
Definition: accctrl.h:206

◆ BuildTrusteeWithObjectsAndSidW()

VOID WINAPI BuildTrusteeWithObjectsAndSidW ( PTRUSTEEW  pTrustee,
POBJECTS_AND_SID  pObjSid,
GUID pObjectGuid,
GUID pInheritedObjectGuid,
PSID  pSid 
)

Definition at line 1970 of file security.c.

1975 {
1976  DWORD ObjectsPresent = 0;
1977 
1978  TRACE("%p %p %p %p %p\n", pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid);
1979 
1980  /* Fill the OBJECTS_AND_SID structure */
1981  if (pObjectGuid != NULL)
1982  {
1984  ObjectsPresent |= ACE_OBJECT_TYPE_PRESENT;
1985  }
1986  else
1987  {
1989  sizeof(GUID));
1990  }
1991 
1992  if (pInheritedObjectGuid != NULL)
1993  {
1995  ObjectsPresent |= ACE_INHERITED_OBJECT_TYPE_PRESENT;
1996  }
1997  else
1998  {
2000  sizeof(GUID));
2001  }
2002 
2003  pObjSid->ObjectsPresent = ObjectsPresent;
2004  pObjSid->pSid = pSid;
2005 
2006  /* Fill the TRUSTEE structure */
2007  pTrustee->pMultipleTrustee = NULL;
2010  pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
2011  pTrustee->ptstrName = (LPWSTR) pObjSid;
2012 }
GUID ObjectTypeGuid
Definition: accctrl.h:349
#define ACE_OBJECT_TYPE_PRESENT
Definition: winnt_old.h:106
TRUSTEE_FORM TrusteeForm
Definition: accctrl.h:215
#define ZeroMemory
Definition: winbase.h:1642
TRUSTEE_TYPE TrusteeType
Definition: accctrl.h:216
#define ACE_INHERITED_OBJECT_TYPE_PRESENT
Definition: winnt_old.h:107
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static POBJECTS_AND_SID pObjSid
Definition: security.c:83
static POBJECTS_AND_SID GUID GUID * pInheritedObjectGuid
Definition: security.c:83
struct _TRUSTEE_W * pMultipleTrustee
Definition: accctrl.h:213
unsigned long DWORD
Definition: ntddk_ex.h:95
MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation
Definition: accctrl.h:214
LPWSTR ptstrName
Definition: accctrl.h:217
static POBJECTS_AND_SID GUID * pObjectGuid
Definition: security.c:83
static PSID pSid
Definition: security.c:74
GUID InheritedObjectTypeGuid
Definition: accctrl.h:350
DWORD ObjectsPresent
Definition: accctrl.h:348
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ BuildTrusteeWithSidA()

VOID WINAPI BuildTrusteeWithSidA ( PTRUSTEE_A  pTrustee,
PSID  pSid 
)

Definition at line 2018 of file security.c.

2020 {
2021  TRACE("%p %p\n", pTrustee, pSid);
2022 
2023  pTrustee->pMultipleTrustee = NULL;
2025  pTrustee->TrusteeForm = TRUSTEE_IS_SID;
2026  pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
2027  pTrustee->ptstrName = (LPSTR) pSid;
2028 }
TRUSTEE_TYPE TrusteeType
Definition: accctrl.h:207
MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation
Definition: accctrl.h:205
static LPSTR(WINAPI *pGetTrusteeNameA)(PTRUSTEEA pTrustee)
struct _TRUSTEE_A * pMultipleTrustee
Definition: accctrl.h:204
LPSTR ptstrName
Definition: accctrl.h:208
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static PSID pSid
Definition: security.c:74
TRUSTEE_FORM TrusteeForm
Definition: accctrl.h:206

◆ BuildTrusteeWithSidW()

VOID WINAPI BuildTrusteeWithSidW ( PTRUSTEE_W  pTrustee,
PSID  pSid 
)

Definition at line 2035 of file security.c.

2037 {
2038  TRACE("%p %p\n", pTrustee, pSid);
2039 
2040  pTrustee->pMultipleTrustee = NULL;
2042  pTrustee->TrusteeForm = TRUSTEE_IS_SID;
2043  pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN;
2044  pTrustee->ptstrName = (LPWSTR) pSid;
2045 }
TRUSTEE_FORM TrusteeForm
Definition: accctrl.h:215
TRUSTEE_TYPE TrusteeType
Definition: accctrl.h:216
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
struct _TRUSTEE_W * pMultipleTrustee
Definition: accctrl.h:213
MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation
Definition: accctrl.h:214
LPWSTR ptstrName
Definition: accctrl.h:217
static PSID pSid
Definition: security.c:74
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ ComputeStringSidSize()

static DWORD ComputeStringSidSize ( LPCWSTR  StringSid)
static

Definition at line 3469 of file security.c.

3470 {
3471  if (StringSid[0] == 'S' && StringSid[1] == '-') /* S-R-I(-S)+ */
3472  {
3473  int ctok = 0;
3474  while (*StringSid)
3475  {
3476  if (*StringSid == '-')
3477  ctok++;
3478  StringSid++;
3479  }
3480 
3481  if (ctok >= 3)
3482  return GetSidLengthRequired(ctok - 2);
3483  }
3484  else /* String constant format - Only available in winxp and above */
3485  {
3486  unsigned int i;
3487 
3488  for (i = 0; i < sizeof(WellKnownSids)/sizeof(WellKnownSids[0]); i++)
3489  if (!strncmpW(WellKnownSids[i].wstr, StringSid, 2))
3491 
3492  for (i = 0; i < sizeof(WellKnownRids)/sizeof(WellKnownRids[0]); i++)
3493  if (!strncmpW(WellKnownRids[i].wstr, StringSid, 2))
3494  {
3495  MAX_SID local;
3498  }
3499 
3500  }
3501 
3502  return GetSidLengthRequired(0);
3503 }
static const WELLKNOWNSID WellKnownSids[]
Definition: security.c:47
DWORD WINAPI GetSidLengthRequired(UCHAR nSubAuthorityCount)
Definition: security.c:731
WINE_UNICODE_INLINE int strncmpW(const WCHAR *str1, const WCHAR *str2, int n)
Definition: unicode.h:235
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
BOOL ADVAPI_GetComputerSid(PSID sid)
Definition: security.c:275
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
Definition: rtlfuncs.h:1104
PUCHAR WINAPI GetSidSubAuthorityCount(PSID pSid)
Definition: security.c:787
#define local
Definition: zutil.h:30
BYTE SubAuthorityCount
Definition: ms-dtyp.idl:200
static const WELLKNOWNRID WellKnownRids[]
Definition: security.c:111

Referenced by ParseStringSidToSid().

◆ ConvertSecurityDescriptorToStringSecurityDescriptorA()

BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorA ( PSECURITY_DESCRIPTOR  SecurityDescriptor,
DWORD  SDRevision,
SECURITY_INFORMATION  Information,
LPSTR OutputString,
PULONG  OutputLen 
)

Definition at line 3175 of file security.c.

3176 {
3177  LPWSTR wstr;
3178  ULONG len;
3180  {
3181  int lenA;
3182 
3183  lenA = WideCharToMultiByte(CP_ACP, 0, wstr, len, NULL, 0, NULL, NULL);
3184  *OutputString = heap_alloc(lenA);
3185 #ifdef __REACTOS__
3186  if (*OutputString == NULL)
3187  {
3188  LocalFree(wstr);
3189  *OutputLen = 0;
3190  return FALSE;
3191  }
3192 #endif
3193  WideCharToMultiByte(CP_ACP, 0, wstr, len, *OutputString, lenA, NULL, NULL);
3194  LocalFree(wstr);
3195 
3196  if (OutputLen != NULL)
3197  *OutputLen = lenA;
3198  return TRUE;
3199  }
3200  else
3201  {
3202  *OutputString = NULL;
3203  if (OutputLen)
3204  *OutputLen = 0;
3205  return FALSE;
3206  }
3207 }
#define TRUE
Definition: types.h:120
#define WideCharToMultiByte
Definition: compat.h:101
_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 CP_ACP
Definition: compat.h:99
BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorW(PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD SDRevision, SECURITY_INFORMATION RequestedInformation, LPWSTR *OutputString, PULONG OutputLen)
Definition: security.c:3111
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
smooth NULL
Definition: ftsmooth.c:416
GLenum GLsizei len
Definition: glext.h:6722
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
unsigned int ULONG
Definition: retypes.h:1
WCHAR * LPWSTR
Definition: xmlstorage.h:184
Iosb Information
Definition: create.c:4377

◆ ConvertSecurityDescriptorToStringSecurityDescriptorW()

BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorW ( PSECURITY_DESCRIPTOR  SecurityDescriptor,
DWORD  SDRevision,
SECURITY_INFORMATION  RequestedInformation,
LPWSTR OutputString,
PULONG  OutputLen 
)

Definition at line 3111 of file security.c.

3112 {
3113  ULONG len;
3114  WCHAR *wptr, *wstr;
3115 
3116  if (SDRevision != SDDL_REVISION_1)
3117  {
3118  ERR("Program requested unknown SDDL revision %d\n", SDRevision);
3120  return FALSE;
3121  }
3122 
3123  len = 0;
3124  if (RequestedInformation & OWNER_SECURITY_INFORMATION)
3126  return FALSE;
3127  if (RequestedInformation & GROUP_SECURITY_INFORMATION)
3129  return FALSE;
3130  if (RequestedInformation & DACL_SECURITY_INFORMATION)
3132  return FALSE;
3133  if (RequestedInformation & SACL_SECURITY_INFORMATION)
3135  return FALSE;
3136 
3137  wstr = wptr = LocalAlloc(0, (len + 1)*sizeof(WCHAR));
3138 #ifdef __REACTOS__
3139  if (wstr == NULL)
3140  return FALSE;
3141 #endif
3142 
3143  if (RequestedInformation & OWNER_SECURITY_INFORMATION)
3144  if (!DumpOwner(SecurityDescriptor, &wptr, NULL)) {
3145  LocalFree (wstr);
3146  return FALSE;
3147  }
3148  if (RequestedInformation & GROUP_SECURITY_INFORMATION)
3149  if (!DumpGroup(SecurityDescriptor, &wptr, NULL)) {
3150  LocalFree (wstr);
3151  return FALSE;
3152  }
3153  if (RequestedInformation & DACL_SECURITY_INFORMATION)
3154  if (!DumpDacl(SecurityDescriptor, &wptr, NULL)) {
3155  LocalFree (wstr);
3156  return FALSE;
3157  }
3158  if (RequestedInformation & SACL_SECURITY_INFORMATION)
3159  if (!DumpSacl(SecurityDescriptor, &wptr, NULL)) {
3160  LocalFree (wstr);
3161  return FALSE;
3162  }
3163  *wptr = 0;
3164 
3165  TRACE("ret: %s, %d\n", wine_dbgstr_w(wstr), len);
3166  *OutputString = wstr;
3167  if (OutputLen)
3168  *OutputLen = strlenW(*OutputString)+1;
3169  return TRUE;
3170 }
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static BOOL DumpOwner(PSECURITY_DESCRIPTOR SecurityDescriptor, WCHAR **pwptr, ULONG *plen)
Definition: security.c:3026
_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
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
static BOOL DumpSacl(PSECURITY_DESCRIPTOR SecurityDescriptor, WCHAR **pwptr, ULONG *plen)
Definition: security.c:3085
#define GROUP_SECURITY_INFORMATION
Definition: setypes.h:124
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SACL_SECURITY_INFORMATION
Definition: setypes.h:126
#define SetLastError(x)
Definition: compat.h:417
static BOOL DumpDacl(PSECURITY_DESCRIPTOR SecurityDescriptor, WCHAR **pwptr, ULONG *plen)
Definition: security.c:3062
GLenum GLsizei len
Definition: glext.h:6722
#define ERR(fmt,...)
Definition: debug.h:109
#define ERROR_UNKNOWN_REVISION
Definition: winerror.h:787
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define OWNER_SECURITY_INFORMATION
Definition: setypes.h:123
unsigned int ULONG
Definition: retypes.h:1
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
static BOOL DumpGroup(PSECURITY_DESCRIPTOR SecurityDescriptor, WCHAR **pwptr, ULONG *plen)
Definition: security.c:3044
#define DACL_SECURITY_INFORMATION
Definition: setypes.h:125
#define SDDL_REVISION_1
Definition: sddl.h:30

Referenced by ConvertSecurityDescriptorToStringSecurityDescriptorA().

◆ ConvertSidToStringSidA()

BOOL WINAPI ConvertSidToStringSidA ( PSID  Sid,
LPSTR StringSid 
)

Definition at line 3313 of file security.c.

3315 {
3316  LPWSTR StringSidW;
3317  int Len;
3318 
3319  if (!ConvertSidToStringSidW(Sid, &StringSidW))
3320  {
3321  return FALSE;
3322  }
3323 
3324  Len = WideCharToMultiByte(CP_ACP, 0, StringSidW, -1, NULL, 0, NULL, NULL);
3325  if (Len <= 0)
3326  {
3327  LocalFree(StringSidW);
3329  return FALSE;
3330  }
3331 
3332  *StringSid = LocalAlloc(LMEM_FIXED, Len);
3333  if (NULL == *StringSid)
3334  {
3335  LocalFree(StringSidW);
3337  return FALSE;
3338  }
3339 
3340  if (!WideCharToMultiByte(CP_ACP, 0, StringSidW, -1, *StringSid, Len, NULL, NULL))
3341  {
3342  LocalFree(StringSid);
3343  LocalFree(StringSidW);
3344  return FALSE;
3345  }
3346 
3347  LocalFree(StringSidW);
3348 
3349  return TRUE;
3350 }
#define TRUE
Definition: types.h:120
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
BOOL WINAPI ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
Definition: security.c:3259
smooth NULL
Definition: ftsmooth.c:416
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
Definition: rtlfuncs.h:1104
#define LMEM_FIXED
Definition: winbase.h:349
#define Len
Definition: deflate.h:82
#define SetLastError(x)
Definition: compat.h:417
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by debugstr_sid(), init_functionpointers(), map_name_2_sid(), test_CreateWellKnownSid(), test_LookupAccountSid(), test_lsa(), test_sid(), test_sid_str(), test_token_attr(), and test_token_label().

◆ ConvertSidToStringSidW()

BOOL WINAPI ConvertSidToStringSidW ( PSID  Sid,
LPWSTR StringSid 
)

Definition at line 3259 of file security.c.

3261 {
3262  NTSTATUS Status;
3264  WCHAR FixedBuffer[64];
3265 
3266  if (!RtlValidSid(Sid))
3267  {
3269  return FALSE;
3270  }
3271 
3272  UnicodeString.Length = 0;
3273  UnicodeString.MaximumLength = sizeof(FixedBuffer);
3274  UnicodeString.Buffer = FixedBuffer;
3277  {
3279  }
3280 
3281  if (!NT_SUCCESS(Status))
3282  {
3284  return FALSE;
3285  }
3286 
3287  *StringSid = LocalAlloc(LMEM_FIXED, UnicodeString.Length + sizeof(WCHAR));
3288  if (NULL == *StringSid)
3289  {
3290  if (UnicodeString.Buffer != FixedBuffer)
3291  {
3293  }
3295  return FALSE;
3296  }
3297 
3298  MoveMemory(*StringSid, UnicodeString.Buffer, UnicodeString.Length);
3299  ZeroMemory((PCHAR) *StringSid + UnicodeString.Length, sizeof(WCHAR));
3300  if (UnicodeString.Buffer != FixedBuffer)
3301  {
3303  }
3304 
3305  return TRUE;
3306 }
signed char * PCHAR
Definition: retypes.h:7
#define TRUE
Definition: types.h:120
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1980
#define ERROR_INVALID_SID
Definition: winerror.h:819
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ZeroMemory
Definition: winbase.h:1642
#define MoveMemory
Definition: winbase.h:1639
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
smooth NULL
Definition: ftsmooth.c:416
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
Definition: rtlfuncs.h:1104
NTSYSAPI BOOLEAN NTAPI RtlValidSid(IN PSID Sid)
Definition: sid.c:21
#define LMEM_FIXED
Definition: winbase.h:349
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define SetLastError(x)
Definition: compat.h:417
NTSYSAPI NTSTATUS NTAPI RtlConvertSidToUnicodeString(OUT PUNICODE_STRING DestinationString, IN PVOID Sid, IN BOOLEAN AllocateDestinationString)
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373

Referenced by _GetUserSidStringFromToken(), AddUserProfiles(), ConvertSidToStringSidA(), CreateUserProfileExW(), get_user_sid(), GetEventUserName(), GetPrincipalDisplayString(), LsapGetDomainInfo(), LsapLookupAccountDomainSids(), LsapLookupBuiltinDomainSids(), LsapLookupWellKnownSids(), MsiSourceListAddSourceW(), RecycleBin5_Constructor(), SampAddMemberToAlias(), SampRemoveMemberFromAlias(), SampRemoveMemberFromAllAliases(), SampSetupAddMemberToAlias(), set_user_sid_prop(), START_TEST(), UpdatePrincipalInfo(), WhoamiGroups(), WhoamiLogonId(), and WhoamiUser().

◆ ConvertStringSecurityDescriptorToSecurityDescriptorA()

BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorA ( LPCSTR  StringSecurityDescriptor,
DWORD  StringSDRevision,
PSECURITY_DESCRIPTOR SecurityDescriptor,
PULONG  SecurityDescriptorSize 
)

Definition at line 2708 of file security.c.

2712 {
2713  UINT len;
2714  BOOL ret = FALSE;
2715  LPWSTR StringSecurityDescriptorW;
2716 
2717  len = MultiByteToWideChar(CP_ACP, 0, StringSecurityDescriptor, -1, NULL, 0);
2718  StringSecurityDescriptorW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
2719 
2720  if (StringSecurityDescriptorW)
2721  {
2722  MultiByteToWideChar(CP_ACP, 0, StringSecurityDescriptor, -1, StringSecurityDescriptorW, len);
2723 
2724  ret = ConvertStringSecurityDescriptorToSecurityDescriptorW(StringSecurityDescriptorW,
2725  StringSDRevision, SecurityDescriptor,
2726  SecurityDescriptorSize);
2727  HeapFree(GetProcessHeap(), 0, StringSecurityDescriptorW);
2728  }
2729 
2730  return ret;
2731 }
_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 CP_ACP
Definition: compat.h:99
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
GLenum GLsizei len
Definition: glext.h:6722
unsigned int UINT
Definition: ndis.h:50
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:402
BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorW(LPCWSTR StringSecurityDescriptor, DWORD StringSDRevision, PSECURITY_DESCRIPTOR *SecurityDescriptor, PULONG SecurityDescriptorSize)
Definition: security.c:2738

Referenced by test_profile_directory_readonly().

◆ ConvertStringSecurityDescriptorToSecurityDescriptorW()

BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorW ( LPCWSTR  StringSecurityDescriptor,
DWORD  StringSDRevision,
PSECURITY_DESCRIPTOR SecurityDescriptor,
PULONG  SecurityDescriptorSize 
)

Definition at line 2738 of file security.c.

2742 {
2743  DWORD cBytes;
2744  SECURITY_DESCRIPTOR* psd;
2745  BOOL bret = FALSE;
2746 
2747  TRACE("%s\n", debugstr_w(StringSecurityDescriptor));
2748 
2749  if (GetVersion() & 0x80000000)
2750  {
2752  goto lend;
2753  }
2754  else if (!StringSecurityDescriptor || !SecurityDescriptor)
2755  {
2757  goto lend;
2758  }
2759  else if (StringSDRevision != SID_REVISION)
2760  {
2762  goto lend;
2763  }
2764 
2765  /* Compute security descriptor length */
2766  if (!ParseStringSecurityDescriptorToSecurityDescriptor(StringSecurityDescriptor,
2767  NULL, &cBytes))
2768  goto lend;
2769 
2770  psd = *SecurityDescriptor = LocalAlloc(GMEM_ZEROINIT, cBytes);
2771  if (!psd) goto lend;
2772 
2773  psd->Revision = SID_REVISION;
2774  psd->Control |= SE_SELF_RELATIVE;
2775 
2776  if (!ParseStringSecurityDescriptorToSecurityDescriptor(StringSecurityDescriptor,
2777  (SECURITY_DESCRIPTOR_RELATIVE *)psd, &cBytes))
2778  {
2779  LocalFree(psd);
2780  goto lend;
2781  }
2782 
2783  if (SecurityDescriptorSize)
2784  *SecurityDescriptorSize = cBytes;
2785 
2786  bret = TRUE;
2787 
2788 lend:
2789  TRACE(" ret=%d\n", bret);
2790  return bret;
2791 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
static BOOL ParseStringSecurityDescriptorToSecurityDescriptor(LPCWSTR StringSecurityDescriptor, SECURITY_DESCRIPTOR_RELATIVE *SecurityDescriptor, LPDWORD cBytes)
Definition: security.c:2560
#define TRUE
Definition: types.h:120
#define SE_SELF_RELATIVE
Definition: setypes.h:780
_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 SID_REVISION
Definition: setypes.h:453
DWORD WINAPI GetVersion(VOID)
Definition: version.c:22
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
#define ERROR_UNKNOWN_REVISION
Definition: winerror.h:787
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
#define GMEM_ZEROINIT
Definition: winbase.h:303

Referenced by ConvertStringSecurityDescriptorToSecurityDescriptorA(), InstallOneService(), registry_callback(), and SetupQueueCopyIndirectW().

◆ ConvertStringSidToSidA()

BOOL WINAPI ConvertStringSidToSidA ( LPCSTR  StringSid,
PSID Sid 
)

Definition at line 3236 of file security.c.

3237 {
3238  BOOL bret = FALSE;
3239 
3240  TRACE("%s, %p\n", debugstr_a(StringSid), Sid);
3241  if (GetVersion() & 0x80000000)
3243  else if (!StringSid || !Sid)
3245  else
3246  {
3247  WCHAR *wStringSid = SERV_dup(StringSid);
3248  bret = ConvertStringSidToSidW(wStringSid, Sid);
3249  heap_free(wStringSid);
3250  }
3251  return bret;
3252 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
BOOL WINAPI ConvertStringSidToSidW(LPCWSTR StringSid, PSID *Sid)
Definition: security.c:3212
DWORD WINAPI GetVersion(VOID)
Definition: version.c:22
unsigned int BOOL
Definition: ntddk_ex.h:94
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
Definition: rtlfuncs.h:1104
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define SetLastError(x)
Definition: compat.h:417
static LPWSTR SERV_dup(LPCSTR str)
Definition: security.c:235
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by test_LsaLookupSids().

◆ ConvertStringSidToSidW()

BOOL WINAPI ConvertStringSidToSidW ( LPCWSTR  StringSid,
PSID Sid 
)

Definition at line 3212 of file security.c.

3213 {
3214  BOOL bret = FALSE;
3215  DWORD cBytes;
3216 
3217  TRACE("%s, %p\n", debugstr_w(StringSid), Sid);
3218  if (GetVersion() & 0x80000000)
3220  else if (!StringSid || !Sid)
3222  else if (ParseStringSidToSid(StringSid, NULL, &cBytes))
3223  {
3224  PSID pSid = *Sid = LocalAlloc(0, cBytes);
3225 
3226  bret = ParseStringSidToSid(StringSid, pSid, &cBytes);
3227  if (!bret)
3228  LocalFree(*Sid);
3229  }
3230  return bret;
3231 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
DWORD WINAPI GetVersion(VOID)
Definition: version.c:22
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
Definition: rtlfuncs.h:1104
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
static PSID pSid
Definition: security.c:74
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes)
Definition: security.c:3508
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373

Referenced by ConvertStringSidToSidA(), and fill_sid().

◆ CopySid()

BOOL WINAPI CopySid ( DWORD  nDestinationSidLength,
PSID  pDestinationSid,
PSID  pSourceSid 
)

Definition at line 591 of file security.c.

592 {
593  return set_ntstatus(RtlCopySid(nDestinationSidLength, pDestinationSid, pSourceSid));
594 }
static __inline BOOL set_ntstatus(NTSTATUS status)
Definition: security.c:229
NTSYSAPI BOOLEAN WINAPI RtlCopySid(DWORD, PSID, PSID)

Referenced by AccpLookupSidByName(), AccRewriteGetExplicitEntriesFromAcl(), AddAceToWindowStation(), AddPrincipalToList(), AuthzGetInformationFromContext(), AuthzInitializeContextFromSid(), BuildDefaultPrincipalAce(), CachedGetUserFromSid(), CacheLookupResults(), GetUserSid(), LookupAccountNameW(), QueueSidLookup(), ReloadPrincipalsList(), and test_LookupAccountSid().

◆ CreateProcessWithLogonW()

BOOL WINAPI CreateProcessWithLogonW ( LPCWSTR  lpUsername,
LPCWSTR  lpDomain,
LPCWSTR  lpPassword,
DWORD  dwLogonFlags,
LPCWSTR  lpApplicationName,
LPWSTR  lpCommandLine,
DWORD  dwCreationFlags,
LPVOID  lpEnvironment,
LPCWSTR  lpCurrentDirectory,
LPSTARTUPINFOW  lpStartupInfo,
LPPROCESS_INFORMATION  lpProcessInformation 
)

Definition at line 3356 of file security.c.

3367 {
3368  FIXME("%s %s %s 0x%08x %s %s 0x%08x %p %s %p %p stub\n", debugstr_w(lpUsername), debugstr_w(lpDomain),
3369  debugstr_w(lpPassword), dwLogonFlags, debugstr_w(lpApplicationName),
3370  debugstr_w(lpCommandLine), dwCreationFlags, lpEnvironment, debugstr_w(lpCurrentDirectory),
3371  lpStartupInfo, lpProcessInformation);
3372 
3373  return FALSE;
3374 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110

◆ CreateProcessWithTokenW()

BOOL WINAPI CreateProcessWithTokenW ( HANDLE  token,
DWORD  logon_flags,
LPCWSTR  application_name,
LPWSTR  command_line,
DWORD  creation_flags,
void environment,
LPCWSTR  current_directory,
STARTUPINFOW startup_info,
PROCESS_INFORMATION process_information 
)

Definition at line 3376 of file security.c.

3379 {
3380  FIXME("%p 0x%08x %s %s 0x%08x %p %s %p %p - semi-stub\n", token,
3381  logon_flags, debugstr_w(application_name), debugstr_w(command_line),
3382  creation_flags, environment, debugstr_w(current_directory),
3383  startup_info, process_information);
3384 
3385  /* FIXME: check if handles should be inherited */
3386  return CreateProcessW( application_name, command_line, NULL, NULL, FALSE, creation_flags, environment,
3387  current_directory, startup_info, process_information );
3388 }
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 token
Definition: glfuncs.h:210
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4593

◆ CreateRestrictedToken()

BOOL WINAPI CreateRestrictedToken ( HANDLE  baseToken,
DWORD  flags,
DWORD  nDisableSids,
PSID_AND_ATTRIBUTES  disableSids,
DWORD  nDeletePrivs,
PLUID_AND_ATTRIBUTES  deletePrivs,
DWORD  nRestrictSids,
PSID_AND_ATTRIBUTES  restrictSids,
PHANDLE  newToken 
)

Definition at line 504 of file security.c.

514 {
517  DWORD size;
518 
519  FIXME("(%p, 0x%x, %u, %p, %u, %p, %u, %p, %p): stub\n",
520  baseToken, flags, nDisableSids, disableSids,
521  nDeletePrivs, deletePrivs,
522  nRestrictSids, restrictSids,
523  newToken);
524 
525  size = sizeof(type);
526  if (!GetTokenInformation( baseToken, TokenType, &type, size, &size )) return FALSE;
527  if (type == TokenImpersonation)
528  {
529  size = sizeof(level);
531  return FALSE;
532  }
533  return DuplicateTokenEx( baseToken, MAXIMUM_ALLOWED, NULL, level, type, newToken );
534 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
GLint level
Definition: gl.h:1546
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
enum _SECURITY_IMPERSONATION_LEVEL SECURITY_IMPERSONATION_LEVEL
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI DuplicateTokenEx(IN HANDLE ExistingTokenHandle, IN DWORD dwDesiredAccess, IN LPSECURITY_ATTRIBUTES lpTokenAttributes OPTIONAL, IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, IN TOKEN_TYPE TokenType, OUT PHANDLE DuplicateTokenHandle)
Definition: security.c:3394
GLbitfield flags
Definition: glext.h:7161
enum _TOKEN_TYPE TOKEN_TYPE
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:413
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ BOOLEAN _In_ TOKEN_TYPE TokenType
Definition: sefuncs.h:417

Referenced by test_token_security_descriptor().

◆ CreateWellKnownSid()

BOOL WINAPI CreateWellKnownSid ( IN WELL_KNOWN_SID_TYPE  WellKnownSidType,
IN PSID DomainSid  OPTIONAL,
OUT PSID  pSid,
IN OUT DWORD cbSid 
)

Definition at line 601 of file security.c.

605 {
606  unsigned int i;
607  TRACE("(%d, %s, %p, %p)\n", WellKnownSidType, debugstr_sid(DomainSid), pSid, cbSid);
608 
609  if (cbSid == NULL || (DomainSid && !IsValidSid(DomainSid)))
610  {
612  return FALSE;
613  }
614 
615  for (i = 0; i < sizeof(WellKnownSids)/sizeof(WellKnownSids[0]); i++) {
616  if (WellKnownSids[i].Type == WellKnownSidType) {
618 
619  if (*cbSid < length)
620  {
621  *cbSid = length;
623  return FALSE;
624  }
625  if (!pSid)
626  {
628  return FALSE;
629  }
631  *cbSid = length;
632  return TRUE;
633  }
634  }
635 
636  if (DomainSid == NULL || *GetSidSubAuthorityCount(DomainSid) == SID_MAX_SUB_AUTHORITIES)
637  {
639  return FALSE;
640  }
641 
642  for (i = 0; i < sizeof(WellKnownRids)/sizeof(WellKnownRids[0]); i++)
643  if (WellKnownRids[i].Type == WellKnownSidType) {
644  UCHAR domain_subauth = *GetSidSubAuthorityCount(DomainSid);
645  DWORD domain_sid_length = GetSidLengthRequired(domain_subauth);
646  DWORD output_sid_length = GetSidLengthRequired(domain_subauth + 1);
647 
648  if (*cbSid < output_sid_length)
649  {
650  *cbSid = output_sid_length;
652  return FALSE;
653  }
654  if (!pSid)
655  {
657  return FALSE;
658  }
659  CopyMemory(pSid, DomainSid, domain_sid_length);
661  (*GetSidSubAuthority(pSid, domain_subauth)) = WellKnownRids[i].Rid;
662  *cbSid = output_sid_length;
663  return TRUE;
664  }
665 
667  return FALSE;
668 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
Type
Definition: Type.h:6
static const WELLKNOWNSID WellKnownSids[]
Definition: security.c:47
DWORD WINAPI GetSidLengthRequired(UCHAR nSubAuthorityCount)
Definition: security.c:731
PDWORD WINAPI GetSidSubAuthority(PSID pSid, DWORD nSubAuthority)
Definition: security.c:775
static const char * debugstr_sid(PSID sid)
Definition: security.c:176
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 SID_MAX_SUB_AUTHORITIES
Definition: setypes.h:454
smooth NULL
Definition: ftsmooth.c:416
_In_ LPCSTR _Out_writes_bytes_to_opt_ cbSid PSID _Inout_ LPDWORD cbSid
Definition: winbase.h:2699
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
Definition: rtlfuncs.h:1104
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define CopyMemory
Definition: winbase.h:1640
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
unsigned char UCHAR
Definition: xmlstorage.h:181
PUCHAR WINAPI GetSidSubAuthorityCount(PSID pSid)
Definition: security.c:787
BYTE SubAuthorityCount
Definition: ms-dtyp.idl:200
static PSID pSid
Definition: security.c:74
BOOL WINAPI IsValidSid(PSID pSid)
Definition: security.c:698
BYTE Revision
Definition: ms-dtyp.idl:199
static const WELLKNOWNRID WellKnownRids[]
Definition: security.c:111
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by create_unknownsid(), CreateWindowStationAndDesktops(), get_sd(), test_SystemSecurity(), and well_known_sid().

◆ debugstr_sid()

static const char* debugstr_sid ( PSID  sid)
static

Definition at line 176 of file security.c.

177 {
178  int auth = 0;
179  SID * psid = (SID *)sid;
180 
181  if (psid == NULL)
182  return "(null)";
183 
184  auth = psid->IdentifierAuthority.Value[5] +
185  (psid->IdentifierAuthority.Value[4] << 8) +
186  (psid->IdentifierAuthority.Value[3] << 16) +
187  (psid->IdentifierAuthority.Value[2] << 24);
188 
189  switch (psid->SubAuthorityCount) {
190  case 0:
191  return wine_dbg_sprintf("S-%d-%d", psid->Revision, auth);
192  case 1:
193  return wine_dbg_sprintf("S-%d-%d-%lu", psid->Revision, auth,
194  psid->SubAuthority[0]);
195  case 2:
196  return wine_dbg_sprintf("S-%d-%d-%lu-%lu", psid->Revision, auth,
197  psid->SubAuthority[0], psid->SubAuthority[1]);
198  case 3:
199  return wine_dbg_sprintf("S-%d-%d-%lu-%lu-%lu", psid->Revision, auth,
200  psid->SubAuthority[0], psid->SubAuthority[1], psid->SubAuthority[2]);
201  case 4:
202  return wine_dbg_sprintf("S-%d-%d-%lu-%lu-%lu-%lu", psid->Revision, auth,
203  psid->SubAuthority[0], psid->SubAuthority[1], psid->SubAuthority[2],
204  psid->SubAuthority[3]);
205  case 5:
206  return wine_dbg_sprintf("S-%d-%d-%lu-%lu-%lu-%lu-%lu", psid->Revision, auth,
207  psid->SubAuthority[0], psid->SubAuthority[1], psid->SubAuthority[2],
208  psid->SubAuthority[3], psid->SubAuthority[4]);
209  case 6:
210  return wine_dbg_sprintf("S-%d-%d-%lu-%lu-%lu-%lu-%lu-%lu", psid->Revision, auth,
211  psid->SubAuthority[3], psid->SubAuthority[1], psid->SubAuthority[2],
212  psid->SubAuthority[0], psid->SubAuthority[4], psid->SubAuthority[5]);
213  case 7:
214  return wine_dbg_sprintf("S-%d-%d-%lu-%lu-%lu-%lu-%lu-%lu-%lu", psid->Revision, auth,
215  psid->SubAuthority[0], psid->SubAuthority[1], psid->SubAuthority[2],
216  psid->SubAuthority[3], psid->SubAuthority[4], psid->SubAuthority[5],
217  psid->SubAuthority[6]);
218  case 8:
219  return wine_dbg_sprintf("S-%d-%d-%lu-%lu-%lu-%lu-%lu-%lu-%lu-%lu", psid->Revision, auth,
220  psid->SubAuthority[0], psid->SubAuthority[1], psid->SubAuthority[2],
221  psid->SubAuthority[3], psid->SubAuthority[4], psid->SubAuthority[5],
222  psid->SubAuthority[6], psid->SubAuthority[7]);
223  }
224  return "(too-big)";
225 }
FT_UInt sid
Definition: cffcmap.c:139
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:271
smooth NULL
Definition: ftsmooth.c:416
DWORD SubAuthority[*]
Definition: ms-dtyp.idl:202
BYTE SubAuthorityCount
Definition: ms-dtyp.idl:200
SID_IDENTIFIER_AUTHORITY IdentifierAuthority
Definition: ms-dtyp.idl:201
BYTE Revision
Definition: ms-dtyp.idl:199

Referenced by CreateWellKnownSid(), and IsWellKnownSid().

◆ DeleteAce()

BOOL WINAPI DeleteAce ( PACL  pAcl,
DWORD  dwAceIndex 
)

Definition at line 1045 of file security.c.

1046 {
1047  return set_ntstatus(RtlDeleteAce(pAcl, dwAceIndex));
1048 }
static __inline BOOL set_ntstatus(NTSTATUS status)
Definition: security.c:229
NTSYSAPI NTSTATUS NTAPI RtlDeleteAce(PACL Acl, ULONG AceIndex)

◆ DumpAce()

static BOOL DumpAce ( LPVOID  pace,
WCHAR **  pwptr,
ULONG plen 
)
static

Definition at line 2936 of file security.c.

2937 {
2938  ACCESS_ALLOWED_ACE *piace; /* all the supported ACEs have the same memory layout */
2939  static const WCHAR openbr = '(';
2940  static const WCHAR closebr = ')';
2941  static const WCHAR semicolon = ';';
2942 
2943  if (((PACE_HEADER)pace)->AceType > SYSTEM_ALARM_ACE_TYPE || ((PACE_HEADER)pace)->AceSize < sizeof(ACCESS_ALLOWED_ACE))
2944  {
2946  return FALSE;
2947  }
2948 
2949  piace = pace;
2950  DumpString(&openbr, 1, pwptr, plen);
2951  switch (piace->Header.AceType)
2952  {
2954  DumpString(SDDL_ACCESS_ALLOWED, -1, pwptr, plen);
2955  break;
2957  DumpString(SDDL_ACCESS_DENIED, -1, pwptr, plen);
2958  break;
2959  case SYSTEM_AUDIT_ACE_TYPE:
2960  DumpString(SDDL_AUDIT, -1, pwptr, plen);
2961  break;
2962  case SYSTEM_ALARM_ACE_TYPE:
2963  DumpString(SDDL_ALARM, -1, pwptr, plen);
2964  break;
2965  }
2966  DumpString(&semicolon, 1, pwptr, plen);
2967 
2968  if (piace->Header.AceFlags & OBJECT_INHERIT_ACE)
2969  DumpString(SDDL_OBJECT_INHERIT, -1, pwptr, plen);
2970  if (piace->Header.AceFlags & CONTAINER_INHERIT_ACE)
2971  DumpString(SDDL_CONTAINER_INHERIT, -1, pwptr, plen);
2973  DumpString(SDDL_NO_PROPAGATE, -1, pwptr, plen);
2974  if (piace->Header.AceFlags & INHERIT_ONLY_ACE)
2975  DumpString(SDDL_INHERIT_ONLY, -1, pwptr, plen);
2976  if (piace->Header.AceFlags & INHERITED_ACE)
2977  DumpString(SDDL_INHERITED, -1, pwptr, plen);
2979  DumpString(SDDL_AUDIT_SUCCESS, -1, pwptr, plen);
2980  if (piace->Header.AceFlags & FAILED_ACCESS_ACE_FLAG)
2981  DumpString(SDDL_AUDIT_FAILURE, -1, pwptr, plen);
2982  DumpString(&semicolon, 1, pwptr, plen);
2983  DumpRights(piace->Mask, pwptr, plen);
2984  DumpString(&semicolon, 1, pwptr, plen);
2985  /* objects not supported */
2986  DumpString(&semicolon, 1, pwptr, plen);
2987  /* objects not supported */
2988  DumpString(&semicolon, 1, pwptr, plen);
2989  if (!DumpSid((PSID)&piace->SidStart, pwptr, plen))
2990  return FALSE;
2991  DumpString(&closebr, 1, pwptr, plen);
2992  return TRUE;
2993 }
static const WCHAR SDDL_OBJECT_INHERIT[]
Definition: security.c:169
UCHAR AceFlags
Definition: ms-dtyp.idl:211
#define TRUE
Definition: types.h:120
static const WCHAR SDDL_INHERITED[]
Definition: security.c:172
static const WCHAR SDDL_CONTAINER_INHERIT[]
Definition: security.c:168
static BOOL DumpSid(PSID psid, WCHAR **pwptr, ULONG *plen)
Definition: security.c:2847
#define NO_PROPAGATE_INHERIT_ACE
Definition: setypes.h:716
ACE_HEADER Header
Definition: ms-dtyp.idl:216
static const WCHAR SDDL_NO_PROPAGATE[]
Definition: security.c:170
static const WCHAR SDDL_ACCESS_ALLOWED[]
Definition: security.c:138
#define SUCCESSFUL_ACCESS_ACE_FLAG
Definition: setypes.h:721
#define FAILED_ACCESS_ACE_FLAG
Definition: setypes.h:722
static const WCHAR SDDL_AUDIT_FAILURE[]
Definition: security.c:174
#define CONTAINER_INHERIT_ACE
Definition: setypes.h:715
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR SDDL_AUDIT[]
Definition: security.c:144
#define ACCESS_ALLOWED_ACE_TYPE
Definition: setypes.h:685
static void DumpRights(DWORD mask, WCHAR **pwptr, ULONG *plen)
Definition: security.c:2897
#define SetLastError(x)
Definition: compat.h:417
#define ACCESS_DENIED_ACE_TYPE
Definition: setypes.h:686
UCHAR AceType
Definition: ms-dtyp.idl:210
static const WCHAR SDDL_INHERIT_ONLY[]
Definition: security.c:171
static const WCHAR SDDL_ALARM[]
Definition: security.c:145
static const ACEFLAG AceType[]
Definition: security.c:2259
#define SYSTEM_ALARM_ACE_TYPE
Definition: setypes.h:688
ACCESS_MASK Mask
Definition: ms-dtyp.idl:217
#define INHERITED_ACE
Definition: ph.h:47
static void DumpString(LPCWSTR string, int cch, WCHAR **pwptr, ULONG *plen)
Definition: security.c:2793
#define SYSTEM_AUDIT_ACE_TYPE
Definition: setypes.h:687
#define INHERIT_ONLY_ACE
Definition: setypes.h:717
#define OBJECT_INHERIT_ACE
Definition: setypes.h:714
static const WCHAR SDDL_ACCESS_DENIED[]
Definition: security.c:139
static const WCHAR SDDL_AUDIT_SUCCESS[]
Definition: security.c:173
#define ERROR_INVALID_ACL
Definition: winerror.h:818

Referenced by DumpAcl().

◆ DumpAcl()

static BOOL DumpAcl ( PACL  pacl,
WCHAR **  pwptr,
ULONG plen,
BOOL  protected,
BOOL  autoInheritReq,
BOOL  autoInherited 
)
static

Definition at line 2995 of file security.c.

2996 {
2997  WORD count;
2998  int i;
2999 
3000  if (protected)
3001  DumpString(SDDL_PROTECTED, -1, pwptr, plen);
3002  if (autoInheritReq)
3003  DumpString(SDDL_AUTO_INHERIT_REQ, -1, pwptr, plen);
3004  if (autoInherited)
3005  DumpString(SDDL_AUTO_INHERITED, -1, pwptr, plen);
3006 
3007  if (pacl == NULL)
3008  return TRUE;
3009 
3010  if (!IsValidAcl(pacl))
3011  return FALSE;
3012 
3013  count = pacl->AceCount;
3014  for (i = 0; i < count; i++)
3015  {
3016  LPVOID ace;
3017  if (!GetAce(pacl, i, &ace))
3018  return FALSE;
3019  if (!DumpAce(ace, pwptr, plen))
3020  return FALSE;
3021  }
3022 
3023  return TRUE;
3024 }
#define TRUE
Definition: types.h:120
#define SDDL_AUTO_INHERITED
Definition: sddl.h:46
GLuint GLuint GLsizei count
Definition: gl.h:1545
BOOL WINAPI IsValidAcl(PACL pAcl)
Definition: security.c:1088
USHORT AceCount
Definition: ms-dtyp.idl:297
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
unsigned short WORD
Definition: ntddk_ex.h:93
#define SDDL_AUTO_INHERIT_REQ
Definition: sddl.h:45
static BOOL DumpAce(LPVOID pace, WCHAR **pwptr, ULONG *plen)
Definition: security.c:2936
BOOL WINAPI GetAce(PACL pAcl, DWORD dwAceIndex, LPVOID *pAce)
Definition: security.c:1065
static void DumpString(LPCWSTR string, int cch, WCHAR **pwptr, ULONG *plen)
Definition: security.c:2793
#define SDDL_PROTECTED
Definition: sddl.h:44

Referenced by DumpDacl(), and DumpSacl().

◆ DumpDacl()

static BOOL DumpDacl ( PSECURITY_DESCRIPTOR  SecurityDescriptor,
WCHAR **  pwptr,
ULONG plen 
)
static

Definition at line 3062 of file security.c.

3063 {
3064  static const WCHAR dacl[] = {'D',':',0};
3066  BOOL present, defaulted;
3067  DWORD revision;
3068  PACL pacl;
3069 
3070  if (!GetSecurityDescriptorDacl(SecurityDescriptor, &present, &pacl, &defaulted))
3071  return FALSE;
3072 
3073  if (!GetSecurityDescriptorControl(SecurityDescriptor, &control, &revision))
3074  return FALSE;
3075 
3076  if (!present)
3077  return TRUE;
3078 
3079  DumpString(dacl, 2, pwptr, plen);
3080  if (!DumpAcl(pacl, pwptr, plen, control & SE_DACL_PROTECTED, control & SE_DACL_AUTO_INHERIT_REQ, control & SE_DACL_AUTO_INHERITED))
3081  return FALSE;
3082  return TRUE;
3083 }
#define TRUE
Definition: types.h:120
BOOL WINAPI GetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbDaclPresent, PACL *pDacl, LPBOOL lpbDaclDefaulted)
Definition: sec.c:45
_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 SE_DACL_AUTO_INHERITED
Definition: setypes.h:775
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI GetSecurityDescriptorControl(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision)
Definition: sec.c:21
WORD SECURITY_DESCRIPTOR_CONTROL
Definition: lsa.idl:37
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: security.c:35
#define SE_DACL_PROTECTED
Definition: setypes.h:777
unsigned long DWORD
Definition: ntddk_ex.h:95
static void DumpString(LPCWSTR string, int cch, WCHAR **pwptr, ULONG *plen)
Definition: security.c:2793
#define SE_DACL_AUTO_INHERIT_REQ
Definition: setypes.h:773
static BOOL DumpAcl(PACL pacl, WCHAR **pwptr, ULONG *plen, BOOL protected, BOOL autoInheritReq, BOOL autoInherited)
Definition: security.c:2995

Referenced by ConvertSecurityDescriptorToStringSecurityDescriptorW().

◆ DumpGroup()

static BOOL DumpGroup ( PSECURITY_DESCRIPTOR  SecurityDescriptor,
WCHAR **  pwptr,
ULONG plen 
)
static

Definition at line 3044 of file security.c.

3045 {
3046  static const WCHAR prefix[] = {'G',':',0};
3047  BOOL bDefaulted;
3048  PSID psid;
3049 
3050  if (!GetSecurityDescriptorGroup(SecurityDescriptor, &psid, &bDefaulted))
3051  return FALSE;
3052 
3053  if (psid == NULL)
3054  return TRUE;
3055 
3056  DumpString(prefix, -1, pwptr, plen);
3057  if (!DumpSid(psid, pwptr, plen))
3058  return FALSE;
3059  return TRUE;
3060 }
#define TRUE
Definition: types.h:120
_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
static BOOL DumpSid(PSID psid, WCHAR **pwptr, ULONG *plen)
Definition: security.c:2847
BOOL WINAPI GetSecurityDescriptorGroup(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID *pGroup, LPBOOL lpbGroupDefaulted)
Definition: sec.c:76
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void DumpString(LPCWSTR string, int cch, WCHAR **pwptr, ULONG *plen)
Definition: security.c:2793

Referenced by ConvertSecurityDescriptorToStringSecurityDescriptorW().

◆ DumpOwner()

static BOOL DumpOwner ( PSECURITY_DESCRIPTOR  SecurityDescriptor,
WCHAR **  pwptr,
ULONG plen 
)
static

Definition at line 3026 of file security.c.

3027 {
3028  static const WCHAR prefix[] = {'O',':',0};
3029  BOOL bDefaulted;
3030  PSID psid;
3031 
3032  if (!GetSecurityDescriptorOwner(SecurityDescriptor, &psid, &bDefaulted))
3033  return FALSE;
3034 
3035  if (psid == NULL)
3036  return TRUE;
3037 
3038  DumpString(prefix, -1, pwptr, plen);
3039  if (!DumpSid(psid, pwptr, plen))
3040  return FALSE;
3041  return TRUE;
3042 }
#define TRUE
Definition: types.h:120
_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
static BOOL DumpSid(PSID psid, WCHAR **pwptr, ULONG *plen)
Definition: security.c:2847
BOOL WINAPI GetSecurityDescriptorOwner(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID *pOwner, LPBOOL lpbOwnerDefaulted)
Definition: sec.c:103
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void DumpString(LPCWSTR string, int cch, WCHAR **pwptr, ULONG *plen)
Definition: security.c:2793

Referenced by ConvertSecurityDescriptorToStringSecurityDescriptorW().

◆ DumpRights()

static void DumpRights ( DWORD  mask,
WCHAR **  pwptr,
ULONG plen 
)
static

Definition at line 2897 of file security.c.

2898 {
2899  static const WCHAR fmtW[] = {'0','x','%','x',0};
2900  WCHAR buf[15];
2901  size_t i;
2902 
2903  if (mask == 0)
2904  return;
2905 
2906  /* first check if the right have name */
2907  for (i = 0; i < sizeof(AceRights)/sizeof(AceRights[0]); i++)
2908  {
2909  if (AceRights[i].wstr == NULL)
2910  break;
2911  if (mask == AceRights[i].value)
2912  {
2913  DumpString(AceRights[i].wstr, -1, pwptr, plen);
2914  return;
2915  }
2916  }
2917 
2918  /* then check if it can be built from bit names */
2919  for (i = 0; i < 32; i++)
2920  {
2921  if ((mask & (1 << i)) && (AceRightBitNames[i] == NULL))
2922  {
2923  /* can't be built from bit names */
2924  sprintfW(buf, fmtW, mask);
2925  DumpString(buf, -1, pwptr, plen);
2926  return;
2927  }
2928  }
2929 
2930  /* build from bit names */
2931  for (i = 0; i < 32; i++)
2932  if (mask & (1 << i))
2933  DumpString(AceRightBitNames[i], -1, pwptr, plen);
2934 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
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
GLenum GLint GLuint mask
Definition: glext.h:6028
smooth NULL
Definition: ftsmooth.c:416
static const ACEFLAG AceRights[]
Definition: security.c:2345
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const LPCWSTR AceRightBitNames[32]
Definition: security.c:2862
#define sprintfW
Definition: unicode.h:58
static void DumpString(LPCWSTR string, int cch, WCHAR **pwptr, ULONG *plen)
Definition: security.c:2793

Referenced by DumpAce().

◆ DumpSacl()

static BOOL DumpSacl ( PSECURITY_DESCRIPTOR  SecurityDescriptor,
WCHAR **  pwptr,
ULONG plen 
)
static

Definition at line 3085 of file security.c.

3086 {
3087  static const WCHAR sacl[] = {'S',':',0};
3089  BOOL present, defaulted;
3090  DWORD revision;
3091  PACL pacl;
3092 
3093  if (!GetSecurityDescriptorSacl(SecurityDescriptor, &present, &pacl, &defaulted))
3094  return FALSE;
3095 
3096  if (!GetSecurityDescriptorControl(SecurityDescriptor, &control, &revision))
3097  return FALSE;
3098 
3099  if (!present)
3100  return TRUE;
3101 
3102  DumpString(sacl, 2, pwptr, plen);
3103  if (!DumpAcl(pacl, pwptr, plen, control & SE_SACL_PROTECTED, control & SE_SACL_AUTO_INHERIT_REQ, control & SE_SACL_AUTO_INHERITED))
3104  return FALSE;
3105  return TRUE;
3106 }
#define TRUE
Definition: types.h:120
_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
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI GetSecurityDescriptorControl(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision)
Definition: sec.c:21
WORD SECURITY_DESCRIPTOR_CONTROL
Definition: lsa.idl:37
#define SE_SACL_AUTO_INHERIT_REQ
Definition: setypes.h:774
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SE_SACL_PROTECTED
Definition: setypes.h:778
#define SE_SACL_AUTO_INHERITED
Definition: setypes.h:776
BOOL WINAPI GetSecurityDescriptorSacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbSaclPresent, PACL *pSacl, LPBOOL lpbSaclDefaulted)
Definition: sec.c:146
static void DumpString(LPCWSTR string, int cch, WCHAR **pwptr, ULONG *plen)
Definition: security.c:2793
static BOOL DumpAcl(PACL pacl, WCHAR **pwptr, ULONG *plen, BOOL protected, BOOL autoInheritReq, BOOL autoInherited)
Definition: security.c:2995

Referenced by ConvertSecurityDescriptorToStringSecurityDescriptorW().

◆ DumpSid()

static BOOL DumpSid ( PSID  psid,
WCHAR **  pwptr,
ULONG plen 
)
static

Definition at line 2847 of file security.c.

2848 {
2849  size_t i;
2850  for (i = 0; i < sizeof(WellKnownSids) / sizeof(WellKnownSids[0]); i++)
2851  {
2852  if (WellKnownSids[i].wstr[0] && EqualSid(psid, (PSID)&(WellKnownSids[i].Sid.Revision)))
2853  {
2854  DumpString(WellKnownSids[i].wstr, 2, pwptr, plen);
2855  return TRUE;
2856  }
2857  }
2858 
2859  return DumpSidNumeric(psid, pwptr, plen);
2860 }
#define TRUE
Definition: types.h:120
static const WELLKNOWNSID WellKnownSids[]
Definition: security.c:47
BOOL WINAPI EqualSid(PSID pSid1, PSID pSid2)
Definition: security.c:708
static BOOL DumpSidNumeric(PSID psid, WCHAR **pwptr, ULONG *plen)
Definition: security.c:2808
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
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
Definition: rtlfuncs.h:1104
static void DumpString(LPCWSTR string, int cch, WCHAR **pwptr, ULONG *plen)
Definition: security.c:2793
BYTE Revision
Definition: ms-dtyp.idl:199

Referenced by DumpAce(), DumpGroup(), and DumpOwner().

◆ DumpSidNumeric()

static BOOL DumpSidNumeric ( PSID  psid,
WCHAR **  pwptr,
ULONG plen 
)
static

Definition at line 2808 of file security.c.

2809 {
2810  DWORD i;
2811  WCHAR fmt[] = { 'S','-','%','u','-','%','d',0 };
2812  WCHAR subauthfmt[] = { '-','%','u',0 };
2813  WCHAR buf[26];
2814  SID *pisid = psid;
2815 
2816  if( !IsValidSid( psid ) || pisid->Revision != SDDL_REVISION)
2817  {
2819  return FALSE;
2820  }
2821 
2822  if (pisid->IdentifierAuthority.Value[0] ||
2823  pisid->IdentifierAuthority.Value[1])
2824  {
2825  FIXME("not matching MS' bugs\n");
2827  return FALSE;
2828  }
2829 
2830  sprintfW( buf, fmt, pisid->Revision,
2831  MAKELONG(
2832  MAKEWORD( pisid->IdentifierAuthority.Value[5],
2833  pisid->IdentifierAuthority.Value[4] ),
2834  MAKEWORD( pisid->IdentifierAuthority.Value[3],
2835  pisid->IdentifierAuthority.Value[2] )
2836  ) );
2837  DumpString(buf, -1, pwptr, plen);
2838 
2839  for( i=0; i<pisid->SubAuthorityCount; i++ )
2840  {
2841  sprintfW( buf, subauthfmt, pisid->SubAuthority[i] );
2842  DumpString(buf, -1, pwptr, plen);
2843  }
2844  return TRUE;
2845 }
#define TRUE
Definition: types.h:120
#define MAKEWORD(a, b)
Definition: typedefs.h:247
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define ERROR_INVALID_SID
Definition: winerror.h:819
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 FIXME(fmt,...)
Definition: debug.h:110
#define MAKELONG(a, b)
Definition: typedefs.h:248
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
DWORD SubAuthority[*]
Definition: ms-dtyp.idl:202
#define sprintfW
Definition: unicode.h:58
BYTE SubAuthorityCount
Definition: ms-dtyp.idl:200
static void DumpString(LPCWSTR string, int cch, WCHAR **pwptr, ULONG *plen)
Definition: security.c:2793
#define SDDL_REVISION
Definition: sddl.h:31
BOOL WINAPI IsValidSid(PSID pSid)
Definition: security.c:698
SID_IDENTIFIER_AUTHORITY IdentifierAuthority
Definition: ms-dtyp.idl:201
BYTE Revision
Definition: ms-dtyp.idl:199
Definition: dsound.c:943

Referenced by DumpSid().

◆ DumpString()

static void DumpString ( LPCWSTR  string,
int  cch,
WCHAR **  pwptr,
ULONG plen 
)
static

Definition at line 2793 of file security.c.

2794 {
2795  if (cch == -1)
2796  cch = strlenW(string);
2797 
2798  if (plen)
2799  *plen += cch;
2800 
2801  if (pwptr)
2802  {
2803  memcpy(*pwptr, string, sizeof(WCHAR)*cch);
2804  *pwptr += cch;
2805  }
2806 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:201
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

Referenced by DumpAce(), DumpAcl(), DumpDacl(), DumpGroup(), DumpOwner(), DumpRights(), DumpSacl(), DumpSid(), and DumpSidNumeric().

◆ DuplicateToken()

BOOL WINAPI DuplicateToken ( IN HANDLE  ExistingTokenHandle,
IN SECURITY_IMPERSONATION_LEVEL  ImpersonationLevel,
OUT PHANDLE  DuplicateTokenHandle 
)

Definition at line 3454 of file security.c.

3457 {
3458  return DuplicateTokenEx(ExistingTokenHandle,
3460  NULL,
3463  DuplicateTokenHandle);
3464 }
#define TOKEN_IMPERSONATE
Definition: setypes.h:873
smooth NULL
Definition: ftsmooth.c:416
#define TOKEN_QUERY
Definition: setypes.h:874
_Out_ PBOOLEAN _Out_ PBOOLEAN _Out_ PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel
Definition: psfuncs.h:154
BOOL WINAPI DuplicateTokenEx(IN HANDLE ExistingTokenHandle, IN DWORD dwDesiredAccess, IN LPSECURITY_ATTRIBUTES lpTokenAttributes OPTIONAL, IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, IN TOKEN_TYPE TokenType, OUT PHANDLE DuplicateTokenHandle)
Definition: security.c:3394

Referenced by test_AccessCheck(), test_CheckTokenMembership(), test_impersonation_level(), test_kernel_objects_security(), and test_token_attr().

◆ DuplicateTokenEx()

BOOL WINAPI DuplicateTokenEx ( IN HANDLE  ExistingTokenHandle,
IN DWORD  dwDesiredAccess,
IN LPSECURITY_ATTRIBUTES lpTokenAttributes  OPTIONAL,
IN SECURITY_IMPERSONATION_LEVEL  ImpersonationLevel,
IN TOKEN_TYPE  TokenType,
OUT PHANDLE  DuplicateTokenHandle 
)

Definition at line 3394 of file security.c.

3400 {
3402  NTSTATUS Status;
3404 
3405  TRACE("%p 0x%08x 0x%08x 0x%08x %p\n", ExistingTokenHandle, dwDesiredAccess,
3406  ImpersonationLevel, TokenType, DuplicateTokenHandle);
3407 
3408  Sqos.Length = sizeof(SECURITY_QUALITY_OF_SERVICE);
3410  Sqos.ContextTrackingMode = 0;
3411  Sqos.EffectiveOnly = FALSE;
3412 
3413  if (lpTokenAttributes != NULL)
3414  {
3416  NULL,
3417  lpTokenAttributes->bInheritHandle ? OBJ_INHERIT : 0,
3418  NULL,
3419  lpTokenAttributes->lpSecurityDescriptor);
3420  }
3421  else
3422  {
3424  NULL,
3425  0,
3426  NULL,
3427  NULL);
3428  }
3429 
3430  ObjectAttributes.SecurityQualityOfService = &Sqos;
3431 
3432  Status = NtDuplicateToken(ExistingTokenHandle,
3433  dwDesiredAccess,
3435  FALSE,
3436  TokenType,
3437  DuplicateTokenHandle);
3438  if (!NT_SUCCESS(Status))
3439  {
3440  ERR("NtDuplicateToken failed: Status %08x\n", Status);
3442  return FALSE;
3443  }
3444 
3445  TRACE("Returning token %p.\n", *DuplicateTokenHandle);
3446 
3447  return TRUE;
3448 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
Definition: lsa.idl:66
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define OBJ_INHERIT
Definition: winternl.h:225
_Out_ PBOOLEAN _Out_ PBOOLEAN _Out_ PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel
Definition: psfuncs.h:154
#define SetLastError(x)
Definition: compat.h:417
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define ERR(fmt,...)
Definition: debug.h:109
struct _SECURITY_QUALITY_OF_SERVICE SECURITY_QUALITY_OF_SERVICE
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
Definition: lsa.idl:65
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_Must_inspect_result_ __kernel_entry NTSTATUS NTAPI NtDuplicateToken(_In_ HANDLE ExistingTokenHandle, _In_ ACCESS_MASK DesiredAccess, _In_opt_ POBJECT_ATTRIBUTES ObjectAttributes, _In_ BOOLEAN EffectiveOnly, _In_ TOKEN_TYPE TokenType, _Out_ PHANDLE NewTokenHandle)
Definition: token.c:2941
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_ BOOLEAN _In_ TOKEN_TYPE TokenType
Definition: sefuncs.h:417

Referenced by CheckTokenMembership(), CreateRestrictedToken(), DuplicateToken(), LaunchProcess(), START_TEST(), test_CreateRestrictedToken(), test_token_security_descriptor(), and WlxStartApplication().

◆ EqualDomainSid()

BOOL WINAPI EqualDomainSid ( IN PSID  pSid1,
IN PSID  pSid2,
OUT BOOL pfEqual 
)

Definition at line 3719 of file security.c.

3722 {
3723  UNIMPLEMENTED;
3724  return FALSE;
3725 }
#define UNIMPLEMENTED
Definition: debug.h:114

◆ EqualPrefixSid()

BOOL WINAPI EqualPrefixSid ( PSID  pSid1,
PSID  pSid2 
)

Definition at line 720 of file security.c.

722 {
723  return RtlEqualPrefixSid (pSid1, pSid2);
724 }
NTSYSAPI BOOLEAN NTAPI RtlEqualPrefixSid(PSID Sid1, PSID Sid2)

Referenced by test_process_security().

◆ EqualSid()

◆ FindFirstFreeAce()

BOOL WINAPI FindFirstFreeAce ( PACL  pAcl,
LPVOID pAce 
)

Definition at line 1055 of file security.c.

1057 {
1058  return RtlFirstFreeAce(pAcl,
1059  (PACE*)pAce);
1060 }
NTSYSAPI BOOLEAN NTAPI RtlFirstFreeAce(PACL Acl, PACE *Ace)
Definition: rtltypes.h:988

◆ FreeSid()

◆ GetAce()

BOOL WINAPI GetAce ( PACL  pAcl,
DWORD  dwAceIndex,
LPVOID pAce 
)

Definition at line 1065 of file security.c.

1066 {
1067  return set_ntstatus(RtlGetAce(pAcl, dwAceIndex, pAce));
1068 }
NTSYSAPI NTSTATUS NTAPI RtlGetAce(PACL Acl, ULONG AceIndex, PVOID *Ace)
static __inline BOOL set_ntstatus(NTSTATUS status)
Definition: security.c:229

Referenced by AccRewriteGetExplicitEntriesFromAcl(), AccRewriteSetEntriesInAcl(), DumpAcl(), CSecurityDescriptor::GetDACLEntry(), CSecurityDescriptor::GetSACLEntry(), map_dacl_2_nfs4acl(), PrintFileDacl(), ReloadPrincipalsList(), and test_GetShellSecurityDescriptor().

◆ GetAclInformation()

BOOL WINAPI GetAclInformation ( PACL  pAcl,
LPVOID  pAclInformation,
DWORD  nAclInformationLength,
ACL_INFORMATION_CLASS  dwAclInformationClass 
)

Definition at line 1073 of file security.c.

1078 {
1079  return set_ntstatus(RtlQueryInformationAcl(pAcl, pAclInformation,
1080  nAclInformationLength, dwAclInformationClass));
1081 }
NTSYSAPI NTSTATUS WINAPI RtlQueryInformationAcl(PACL, LPVOID, DWORD, ACL_INFORMATION_CLASS)
static __inline BOOL set_ntstatus(NTSTATUS status)
Definition: security.c:229

Referenced by AccRewriteSetEntriesInAcl(), CSecurityDescriptor::GetDACLEntriesCount(), CSecurityDescriptor::GetSACLEntriesCount(), and test_GetShellSecurityDescriptor().

◆ GetFileSecurityA()

BOOL WINAPI GetFileSecurityA ( LPCSTR  lpFileName,
SECURITY_INFORMATION  RequestedInformation,
PSECURITY_DESCRIPTOR  pSecurityDescriptor,
DWORD  nLength,
LPDWORD  lpnLengthNeeded 
)

Definition at line 1252 of file security.c.

1257 {
1259  BOOL bResult;
1260 
1262  {
1264  return FALSE;
1265  }
1266 
1267  bResult = GetFileSecurityW(FileName.Buffer,
1268  RequestedInformation,
1269  pSecurityDescriptor,
1270  nLength,
1271  lpnLengthNeeded);
1272 
1274 
1275  return bResult;
1276 }
_In_ DWORD nLength
Definition: wincon.h:461
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
unsigned int BOOL
Definition: ntddk_ex.h:94
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define SetLastError(x)
Definition: compat.h:417
BOOL WINAPI GetFileSecurityW(LPCWSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded)
Definition: security.c:1283
struct _FileName FileName
Definition: fatprocs.h:884
_In_ LPCSTR lpFileName
Definition: winbase.h:3028

Referenced by test_FileSecurity().

◆ GetFileSecurityW()

BOOL WINAPI GetFileSecurityW ( LPCWSTR  lpFileName,
SECURITY_INFORMATION  RequestedInformation,
PSECURITY_DESCRIPTOR  pSecurityDescriptor,
DWORD  nLength,
LPDWORD  lpnLengthNeeded 
)

Definition at line 1283 of file security.c.

1288 {
1290  IO_STATUS_BLOCK StatusBlock;
1292  ULONG AccessMask = 0;
1294  NTSTATUS Status;
1295 
1296  TRACE("GetFileSecurityW() called\n");
1297 
1298  QuerySecurityAccessMask(RequestedInformation, &AccessMask);
1299 
1301  &FileName,
1302  NULL,
1303  NULL))
1304  {
1305  ERR("Invalid path\n");
1307  return FALSE;
1308  }
1309 
1311  &FileName,
1313  NULL,
1314  NULL);
1315 
1317  AccessMask,
1319  &StatusBlock,
1321  0);
1322 
1323  RtlFreeHeap(RtlGetProcessHeap(),
1324  0,
1325  FileName.Buffer);
1326 
1327  if (!NT_SUCCESS(Status))
1328  {
1329  ERR("NtOpenFile() failed (Status %lx)\n", Status);
1331  return FALSE;
1332  }
1333 
1335  RequestedInformation,
1336  pSecurityDescriptor,
1337  nLength,
1338  lpnLengthNeeded);
1340  if (!NT_SUCCESS(Status))
1341  {
1342  ERR("NtQuerySecurityObject() failed (Status %lx)\n", Status);
1344  return FALSE;
1345  }
1346 
1347  return TRUE;
1348 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define TRUE
Definition: types.h:120
VOID WINAPI QuerySecurityAccessMask(IN SECURITY_INFORMATION SecurityInformation, OUT LPDWORD DesiredAccess)
Definition: sec.c:377
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
_In_ DWORD nLength
Definition: wincon.h:461
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:125
HANDLE FileHandle
Definition: stats.c:38
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3951
NTSTATUS NTAPI NtQuerySecurityObject(IN HANDLE Handle, IN SECURITY_INFORMATION SecurityInformation, OUT PSECURITY_DESCRIPTOR SecurityDescriptor, IN ULONG Length, OUT PULONG ResultLength)
Definition: obsecure.c:803
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ACCESS_MASK AccessMask
Definition: exfuncs.h:186
#define SetLastError(x)
Definition: compat.h:417
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define ERR(fmt,...)
Definition: debug.h:109
struct _FileName FileName
Definition: fatprocs.h:884
unsigned int ULONG
Definition: retypes.h:1
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define ERROR_INVALID_NAME
Definition: compat.h:93
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
_In_ LPCSTR lpFileName
Definition: winbase.h:3028

Referenced by GetFileSecurityA(), and RetreiveFileSecurity().

◆ GetKernelObjectSecurity()

BOOL WINAPI GetKernelObjectSecurity ( HANDLE  Handle,
SECURITY_INFORMATION  RequestedInformation,
PSECURITY_DESCRIPTOR  pSecurityDescriptor,
DWORD  nLength,
LPDWORD  lpnLengthNeeded 
)

Definition at line 866 of file security.c.

872 {
873  TRACE("(%p,0x%08x,%p,0x%08x,%p)\n", Handle, RequestedInformation,
874  pSecurityDescriptor, nLength, lpnLengthNeeded);
875 
876  return set_ntstatus( NtQuerySecurityObject(Handle, RequestedInformation, pSecurityDescriptor,
877  nLength, lpnLengthNeeded ));
878 }
_In_ DWORD nLength
Definition: wincon.h:461
_In_ HANDLE Handle
Definition: extypes.h:390
NTSTATUS NTAPI NtQuerySecurityObject(IN HANDLE Handle, IN SECURITY_INFORMATION SecurityInformation, OUT PSECURITY_DESCRIPTOR SecurityDescriptor, IN ULONG Length, OUT PULONG ResultLength)
Definition: obsecure.c:803
#define TRACE(s)
Definition: solgame.cpp:4
static __inline BOOL set_ntstatus(NTSTATUS status)
Definition: security.c:229

Referenced by test_AddMandatoryAce(), test_child_token_sd(), test_child_token_sd_medium(), test_child_token_sd_restricted(), test_default_dacl_owner_sid(), test_get_security_descriptor(), test_token_label(), and test_token_security_descriptor().

◆ GetLengthSid()

◆ GetNamedSecurityInfoA()

DWORD WINAPI GetNamedSecurityInfoA ( LPSTR  pObjectName,
SE_OBJECT_TYPE  ObjectType,
SECURITY_INFORMATION  SecurityInfo,
PSID ppsidOwner,
PSID ppsidGroup,
PACL ppDacl,
PACL ppSacl,
PSECURITY_DESCRIPTOR ppSecurityDescriptor 
)

Definition at line 3637 of file security.c.

3645 {
3646  DWORD len;
3647  LPWSTR wstr = NULL;
3648  DWORD r;
3649 
3650  TRACE("%s %d %d %p %p %p %p %p\n", pObjectName, ObjectType, SecurityInfo,
3651  ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor);
3652 
3653  if( pObjectName )
3654  {
3655  len = MultiByteToWideChar( CP_ACP, 0, pObjectName, -1, NULL, 0 );
3656  wstr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR));
3657  MultiByteToWideChar( CP_ACP, 0, pObjectName, -1, wstr, len );
3658  }
3659 
3660  r = GetNamedSecurityInfoW( wstr, ObjectType, SecurityInfo, ppsidOwner,
3661  ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor );
3662 
3663  HeapFree( GetProcessHeap(), 0, wstr );
3664 
3665  return r;
3666 }
DWORD WINAPI GetNamedSecurityInfoW(LPWSTR pObjectName, SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, PSID *ppsidOwner, PSID *ppsidGroup, PACL *ppDacl, PACL *ppSacl, PSECURITY_DESCRIPTOR *ppSecurityDescriptor)
Definition: misc.c:1147
ObjectType
Definition: metafile.c:80
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define CP_ACP
Definition: compat.h:99
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ GetSecurityInfoExA()

DWORD WINAPI GetSecurityInfoExA ( HANDLE  hObject,
SE_OBJECT_TYPE  ObjectType,
SECURITY_INFORMATION  SecurityInfo,
LPCSTR  lpProvider,
LPCSTR  lpProperty,
PACTRL_ACCESSA ppAccessList,
PACTRL_AUDITA ppAuditList,
LPSTR lppOwner,
LPSTR lppGroup 
)

Definition at line 1768 of file security.c.

1777 {
1778  FIXME("%s() not implemented!\n", __FUNCTION__);
1779  return ERROR_BAD_PROVIDER;
1780 }
#define ERROR_BAD_PROVIDER
Definition: winerror.h:707
#define FIXME(fmt,...)
Definition: debug.h:110
#define __FUNCTION__
Definition: types.h:112

◆ GetSecurityInfoExW()

DWORD WINAPI GetSecurityInfoExW ( HANDLE  hObject,
SE_OBJECT_TYPE  ObjectType,
SECURITY_INFORMATION  SecurityInfo,
LPCWSTR  lpProvider,
LPCWSTR  lpProperty,
PACTRL_ACCESSW ppAccessList,
PACTRL_AUDITW ppAuditList,
LPWSTR lppOwner,
LPWSTR lppGroup 
)

Definition at line 1788 of file security.c.

1797 {
1798  FIXME("%s() not implemented!\n", __FUNCTION__);
1799  return ERROR_BAD_PROVIDER;
1800 }
#define ERROR_BAD_PROVIDER
Definition: winerror.h:707
#define FIXME(fmt,...)
Definition: debug.h:110
#define __FUNCTION__
Definition: types.h:112

◆ GetSidIdentifierAuthority()

PSID_IDENTIFIER_AUTHORITY WINAPI GetSidIdentifierAuthority ( PSID  pSid)

Definition at line 764 of file security.c.

765 {
768 }
#define ERROR_SUCCESS
Definition: deptool.c:10
NTSYSAPI PSID_IDENTIFIER_AUTHORITY NTAPI RtlIdentifierAuthoritySid(PSID Sid)
#define SetLastError(x)
Definition: compat.h:417