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.

62 lines
1.9 KiB

  1. #pragma once
  2. #include <memory>
  3. #include "Resource.h"
  4. #include "ADMTCrypt.h"
  5. //---------------------------------------------------------------------------
  6. // CPasswordMigration
  7. //---------------------------------------------------------------------------
  8. class ATL_NO_VTABLE CPasswordMigration :
  9. public CComObjectRootEx<CComSingleThreadModel>,
  10. public CComCoClass<CPasswordMigration, &CLSID_PasswordMigration>,
  11. public ISupportErrorInfoImpl<&IID_IPasswordMigration>,
  12. public IDispatchImpl<IPasswordMigration, &IID_IPasswordMigration, &LIBID_MsPwdMig>
  13. {
  14. public:
  15. CPasswordMigration();
  16. ~CPasswordMigration();
  17. DECLARE_REGISTRY_RESOURCEID(IDR_PASSWORDMIGRATION)
  18. DECLARE_NOT_AGGREGATABLE(CPasswordMigration)
  19. DECLARE_PROTECT_FINAL_CONSTRUCT()
  20. BEGIN_COM_MAP(CPasswordMigration)
  21. COM_INTERFACE_ENTRY(IPasswordMigration)
  22. COM_INTERFACE_ENTRY(IDispatch)
  23. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  24. END_COM_MAP()
  25. // IPasswordMigration
  26. STDMETHOD(EstablishSession)(BSTR bstrSourceServer, BSTR bstrTargetServer);
  27. STDMETHOD(CopyPassword)(BSTR bstrSourceAccount, BSTR bstrTargetAccount, BSTR bstrTargetPassword);
  28. STDMETHOD(GenerateKey)(BSTR bstrSourceDomainFlatName, BSTR bstrKeyFilePath, BSTR bstrPassword);
  29. protected:
  30. void GenerateKeyImpl(LPCTSTR pszDomain, LPCTSTR pszFile, LPCTSTR pszPassword);
  31. void CheckPasswordDC(LPCWSTR srcServer, LPCWSTR tgtServer);
  32. void CopyPasswordImpl(LPCTSTR pszSourceAccount, LPCTSTR pszTargetAccount, LPCTSTR pszPassword);
  33. static void GetDomainName(LPCTSTR pszServer, _bstr_t& strNameDNS, _bstr_t& strNameFlat);
  34. static BOOL IsEveryoneInPW2KCAGroup(LPCWSTR sTgtDomainDNS);
  35. static _bstr_t GetPathToPreW2KCAGroup();
  36. static BOOL DoesAnonymousHaveEveryoneAccess(LPCWSTR tgtServer);
  37. protected:
  38. bool m_bSessionEstablished;
  39. _bstr_t m_strSourceServer;
  40. _bstr_t m_strTargetServer;
  41. _bstr_t m_strSourceDomainDNS;
  42. _bstr_t m_strSourceDomainFlat;
  43. _bstr_t m_strTargetDomainDNS;
  44. _bstr_t m_strTargetDomainFlat;
  45. std::auto_ptr<CTargetCrypt> m_pTargetCrypt;
  46. };