ReactOS  0.4.15-dev-4853-g3a72a52
sddl.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SDDL_REVISION_1   1
 
#define SDDL_REVISION   SDDL_REVISION_1
 
#define SDDL_OWNER   TEXT("O")
 
#define SDDL_GROUP   TEXT("G")
 
#define SDDL_DACL   TEXT("D")
 
#define SDDL_SACL   TEXT("S")
 
#define SDDL_PROTECTED   TEXT("P")
 
#define SDDL_AUTO_INHERIT_REQ   TEXT("AR")
 
#define SDDL_AUTO_INHERITED   TEXT("AI")
 
#define SDDL_READ_PROPERTY   TEXT("RP")
 
#define SDDL_WRITE_PROPERTY   TEXT("WP")
 
#define SDDL_CREATE_CHILD   TEXT("CC")
 
#define SDDL_DELETE_CHILD   TEXT("DC")
 
#define SDDL_LIST_CHILDREN   TEXT("LC")
 
#define SDDL_SELF_WRITE   TEXT("SW")
 
#define SDDL_LIST_OBJECT   TEXT("LO")
 
#define SDDL_DELETE_TREE   TEXT("DT")
 
#define SDDL_CONTROL_ACCESS   TEXT("CR")
 
#define SDDL_READ_CONTROL   TEXT("RC")
 
#define SDDL_WRITE_DAC   TEXT("WD")
 
#define SDDL_WRITE_OWNER   TEXT("WO")
 
#define SDDL_STANDARD_DELETE   TEXT("SD")
 
#define SDDL_GENERIC_ALL   TEXT("GA")
 
#define SDDL_GENERIC_READ   TEXT("GR")
 
#define SDDL_GENERIC_WRITE   TEXT("GW")
 
#define SDDL_GENERIC_EXECUTE   TEXT("GX")
 
#define SDDL_FILE_ALL   TEXT("FA")
 
#define SDDL_FILE_READ   TEXT("FR")
 
#define SDDL_FILE_WRITE   TEXT("FW")
 
#define SDDL_FILE_EXECUTE   TEXT("FX")
 
#define SDDL_KEY_ALL   TEXT("KA")
 
#define SDDL_KEY_READ   TEXT("KR")
 
#define SDDL_KEY_WRITE   TEXT("KW")
 
#define SDDL_KEY_EXECUTE   TEXT("KX")
 
#define SDDL_ALIAS_SIZE   2
 
#define SDDL_DOMAIN_ADMINISTRATORS   TEXT("DA")
 
#define SDDL_DOMAIN_GUESTS   TEXT("DG")
 
#define SDDL_DOMAIN_USERS   TEXT("DU")
 
#define SDDL_ENTERPRISE_DOMAIN_CONTROLLERS   TEXT("ED")
 
#define SDDL_DOMAIN_DOMAIN_CONTROLLERS   TEXT("DD")
 
#define SDDL_DOMAIN_COMPUTERS   TEXT("DC")
 
#define SDDL_BUILTIN_ADMINISTRATORS   TEXT("BA")
 
#define SDDL_BUILTIN_GUESTS   TEXT("BG")
 
#define SDDL_BUILTIN_USERS   TEXT("BU")
 
#define SDDL_LOCAL_ADMIN   TEXT("LA")
 
#define SDDL_LOCAL_GUEST   TEXT("LG")
 
#define SDDL_ACCOUNT_OPERATORS   TEXT("AO")
 
#define SDDL_BACKUP_OPERATORS   TEXT("BO")
 
#define SDDL_PRINTER_OPERATORS   TEXT("PO")
 
#define SDDL_SERVER_OPERATORS   TEXT("SO")
 
#define SDDL_AUTHENTICATED_USERS   TEXT("AU")
 
#define SDDL_PERSONAL_SELF   TEXT("PS")
 
#define SDDL_CREATOR_OWNER   TEXT("CO")
 
#define SDDL_CREATOR_GROUP   TEXT("CG")
 
#define SDDL_LOCAL_SYSTEM   TEXT("SY")
 
#define SDDL_POWER_USERS   TEXT("PU")
 
#define SDDL_EVERYONE   TEXT("WD")
 
#define SDDL_REPLICATOR   TEXT("RE")
 
#define SDDL_INTERACTIVE   TEXT("IU")
 
#define SDDL_NETWORK   TEXT("NU")
 
#define SDDL_SERVICE   TEXT("SU")
 
#define SDDL_RESTRICTED_CODE   TEXT("RC")
 
#define SDDL_ANONYMOUS   TEXT("AN")
 
