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.

530 lines
14 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. AuditDlg.hxx
  7. This dialog contains the definition for the Auditting dialogs
  8. FILE HISTORY:
  9. Johnl 29-Aug-1991 Created
  10. */
  11. #ifndef _AUDITDLG_HXX_
  12. #define _AUDITDLG_HXX_
  13. #define CID_AUDIT_BASE (CID_PERM_LAST)
  14. /* The checkbox control IDs must be in consecutive order.
  15. */
  16. #define MAX_AUDITS 9
  17. #define SLT_CHECK_TEXT_1 (CID_AUDIT_BASE+1)
  18. #define SLT_CHECK_TEXT_2 (CID_AUDIT_BASE+2)
  19. #define SLT_CHECK_TEXT_3 (CID_AUDIT_BASE+3)
  20. #define SLT_CHECK_TEXT_4 (CID_AUDIT_BASE+4)
  21. #define SLT_CHECK_TEXT_5 (CID_AUDIT_BASE+5)
  22. #define SLT_CHECK_TEXT_6 (CID_AUDIT_BASE+6)
  23. #define SLT_CHECK_TEXT_7 (CID_AUDIT_BASE+7)
  24. #define SLT_CHECK_TEXT_8 (CID_AUDIT_BASE+8)
  25. #define SLT_CHECK_TEXT_9 (CID_AUDIT_BASE+9)
  26. #define CHECK_AUDIT_S_1 (CID_AUDIT_BASE+21)
  27. #define CHECK_AUDIT_S_2 (CID_AUDIT_BASE+22)
  28. #define CHECK_AUDIT_S_3 (CID_AUDIT_BASE+23)
  29. #define CHECK_AUDIT_S_4 (CID_AUDIT_BASE+24)
  30. #define CHECK_AUDIT_S_5 (CID_AUDIT_BASE+25)
  31. #define CHECK_AUDIT_S_6 (CID_AUDIT_BASE+26)
  32. #define CHECK_AUDIT_S_7 (CID_AUDIT_BASE+27)
  33. #define CHECK_AUDIT_S_8 (CID_AUDIT_BASE+28)
  34. #define CHECK_AUDIT_S_9 (CID_AUDIT_BASE+29)
  35. /* Failed audit boxes */
  36. #define CHECK_AUDIT_F_1 (CID_AUDIT_BASE+31)
  37. #define CHECK_AUDIT_F_2 (CID_AUDIT_BASE+32)
  38. #define CHECK_AUDIT_F_3 (CID_AUDIT_BASE+33)
  39. #define CHECK_AUDIT_F_4 (CID_AUDIT_BASE+34)
  40. #define CHECK_AUDIT_F_5 (CID_AUDIT_BASE+35)
  41. #define CHECK_AUDIT_F_6 (CID_AUDIT_BASE+36)
  42. #define CHECK_AUDIT_F_7 (CID_AUDIT_BASE+37)
  43. #define CHECK_AUDIT_F_8 (CID_AUDIT_BASE+38)
  44. #define CHECK_AUDIT_F_9 (CID_AUDIT_BASE+39)
  45. #define FRAME_AUDIT_BOX (CID_AUDIT_BASE+41)
  46. #ifndef RC_INVOKED
  47. #include <bltdisph.hxx>
  48. #include <bltcc.hxx>
  49. #include <subjlb.hxx>
  50. #include "permdlg.hxx"
  51. #include <auditchk.hxx>
  52. /*************************************************************************
  53. NAME: SUBJ_AUDIT_LBI
  54. SYNOPSIS: This class is the class that the subject audit
  55. listbox contains.
  56. INTERFACE:
  57. PARENT: SUBJ_LBI
  58. USES: MASK_MAP, NLS_STR
  59. CAVEATS:
  60. NOTES:
  61. HISTORY:
  62. Johnl 20-Aug-1991 Created
  63. beng 08-Oct-1991 Win32 conversion
  64. **************************************************************************/
  65. class SUBJ_AUDIT_LBI : public SUBJ_LBI
  66. {
  67. private:
  68. AUDIT_PERMISSION * _pAuditPerm ;
  69. public:
  70. SUBJ_AUDIT_LBI( AUDIT_PERMISSION * pauditperm ) ;
  71. ~SUBJ_AUDIT_LBI() ;
  72. virtual void Paint( LISTBOX * plb, HDC hdc, const RECT * prect, GUILTT_INFO * pguiltt ) const ;
  73. AUDIT_PERMISSION * QueryAuditPerm( void ) const
  74. { return _pAuditPerm ; }
  75. } ;
  76. /*************************************************************************
  77. NAME: SUBJECT_AUDIT_LISTBOX
  78. SYNOPSIS: This listbox lists the users/groups and the associated
  79. permissions in the main permission dialog.
  80. INTERFACE:
  81. PARENT:
  82. USES:
  83. CAVEATS:
  84. NOTES:
  85. HISTORY:
  86. Johnl 20-Aug-1991 Created
  87. **************************************************************************/
  88. class SUBJECT_AUDIT_LISTBOX : public SUBJECT_LISTBOX
  89. {
  90. private:
  91. ACCPERM * _paccperm ;
  92. public:
  93. SUBJECT_AUDIT_LISTBOX( OWNER_WINDOW * pownerwin,
  94. CID cid,
  95. ACCPERM * paccperm ) ;
  96. ~SUBJECT_AUDIT_LISTBOX() ;
  97. virtual APIERR Fill( void ) ;
  98. void DeleteCurrentItem( void ) ;
  99. ACCPERM * QueryAccperm( void ) const
  100. { return _paccperm ; }
  101. DECLARE_LB_QUERY_ITEM( SUBJ_AUDIT_LBI ) ;
  102. } ;
  103. /*************************************************************************
  104. NAME: SUBJ_LB_AUDIT_GROUP
  105. SYNOPSIS: This class cooridinates actions between the Subject listbox
  106. and the permission name combo.
  107. INTERFACE:
  108. PARENT: CONTROL_GROUP
  109. USES:
  110. CAVEATS:
  111. NOTES: There is a synchronization that must be kept between the
  112. _psauditlbiCurrent member and the current selection of
  113. the listbox. CommitCurrent should be called before
  114. updating _psauditlbiCurrent.
  115. HISTORY:
  116. Johnl 13-Nov-1991 Created
  117. **************************************************************************/
  118. class SUBJ_LB_AUDIT_GROUP : public CONTROL_GROUP
  119. {
  120. private:
  121. //
  122. // TRUE if this group is currently enabled, FALSE otherwise. The group
  123. // becomes disabled when the listbox is emptied
  124. //
  125. BOOL _fEnabled ;
  126. SUBJECT_AUDIT_LISTBOX * _plbSubj ;
  127. PUSH_BUTTON * _pbuttonRemove ;
  128. SET_OF_AUDIT_CATEGORIES * _psetofauditcategories ;
  129. /* This is a pointer to the LBI that currently has focus in the listbox.
  130. * When the listbox selection changes, we "Commit" the current audits
  131. * to this guy, then set the new current selection.
  132. */
  133. SUBJ_AUDIT_LBI * _psauditlbiCurrent ;
  134. protected:
  135. virtual APIERR OnUserAction( CONTROL_WINDOW *, const CONTROL_EVENT & );
  136. SUBJ_AUDIT_LBI * QueryCurrentLBI( void )
  137. { return _psauditlbiCurrent ; }
  138. public:
  139. SUBJ_LB_AUDIT_GROUP( SUBJECT_AUDIT_LISTBOX * plbSubj,
  140. PUSH_BUTTON * pbuttonRemove,
  141. SET_OF_AUDIT_CATEGORIES * psetofauditcategories ) ;
  142. /* Set the current LBI that has the focus. This sets the internal members
  143. * and updates the set of audit categories to reflect the current settings.
  144. */
  145. APIERR SetCurrent( SUBJ_AUDIT_LBI * psubjauditlbiCurrent ) ;
  146. /* Updates _psauditlbiCurrent from the contents of _psetofauditcategories.
  147. * This is necessary because the SET_OF_AUDIT_CATEGORIES class doesn't
  148. * dynamically update the audit bitfields.
  149. */
  150. APIERR CommitCurrent( void ) ;
  151. void Enable( BOOL fEnable ) ;
  152. SUBJECT_AUDIT_LISTBOX * QuerySubjLB( void )
  153. { return _plbSubj ; }
  154. PUSH_BUTTON * QueryRemoveButton( void )
  155. { return _pbuttonRemove ; }
  156. SET_OF_AUDIT_CATEGORIES * QuerySetOfAuditCategories( void )
  157. { return _psetofauditcategories ; }
  158. BOOL IsEnabled( void )
  159. { return _fEnabled ; }
  160. } ;
  161. /*************************************************************************
  162. NAME: MULTI_SUBJ_AUDIT_BASE_DLG
  163. SYNOPSIS: This class is the base nt auditting dialog class. It provides
  164. the basic controls for all of the NT auditting dialogs.
  165. INTERFACE:
  166. PARENT: MAIN_PERM_BASE_DLG
  167. USES:
  168. CAVEATS: Changes made in the audit checkboxes do not take affect on the
  169. current subject until _subjlbauditGroup->CommitCurrent(). This
  170. means we need to watch for someone pressing the Add button,
  171. the OK button and changing the selection.
  172. We assume pressing the remove button is okay since you can
  173. only remove the current item (which shouldn't then need
  174. to be updated). If multi-select is supported, this will
  175. change.
  176. NOTES:
  177. HISTORY:
  178. Johnl 27-Sep-1991 Created
  179. **************************************************************************/
  180. class MULTI_SUBJ_AUDIT_BASE_DLG : public MULTI_SUBJ_PERM_BASE_DLG
  181. {
  182. private:
  183. SUBJECT_AUDIT_LISTBOX _subjLB ;
  184. /* The set of audit categories is essentially an array of AUDIT_CHECKBOXES
  185. * that will read and set the individual checkboxes given the appropriate
  186. * bitfields.
  187. */
  188. SET_OF_AUDIT_CATEGORIES _SetOfAudits ;
  189. /* Cooridinates actions between changing listbox selection and disabling
  190. * the remove button.
  191. */
  192. SUBJ_LB_AUDIT_GROUP _subjlbauditGroup ;
  193. protected:
  194. MULTI_SUBJ_AUDIT_BASE_DLG( const TCHAR * pszDialogName,
  195. HWND hwndParent,
  196. const TCHAR * pszDialogTitle,
  197. ACL_TO_PERM_CONVERTER * paclconv,
  198. const TCHAR * pszResourceType,
  199. const TCHAR * pszResourceName,
  200. const TCHAR * pszHelpFileName,
  201. ULONG * ahcMainDialog ) ;
  202. /* We hook these guys so we can "commit" the current selection before
  203. * the current item loses the selection bar.
  204. */
  205. virtual BOOL OnOK( void ) ;
  206. virtual APIERR OnAddSubject( void ) ;
  207. virtual void OnDeleteSubject( void ) ;
  208. public:
  209. void WrnIfAuditingIsOff(void);
  210. virtual APIERR Initialize( BOOL * pfUserQuit, BOOL fAccessPerms ) ;
  211. virtual ~MULTI_SUBJ_AUDIT_BASE_DLG() ;
  212. SUBJ_LB_AUDIT_GROUP * QuerySubjLBGroup( void )
  213. { return &_subjlbauditGroup ; }
  214. };
  215. /*************************************************************************
  216. NAME: CONT_AUDIT_DLG
  217. SYNOPSIS: This is the Container auditting dialog (for NT only).
  218. INTERFACE:
  219. PARENT: MULTI_SUBJ_AUDIT_BASE_DLG
  220. USES: CHECKBOX
  221. CAVEATS:
  222. NOTES:
  223. HISTORY:
  224. Johnl 27-Sep-1991 Created
  225. **************************************************************************/
  226. class CONT_AUDIT_DLG : public MULTI_SUBJ_AUDIT_BASE_DLG
  227. {
  228. private:
  229. CHECKBOX _checkAssignToContContents ;
  230. SLT_FONT _sltfontTreeApplyHelpText ;
  231. /* Pointer to confirmation string that is displayed to the user if the
  232. * Tree apply checkbox is checked.
  233. */
  234. const TCHAR * _pszTreeApplyConfirmation ;
  235. protected:
  236. virtual BOOL OnOK( void ) ;
  237. public:
  238. CONT_AUDIT_DLG( const TCHAR * pszDialogName,
  239. HWND hwndParent,
  240. const TCHAR * pszDialogTitle,
  241. ACL_TO_PERM_CONVERTER * paclconv,
  242. const TCHAR * pszResourceType,
  243. const TCHAR * pszResourceName,
  244. const TCHAR * pszHelpFileName,
  245. ULONG * ahcMainDialog,
  246. const TCHAR * pszAssignToContContentsTitle,
  247. const TCHAR * pszTreeApplyHelpText,
  248. const TCHAR * pszTreeApplyConfirmation ) ;
  249. virtual ~CONT_AUDIT_DLG() ;
  250. virtual BOOL IsAssignToExistingObjChecked( void ) ;
  251. BOOL IsAssignToExistingContChecked( void )
  252. { return _checkAssignToContContents.QueryCheck() ; }
  253. };
  254. /*************************************************************************
  255. NAME: OBJECT_AUDIT_DLG
  256. SYNOPSIS: This is the object auditting dialog (for NT only).
  257. The only difference between this dialog and the
  258. CONT_AUDIT_DLG is this dialog doesn't have
  259. a checkbox for applying tree permissions.
  260. INTERFACE:
  261. PARENT: MULTI_SUBJ_AUDIT_BASE_DLG
  262. USES:
  263. CAVEATS:
  264. NOTES:
  265. HISTORY:
  266. Johnl 27-Sep-1991 Created
  267. **************************************************************************/
  268. class OBJECT_AUDIT_DLG : public MULTI_SUBJ_AUDIT_BASE_DLG
  269. {
  270. public:
  271. OBJECT_AUDIT_DLG(
  272. const TCHAR * pszDialogName,
  273. HWND hwndParent,
  274. const TCHAR * pszDialogTitle,
  275. ACL_TO_PERM_CONVERTER * paclconv,
  276. const TCHAR * pszResourceType,
  277. const TCHAR * pszResourceName,
  278. const TCHAR * pszHelpFileName,
  279. ULONG * ahcMainDialog ) ;
  280. virtual ~OBJECT_AUDIT_DLG() ;
  281. };
  282. /*************************************************************************
  283. NAME: CONT_NEWOBJ_AUDIT_DLG
  284. SYNOPSIS: This is the Container auditting dialog that also supports
  285. object permissions (exactly the same as CONT_AUDIT_DLG except
  286. this guy has an "apply to existing objects" checkbox.
  287. INTERFACE:
  288. PARENT: CONT_AUDIT_DLG
  289. USES: CHECKBOX
  290. NOTES:
  291. HISTORY:
  292. Johnl 27-Sep-1991 Created
  293. **************************************************************************/
  294. class CONT_NEWOBJ_AUDIT_DLG : public CONT_AUDIT_DLG
  295. {
  296. private:
  297. CHECKBOX _checkAssignToObj ;
  298. public:
  299. CONT_NEWOBJ_AUDIT_DLG(
  300. const TCHAR * pszDialogName,
  301. HWND hwndParent,
  302. const TCHAR * pszDialogTitle,
  303. ACL_TO_PERM_CONVERTER * paclconv,
  304. const TCHAR * pszResourceType,
  305. const TCHAR * pszResourceName,
  306. const TCHAR * pszHelpFileName,
  307. ULONG * ahcMainDialog,
  308. const TCHAR * pszAssignToContContentsTitle,
  309. const TCHAR * pszAssignToObjTitle,
  310. const TCHAR * pszTreeApplyHelpText,
  311. const TCHAR * pszTreeApplyConfirmation ) ;
  312. virtual ~CONT_NEWOBJ_AUDIT_DLG() ;
  313. virtual BOOL IsAssignToExistingObjChecked( void ) ;
  314. };
  315. /*************************************************************************
  316. NAME: LM_AUDITTING_DLG
  317. SYNOPSIS: This is the LM Auditting dialog for both files and
  318. directories. If the resource being editted is a file,
  319. then the pszAssignToContContentsTitle should be NULL
  320. (thus the checkbox will be hidden).
  321. INTERFACE:
  322. PARENT:
  323. USES:
  324. CAVEATS:
  325. NOTES:
  326. HISTORY:
  327. Johnl 27-Sep-1991 Created
  328. **************************************************************************/
  329. class LM_AUDITTING_DLG : public MAIN_PERM_BASE_DLG
  330. {
  331. private:
  332. CHECKBOX _checkAssignToContContents ;
  333. SET_OF_AUDIT_CATEGORIES _SetOfAudits ;
  334. /* Pointer to confirmation string that is displayed to the user if the
  335. * Tree apply checkbox is checked.
  336. */
  337. const TCHAR * _pszTreeApplyConfirmation ;
  338. /* These point to the actual bit fields inside the AUDIT_PERMISSION.
  339. */
  340. BITFIELD * _pbitsSuccess ;
  341. BITFIELD * _pbitsFailed ;
  342. SLT_FONT _sltfontTreeApplyHelpText ;
  343. protected:
  344. virtual BOOL OnOK( void ) ;
  345. public:
  346. LM_AUDITTING_DLG( const TCHAR * pszDialogName,
  347. HWND hwndParent,
  348. const TCHAR * pszDialogTitle,
  349. ACL_TO_PERM_CONVERTER * paclconv,
  350. const TCHAR * pszResourceType,
  351. const TCHAR * pszResourceName,
  352. const TCHAR * pszHelpFileName,
  353. ULONG * ahcMainDialog,
  354. const TCHAR * pszAssignToContContentsTitle,
  355. const TCHAR * pszTreeApplyHelpText,
  356. const TCHAR * pszTreeApplyConfirmation ) ;
  357. virtual ~LM_AUDITTING_DLG() ;
  358. virtual APIERR Initialize( BOOL * pfUserQuit, BOOL fAccessPerms ) ;
  359. BOOL IsAssignToExistingContChecked( void )
  360. { return _checkAssignToContContents.QueryCheck() ; }
  361. };
  362. #endif // RC_INVOKED
  363. #endif // _AUDITDLG_HXX_