Sddl.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:10k
源码类别:

模拟服务器

开发平台:

C/C++

  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. //
  129. // SDDL Seperators
  130. //
  131. #define SDDL_SEPERATORC                     TEXT(';')
  132. #define SDDL_DELIMINATORC                   TEXT(':')
  133. #define SDDL_ACE_BEGINC                     TEXT('(')
  134. #define SDDL_ACE_ENDC                       TEXT(')')
  135. #if(_WIN32_WINNT >= 0x0500)
  136. WINADVAPI
  137. BOOL
  138. WINAPI
  139. ConvertSidToStringSidA(
  140.     IN  PSID     Sid,
  141.     OUT LPSTR  *StringSid
  142.     );
  143. WINADVAPI
  144. BOOL
  145. WINAPI
  146. ConvertSidToStringSidW(
  147.     IN  PSID     Sid,
  148.     OUT LPWSTR  *StringSid
  149.     );
  150. #ifdef UNICODE
  151. #define ConvertSidToStringSid  ConvertSidToStringSidW
  152. #else
  153. #define ConvertSidToStringSid  ConvertSidToStringSidA
  154. #endif // !UNICODE
  155. WINADVAPI
  156. BOOL
  157. WINAPI
  158. ConvertStringSidToSidA(
  159.     IN LPCSTR   StringSid,
  160.     OUT PSID   *Sid
  161.     );
  162. WINADVAPI
  163. BOOL
  164. WINAPI
  165. ConvertStringSidToSidW(
  166.     IN LPCWSTR   StringSid,
  167.     OUT PSID   *Sid
  168.     );
  169. #ifdef UNICODE
  170. #define ConvertStringSidToSid  ConvertStringSidToSidW
  171. #else
  172. #define ConvertStringSidToSid  ConvertStringSidToSidA
  173. #endif // !UNICODE
  174. WINADVAPI
  175. BOOL
  176. WINAPI
  177. ConvertStringSecurityDescriptorToSecurityDescriptorA(
  178.     IN  LPCSTR StringSecurityDescriptor,
  179.     IN  DWORD StringSDRevision,
  180.     OUT PSECURITY_DESCRIPTOR  *SecurityDescriptor,
  181.     OUT PULONG  SecurityDescriptorSize OPTIONAL
  182.     );
  183. WINADVAPI
  184. BOOL
  185. WINAPI
  186. ConvertStringSecurityDescriptorToSecurityDescriptorW(
  187.     IN  LPCWSTR StringSecurityDescriptor,
  188.     IN  DWORD StringSDRevision,
  189.     OUT PSECURITY_DESCRIPTOR  *SecurityDescriptor,
  190.     OUT PULONG  SecurityDescriptorSize OPTIONAL
  191.     );
  192. #ifdef UNICODE
  193. #define ConvertStringSecurityDescriptorToSecurityDescriptor  ConvertStringSecurityDescriptorToSecurityDescriptorW
  194. #else
  195. #define ConvertStringSecurityDescriptorToSecurityDescriptor  ConvertStringSecurityDescriptorToSecurityDescriptorA
  196. #endif // !UNICODE
  197. WINADVAPI
  198. BOOL
  199. WINAPI
  200. ConvertSecurityDescriptorToStringSecurityDescriptorA(
  201.     IN  PSECURITY_DESCRIPTOR  SecurityDescriptor,
  202.     IN  DWORD RequestedStringSDRevision,
  203.     IN  SECURITY_INFORMATION SecurityInformation,
  204.     OUT LPSTR  *StringSecurityDescriptor OPTIONAL,
  205.     OUT PULONG StringSecurityDescriptorLen OPTIONAL
  206.     );
  207. WINADVAPI
  208. BOOL
  209. WINAPI
  210. ConvertSecurityDescriptorToStringSecurityDescriptorW(
  211.     IN  PSECURITY_DESCRIPTOR  SecurityDescriptor,
  212.     IN  DWORD RequestedStringSDRevision,
  213.     IN  SECURITY_INFORMATION SecurityInformation,
  214.     OUT LPWSTR  *StringSecurityDescriptor OPTIONAL,
  215.     OUT PULONG StringSecurityDescriptorLen OPTIONAL
  216.     );
  217. #ifdef UNICODE
  218. #define ConvertSecurityDescriptorToStringSecurityDescriptor  ConvertSecurityDescriptorToStringSecurityDescriptorW
  219. #else
  220. #define ConvertSecurityDescriptorToStringSecurityDescriptor  ConvertSecurityDescriptorToStringSecurityDescriptorA
  221. #endif // !UNICODE
  222. #endif /* _WIN32_WINNT >=  0x0500 */
  223. #ifdef __cplusplus
  224. }
  225. #endif
  226. #endif  // endif __SDDL_H__