#define SDDL_SCHEMA_ADMINISTRATORS   TEXT("SA")
 
#define SDDL_CERT_SERV_ADMINISTRATORS   TEXT("CA")
 
#define SDDL_RAS_SERVERS   TEXT("RS")
 
#define SDDL_ENTERPRISE_ADMINS   TEXT("EA")
 
#define SDDL_GROUP_POLICY_ADMINS   TEXT("PA")
 
#define SDDL_ALIAS_PREW2KCOMPACC   TEXT("RU")
 
#define SDDL_LOCAL_SERVICE   TEXT("LS")
 
#define SDDL_NETWORK_SERVICE   TEXT("NS")
 
#define SDDL_REMOTE_DESKTOP   TEXT("RD")
 
#define SDDL_NETWORK_CONFIGURATION_OPS   TEXT("NO")
 
#define SDDL_PERFMON_USERS   TEXT("MU")
 
#define SDDL_PERFLOG_USERS   TEXT("LU")
 
#define SDDL_SEPERATORC   TEXT(';')
 
#define SDDL_DELIMINATORC   TEXT(':')
 
#define SDDL_ACE_BEGINC   TEXT('(')
 
#define SDDL_ACE_ENDC   TEXT(')')
 
#define SDDL_SEPERATOR   TEXT(";")
 
#define SDDL_DELIMINATOR   TEXT(":")
 
#define SDDL_ACE_BEGIN   TEXT("(")
 
#define SDDL_ACE_END   TEXT(")")
 
#define ConvertSidToStringSid   ConvertSidToStringSidA
 
#define ConvertStringSidToSid   ConvertStringSidToSidA
 
#define ConvertStringSecurityDescriptorToSecurityDescriptor   ConvertStringSecurityDescriptorToSecurityDescriptorA
 
#define ConvertSecurityDescriptorToStringSecurityDescriptor   ConvertSecurityDescriptorToStringSecurityDescriptorA
 

Functions

BOOL WINAPI ConvertSidToStringSidA (PSID, LPSTR *)
 
BOOL WINAPI ConvertSidToStringSidW (PSID, LPWSTR *)
 
BOOL WINAPI ConvertStringSidToSidA (LPCSTR, PSID *)
 
BOOL WINAPI ConvertStringSidToSidW (LPCWSTR, PSID *)
 
BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorA (LPCSTR, DWORD, PSECURITY_DESCRIPTOR *, PULONG)
 
BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorW (LPCWSTR, DWORD, PSECURITY_DESCRIPTOR *, PULONG)
 
BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorA (PSECURITY_DESCRIPTOR, DWORD, SECURITY_INFORMATION, LPSTR *, PULONG)
 
BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorW (PSECURITY_DESCRIPTOR, DWORD, SECURITY_INFORMATION, LPWSTR *, PULONG)
 

Macro Definition Documentation

◆ ConvertSecurityDescriptorToStringSecurityDescriptor

#define ConvertSecurityDescriptorToStringSecurityDescriptor   ConvertSecurityDescriptorToStringSecurityDescriptorA

Definition at line 164 of file sddl.h.

◆ ConvertSidToStringSid

#define ConvertSidToStringSid   ConvertSidToStringSidA

Definition at line 160 of file sddl.h.

◆ ConvertStringSecurityDescriptorToSecurityDescriptor

#define ConvertStringSecurityDescriptorToSecurityDescriptor   ConvertStringSecurityDescriptorToSecurityDescriptorA

Definition at line 162 of file sddl.h.

◆ ConvertStringSidToSid

#define ConvertStringSidToSid   ConvertStringSidToSidA

Definition at line 161 of file sddl.h.

◆ SDDL_ACCOUNT_OPERATORS

#define SDDL_ACCOUNT_OPERATORS   TEXT("AO")

Definition at line 93 of file sddl.h.

◆ SDDL_ACE_BEGIN

#define SDDL_ACE_BEGIN   TEXT("(")

Definition at line 136 of file sddl.h.

◆ SDDL_ACE_BEGINC

#define SDDL_ACE_BEGINC   TEXT('(')

Definition at line 128 of file sddl.h.

◆ SDDL_ACE_END

#define SDDL_ACE_END   TEXT(")")

Definition at line 137 of file sddl.h.

◆ SDDL_ACE_ENDC

#define SDDL_ACE_ENDC   TEXT(')')

Definition at line 129 of file sddl.h.

◆ SDDL_ALIAS_PREW2KCOMPACC

#define SDDL_ALIAS_PREW2KCOMPACC   TEXT("RU")

