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.

80 lines
2.3 KiB

  1. // Copyright (c) 1997-1999 Microsoft Corporation
  2. #ifndef __PRINCIPAL_H
  3. #define __PRINCIPAL_H
  4. // "generic" definition combining the perms from old and new security strategies.
  5. #define ACL_ENABLE 0x1 //NS_MethodStyle
  6. #define ACL_METHOD_EXECUTE 0x2 //NS_MethodStyle
  7. #define ACL_FULL_WRITE 0x4 //NS_MethodStyle
  8. #define ACL_PARTIAL_WRITE 0x8 //NS_MethodStyle
  9. #define ACL_PROVIDER_WRITE 0x10 //NS_MethodStyle
  10. #define ACL_REMOTE_ENABLE 0x20 //NS_MethodStyle
  11. #define ACL_READ_CONTROL 0x20000 //NS_MethodStyle
  12. #define ACL_WRITE_DAC 0x40000 //NS_MethodStyle & RootSecStyle:Edit Security
  13. #define ACL_INSTANCE_WRITE 0x40 //RootSecStyle
  14. #define ACL_CLASS_WRITE 0x80 //RootSecStyle
  15. #define ACL_MAX_BIT ACL_WRITE_DAC
  16. #define VALID_NSMETHOD_STYLE (ACL_ENABLE | ACL_METHOD_EXECUTE | ACL_FULL_WRITE | \
  17. ACL_PARTIAL_WRITE | ACL_PROVIDER_WRITE | ACL_READ_CONTROL | \
  18. ACL_WRITE_DAC)
  19. #define VALID_ROOTSEC_STYLE (ACL_INSTANCE_WRITE |\
  20. ACL_CLASS_WRITE | ACL_WRITE_DAC)
  21. #define ALLOW_COL 1
  22. #define DENY_COL 2
  23. #include "DataSrc.h"
  24. //------------------------------------------------------------------------
  25. class CPrincipal
  26. {
  27. public:
  28. typedef enum {
  29. RootSecStyle, // pre-M3
  30. NS_MethodStyle // M3+
  31. } SecurityStyle;
  32. // for initializing.
  33. CPrincipal(CWbemClassObject &userInst, SecurityStyle secStyle);
  34. // move m_perms into the checkboxes
  35. void LoadChecklist(HWND list, int OSType);
  36. // move the checkboxes into m_perms.
  37. void SaveChecklist(HWND list, int OSType);
  38. HRESULT Put(CWbemServices &service, CWbemClassObject &userInst);
  39. bool Changed(void)
  40. {
  41. return (m_origPerms != m_perms);
  42. };
  43. int GetImageIndex(void);
  44. void AddAce(CWbemClassObject &princ);
  45. HRESULT DeleteSelf(CWbemServices &service); // M1 targets only.
  46. TCHAR m_name[100];
  47. TCHAR m_domain[100];
  48. SecurityStyle m_secStyle;
  49. UINT m_SidType;
  50. bool m_editable;
  51. // perms mask for this principal (aka account)
  52. DWORD m_perms, m_origPerms, m_inheritedPerms;
  53. };
  54. //------------------------------------------------------------------------
  55. // An instance is attached to each item in the permissions list so they
  56. // can be matched up reliably.
  57. typedef struct
  58. {
  59. // Identifies the "generic" perm bit. Only set ONE bit.
  60. DWORD m_permBit;
  61. } CPermission;
  62. #endif __PRINCIPAL_H