Source code of Windows XP (NT5)
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.

146 lines
2.6 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. SepSddl.h
  5. Abstract:
  6. This header contains private information for processing SDDL strings
  7. in kernel mode. This file is meant to be included only by sesddl.c.
  8. Author:
  9. Adrian J. Oney - April 21, 2002
  10. Revision History:
  11. --*/
  12. //
  13. // Define the location of our various SIDs
  14. //
  15. #ifndef _KERNELIMPLEMENTATION_
  16. #define DEFINE_SDDL_ENTRY(Sid, Ver, Sddl, SddlLen) \
  17. { FIELD_OFFSET(SE_EXPORTS, Sid), Ver, Sddl, SddlLen }
  18. #else
  19. extern PSID SeServiceSid;
  20. extern PSID SeLocalServiceSid;
  21. extern PSID SeNetworkServiceSid;
  22. #define DEFINE_SDDL_ENTRY(Sid, Ver, Sddl, SddlLen) \
  23. { &##Sid, Sddl, SddlLen }
  24. #endif
  25. //
  26. // Local macros
  27. //
  28. #define SDDL_LEN_TAG( tagdef ) ( sizeof( tagdef ) / sizeof( WCHAR ) - 1 )
  29. // 64K-1
  30. #define SDDL_MAX_ACL_SIZE 0xFFFF
  31. //
  32. // This structure is used to do some lookups for mapping ACES
  33. //
  34. typedef enum {
  35. WIN2K_OR_LATER,
  36. WINXP_OR_LATER
  37. } OS_SID_VER;
  38. typedef struct _STRSD_KEY_LOOKUP {
  39. PWSTR Key;
  40. ULONG KeyLen;
  41. ULONG Value;
  42. } STRSD_KEY_LOOKUP, *PSTRSD_KEY_LOOKUP;
  43. //
  44. // This structure is used to map account monikers to sids
  45. //
  46. typedef struct _STRSD_SID_LOOKUP {
  47. #ifndef _KERNELIMPLEMENTATION_
  48. ULONG_PTR ExportSidFieldOffset;
  49. OS_SID_VER OsVer;
  50. #else
  51. PSID *Sid;
  52. #endif
  53. WCHAR Key[SDDL_ALIAS_SIZE+2];
  54. ULONG KeyLen;
  55. } STRSD_SID_LOOKUP, *PSTRSD_SID_LOOKUP;
  56. //
  57. // Functions private to sddl.c
  58. //
  59. NTSTATUS
  60. SepSddlSecurityDescriptorFromSDDLString(
  61. IN LPCWSTR SecurityDescriptorString,
  62. IN LOGICAL SuppliedByDefaultMechanism,
  63. OUT PSECURITY_DESCRIPTOR *SecurityDescriptor
  64. );
  65. NTSTATUS
  66. SepSddlDaclFromSDDLString(
  67. IN LPCWSTR StringSecurityDescriptor,
  68. IN LOGICAL SuppliedByDefaultMechanism,
  69. OUT ULONG *SecurityDescriptorControlFlags,
  70. OUT PACL *DiscretionaryAcl
  71. );
  72. NTSTATUS
  73. SepSddlGetSidForString(
  74. IN PWSTR String,
  75. OUT PSID *SID,
  76. OUT PWSTR *End
  77. );
  78. LOGICAL
  79. SepSddlLookupAccessMaskInTable(
  80. IN PWSTR String,
  81. OUT ULONG *AccessMask,
  82. OUT PWSTR *End
  83. );
  84. NTSTATUS
  85. SepSddlGetAclForString(
  86. IN PWSTR AclString,
  87. OUT PACL *Acl,
  88. OUT PWSTR *End
  89. );
  90. NTSTATUS
  91. SepSddlAddAceToAcl(
  92. IN OUT PACL *Acl,
  93. IN OUT ULONG *TrueAclSize,
  94. IN ULONG AceType,
  95. IN ULONG AceFlags,
  96. IN ULONG AccessMask,
  97. IN ULONG RemainingAces,
  98. IN PSID SidPtr
  99. );
  100. #ifndef _KERNELIMPLEMENTATION_
  101. LOGICAL
  102. SepSddlParseWideStringUlong(
  103. IN LPCWSTR Buffer,
  104. OUT LPCWSTR *FinalPosition,
  105. OUT ULONG *Value
  106. );
  107. #endif // _KERNELIMPLEMENTATION_