Definition at line 115 of file sddl.h.

◆ SDDL_ALIAS_SIZE

#define SDDL_ALIAS_SIZE   2

Definition at line 77 of file sddl.h.

◆ SDDL_ANONYMOUS

#define SDDL_ANONYMOUS   TEXT("AN")

Definition at line 109 of file sddl.h.

◆ SDDL_AUTHENTICATED_USERS

#define SDDL_AUTHENTICATED_USERS   TEXT("AU")

Definition at line 97 of file sddl.h.

◆ SDDL_AUTO_INHERIT_REQ

#define SDDL_AUTO_INHERIT_REQ   TEXT("AR")

Definition at line 45 of file sddl.h.

◆ SDDL_AUTO_INHERITED

#define SDDL_AUTO_INHERITED   TEXT("AI")

Definition at line 46 of file sddl.h.

◆ SDDL_BACKUP_OPERATORS

#define SDDL_BACKUP_OPERATORS   TEXT("BO")

Definition at line 94 of file sddl.h.

◆ SDDL_BUILTIN_ADMINISTRATORS

#define SDDL_BUILTIN_ADMINISTRATORS   TEXT("BA")

Definition at line 88 of file sddl.h.

◆ SDDL_BUILTIN_GUESTS

#define SDDL_BUILTIN_GUESTS   TEXT("BG")

Definition at line 89 of file sddl.h.

◆ SDDL_BUILTIN_USERS

#define SDDL_BUILTIN_USERS   TEXT("BU")

Definition at line 90 of file sddl.h.

◆ SDDL_CERT_SERV_ADMINISTRATORS

#define SDDL_CERT_SERV_ADMINISTRATORS   TEXT("CA")

Definition at line 111 of file sddl.h.

◆ SDDL_CONTROL_ACCESS

#define SDDL_CONTROL_ACCESS   TEXT("CR")

Definition at line 59 of file sddl.h.

◆ SDDL_CREATE_CHILD

#define SDDL_CREATE_CHILD   TEXT("CC")

Definition at line 53 of file sddl.h.

◆ SDDL_CREATOR_GROUP

#define SDDL_CREATOR_GROUP   TEXT("CG")

Definition at line 100 of file sddl.h.

◆ SDDL_CREATOR_OWNER

#define SDDL_CREATOR_OWNER   TEXT("CO")

Definition at line 99 of file sddl.h.

◆ SDDL_DACL

#define SDDL_DACL   TEXT("D")

Definition at line 38 of file sddl.h.

◆ SDDL_DELETE_CHILD

#define SDDL_DELETE_CHILD   TEXT("DC")

Definition at line 54 of file sddl.h.

◆ SDDL_DELETE_TREE

#define SDDL_DELETE_TREE   TEXT("DT")

Definition at line 58 of file sddl.h.

◆ SDDL_DELIMINATOR

#define SDDL_DELIMINATOR   TEXT(":")

Definition at line 135 of file sddl.h.

◆ SDDL_DELIMINATORC

#define SDDL_DELIMINATORC   TEXT(':')

Definition at line 127 of file sddl.h.

◆ SDDL_DOMAIN_ADMINISTRATORS

#define SDDL_DOMAIN_ADMINISTRATORS   TEXT("DA")

Definition at line 82 of file sddl.h.

◆ SDDL_DOMAIN_COMPUTERS

#define SDDL_DOMAIN_COMPUTERS   TEXT("DC")

Definition at line 87 of file sddl.h.

◆ SDDL_DOMAIN_DOMAIN_CONTROLLERS

#define SDDL_DOMAIN_DOMAIN_CONTROLLERS   TEXT("DD")

Definition at line 86 of file sddl.h.

◆ SDDL_DOMAIN_GUESTS

#define SDDL_DOMAIN_GUESTS   TEXT("DG")

Definition at line 83 of file sddl.h.

◆ SDDL_DOMAIN_USERS

#define SDDL_DOMAIN_USERS   TEXT("DU")

Definition at line 84 of file sddl.h.

◆ SDDL_ENTERPRISE_ADMINS

#define SDDL_ENTERPRISE_ADMINS   TEXT("EA")

Definition at line 113 of file sddl.h.

◆ SDDL_ENTERPRISE_DOMAIN_CONTROLLERS

#define SDDL_ENTERPRISE_DOMAIN_CONTROLLERS   TEXT("ED")

Definition at line 85 of file sddl.h.

◆ SDDL_EVERYONE

#define SDDL_EVERYONE   TEXT("WD")

