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.

747 lines
28 KiB

  1. /**********************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1990-1999 **/
  4. /**********************************************************************/
  5. /*
  6. SEDAPI.h
  7. This File contains the prototypes and descriptions for the interface to
  8. the generic security editor dialogs for NT objects.
  9. FILE HISTORY:
  10. Johnl 02-Aug-1991 Created
  11. Johnl 27-Dec-1991 Updated to reflect reality
  12. JohnL 25-Feb-1992 Nuked NewObjValidMask (new obj use generic/stan.
  13. only, Added GENERIC_MAPPING param.
  14. Johnl 15-Jan-1993 Added CantRead flags, cleaned up comments
  15. */
  16. #ifndef _SEDAPI_H_
  17. #define _SEDAPI_H_
  18. #if _MSC_VER > 1000
  19. #pragma once
  20. #endif
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. //
  25. // The following are status codes indicating the state of the permissions on
  26. // the resource we are setting permissions for.
  27. //
  28. #define SED_STATUS_MODIFIED (1)
  29. #define SED_STATUS_NOT_MODIFIED (2)
  30. #define SED_STATUS_NOT_ALL_MODIFIED (3)
  31. #define SED_STATUS_FAILED_TO_MODIFY (4)
  32. //
  33. // Current Security editor revision level.
  34. //
  35. #define SED_REVISION (1)
  36. #define SED_REVISION1 (1)
  37. //
  38. // The following structure is for user help in the various dialogs. Each
  39. // use of the security editor (whether for files/directories, Registry, Printer
  40. // stuff etc.) will have its own set of permission names/capabilities, thus
  41. // each will require its own help file. This structure allows the client
  42. // of the security editor to specify which help files and which help
  43. // contexts should be used for each dialog.
  44. //
  45. typedef struct _SED_HELP_INFO
  46. {
  47. //
  48. // The name of the ".hlp" file to be passed to the help engine APIs.
  49. //
  50. LPWSTR pszHelpFileName ;
  51. //
  52. // An array of help contexts corresponding to each dialog.
  53. // Use the HC_ manifiests defined below to fill this array. The
  54. // manifests correspond to the following dialogs:
  55. //
  56. // HC_MAIN_DLG - First dialog brought up by the ACL editor
  57. // HC_SPECIAL_ACCESS_DLG - Container/object special access dialog
  58. // HC_NEW_ITEM_SPECIAL_ACCESS_DLG - New item special access dialog
  59. // (not needed for containers that do not support new item
  60. // permissions).
  61. // HC_ADD_USER_DLG - The "Add" dialog (brought up when the "Add..."
  62. // button is pressed).
  63. // HC_ADD_USER_MEMBERS_LG_DLG - The Local Group members dialog (brought
  64. // up from the "Members" button in the "Add" dialog)
  65. // HC_ADD_USER_MEMBERS_GG_DLG - The Global Group members dialog (brought
  66. // up from the "Members" button in the "Add" dialog).
  67. //
  68. ULONG aulHelpContext[7] ;
  69. } SED_HELP_INFO, *PSED_HELP_INFO ;
  70. #define HC_MAIN_DLG 0
  71. #define HC_SPECIAL_ACCESS_DLG 1
  72. #define HC_NEW_ITEM_SPECIAL_ACCESS_DLG 2
  73. #define HC_ADD_USER_DLG 3
  74. #define HC_ADD_USER_MEMBERS_LG_DLG 4 // Members Local Group Dialog
  75. #define HC_ADD_USER_MEMBERS_GG_DLG 5 // Members Global Group Dialog
  76. #define HC_ADD_USER_SEARCH_DLG 6 // Search Dialog
  77. //
  78. // This data type defines information related to a single class of object.
  79. // For example, a FILE object, or PRINT_QUEUE object would have a structure
  80. // like this defined.
  81. //
  82. typedef struct _SED_OBJECT_TYPE_DESCRIPTOR
  83. {
  84. //
  85. // The current revision level being used by the client. This is for
  86. // support in case structure definitions change. It should contain
  87. // the current revision supported.
  88. //
  89. UCHAR Revision ;
  90. //
  91. // Defines whether the object is a container or not.
  92. // TRUE indicates the object may contain other objects. Means the
  93. // user can Tree apply the permissions if desired.
  94. //
  95. BOOLEAN IsContainer;
  96. //
  97. // Defines whether "New Object" permissions can be assigned (i.e.,
  98. // a "New Object" is an object that will be created in the future).
  99. //
  100. // This field is ignored when editting Auditting information
  101. //
  102. BOOLEAN AllowNewObjectPerms ;
  103. //
  104. // This flag, if set to TRUE, will make the ACL editor map all specific
  105. // permissions in the security descriptor to the corresponding generic
  106. // permissions (using the passed generic mapping) and clear the mapped
  107. // specific bits.
  108. //
  109. // * Note that specific bits for Generic All will always *
  110. // * be mapped regardless of this flag (due to Full Control *
  111. // * in the special access dialogs). *
  112. //
  113. // Clients who only expose the Generic and Standard permissions will
  114. // generally set this flag to TRUE. If you are exposing the specific
  115. // bits (note you should not expose both specific and generic except for
  116. // Generic All) then this flag should be FALSE.
  117. //
  118. BOOLEAN MapSpecificPermsToGeneric ;
  119. //
  120. // The generic mapping for the container or object permissions.
  121. //
  122. // This is used for mapping the specific permissions to the generic
  123. // flags.
  124. //
  125. PGENERIC_MAPPING GenericMapping ;
  126. //
  127. // The generic mapping for the New Object permissions.
  128. //
  129. // This is used for mapping the specific permissions to the generic
  130. // flags for new object permissions (not used if AllowNewObjectPerms
  131. // is FALSE).
  132. //
  133. PGENERIC_MAPPING GenericMappingNewObjects ;
  134. //
  135. // The (localized) name of the object type.
  136. // For example, "File", "Print Job" or "Directory".
  137. //
  138. LPWSTR ObjectTypeName;
  139. //
  140. // The help information suitable for the type of object the Security
  141. // Editor will be operating on.
  142. //
  143. PSED_HELP_INFO HelpInfo ;
  144. //
  145. // The (localized) title to display if protection/auditting can be applied
  146. // to sub-objects/sub-containers. This is the Tree apply
  147. // checkbox title.
  148. //
  149. // This string will be presented with a checkbox before it.
  150. // If this box is checked, then the callback entry point
  151. // will be called with the ApplyToSubContainers flag set to TRUE.
  152. //
  153. // This field is ignored if the IsContainer field is FALSE.
  154. //
  155. // As an example of how this field is used, the File Manager may
  156. // specify the following string in the DIRECTORY object's
  157. // descriptor:
  158. //
  159. // "R&eplace Permissions on Subdirectories"
  160. //
  161. LPWSTR ApplyToSubContainerTitle;
  162. //
  163. // The (localized) title to display if protection/auditting can be applied
  164. // to sub-objects.
  165. //
  166. // This string will be presented with a checkbox before it.
  167. // If this box is checked, then the callback entry point
  168. // will be called with the ApplyTuSubObjects flag set to TRUE.
  169. //
  170. // This field is ignored if the IsContainer flag is FALSE or the
  171. // AllowNewObjectPerms flag is FALSE.
  172. //
  173. // As an example of how this field is used, the File Manager may
  174. // specify the following string in the DIRECTORY object's
  175. // descriptor:
  176. //
  177. // "Replace Permissions on Existing &Files"
  178. //
  179. LPWSTR ApplyToObjectsTitle;
  180. //
  181. // The (localized) text is presented in a confirmation message box
  182. // that is displayed to the user after the user has checked the
  183. // "ApplyToSubContainer" checkbox.
  184. //
  185. // This field is ignored if the IsContainer field is FALSE.
  186. //
  187. // For directories, this text might be:
  188. //
  189. // "Do you want to replace the permissions on all existing
  190. // files and subdirectories within %1?"
  191. //
  192. // %1 will be substituted by the Acl Editor with the object name
  193. // field (i.e., "C:\MyDirectory")
  194. //
  195. LPWSTR ApplyToSubContainerConfirmation ;
  196. //
  197. // The (localized) title to display in the "Type of Access" combo
  198. // that brings up the Special access dialog. This same title is
  199. // used for the title of this dialog except the "..." is stripped
  200. // from the end.
  201. //
  202. // This field is ignored if the System Acl editor was invoked.
  203. //
  204. // As an example of how this field is used, the File Manager may
  205. // specify the following string in the DIRECTORY object's
  206. // descriptor:
  207. //
  208. // "Special Directory Access..."
  209. //
  210. LPWSTR SpecialObjectAccessTitle ;
  211. //
  212. // The (localized) title to display in the "Type of Access" combo
  213. // that brings up the Special new object access dialog. This same title
  214. // is used for the title of this dialog except the "..." is stripped
  215. // from the end.
  216. //
  217. // This item is required if AllowNewObjectPerms is TRUE, it is ignored
  218. // if AllowNewObjectPerms is FALSE or we are editting a SACL.
  219. //
  220. // As an example of how this field is used, the file browser may
  221. // specify the following string in the DIRECTORY object's
  222. // descriptor:
  223. //
  224. // "Special File Access..."
  225. //
  226. LPWSTR SpecialNewObjectAccessTitle ;
  227. } SED_OBJECT_TYPE_DESCRIPTOR, *PSED_OBJECT_TYPE_DESCRIPTOR;
  228. //
  229. // It is desirable to display access names that are
  230. // meaningful in the context of the type of object whose ACL
  231. // is being worked on. For example, for a PRINT_QUEUE object type,
  232. // it may be desirable to display an access type named "Submit Print Jobs".
  233. // The following structures are used for defining these application defined
  234. // access groupings that appear in the "Type of access" combobox and the
  235. // Special Access dialogs.
  236. //
  237. //
  238. // The following are the different permission description types that the user
  239. // will manipulate for setting permissions.
  240. //
  241. // SED_DESC_TYPE_RESOURCE - The SED_APPLICATION_ACCESS structure is describing
  242. // an object or container permission that will be displayed in the main
  243. // permissions listbox. These should be the permissions that the
  244. // user will use all the time and will generally be a conglomeration
  245. // of permissions (for example, "Edit" which would include Read, Write
  246. // and possibly delete).
  247. //
  248. // SED_DESC_TYPE_CONT_AND_NEW_OBJECT - The structure is describing a container
  249. // and new object permission that will be shown in the main permissions
  250. // listbox. The Container permission is contained in AccessMask1 and
  251. // the New Object resource is in AccessMask2. When the permission name
  252. // is selected by the user, the container access permissions *and* the
  253. // new object access permissions will be set to the corresponding access
  254. // mask. This is useful when inherittance can be used to set the New
  255. // Object Access permissions.
  256. //
  257. // SED_DESC_TYPE_RESOURCE_SPECIAL - The structure is describing an object
  258. // or container permissions that will be displayed in the Special
  259. // access dialog. These are generally generic/standard permissions (such as
  260. // Read, Write, Execute, Set Permissions etc.). The permission names
  261. // will appear next to checkboxes, thus they should have the "&"
  262. // accelerator next to the appropriate letter.
  263. //
  264. // SED_DESC_TYPE_NEW_OBJECT_SPECIAL - The structure is describing a new object
  265. // permission that will be shown in the Special New Object access
  266. // dialog. This is used the same way the SED_DESC_TYPE_RESOURCE_SPECIAL
  267. // type is used, that is, the permissions should be the primitive, per
  268. // bit permissions. The permission names
  269. // will appear next to checkboxes, thus they should have the "&"
  270. // accelerator next to the appropriate letter.
  271. //
  272. // SED_DESC_TYPE_AUDIT - The structure is describing an Audit access mask.
  273. // AccessMask1 contains the audit mask to be associated with the
  274. // permission title string. The title string will appear next to
  275. // a checkbox, thus they should have the "&" accelerator next to
  276. // the appropriate letter in the title string.
  277. //
  278. // Note that they cannot be freely intermixed, use the following table
  279. // as a guide for which ones to use where:
  280. //
  281. // IsContainer AllowNewObjectPerms
  282. // False False RESOURCE, RESOURCE_SPECIAL
  283. // True False RESOURCE, RESOURCE_SPECIAL
  284. // True True RESOURCE_SPECIAL, CONT_AND_NEW_OBJECT,
  285. // NEW_OBJECT_SPECIAL
  286. // True False SED_DESC_TYPE_AUDIT
  287. //
  288. // Note that in the third case (IsContainer && AllowNewObjectPerms) you
  289. // *cannot* use the RESOURCE permission description type, you must always
  290. // associate the permission on the resource with new object permissions.
  291. //
  292. #define SED_DESC_TYPE_RESOURCE (1)
  293. #define SED_DESC_TYPE_RESOURCE_SPECIAL (2)
  294. #define SED_DESC_TYPE_CONT_AND_NEW_OBJECT (3)
  295. #define SED_DESC_TYPE_NEW_OBJECT_SPECIAL (4)
  296. #define SED_DESC_TYPE_AUDIT (5)
  297. //
  298. // To describe the permissions to the ACL Editor, build an array consisting
  299. // of SED_APPLICATION_ACCESS structures. The use of each field is as follows:
  300. //
  301. // Type - Contains one of the SED_DESC_TYPE_* manifests, determines what the
  302. // rest of the fields in this structure mean. Specifically, if Type
  303. // equals:
  304. //
  305. // AccessMask1 AccessMask2 PermissionTitle
  306. // ============================================
  307. //SED_DESC_TYPE_RESOURCE Perm Not Used Name of this Perm
  308. //SED_DESC_TYPE_RESOURCE_SPECIAL Special Perm Not Used Name of this Perm
  309. //SED_DESC_TYPE_CONT_AND_NEW_OBJECT Perm Special Perm Name of this Perm
  310. //SED_DESC_TYPE_NEW_OBJECT_SPECIAL Special Perm Not Used Name of this Perm
  311. //SED_DESC_TYPE_AUDIT Audit Mask Not Used Name of this Audit mask
  312. //
  313. // AccessMask1 - Access mask to be associated with the PermissionTitle string,
  314. // see the table under Type for what this field contains.
  315. //
  316. // AccessMask2 - Either used for Special permissions or ignored.
  317. //
  318. // PermissionTitle - Title string this permission set is being associated with.
  319. typedef struct _SED_APPLICATION_ACCESS
  320. {
  321. UINT Type ;
  322. ACCESS_MASK AccessMask1 ;
  323. ACCESS_MASK AccessMask2 ;
  324. LPWSTR PermissionTitle ;
  325. } SED_APPLICATION_ACCESS, *PSED_APPLICATION_ACCESS;
  326. //
  327. // This can be used for AccessMask2 when dealing with containers that support
  328. // new object permissions and you need a SED_DESC_TYPE_CONT_AND_NEW_OBJECT
  329. // that doesn't have a new object permission.
  330. //
  331. #define ACCESS_MASK_NEW_OBJ_NOT_SPECIFIED (0xffffffff)
  332. typedef struct _SED_APPLICATION_ACCESSES
  333. {
  334. //
  335. // The count field indicates how many application defined access groupings
  336. // are defined by this data structure. The AccessGroup[] array then
  337. // contains that number of elements.
  338. //
  339. ULONG Count;
  340. PSED_APPLICATION_ACCESS AccessGroup ;
  341. //
  342. // The default permission that should be selected in in the
  343. // "Type of Access" combobox of the "Add" dialog. Should be one of
  344. // the SED_DESC_TYPE_RESOURCE permissions (i.e., what is shown in the
  345. // main dialog).
  346. //
  347. // The default permission for "Files" & "Directories" for example might
  348. // be:
  349. //
  350. // "Read"
  351. //
  352. LPWSTR DefaultPermName ;
  353. } SED_APPLICATION_ACCESSES, *PSED_APPLICATION_ACCESSES ;
  354. /*++
  355. Routine Description:
  356. This routine is provided by a caller of the graphical ACL editor.
  357. It is called by the ACL editor to apply security/auditting info to
  358. target object(s) when requested by the user.
  359. All error notification should be performed in this call. To dismiss
  360. the ACL Editor, return 0, otherwise return a non-zero error code.
  361. Parameters:
  362. hwndParent - Parent window handle to use for message boxes or subsequent
  363. dialogs.
  364. hInstance - Instance handle suitable for retrieving resources from the
  365. applications .exe or .dll.
  366. CallbackContext - This is the value passed as the CallbackContext argument
  367. to the SedDiscretionaryAclEditor() or SedSystemAclEditor api when
  368. the graphical editor was invoked.
  369. SecDesc - This parameter points to a security descriptor
  370. that should be applied to this object/container and optionally
  371. sub-containers if the user selects the apply to tree option.
  372. SecDescNewObjects - This parameter is used only when operating on a
  373. resource that is a container and supports new objects (for
  374. example, directories). If the user chooses the apply to tree option,
  375. then this security descriptor will have all of the "New Object"
  376. permission ACEs contained in the primary container and the inherit
  377. bits will be set appropriately.
  378. ApplyToSubContainers - When TRUE, indicates that Dacl/Sacl is to be applied
  379. to sub-containers of the target container as well as the target container.
  380. This will only be TRUE if the target object is a container object.
  381. ApplyToSubObjects - When TRUE, indicates the Dacl/Sacl is to be applied to
  382. sub-objects of the target object.
  383. The SecDescNewObjects should be used for applying the permissions
  384. in this instance.
  385. StatusReturn - This status flag indicates what condition the
  386. resources permissions were left in after an error occurred.
  387. SED_STATUS_MODIFIED - This (success) status code indicates the
  388. protection has successfully been modified.
  389. SED_STATUS_NOT_ALL_MODIFIED - This (warning) status code
  390. indicates an attempt to modify the resource permissions
  391. has only partially succeeded.
  392. SED_STATUS_FAILED_TO_MODIFY - This (error) status code indicates
  393. an attempt to modify the permissions has failed completely.
  394. Return Status:
  395. The return code is a standard Win32 error code. All errors that occur
  396. must be reported inside this function. If the return code is NO_ERROR,
  397. then the security editor will dismiss itself. If you do not wish the
  398. security editor dismissed, return a non-zero value (the actual value is
  399. ignored).
  400. --*/
  401. typedef DWORD (WINAPI *PSED_FUNC_APPLY_SEC_CALLBACK)(
  402. HWND hwndParent,
  403. HANDLE hInstance,
  404. ULONG_PTR CallbackContext,
  405. PSECURITY_DESCRIPTOR SecDesc,
  406. PSECURITY_DESCRIPTOR SecDescNewObjects,
  407. BOOLEAN ApplyToSubContainers,
  408. BOOLEAN ApplyToSubObjects,
  409. LPDWORD StatusReturn
  410. ) ;
  411. /*++
  412. Routine Description:
  413. This routine invokes the graphical Discretionary ACL editor DLL. The
  414. graphical DACL editor may be used to modify or create:
  415. - A default Discretionary ACL
  416. - A Discretionary ACL for a particular type of object.
  417. - A Discretionary ACL for a particular named instance of an
  418. object.
  419. Additionally, in the case where the ACl is that of a named object
  420. instance, and that object may contain other object instances, the
  421. user will be presented with the opportunity to apply the protection
  422. to the entire sub-tree of objects.
  423. If an error occurs, the user will be properly notified by the ACL
  424. editor.
  425. Parameters:
  426. Owner - Handle of the owner window the security editor should use for
  427. dialog creation and error messages. This will lock down the passed
  428. window.
  429. Instance - Instance handle of the application. This will be passed
  430. to the security editor callback where it can be used for retrieving
  431. any necessary resources such as message strings, dialog boxes etc.
  432. Server - The server name in the form "\\server" that the resource resides
  433. on. This is used for adding users, groups and aliases to the
  434. DACL and SACL. NULL indicates the local machine.
  435. ObjectType - This parameter is used to specify information
  436. about the type of object whose security is being edited.
  437. ApplicationAccesses - This parameter is used to specify
  438. groupings of access types when operating
  439. on security for the specified object type. For example, it may be
  440. useful to define an access type called "Submit Print Job" for a
  441. PRINT_QUEUE class of object.
  442. ObjectName - This optional parameter is used to pass the name of the
  443. object whose security is being edited.
  444. ApplySecurityCallbackRoutine - This parameter is used to provide the
  445. address of a routine to be called to apply security to either the
  446. object specified, or, in the case that the object is a container,
  447. to sub-containers or sub-non-containers of that object.
  448. CallbackContext - This value is opaque to the DACL editor. Its only
  449. purpose is so that a context value may be passed back to the
  450. application via the ApplySecurityCallbackRoutine when that routine
  451. is invoked. This may be used by the application to re-locate
  452. context related to the edit session. For example, it may be a
  453. handle to the object whose security is being edited.
  454. SecurityDescriptor - This parameter points to a security descriptor
  455. containing the current discretionary ACL of the object. This
  456. security descriptor may, but does not have to, contain the owner
  457. and group of that object as well. Note that the security descriptor's
  458. DaclPresent flag may be FALSE, indicating either that the object
  459. had no protection, or that the user couldn't read the protection.
  460. This security descriptor will not be modified by the ACL editor.
  461. This may be NULL, in which case, the user will be presented with
  462. an empty permission list.
  463. CouldntReadDacl - This boolean flag is used to indicate that the
  464. user does not have read access to the target object's discretionary
  465. acl. In this case, a warning
  466. to the user will be presented along with the option to continue
  467. or cancel.
  468. CantWriteDacl - This boolean flag is used to indicate that the user
  469. does not have write acces to the target object's discretionary
  470. acl (but does have read access). This invokes the editor in a
  471. read only mode that allows the user to view the security but not
  472. change it.
  473. Note that SACL access is determined by the SeSecurity privilege.
  474. If you have the privilege, then you can both read *and* write the
  475. SACL, if you do not have the privilege, you cannot read or write the
  476. SACL.
  477. SEDStatusReturn - This status flag indicates what condition the
  478. resources permissions were left in after the ACL editor was
  479. dismissed. It may be one of:
  480. SED_STATUS_MODIFIED - This (success) status code indicates the
  481. editor has been exited and protection has successfully been
  482. modified.
  483. SED_STATUS_NOT_MODIFIED - This (success) status code indicates
  484. the editor has been exited without attempting to modify the
  485. protection.
  486. SED_STATUS_NOT_ALL_MODIFIED - This (warning) status code indicates
  487. the user requested the protection to be modified, but an attempt
  488. to do so only partially succeeded. The user has been notified
  489. of this situation.
  490. SED_STATUS_FAILED_TO_MODIFY - This (error) status code indicates
  491. the user requested the protection to be modified, but an
  492. attempt to do so has failed. The user has been notified of
  493. this situation.
  494. Flags - Should be zero.
  495. Return Code:
  496. A standard windows error return such as ERROR_NOT_ENOUGH_MEMORY. This
  497. means the ACL editor was never displayed. The user will be notified
  498. of the error before this procedure returns.
  499. --*/
  500. DWORD WINAPI
  501. SedDiscretionaryAclEditor(
  502. HWND Owner,
  503. HANDLE Instance,
  504. LPWSTR Server,
  505. PSED_OBJECT_TYPE_DESCRIPTOR ObjectType,
  506. PSED_APPLICATION_ACCESSES ApplicationAccesses,
  507. LPWSTR ObjectName,
  508. PSED_FUNC_APPLY_SEC_CALLBACK ApplySecurityCallbackRoutine,
  509. ULONG_PTR CallbackContext,
  510. PSECURITY_DESCRIPTOR SecurityDescriptor,
  511. BOOLEAN CouldntReadDacl,
  512. BOOLEAN CantWriteDacl,
  513. LPDWORD SEDStatusReturn,
  514. DWORD Flags
  515. ) ;
  516. //
  517. // The parameters for the SACL editor are exactly the same except where
  518. // noted as that of the SedDiscretionaryAclEditor.
  519. //
  520. DWORD WINAPI
  521. SedSystemAclEditor(
  522. HWND Owner,
  523. HANDLE Instance,
  524. LPWSTR Server,
  525. PSED_OBJECT_TYPE_DESCRIPTOR ObjectType,
  526. PSED_APPLICATION_ACCESSES ApplicationAccesses,
  527. LPWSTR ObjectName,
  528. PSED_FUNC_APPLY_SEC_CALLBACK ApplySecurityCallbackRoutine,
  529. ULONG_PTR CallbackContext,
  530. PSECURITY_DESCRIPTOR SecurityDescriptor,
  531. BOOLEAN CouldntEditSacl,
  532. LPDWORD SEDStatusReturn,
  533. DWORD Flags
  534. ) ;
  535. /*++
  536. Routine Description:
  537. This routine invokes the take ownership dialog which is used
  538. to view and/or set the owner of a security descriptor. The current owner
  539. is displayed along with an optional button for the currently logged
  540. on user to take ownership.
  541. If an error occurs, the user will be properly notified by the API.
  542. Parameters:
  543. Owner - Handle of the owner window the security editor should use for
  544. dialog creation and error messages. This will lock down the passed
  545. window.
  546. Instance - Instance handle of the application. This will be passed
  547. to the security editor callback where it can be used for retrieving
  548. any necessary resources such as message strings, dialog boxes etc.
  549. Server - The server name in the form "\\server" that the resource resides
  550. on. NULL indicates the local machine.
  551. ObjectTypeName - NT Resource type of object the user wants to look
  552. at the owner of.
  553. Examples for this parameter would be "File", "Directory"
  554. or "Files/Directories".
  555. ObjectName - This parameter is used to pass the name of the
  556. object whose security is being edited. This might be
  557. "C:\status.doc" or some other qualified name.
  558. CountOfObjects - The number of objects the user wants to change permissions
  559. on. If this number is greater then one, then the ObjectName is
  560. ignored and a message of the form "%d ObjectTypeName Selected".
  561. ApplySecurityCallbackRoutine - This parameter is used to provide the
  562. address of a routine to be called to apply the new security
  563. descriptor. The flags in the PSED_FUNC_APPLY_SEC_CALLBACK
  564. type are not used.
  565. CallbackContext - This value is opaque to this API. Its only
  566. purpose is so that a context value may be passed back to the
  567. application via the ApplySecurityCallbackRoutine when that routine
  568. is invoked. This may be used by the application to re-locate
  569. context related to the edit session. For example, it may be a
  570. handle to the object whose security is being edited.
  571. SecurityDescriptor - This parameter points to a security descriptor
  572. containing the current owner and group. May be NULL.
  573. CouldntReadOwner - This boolean flag may be used to indicate that the
  574. user does not have read access to the target object's owner/group
  575. SID. In this case, a warning
  576. to the user will be presented along with the option to continue
  577. or cancel.
  578. CantWriteOwner - The boolean flag may be used to indicate that the user
  579. does not have write access to the target object's owner/group SID.
  580. SEDStatusReturn - This status flag indicates what condition the
  581. resources security descriptor were left in after the take ownership
  582. dialog was dismissed. It may be one of:
  583. SED_STATUS_MODIFIED - This (success) status code indicates the
  584. dialog has been exited and the new owner has successfully been
  585. modified.
  586. SED_STATUS_NOT_MODIFIED - This (success) status code indicates
  587. the dialog has been exited without attempting to modify the
  588. owner.
  589. SED_STATUS_NOT_ALL_MODIFIED - This (warning) status code indicates
  590. the user requested the owner to be modified, but an attempt
  591. to do so only partially succeeded. The user has been notified
  592. of this situation.
  593. SED_STATUS_FAILED_TO_MODIFY - This (error) status code indicates
  594. the user requested the owner to be modified, but an
  595. attempt to do so has failed. The user has been notified of
  596. this situation.
  597. Flags - Should be zero.
  598. Return Code:
  599. A standard windows error return such as ERROR_NOT_ENOUGH_MEMORY. This
  600. means the dialog was never displayed. The user will be notified
  601. of the error before this procedure returns.
  602. --*/
  603. DWORD WINAPI
  604. SedTakeOwnership(
  605. HWND Owner,
  606. HANDLE Instance,
  607. LPWSTR Server,
  608. LPWSTR ObjectTypeName,
  609. LPWSTR ObjectName,
  610. UINT CountOfObjects,
  611. PSED_FUNC_APPLY_SEC_CALLBACK ApplySecurityCallbackRoutine,
  612. ULONG_PTR CallbackContext,
  613. PSECURITY_DESCRIPTOR SecurityDescriptor,
  614. BOOLEAN CouldntReadOwner,
  615. BOOLEAN CantWriteOwner,
  616. LPDWORD SEDStatusReturn,
  617. PSED_HELP_INFO HelpInfo,
  618. DWORD Flags
  619. );
  620. #ifdef __cplusplus
  621. }
  622. #endif
  623. #endif //_SEDAPI_H_