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.

182 lines
7.8 KiB

  1. #ifndef _DSSEC_H_
  2. #define _DSSEC_H_
  3. #include <aclui.h> // LPSECURITYINFO
  4. //+---------------------------------------------------------------------------
  5. //
  6. // Function: PFNREADOBJECTSECURITY
  7. //
  8. // Synopsis: Reads the security descriptor of a DS object
  9. //
  10. // Arguments: [IN LPCWSTR] -- ADS path of DS Object
  11. // [IN SECURITY_INFORMATION] -- Which SD parts to read
  12. // [OUT PSECURITY_DESCRIPTOR*] -- Return SD here. Caller frees with LocalFree
  13. // [IN LPARAM] -- Context param
  14. //
  15. // Return: HRESULT
  16. //
  17. //----------------------------------------------------------------------------
  18. //
  19. // Function: PFNWRITEOBJECTSECURITY
  20. //
  21. // Synopsis: Writes a security descriptor to a DS object
  22. //
  23. // Arguments: [IN LPCWSTR] -- ADS path of DS Object
  24. // [IN SECURITY_INFORMATION] -- Which SD parts to write
  25. // [OUT PSECURITY_DESCRIPTOR] -- Security descriptor to write
  26. // [IN LPARAM] -- Context param
  27. //
  28. // Return: HRESULT
  29. //
  30. //----------------------------------------------------------------------------
  31. typedef HRESULT (WINAPI *PFNREADOBJECTSECURITY)(LPCWSTR, SECURITY_INFORMATION, PSECURITY_DESCRIPTOR*, LPARAM);
  32. typedef HRESULT (WINAPI *PFNWRITEOBJECTSECURITY)(LPCWSTR, SECURITY_INFORMATION, PSECURITY_DESCRIPTOR, LPARAM);
  33. //+---------------------------------------------------------------------------
  34. //
  35. // Function: DSCreateISecurityInfoObject
  36. //
  37. // Synopsis: Instantiates an ISecurityInfo interface for a DS object
  38. //
  39. // Arguments: [IN pwszObjectPath] -- Full ADS path of DS object
  40. // [IN pwszObjectClass] -- Class of the object (optional)
  41. // [IN dwFlags] -- Combination of DSSI_* flags
  42. // [OUT ppSI] -- Interface pointer returned here
  43. // [IN pfnReadSD] -- Optional function for reading SD
  44. // [IN pfnWriteSD] -- Optional function for writing SD
  45. // [IN LPARAM] -- Passed to pfnReadSD/pfnWriteSD
  46. //
  47. // Return: HRESULT
  48. //
  49. //----------------------------------------------------------------------------
  50. STDAPI
  51. DSCreateISecurityInfoObject(LPCWSTR pwszObjectPath,
  52. LPCWSTR pwszObjectClass,
  53. DWORD dwFlags,
  54. LPSECURITYINFO *ppSI,
  55. PFNREADOBJECTSECURITY pfnReadSD,
  56. PFNWRITEOBJECTSECURITY pfnWriteSD,
  57. LPARAM lpContext);
  58. // Flags for DSCreateISecurityInfoObject
  59. #define DSSI_READ_ONLY 0x00000001
  60. #define DSSI_NO_ACCESS_CHECK 0x00000002
  61. #define DSSI_NO_EDIT_SACL 0x00000004
  62. #define DSSI_NO_EDIT_OWNER 0x00000008
  63. #define DSSI_IS_ROOT 0x00000010
  64. #define DSSI_NO_FILTER 0x00000020
  65. #define DSSI_NO_READONLY_MESSAGE 0x00000040
  66. //
  67. // Same as above, with optional server, user & password arguments.
  68. // If use & password are not provided, ADSI defaults are used.
  69. // If the server is not provided, it is obtained from the object
  70. // path or DsGetDcName.
  71. //
  72. STDAPI
  73. DSCreateISecurityInfoObjectEx(LPCWSTR pwszObjectPath,
  74. LPCWSTR pwszObjectClass,
  75. LPCWSTR pwszServer,
  76. LPCWSTR pwszUserName,
  77. LPCWSTR pwszPassword,
  78. DWORD dwFlags,
  79. LPSECURITYINFO *ppSI,
  80. PFNREADOBJECTSECURITY pfnReadSD,
  81. PFNWRITEOBJECTSECURITY pfnWriteSD,
  82. LPARAM lpContext);
  83. //+---------------------------------------------------------------------------
  84. //
  85. // Function: DSCreateSecurityPage
  86. //
  87. // Synopsis: Creates a Security property page for a DS object
  88. //
  89. // Arguments: [IN pwszObjectPath] -- Full ADS path of DS object
  90. // [IN pwszObjectClass] -- Class of the object (optional)
  91. // [IN dwFlags] -- Combination of DSSI_* flags
  92. // [OUT phPage] -- HPROPSHEETPAGE returned here
  93. // [IN pfnReadSD] -- Optional function for reading SD
  94. // [IN pfnWriteSD] -- Optional function for writing SD
  95. // [IN LPARAM] -- Passed to pfnReadSD/pfnWriteSD
  96. //
  97. // Return: HRESULT
  98. //
  99. //----------------------------------------------------------------------------
  100. STDAPI
  101. DSCreateSecurityPage(LPCWSTR pwszObjectPath,
  102. LPCWSTR pwszObjectClass,
  103. DWORD dwFlags,
  104. HPROPSHEETPAGE *phPage,
  105. PFNREADOBJECTSECURITY pfnReadSD,
  106. PFNWRITEOBJECTSECURITY pfnWriteSD,
  107. LPARAM lpContext);
  108. //+---------------------------------------------------------------------------
  109. //
  110. // Function: DSEditSecurity
  111. //
  112. // Synopsis: Displays a modal dialog for editing security on a DS object
  113. //
  114. // Arguments: [IN hwndOwner] -- Dialog owner window
  115. // [IN pwszObjectPath] -- Full ADS path of DS object
  116. // [IN pwszObjectClass] -- Class of the object (optional)
  117. // [IN dwFlags] -- Combination of DSSI_* flags
  118. // [IN pwszCaption] -- Optional dialog caption
  119. // [IN pfnReadSD] -- Optional function for reading SD
  120. // [IN pfnWriteSD] -- Optional function for writing SD
  121. // [IN LPARAM] -- Passed to pfnReadSD/pfnWriteSD
  122. //
  123. // Return: HRESULT
  124. //
  125. //----------------------------------------------------------------------------
  126. STDAPI
  127. DSEditSecurity(HWND hwndOwner,
  128. LPCWSTR pwszObjectPath,
  129. LPCWSTR pwszObjectClass,
  130. DWORD dwFlags,
  131. LPCWSTR pwszCaption,
  132. PFNREADOBJECTSECURITY pfnReadSD,
  133. PFNWRITEOBJECTSECURITY pfnWriteSD,
  134. LPARAM lpContext);
  135. typedef HRESULT (WINAPI *PFNDSCREATEISECINFO)(LPCWSTR,
  136. LPCWSTR,
  137. DWORD,
  138. LPSECURITYINFO*,
  139. PFNREADOBJECTSECURITY,
  140. PFNWRITEOBJECTSECURITY,
  141. LPARAM);
  142. typedef HRESULT (WINAPI *PFNDSCREATEISECINFOEX)(LPCWSTR,
  143. LPCWSTR,
  144. LPCWSTR,
  145. LPCWSTR,
  146. LPCWSTR,
  147. DWORD,
  148. LPSECURITYINFO*,
  149. PFNREADOBJECTSECURITY,
  150. PFNWRITEOBJECTSECURITY,
  151. LPARAM);
  152. typedef HRESULT (WINAPI *PFNDSCREATESECPAGE)(LPCWSTR,
  153. LPCWSTR,
  154. DWORD,
  155. HPROPSHEETPAGE*,
  156. PFNREADOBJECTSECURITY,
  157. PFNWRITEOBJECTSECURITY,
  158. LPARAM);
  159. typedef HRESULT (WINAPI *PFNDSEDITSECURITY)(HWND,
  160. LPCWSTR,
  161. LPCWSTR,
  162. DWORD,
  163. LPCWSTR,
  164. PFNREADOBJECTSECURITY,
  165. PFNWRITEOBJECTSECURITY,
  166. LPARAM);
  167. #endif /* _DSSEC_H_ */