Definition at line 103 of file sddl.h.

◆ SDDL_FILE_ALL

#define SDDL_FILE_ALL   TEXT("FA")

Definition at line 68 of file sddl.h.

◆ SDDL_FILE_EXECUTE

#define SDDL_FILE_EXECUTE   TEXT("FX")

Definition at line 71 of file sddl.h.

◆ SDDL_FILE_READ

#define SDDL_FILE_READ   TEXT("FR")

Definition at line 69 of file sddl.h.

◆ SDDL_FILE_WRITE

#define SDDL_FILE_WRITE   TEXT("FW")

Definition at line 70 of file sddl.h.

◆ SDDL_GENERIC_ALL

#define SDDL_GENERIC_ALL   TEXT("GA")

Definition at line 64 of file sddl.h.

◆ SDDL_GENERIC_EXECUTE

#define SDDL_GENERIC_EXECUTE   TEXT("GX")

Definition at line 67 of file sddl.h.

◆ SDDL_GENERIC_READ

#define SDDL_GENERIC_READ   TEXT("GR")

Definition at line 65 of file sddl.h.

◆ SDDL_GENERIC_WRITE

#define SDDL_GENERIC_WRITE   TEXT("GW")

Definition at line 66 of file sddl.h.

◆ SDDL_GROUP

#define SDDL_GROUP   TEXT("G")

Definition at line 37 of file sddl.h.

◆ SDDL_GROUP_POLICY_ADMINS

#define SDDL_GROUP_POLICY_ADMINS   TEXT("PA")

Definition at line 114 of file sddl.h.

◆ SDDL_INTERACTIVE

#define SDDL_INTERACTIVE   TEXT("IU")

Definition at line 105 of file sddl.h.

◆ SDDL_KEY_ALL

#define SDDL_KEY_ALL   TEXT("KA")

Definition at line 72 of file sddl.h.

◆ SDDL_KEY_EXECUTE

#define SDDL_KEY_EXECUTE   TEXT("KX")

Definition at line 75 of file sddl.h.

◆ SDDL_KEY_READ

#define SDDL_KEY_READ   TEXT("KR")

Definition at line 73 of file sddl.h.

◆ SDDL_KEY_WRITE

#define SDDL_KEY_WRITE   TEXT("KW")

Definition at line 74 of file sddl.h.

◆ SDDL_LIST_CHILDREN

#define SDDL_LIST_CHILDREN   TEXT("LC")

Definition at line 55 of file sddl.h.

◆ SDDL_LIST_OBJECT

#define SDDL_LIST_OBJECT   TEXT("LO")

Definition at line 57 of file sddl.h.

◆ SDDL_LOCAL_ADMIN

#define SDDL_LOCAL_ADMIN   TEXT("LA")

Definition at line 91 of file sddl.h.

◆ SDDL_LOCAL_GUEST

#define SDDL_LOCAL_GUEST   TEXT("LG")

Definition at line 92 of file sddl.h.

◆ SDDL_LOCAL_SERVICE

#define SDDL_LOCAL_SERVICE   TEXT("LS")

Definition at line 116 of file sddl.h.

◆ SDDL_LOCAL_SYSTEM

#define SDDL_LOCAL_SYSTEM   TEXT("SY")

Definition at line 101 of file sddl.h.

◆ SDDL_NETWORK

#define SDDL_NETWORK   TEXT("NU")

Definition at line 106 of file sddl.h.

◆ SDDL_NETWORK_CONFIGURATION_OPS

#define SDDL_NETWORK_CONFIGURATION_OPS   TEXT("NO")

Definition at line 119 of file sddl.h.

◆ SDDL_NETWORK_SERVICE

#define SDDL_NETWORK_SERVICE   TEXT("NS")

Definition at line 117 of file sddl.h.

◆ SDDL_OWNER

#define SDDL_OWNER   TEXT("O")

Definition at line 36 of file sddl.h.

◆ SDDL_PERFLOG_USERS

#define SDDL_PERFLOG_USERS   TEXT("LU")

Definition at line 121 of file sddl.h.

◆ SDDL_PERFMON_USERS

#define SDDL_PERFMON_USERS   TEXT("MU")

Definition at line 120 of file sddl.h.

◆ SDDL_PERSONAL_SELF

#define SDDL_PERSONAL_SELF   TEXT("PS")

Definition at line 98 of file sddl.h.

◆ SDDL_POWER_USERS

#define SDDL_POWER_USERS   TEXT("PU")

Definition at line 102 of file sddl.h.

