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.

117 lines
6.4 KiB

  1. // IManageDB.h : Declaration of the CIManageDB
  2. #ifndef __IMANAGEDB_H_
  3. #define __IMANAGEDB_H_
  4. #include "resource.h" // main symbols
  5. #include "EaLen.hpp"
  6. #include "TReg.hpp"
  7. #include "Err.hpp"
  8. #include "ResStr.h"
  9. //#import "\bin\mcsvarsetmin.tlb" no_namespace
  10. #import "VarSet.tlb" no_namespace rename("property", "aproperty")
  11. #import "msado21.tlb" no_namespace no_implementation rename("EOF", "EndOfFile")
  12. #import "msadox.dll" no_implementation exclude("DataTypeEnum")
  13. //#import <msjro.dll> no_namespace no_implementation
  14. const _bstr_t sKeyBase = L"Software\\Mission Critical Software\\DomainAdmin";
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CIManageDB
  17. typedef struct x
  18. {
  19. _bstr_t sReportName;
  20. _bstr_t arReportFields[10];
  21. int arReportSize[10];
  22. int colsFilled;
  23. } reportStruct;
  24. class ATL_NO_VTABLE CIManageDB :
  25. public CComObjectRootEx<CComMultiThreadModel>,
  26. public CComCoClass<CIManageDB, &CLSID_IManageDB>,
  27. public ISupportErrorInfoImpl<&IID_IIManageDB>,
  28. public IDispatchImpl<IIManageDB, &IID_IIManageDB, &LIBID_DBMANAGERLib>
  29. {
  30. public:
  31. CIManageDB();
  32. ~CIManageDB();
  33. HRESULT FinalConstruct();
  34. void FinalRelease();
  35. DECLARE_REGISTRY_RESOURCEID(IDR_IMANAGEDB)
  36. DECLARE_PROTECT_FINAL_CONSTRUCT()
  37. BEGIN_COM_MAP(CIManageDB)
  38. COM_INTERFACE_ENTRY(IIManageDB)
  39. COM_INTERFACE_ENTRY(IDispatch)
  40. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  41. END_COM_MAP()
  42. // IIManageDB
  43. public:
  44. STDMETHOD(GetUserProps)(/*[in]*/ BSTR sDom, /*[in]*/ BSTR sSam, /*[in,out]*/ IUnknown ** ppVs);
  45. STDMETHOD(SaveUserProps)(IUnknown * pVs);
  46. STDMETHOD(GetMigratedObjectBySourceDN)(/*[in]*/ BSTR sSourceDN, /*[in,out]*/ IUnknown ** ppUnk);
  47. STDMETHOD(GetActionHistoryKey)(/*[in]*/ long lActionID, /*[in]*/ BSTR sKeyName, /*[in,out]*/ VARIANT * pVar);
  48. STDMETHOD(AreThereAnyMigratedObjects)(/*[out]*/ long * count);
  49. STDMETHOD(CloseAccountsTable)();
  50. STDMETHOD(OpenAccountsTable)(/*[in]*/ LONG bSource);
  51. STDMETHOD(AddSourceObject)(/*[in]*/ BSTR sDomain, /*[in]*/ BSTR sSAMName, /*[in]*/ BSTR sType, /*[in]*/ BSTR sRDN, /*[in]*/ BSTR sCanonicalName, /*[in]*/ LONG bSource);
  52. STDMETHOD(AddAcctRef)(/*[in]*/ BSTR sDomain, /*[in]*/ BSTR sAcct, /*[in]*/ BSTR sAcctSid, /*[in]*/ BSTR sComp, /*[in]*/ long lCount, /*[in]*/ BSTR sType);
  53. STDMETHOD(CancelDistributedAction)(/*[in]*/ long lActionID, /*[in]*/ BSTR sComp);
  54. STDMETHOD(SetDistActionStatus)(/*[in]*/ long lActionID, /*[in]*/ BSTR sComp, /*[in]*/ long lStatus, BSTR sText);
  55. STDMETHOD(SetServiceAcctEntryStatus)(/*[in]*/ BSTR sComp, /*[in]*/ BSTR sSvc, /*[in]*/ BSTR sAcct, /*[in]*/ long Status);
  56. STDMETHOD(GetPasswordAge)(/*[in]*/ BSTR sDomain, /*[in]*/ BSTR sComp, /*[out]*/ BSTR * sDesc, /*[out]*/ long * lAge, /*[out]*/ long *lTime);
  57. STDMETHOD(SavePasswordAge)(/*[in]*/ BSTR sDomain, /*[in]*/ BSTR sComp, /*[in]*/ BSTR sDesc, /*[in]*/ long lAge);
  58. STDMETHOD(GetServiceAccount)(/*[in]*/ BSTR Account, /*[in,out]*/ IUnknown ** pUnk);
  59. STDMETHOD(SetServiceAccount)(/*[in]*/ BSTR System, /*[in]*/ BSTR Service, /*[in]*/ BSTR ServiceDisplayName,/*[in]*/ BSTR Account);
  60. STDMETHOD(GetFailedDistributedActions)(/*[in]*/ long lActionID, /*[in,out]*/ IUnknown ** pUnk);
  61. STDMETHOD(AddDistributedAction)(/*[in]*/ BSTR sServerName, /*[in]*/ BSTR sResultFile, /*[in]*/ long lStatus, BSTR sText);
  62. STDMETHOD(GenerateReport)(/*[in]*/ BSTR sReportName, /*[in]*/ BSTR sFileName, /*[in]*/ BSTR sSrcDomain, /*[in]*/ BSTR sTgtDomain, /*[in]*/ LONG bSourceNT4);
  63. STDMETHOD(GetAMigratedObject)(/*[in]*/ BSTR sSrcSamName, /*[in]*/ BSTR sSrcDomain, /*[in]*/ BSTR sTgtDomain, /*[in,out]*/ IUnknown ** ppUnk);
  64. STDMETHOD(GetCurrentActionID)(/*[out]*/ long * pActionID);
  65. STDMETHOD(ClearSCMPasswords)();
  66. STDMETHOD(GetSCMPasswords)(/*[out]*/ IUnknown ** ppUnk);
  67. STDMETHOD(SaveSCMPasswords)(/*[in]*/ IUnknown * pUnk);
  68. STDMETHOD(GetRSForReport)(/*[in]*/ BSTR sReport, /*[out,retval]*/ IUnknown ** pprsData);
  69. STDMETHOD(GetMigratedObjects)(/*[in]*/ long lActionID, /*[in,out]*/ IUnknown ** ppUnk);
  70. STDMETHOD(SaveMigratedObject)(/*[in]*/ long lActionID, /*[in]*/ IUnknown * pUnk);
  71. STDMETHOD(GetNextActionID)(/*[out]*/ long * pActionID);
  72. STDMETHOD(GetActionHistory)(/*[in]*/ long lActionID, /*[in,out]*/ IUnknown ** ppUnk);
  73. STDMETHOD(SetActionHistory)(/*[in]*/ long lActionID, /*[in]*/ IUnknown * pUnk);
  74. STDMETHOD(GetSettings)(/*[in,out]*/ IUnknown ** ppUnk);
  75. STDMETHOD(GetVarsetFromDB)(/*[in]*/ BSTR sTable, /*[in,out]*/ IUnknown ** ppVarset, /*[in,optional]*/ VARIANT ActionID = _variant_t(-1L));
  76. STDMETHOD(SaveSettings)(/*[in]*/ IUnknown * pUnk );
  77. STDMETHOD(ClearTable)(/*[in]*/ BSTR sTableName, /*[in,optional]*/ VARIANT Filter = _variant_t(L""));
  78. STDMETHOD(SetVarsetToDB)(/*[in]*/ IUnknown * pUnk, /*[in]*/ BSTR sTableName, /*[in,optional]*/ VARIANT ActionID = _variant_t(-1L));
  79. STDMETHOD(GetAMigratedObjectToAnyDomain)(/*[in]*/ BSTR sSrcSamName, /*[in]*/ BSTR sSrcDomain, /*[in,out]*/ IUnknown ** ppUnk);
  80. STDMETHOD(SrcSidColumnInMigratedObjectsTable)(/*[out, retval]*/ VARIANT_BOOL * pbFound);
  81. STDMETHOD(GetMigratedObjectsFromOldMOT)(/*[in]*/ long lActionID, /*[in,out]*/ IUnknown ** ppUnk);
  82. STDMETHOD(CreateSrcSidColumnInMOT)(/*[out, retval]*/ VARIANT_BOOL * pbCreated);
  83. STDMETHOD(PopulateSrcSidColumnByDomain)(/*[in]*/ BSTR sDomainName, /*[in]*/ BSTR sSid, /*[out, retval]*/ VARIANT_BOOL * pbPopulated);
  84. STDMETHOD(DeleteSrcSidColumnInMOT)(/*[out, retval]*/ VARIANT_BOOL * pbDeleted);
  85. STDMETHOD(GetMigratedObjectsWithSSid)(/*[in]*/ long lActionID, /*[in,out]*/ IUnknown ** ppUnk);
  86. STDMETHOD(CreateSidColumnInAR)();
  87. STDMETHOD(SidColumnInARTable)(/*[out, retval]*/ VARIANT_BOOL * pbFound);
  88. STDMETHOD(GetMigratedObjectByType)(/*[in]*/ long lActionID, /*[in]*/ BSTR sSrcDomain, /*[in]*/ BSTR sType, /*[in,out]*/ IUnknown ** ppUnk);
  89. STDMETHOD(GetAMigratedObjectBySidAndRid)(/*[in]*/ BSTR sSrcDomainSid, /*[in]*/ BSTR sRid, /*[in,out]*/ IUnknown ** ppUnk);
  90. protected:
  91. HRESULT PutVariantInDB( _RecordsetPtr pRs, _variant_t val );
  92. HRESULT GetVarFromDB(_RecordsetPtr pRec, _variant_t& val);
  93. void UpgradeDatabase(LPCTSTR pszFolder);
  94. private:
  95. void RestoreVarset(IVarSetPtr pVS);
  96. void ClipVarset(IVarSetPtr pVS);
  97. HRESULT ChangeNCTableColumns(BOOL bSource);
  98. BOOL NCTablesColumnsChanged(BOOL bSource);
  99. _ConnectionPtr m_cn;
  100. _variant_t m_vtConn;
  101. void SetActionIDInMigratedObjects(_bstr_t sFilter);
  102. IVarSetPtr m_pQueryMapping;
  103. _RecordsetPtr m_rsAccounts;
  104. };
  105. #endif //__IMANAGEDB_H_