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.

76 lines
2.6 KiB

  1. // UserRights.h : Declaration of the CUserRights
  2. #ifndef __USERRIGHTS_H_
  3. #define __USERRIGHTS_H_
  4. #include "resource.h" // main symbols
  5. #include <comdef.h>
  6. #include "ntsecapi.h"
  7. #include "CommaLog.hpp"
  8. class PrivNode;
  9. class PrivList;
  10. /////////////////////////////////////////////////////////////////////////////
  11. // CUserRights
  12. class ATL_NO_VTABLE CUserRights :
  13. public CComObjectRootEx<CComSingleThreadModel>,
  14. public CComCoClass<CUserRights, &CLSID_UserRights>,
  15. public IDispatchImpl<IUserRights, &IID_IUserRights, &LIBID_MCSDCTWORKEROBJECTSLib>
  16. {
  17. BOOL m_bNoChange;
  18. BOOL m_bUseDisplayName;
  19. BOOL m_bRemove;
  20. _bstr_t m_SourceComputer;
  21. _bstr_t m_TargetComputer;
  22. LSA_HANDLE m_SrcPolicy;
  23. LSA_HANDLE m_TgtPolicy;
  24. public:
  25. CUserRights()
  26. {
  27. m_bNoChange = FALSE;
  28. m_bUseDisplayName = FALSE;
  29. m_bRemove = FALSE;
  30. m_SrcPolicy = 0;
  31. m_TgtPolicy = 0;
  32. }
  33. ~CUserRights();
  34. DECLARE_REGISTRY_RESOURCEID(IDR_USERRIGHTS)
  35. DECLARE_NOT_AGGREGATABLE(CUserRights)
  36. DECLARE_PROTECT_FINAL_CONSTRUCT()
  37. BEGIN_COM_MAP(CUserRights)
  38. COM_INTERFACE_ENTRY(IUserRights)
  39. COM_INTERFACE_ENTRY(IDispatch)
  40. END_COM_MAP()
  41. // IUserRights
  42. public:
  43. STDMETHOD(GetRightsOfUser)(BSTR server, BSTR user, SAFEARRAY ** rights);
  44. STDMETHOD(GetUsersWithRight)(BSTR server, BSTR right, /*[out]*/ SAFEARRAY ** users);
  45. STDMETHOD(GetRights)(BSTR server, /*[out]*/ SAFEARRAY ** rights);
  46. STDMETHOD(RemoveUserRight)(BSTR server, BSTR username, BSTR right);
  47. STDMETHOD(AddUserRight)(BSTR server, BSTR username, BSTR right);
  48. STDMETHOD(ExportUserRights)(BSTR server, BSTR filename, BOOL bAppendToFile);
  49. STDMETHOD(get_RemoveOldRightsFromTargetAccounts)(/*[out, retval]*/ BOOL *pVal);
  50. STDMETHOD(put_RemoveOldRightsFromTargetAccounts)(/*[in]*/ BOOL newVal);
  51. STDMETHOD(get_NoChange)(/*[out, retval]*/ BOOL *pVal);
  52. STDMETHOD(put_NoChange)(/*[in]*/ BOOL newVal);
  53. STDMETHOD(CopyUserRights)(BSTR sourceUserName, BSTR targetUserName);
  54. STDMETHOD(OpenTargetServer)(BSTR computerName);
  55. STDMETHOD(OpenSourceServer)(BSTR serverName);
  56. STDMETHOD(CopyUserRightsWithSids)(BSTR sourceUserName, BSTR sourceSID,BSTR targetUserName,BSTR targetSID);
  57. protected:
  58. DWORD CopyUserRightsInternal(WCHAR * sourceUserName,WCHAR * tgtUserName, WCHAR * sourceSid, WCHAR * targetSid,BOOL noChange, BOOL remove);
  59. DWORD EnumerateAccountsWithRight(LSA_HANDLE policy, WCHAR * server,LSA_UNICODE_STRING * pRight, CommaDelimitedLog * pLog);
  60. DWORD SafeArrayFromPrivList(PrivList * privList, SAFEARRAY ** pArray);
  61. };
  62. #endif //__USERRIGHTS_H_