◆ SDDL_PRINTER_OPERATORS

#define SDDL_PRINTER_OPERATORS   TEXT("PO")

Definition at line 95 of file sddl.h.

◆ SDDL_PROTECTED

#define SDDL_PROTECTED   TEXT("P")

Definition at line 44 of file sddl.h.

◆ SDDL_RAS_SERVERS

#define SDDL_RAS_SERVERS   TEXT("RS")

Definition at line 112 of file sddl.h.

◆ SDDL_READ_CONTROL

#define SDDL_READ_CONTROL   TEXT("RC")

Definition at line 60 of file sddl.h.

◆ SDDL_READ_PROPERTY

#define SDDL_READ_PROPERTY   TEXT("RP")

Definition at line 51 of file sddl.h.

◆ SDDL_REMOTE_DESKTOP

#define SDDL_REMOTE_DESKTOP   TEXT("RD")

Definition at line 118 of file sddl.h.

◆ SDDL_REPLICATOR

#define SDDL_REPLICATOR   TEXT("RE")

Definition at line 104 of file sddl.h.

◆ SDDL_RESTRICTED_CODE

#define SDDL_RESTRICTED_CODE   TEXT("RC")

Definition at line 108 of file sddl.h.

◆ SDDL_REVISION

#define SDDL_REVISION   SDDL_REVISION_1

Definition at line 31 of file sddl.h.

◆ SDDL_REVISION_1

#define SDDL_REVISION_1   1

Definition at line 30 of file sddl.h.

◆ SDDL_SACL

#define SDDL_SACL   TEXT("S")

Definition at line 39 of file sddl.h.

◆ SDDL_SCHEMA_ADMINISTRATORS

#define SDDL_SCHEMA_ADMINISTRATORS   TEXT("SA")

Definition at line 110 of file sddl.h.

◆ SDDL_SELF_WRITE

#define SDDL_SELF_WRITE   TEXT("SW")

Definition at line 56 of file sddl.h.

◆ SDDL_SEPERATOR

#define SDDL_SEPERATOR   TEXT(";")

Definition at line 134 of file sddl.h.

◆ SDDL_SEPERATORC

#define SDDL_SEPERATORC   TEXT(';')

Definition at line 126 of file sddl.h.

◆ SDDL_SERVER_OPERATORS

#define SDDL_SERVER_OPERATORS   TEXT("SO")

Definition at line 96 of file sddl.h.

◆ SDDL_SERVICE

#define SDDL_SERVICE   TEXT("SU")

Definition at line 107 of file sddl.h.

◆ SDDL_STANDARD_DELETE

#define SDDL_STANDARD_DELETE   TEXT("SD")

Definition at line 63 of file sddl.h.

◆ SDDL_WRITE_DAC

#define SDDL_WRITE_DAC   TEXT("WD")

Definition at line 61 of file sddl.h.

◆ SDDL_WRITE_OWNER

#define SDDL_WRITE_OWNER   TEXT("WO")

Definition at line 62 of file sddl.h.

◆ SDDL_WRITE_PROPERTY

#define SDDL_WRITE_PROPERTY   TEXT("WP")

Definition at line 52 of file sddl.h.

Function Documentation

◆ ConvertSecurityDescriptorToStringSecurityDescriptorA()

BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorA ( PSECURITY_DESCRIPTOR  ,
DWORD  ,
SECURITY_INFORMATION  ,
LPSTR ,
PULONG   
)

Definition at line 3298 of file security.c.

3299 {
3300  LPWSTR wstr;
3301  ULONG len;
3303  {
3304  int lenA;
3305 
3306  lenA = WideCharToMultiByte(CP_ACP, 0, wstr, len, NULL, 0, NULL, NULL);
3307  *OutputString = heap_alloc(lenA);
3308 #ifdef __REACTOS__
3309  if (*OutputString == NULL)
3310  {
3311  LocalFree(wstr);
3312  *OutputLen = 0;
3313  return FALSE;
3314  }
3315 #endif
3316  WideCharToMultiByte(CP_ACP, 0, wstr, len, *OutputString, lenA, NULL, NULL);
3317  LocalFree(wstr);
3318 
3319  if (OutputLen != NULL)
3320  *OutputLen = lenA;
3321  return TRUE;
3322  }
3323  else
3324  {
3325  *OutputString = NULL;
3326  if (OutputLen)
3327  *OutputLen = 0;
3328  return FALSE;
3329  }
3330 }
#define WideCharToMultiByte
Definition: compat.h:111
#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
#define CP_ACP
Definition: compat.h:109
BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorW(PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD SDRevision, SECURITY_INFORMATION RequestedInformation, LPWSTR *OutputString, PULONG OutputLen)
Definition: security.c:3234
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
Definition: wdfrequest.h:1044
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define FALSE
Definition: types.h:117
GLenum GLsizei len
Definition: glext.h:6722
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ ConvertSecurityDescriptorToStringSecurityDescriptorW()

