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.

63 lines
1.8 KiB

  1. //+--------------------------------------------------------------------------
  2. // File: prvlg.h
  3. // Contents: privilege manager declaration
  4. //---------------------------------------------------------------------------
  5. #include <ntsecapi.h>
  6. namespace CertSrv
  7. {
  8. // define event
  9. class CPrivilegeManager
  10. {
  11. public:
  12. CPrivilegeManager() :
  13. m_lsah(NULL),
  14. m_pAddPrivilegeBackup(NULL),
  15. m_pAddPrivilegeAudit(NULL),
  16. m_pRemovePrivilegeBackup(NULL),
  17. m_pRemovePrivilegeAudit(NULL) {};
  18. ~CPrivilegeManager()
  19. {
  20. if(m_pAddPrivilegeBackup)
  21. LocalFree(m_pAddPrivilegeBackup);
  22. if(m_pAddPrivilegeAudit)
  23. LocalFree(m_pAddPrivilegeAudit);
  24. if(m_pRemovePrivilegeBackup)
  25. LocalFree(m_pRemovePrivilegeBackup);
  26. if(m_pRemovePrivilegeAudit)
  27. LocalFree(m_pRemovePrivilegeAudit);
  28. }
  29. HRESULT ComputePrivilegeChanges(
  30. const PSECURITY_DESCRIPTOR pOldSD,
  31. const PSECURITY_DESCRIPTOR pNewSD);
  32. HRESULT UpdatePrivileges();
  33. protected:
  34. HRESULT OpenPolicy();
  35. HRESULT ClosePolicy();
  36. HRESULT AddPrivilege(const PSID pSid, DWORD dwRole);
  37. HRESULT RemovePrivilege(const PSID pSid, DWORD dwRole);
  38. void GetPrivilegeString(
  39. DWORD dwRole,
  40. PLSA_UNICODE_STRING &plsastr,
  41. ULONG &cstr);
  42. HRESULT InitBuffer(PACCESS_ALLOWED_ACE **buffer, DWORD cAce);
  43. LSA_HANDLE m_lsah;
  44. PACCESS_ALLOWED_ACE *m_pAddPrivilegeBackup;
  45. PACCESS_ALLOWED_ACE *m_pAddPrivilegeAudit;
  46. PACCESS_ALLOWED_ACE *m_pRemovePrivilegeBackup;
  47. PACCESS_ALLOWED_ACE *m_pRemovePrivilegeAudit;
  48. DWORD m_cOldAce, m_cNewAce;
  49. static LSA_UNICODE_STRING m_lsaSecurityPrivilege[];
  50. static LSA_UNICODE_STRING m_lsaBackupRestorePrivilege[];
  51. }; // class CPrivilegeManager
  52. } // namespace CertSrv