Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

275 lines
10 KiB

  1. /*++
  2. Copyright (c) 1997-1998 Microsoft Corporation
  3. Module Name:
  4. sddl.w
  5. Abstract:
  6. This module defines the support and conversions routines necessary for SDDL.
  7. Revision History:
  8. --*/
  9. #ifndef __SDDL_H__
  10. #define __SDDL_H__
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. //
  15. // SDDL Version information
  16. //
  17. #define SDDL_REVISION_1 1
  18. #define SDDL_REVISION SDDL_REVISION_1
  19. //
  20. // SDDL Component tags
  21. //
  22. #define SDDL_OWNER TEXT("O") // Owner tag
  23. #define SDDL_GROUP TEXT("G") // Group tag
  24. #define SDDL_DACL TEXT("D") // DACL tag
  25. #define SDDL_SACL TEXT("S") // SACL tag
  26. //
  27. // SDDL Security descriptor controls
  28. //
  29. #define SDDL_PROTECTED TEXT("P") // DACL or SACL Protected
  30. #define SDDL_AUTO_INHERIT_REQ TEXT("AR") // Auto inherit request
  31. #define SDDL_AUTO_INHERITED TEXT("AI") // DACL/SACL are auto inherited
  32. //
  33. // SDDL Ace types
  34. //
  35. #define SDDL_ACCESS_ALLOWED TEXT("A") // Access allowed
  36. #define SDDL_ACCESS_DENIED TEXT("D") // Access denied
  37. #define SDDL_OBJECT_ACCESS_ALLOWED TEXT("OA") // Object access allowed
  38. #define SDDL_OBJECT_ACCESS_DENIED TEXT("OD") // Object access denied
  39. #define SDDL_AUDIT TEXT("AU") // Audit
  40. #define SDDL_ALARM TEXT("AL") // Alarm
  41. #define SDDL_OBJECT_AUDIT TEXT("OU") // Object audit
  42. #define SDDL_OBJECT_ALARM TEXT("OL") // Object alarm
  43. //
  44. // SDDL Ace flags
  45. //
  46. #define SDDL_CONTAINER_INHERIT TEXT("CI") // Container inherit
  47. #define SDDL_OBJECT_INHERIT TEXT("OI") // Object inherit
  48. #define SDDL_NO_PROPAGATE TEXT("NP") // Inherit no propagate
  49. #define SDDL_INHERIT_ONLY TEXT("IO") // Inherit only
  50. #define SDDL_INHERITED TEXT("ID") // Inherited
  51. #define SDDL_AUDIT_SUCCESS TEXT("SA") // Audit success
  52. #define SDDL_AUDIT_FAILURE TEXT("FA") // Audit failure
  53. //
  54. // SDDL Rights
  55. //
  56. #define SDDL_READ_PROPERTY TEXT("RP")
  57. #define SDDL_WRITE_PROPERTY TEXT("WP")
  58. #define SDDL_CREATE_CHILD TEXT("CC")
  59. #define SDDL_DELETE_CHILD TEXT("DC")
  60. #define SDDL_LIST_CHILDREN TEXT("LC")
  61. #define SDDL_SELF_WRITE TEXT("SW")
  62. #define SDDL_LIST_OBJECT TEXT("LO")
  63. #define SDDL_DELETE_TREE TEXT("DT")
  64. #define SDDL_CONTROL_ACCESS TEXT("CR")
  65. #define SDDL_READ_CONTROL TEXT("RC")
  66. #define SDDL_WRITE_DAC TEXT("WD")
  67. #define SDDL_WRITE_OWNER TEXT("WO")
  68. #define SDDL_STANDARD_DELETE TEXT("SD")
  69. #define SDDL_GENERIC_ALL TEXT("GA")
  70. #define SDDL_GENERIC_READ TEXT("GR")
  71. #define SDDL_GENERIC_WRITE TEXT("GW")
  72. #define SDDL_GENERIC_EXECUTE TEXT("GX")
  73. #define SDDL_FILE_ALL TEXT("FA")
  74. #define SDDL_FILE_READ TEXT("FR")
  75. #define SDDL_FILE_WRITE TEXT("FW")
  76. #define SDDL_FILE_EXECUTE TEXT("FX")
  77. #define SDDL_KEY_ALL TEXT("KA")
  78. #define SDDL_KEY_READ TEXT("KR")
  79. #define SDDL_KEY_WRITE TEXT("KW")
  80. #define SDDL_KEY_EXECUTE TEXT("KX")
  81. //
  82. // SDDL User alias max size
  83. // - currently, upto two supported eg. "DA"
  84. // - modify this if more WCHARs need to be there in future e.g. "DAX"
  85. //
  86. #define SDDL_ALIAS_SIZE 2
  87. //
  88. // SDDL User aliases
  89. //
  90. #define SDDL_DOMAIN_ADMINISTRATORS TEXT("DA") // Domain admins
  91. #define SDDL_DOMAIN_GUESTS TEXT("DG") // Domain guests
  92. #define SDDL_DOMAIN_USERS TEXT("DU") // Domain users
  93. #define SDDL_ENTERPRISE_DOMAIN_CONTROLLERS TEXT("ED") // Enterprise domain controllers
  94. #define SDDL_DOMAIN_DOMAIN_CONTROLLERS TEXT("DD") // Domain domain controllers
  95. #define SDDL_DOMAIN_COMPUTERS TEXT("DC") // Domain computers
  96. #define SDDL_BUILTIN_ADMINISTRATORS TEXT("BA") // Builtin (local ) administrators
  97. #define SDDL_BUILTIN_GUESTS TEXT("BG") // Builtin (local ) guests
  98. #define SDDL_BUILTIN_USERS TEXT("BU") // Builtin (local ) users
  99. #define SDDL_LOCAL_ADMIN TEXT("LA") // Local administrator account
  100. #define SDDL_LOCAL_GUEST TEXT("LG") // Local group account
  101. #define SDDL_ACCOUNT_OPERATORS TEXT("AO") // Account operators
  102. #define SDDL_BACKUP_OPERATORS TEXT("BO") // Backup operators
  103. #define SDDL_PRINTER_OPERATORS TEXT("PO") // Printer operators
  104. #define SDDL_SERVER_OPERATORS TEXT("SO") // Server operators
  105. #define SDDL_AUTHENTICATED_USERS TEXT("AU") // Authenticated users
  106. #define SDDL_PERSONAL_SELF TEXT("PS") // Personal self
  107. #define SDDL_CREATOR_OWNER TEXT("CO") // Creator owner
  108. #define SDDL_CREATOR_GROUP TEXT("CG") // Creator group
  109. #define SDDL_LOCAL_SYSTEM TEXT("SY") // Local system
  110. #define SDDL_POWER_USERS TEXT("PU") // Power users
  111. #define SDDL_EVERYONE TEXT("WD") // Everyone ( World )
  112. #define SDDL_REPLICATOR TEXT("RE") // Replicator
  113. #define SDDL_INTERACTIVE TEXT("IU") // Interactive logon user
  114. #define SDDL_NETWORK TEXT("NU") // Nework logon user
  115. #define SDDL_SERVICE TEXT("SU") // Service logon user
  116. #define SDDL_RESTRICTED_CODE TEXT("RC") // Restricted code
  117. #define SDDL_ANONYMOUS TEXT("AN") // Anonymous Logon
  118. #define SDDL_SCHEMA_ADMINISTRATORS TEXT("SA") // Schema Administrators
  119. #define SDDL_CERT_SERV_ADMINISTRATORS TEXT("CA") // Certificate Server Administrators
  120. #define SDDL_RAS_SERVERS TEXT("RS") // RAS servers group
  121. #define SDDL_ENTERPRISE_ADMINS TEXT("EA") // Enterprise administrators
  122. #define SDDL_GROUP_POLICY_ADMINS TEXT("PA") // Group Policy administrators
  123. #define SDDL_ALIAS_PREW2KCOMPACC TEXT("RU") // alias to allow previous windows 2000
  124. #define SDDL_LOCAL_SERVICE TEXT("LS") // Local service account (for services)
  125. #define SDDL_NETWORK_SERVICE TEXT("NS") // Network service account (for services)
  126. #define SDDL_REMOTE_DESKTOP TEXT("RD") // Remote desktop users (for terminal server)
  127. #define SDDL_NETWORK_CONFIGURATION_OPS TEXT("NO") // Network configuration operators ( to manage configuration of networking features)
  128. #define SDDL_PERFMON_USERS TEXT("MU") // Performance Monitor Users
  129. #define SDDL_PERFLOG_USERS TEXT("LU") // Performance Log Users
  130. //
  131. // SDDL Seperators - character version
  132. //
  133. #define SDDL_SEPERATORC TEXT(';')
  134. #define SDDL_DELIMINATORC TEXT(':')
  135. #define SDDL_ACE_BEGINC TEXT('(')
  136. #define SDDL_ACE_ENDC TEXT(')')
  137. //
  138. // SDDL Seperators - string version
  139. //
  140. #define SDDL_SEPERATOR TEXT(";")
  141. #define SDDL_DELIMINATOR TEXT(":")
  142. #define SDDL_ACE_BEGIN TEXT("(")
  143. #define SDDL_ACE_END TEXT(")")
  144. #if !defined(_NTDDK_)
  145. #if(_WIN32_WINNT >= 0x0500)
  146. WINADVAPI
  147. BOOL
  148. WINAPI
  149. ConvertSidToStringSidA(
  150. IN PSID Sid,
  151. OUT LPSTR *StringSid
  152. );
  153. WINADVAPI
  154. BOOL
  155. WINAPI
  156. ConvertSidToStringSidW(
  157. IN PSID Sid,
  158. OUT LPWSTR *StringSid
  159. );
  160. #ifdef UNICODE
  161. #define ConvertSidToStringSid ConvertSidToStringSidW
  162. #else
  163. #define ConvertSidToStringSid ConvertSidToStringSidA
  164. #endif // !UNICODE
  165. WINADVAPI
  166. BOOL
  167. WINAPI
  168. ConvertStringSidToSidA(
  169. IN LPCSTR StringSid,
  170. OUT PSID *Sid
  171. );
  172. WINADVAPI
  173. BOOL
  174. WINAPI
  175. ConvertStringSidToSidW(
  176. IN LPCWSTR StringSid,
  177. OUT PSID *Sid
  178. );
  179. #ifdef UNICODE
  180. #define ConvertStringSidToSid ConvertStringSidToSidW
  181. #else
  182. #define ConvertStringSidToSid ConvertStringSidToSidA
  183. #endif // !UNICODE
  184. WINADVAPI
  185. BOOL
  186. WINAPI
  187. ConvertStringSecurityDescriptorToSecurityDescriptorA(
  188. IN LPCSTR StringSecurityDescriptor,
  189. IN DWORD StringSDRevision,
  190. OUT PSECURITY_DESCRIPTOR *SecurityDescriptor,
  191. OUT PULONG SecurityDescriptorSize OPTIONAL
  192. );
  193. WINADVAPI
  194. BOOL
  195. WINAPI
  196. ConvertStringSecurityDescriptorToSecurityDescriptorW(
  197. IN LPCWSTR StringSecurityDescriptor,
  198. IN DWORD StringSDRevision,
  199. OUT PSECURITY_DESCRIPTOR *SecurityDescriptor,
  200. OUT PULONG SecurityDescriptorSize OPTIONAL
  201. );
  202. #ifdef UNICODE
  203. #define ConvertStringSecurityDescriptorToSecurityDescriptor ConvertStringSecurityDescriptorToSecurityDescriptorW
  204. #else
  205. #define ConvertStringSecurityDescriptorToSecurityDescriptor ConvertStringSecurityDescriptorToSecurityDescriptorA
  206. #endif // !UNICODE
  207. WINADVAPI
  208. BOOL
  209. WINAPI
  210. ConvertSecurityDescriptorToStringSecurityDescriptorA(
  211. IN PSECURITY_DESCRIPTOR SecurityDescriptor,
  212. IN DWORD RequestedStringSDRevision,
  213. IN SECURITY_INFORMATION SecurityInformation,
  214. OUT LPSTR *StringSecurityDescriptor OPTIONAL,
  215. OUT PULONG StringSecurityDescriptorLen OPTIONAL
  216. );
  217. WINADVAPI
  218. BOOL
  219. WINAPI
  220. ConvertSecurityDescriptorToStringSecurityDescriptorW(
  221. IN PSECURITY_DESCRIPTOR SecurityDescriptor,
  222. IN DWORD RequestedStringSDRevision,
  223. IN SECURITY_INFORMATION SecurityInformation,
  224. OUT LPWSTR *StringSecurityDescriptor OPTIONAL,
  225. OUT PULONG StringSecurityDescriptorLen OPTIONAL
  226. );
  227. #ifdef UNICODE
  228. #define ConvertSecurityDescriptorToStringSecurityDescriptor ConvertSecurityDescriptorToStringSecurityDescriptorW
  229. #else
  230. #define ConvertSecurityDescriptorToStringSecurityDescriptor ConvertSecurityDescriptorToStringSecurityDescriptorA
  231. #endif // !UNICODE
  232. #endif /* _WIN32_WINNT >= 0x0500 */
  233. #endif /* !defined(_NTDDK_) */
  234. #ifdef __cplusplus
  235. }
  236. #endif
  237. #endif // endif __SDDL_H__