BOOL WINAPI ConvertSecurityDescriptorToStringSecurityDescriptorW ( PSECURITY_DESCRIPTOR  ,
DWORD  ,
SECURITY_INFORMATION  ,
LPWSTR ,
PULONG   
)

Definition at line 3234 of file security.c.

3235 {
3236  ULONG len;
3237  WCHAR *wptr, *wstr;
3238 
3239  if (SDRevision != SDDL_REVISION_1)
3240  {
3241  ERR("Program requested unknown SDDL revision %d\n", SDRevision);
3243  return FALSE;
3244  }
3245 
3246  len = 0;
3247  if (RequestedInformation & OWNER_SECURITY_INFORMATION)
3249  return FALSE;
3250  if (RequestedInformation & GROUP_SECURITY_INFORMATION)
3252  return FALSE;
3253  if (RequestedInformation & DACL_SECURITY_INFORMATION)
3255  return FALSE;
3256  if (RequestedInformation & SACL_SECURITY_INFORMATION)
3258  return FALSE;
3259 
3260  wstr = wptr = LocalAlloc(0, (len + 1)*sizeof(WCHAR));
3261 #ifdef __REACTOS__
3262  if (wstr == NULL)
3263  return FALSE;
3264 #endif
3265 
3266  if (RequestedInformation & OWNER_SECURITY_INFORMATION)
3267  if (!DumpOwner(SecurityDescriptor, &wptr, NULL)) {
3268  LocalFree (wstr);
3269  return FALSE;
3270  }
3271  if (RequestedInformation & GROUP_SECURITY_INFORMATION)
3272  if (!DumpGroup(SecurityDescriptor, &wptr, NULL)) {
3273  LocalFree (wstr);
3274  return FALSE;
3275  }
3276  if (RequestedInformation & DACL_SECURITY_INFORMATION)
3277  if (!DumpDacl(SecurityDescriptor, &wptr, NULL)) {
3278  LocalFree (wstr);
3279  return FALSE;
3280  }
3281  if (RequestedInformation & SACL_SECURITY_INFORMATION)
3282  if (!DumpSacl(SecurityDescriptor, &wptr, NULL)) {
3283  LocalFree (wstr);
3284  return FALSE;
3285  }
3286  *wptr = 0;
3287 
3288  TRACE("ret: %s, %d\n", wine_dbgstr_w(wstr), len);
3289  *OutputString = wstr;
3290  if (OutputLen)
3291  *OutputLen = strlenW(*OutputString)+1;
3292  return TRUE;
3293 }
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:3149
#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
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:3208
#define GROUP_SECURITY_INFORMATION
Definition: setypes.h:124
#define FALSE
Definition: types.h:117
#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:611
static BOOL DumpDacl(PSECURITY_DESCRIPTOR SecurityDescriptor, WCHAR **pwptr, ULONG *plen)
Definition: security.c:3185
GLenum GLsizei len
Definition: glext.h:6722
#define ERR(fmt,...)
Definition: debug.h:110
#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
#define NULL
Definition: types.h:112
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:3167
#define DACL_SECURITY_INFORMATION
Definition: setypes.h:125
#define SDDL_REVISION_1
Definition: sddl.h:30

Referenced by ConvertSecurityDescriptorToStringSecurityDescriptorA().

◆ ConvertSidToStringSidA()

BOOL WINAPI ConvertSidToStringSidA ( PSID  ,
LPSTR  
)

Definition at line 3436 of file security.c.

