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.

92 lines
2.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1998
  6. //
  7. // File: dcbufmgr.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef __DCBUFMGR_H__
  11. #define __DCBUFMGR_H__
  12. #include "afxmt.h" // CCriticalSection
  13. #include "ntdsapi.h" //PDS_DOMAIN_CONTROLLER_INFO_1
  14. #define WM_USER_GETDC_THREAD_DONE WM_USER + 200
  15. enum BUFFER_ENTRY_TYPE {
  16. BUFFER_ENTRY_TYPE_VALID = 0,
  17. BUFFER_ENTRY_TYPE_ERROR,
  18. BUFFER_ENTRY_TYPE_INPROGRESS
  19. };
  20. class CDCSITEINFO
  21. {
  22. public:
  23. CString m_csDomainName;
  24. DWORD m_cInfo;
  25. PDS_DOMAIN_CONTROLLER_INFO_1 m_pDCInfo;
  26. HRESULT m_hr;
  27. CDCSITEINFO();
  28. ~CDCSITEINFO();
  29. inline CString& GetDomainName() { return m_csDomainName; }
  30. inline DWORD GetNumOfInfo() { return m_cInfo; }
  31. inline PDS_DOMAIN_CONTROLLER_INFO_1 GetDCInfo() { return m_pDCInfo; }
  32. void SetEntry(LPCTSTR pszDomainName, DWORD cInfo, PVOID pDCInfo, HRESULT hr);
  33. enum BUFFER_ENTRY_TYPE GetEntryType();
  34. void ReSet();
  35. };
  36. class CDCBufferManager
  37. {
  38. private:
  39. LONG m_cRef; // instance reference count
  40. HWND m_hDlg; // the owner dialog which owns this instance
  41. LONG m_lContinue; // synchronization flag between owner dialog and all the related running threads
  42. CCriticalSection m_CriticalSection; // synchronize access to the buffer
  43. CMapStringToPtr m_map; // DomainName ==> PDCSITEINFO. The Buffer.
  44. void FreeBuffer();
  45. // constructor
  46. CDCBufferManager(HWND hDlg);
  47. // destructor
  48. ~CDCBufferManager();
  49. public:
  50. static HRESULT CreateInstance(
  51. IN HWND hDlg,
  52. OUT CDCBufferManager **ppDCBufferManager
  53. );
  54. LONG AddRef();
  55. LONG Release();
  56. void SignalExit();
  57. BOOL ShouldExit();
  58. HRESULT LoadInfo(
  59. IN PCTSTR pszDomainDnsName,
  60. OUT CDCSITEINFO **ppInfo
  61. );
  62. HRESULT AddInfo(
  63. IN PCTSTR pszDomainDnsName,
  64. IN DWORD cInfo,
  65. IN PVOID pDCInfo,
  66. IN HRESULT hr,
  67. OUT PVOID* ppv
  68. );
  69. void ThreadReport(
  70. IN PVOID ptr,
  71. IN HRESULT hr
  72. );
  73. HRESULT StartThread(
  74. IN PCTSTR pszDomainDnsName
  75. );
  76. };
  77. #endif // __DCBUFMGR_H__