3438 {
3439  LPWSTR StringSidW;
3440  int Len;
3441 
3442  if (!ConvertSidToStringSidW(Sid, &StringSidW))
3443  {
3444  return FALSE;
3445  }
3446 
3447  Len = WideCharToMultiByte(CP_ACP, 0, StringSidW, -1, NULL, 0, NULL, NULL);
3448  if (Len <= 0)
3449  {
3450  LocalFree(StringSidW);
3452  return FALSE;
3453  }
3454 
3455  *StringSid = LocalAlloc(LMEM_FIXED, Len);
3456  if (NULL == *StringSid)
3457  {
3458  LocalFree(StringSidW);
3460  return FALSE;
3461  }
3462 
3463  if (!WideCharToMultiByte(CP_ACP, 0, StringSidW, -1, *StringSid, Len, NULL, NULL))
3464  {
3465  LocalFree(StringSid);
3466  LocalFree(StringSidW);
3467  return FALSE;
3468  }
3469 
3470  LocalFree(StringSidW);
3471 
3472  return TRUE;
3473 }
#define WideCharToMultiByte
Definition: compat.h:111
#define TRUE
Definition: types.h:120
#define CP_ACP
Definition: compat.h:109
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
BOOL WINAPI ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
Definition: security.c:3382
#define FALSE
Definition: types.h:117
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
Definition: rtlfuncs.h:1103
#define LMEM_FIXED
Definition: winbase.h:365
#define Len
Definition: deflate.h:82
#define SetLastError(x)
Definition: compat.h:611
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by debugstr_sid(), get_user_sid(), 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  ,
LPWSTR  
)

Definition at line 3382 of file security.c.

3384 {
3385  NTSTATUS Status;
3387  WCHAR FixedBuffer[64];
3388 
3389  if (!RtlValidSid(Sid))
3390  {
3392  return FALSE;
3393  }
3394 
3395  UnicodeString.Length = 0;
3396  UnicodeString.MaximumLength = sizeof(FixedBuffer);
3397  UnicodeString.Buffer = FixedBuffer;
3400  {
3402  }
3403 
3404  if (!NT_SUCCESS(Status))
3405  {
3407  return FALSE;
3408  }
3409 
3410  *StringSid = LocalAlloc(LMEM_FIXED, UnicodeString.Length + sizeof(WCHAR));
3411  if (NULL == *StringSid)
3412  {
3413  if (UnicodeString.Buffer != FixedBuffer)
3414  {
3416  }
3418  return FALSE;
3419  }
3420 
3421  MoveMemory(*StringSid, UnicodeString.Buffer, UnicodeString.Length);
3422  ZeroMemory((PCHAR) *StringSid + UnicodeString.Length, sizeof(WCHAR));
3423  if (UnicodeString.Buffer != FixedBuffer)
3424  {
3426  }
3427 
3428  return TRUE;
3429 }
signed char * PCHAR
Definition: retypes.h:7
#define TRUE
Definition: types.h:120
#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:1667
WDF_EXTERN_C_START typedef _Must_inspect_result_ _In_opt_ PCUNICODE_STRING UnicodeString
Definition: wdfstring.h:64
#define MoveMemory
Definition: winbase.h:1664
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define FALSE
Definition: types.h:117
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
Definition: rtlfuncs.h:1103
NTSYSAPI BOOLEAN NTAPI RtlValidSid(IN PSID Sid)
Definition: sid.c:21
#define LMEM_FIXED
Definition: winbase.h:365
Status
Definition: gdiplustypes.h:24
__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:611
NTSYSAPI NTSTATUS NTAPI RtlConvertSidToUnicodeString(OUT PUNICODE_STRING DestinationString, IN PVOID Sid, IN BOOLEAN AllocateDestinationString)
#define NULL
Definition: types.h:112
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  ,
DWORD  ,
PSECURITY_DESCRIPTOR ,
PULONG   
)

Definition at line 2831 of file security.c.

2835 {
2836  UINT len;
2837  BOOL ret = FALSE;
2838  LPWSTR StringSecurityDescriptorW;
2839 
2840  len = MultiByteToWideChar(CP_ACP, 0, StringSecurityDescriptor, -1, NULL, 0);
2841  StringSecurityDescriptorW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
2842 
2843  if (StringSecurityDescriptorW)
2844  {
2845  MultiByteToWideChar(CP_ACP, 0, StringSecurityDescriptor, -1, StringSecurityDescriptorW, len);
2846 
2847  ret = ConvertStringSecurityDescriptorToSecurityDescriptorW(StringSecurityDescriptorW,
2848  StringSDRevision, SecurityDescriptor,
2849  SecurityDescriptorSize);
2850  HeapFree(GetProcessHeap(), 0, StringSecurityDescriptorW);
2851  }
2852 
2853  return ret;
2854 }
_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:109
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:595
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 NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorW(LPCWSTR StringSecurityDescriptor, DWORD StringSDRevision, PSECURITY_DESCRIPTOR *SecurityDescriptor, PULONG SecurityDescriptorSize)
Definition: security.c:2861

Referenced by test_profile_directory_readonly().

◆ ConvertStringSecurityDescriptorToSecurityDescriptorW()

BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorW ( LPCWSTR  ,
DWORD  ,
PSECURITY_DESCRIPTOR ,
PULONG   
)

Definition at line 2861 of file security.c.

2865 {
2866  DWORD cBytes;
2867  SECURITY_DESCRIPTOR* psd;
2868  BOOL bret = FALSE;
2869 
2870  TRACE("%s\n", debugstr_w(StringSecurityDescriptor));
2871 
2872  if (GetVersion() & 0x80000000)
2873  {
2875  goto lend;
2876  }
2877  else if (!StringSecurityDescriptor || !SecurityDescriptor)
2878  {
2880  goto lend;
2881  }
2882  else if (StringSDRevision != SID_REVISION)
2883  {
2885  goto lend;
2886  }
2887 
2888  /* Compute security descriptor length */
2889  if (!ParseStringSecurityDescriptorToSecurityDescriptor(StringSecurityDescriptor,
2890  NULL, &cBytes))
2891  goto lend;
2892 
2893  psd = *SecurityDescriptor = LocalAlloc(GMEM_ZEROINIT, cBytes);
2894  if (!psd) goto lend;
2895 
2896  psd->Revision = SID_REVISION;
2897  psd->Control |= SE_SELF_RELATIVE;
2898 
2899  if (!ParseStringSecurityDescriptorToSecurityDescriptor(StringSecurityDescriptor,
2900  (SECURITY_DESCRIPTOR_RELATIVE *)psd, &cBytes))
2901  {
2902  LocalFree(psd);
2903  goto lend;
2904  }
2905 
2906  if (SecurityDescriptorSize)
2907  *SecurityDescriptorSize = cBytes;
2908 
2909  bret = TRUE;
2910 
2911 lend:
2912  TRACE(" ret=%d\n", bret);
2913  return bret;
2914 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
static BOOL ParseStringSecurityDescriptorToSecurityDescriptor(LPCWSTR StringSecurityDescriptor, SECURITY_DESCRIPTOR_RELATIVE *SecurityDescriptor, LPDWORD cBytes)
Definition: security.c:2683
#define SE_SELF_RELATIVE
Definition: setypes.h:830
#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
#define SID_REVISION
Definition: setypes.h:481
DWORD WINAPI GetVersion(VOID)
Definition: version.c:22
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
#define ERROR_UNKNOWN_REVISION
Definition: winerror.h:787
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
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  ,
PSID  
)

Definition at line 3359 of file security.c.

3360 {
3361  BOOL bret = FALSE;
3362 
3363  TRACE("%s, %p\n", debugstr_a(StringSid), Sid);
3364  if (GetVersion() & 0x80000000)
3366  else if (!StringSid || !Sid)
3368  else
3369  {
3370  WCHAR *wStringSid = SERV_dup(StringSid);
3371  bret = ConvertStringSidToSidW(wStringSid, Sid);
3372  heap_free(wStringSid);
3373  }
3374  return bret;
3375 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
BOOL WINAPI ConvertStringSidToSidW(LPCWSTR StringSid, PSID *Sid)
Definition: security.c:3335
DWORD WINAPI GetVersion(VOID)
Definition: version.c:22
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
Definition: rtlfuncs.h:1103
#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:611
static LPWSTR SERV_dup(LPCSTR str)
Definition: security.c:235
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by test_LsaLookupSids().

◆ ConvertStringSidToSidW()

BOOL WINAPI ConvertStringSidToSidW ( LPCWSTR  ,
PSID  
)

Definition at line 3335 of file security.c.

3336 {
3337  BOOL bret = FALSE;
3338  DWORD cBytes;
3339 
3340  TRACE("%s, %p\n", debugstr_w(StringSid), Sid);
3341  if (GetVersion() & 0x80000000)
3343  else if (!StringSid || !Sid)
3345  else if (ParseStringSidToSid(StringSid, NULL, &cBytes))
3346  {
3347  PSID pSid = *Sid = LocalAlloc(0, cBytes);
3348 
3349  bret = ParseStringSidToSid(StringSid, pSid, &cBytes);
3350  if (!bret)
3351  LocalFree(*Sid);
3352  }
3353  return bret;
3354 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
DWORD WINAPI GetVersion(VOID)
Definition: version.c:22
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
Definition: rtlfuncs.h:1103
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
static PSID pSid
Definition: security.c:74
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
static BOOL ParseStringSidToSid(LPCWSTR StringSid, PSID pSid, LPDWORD cBytes)
Definition: security.c:3705
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373

Referenced by ConvertStringSidToSidA(), and fill_sid().