Leaked source code of windows server 2003
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
1.5 KiB

  1. // Class to enumerate Domain Controllers
  2. // Copyright (c) 2001 Microsoft Corporation
  3. // Nov 2001 lucios
  4. // This class is an informal gathering of all
  5. // that is necessary to enummerate domain controllers
  6. // in order to fix the bug 472876
  7. // NTRAID#NTBUG9-472876-2001/11/30-lucios
  8. #include <string>
  9. #include <set>
  10. #include <comdef.h>
  11. #include <ntldap.h>
  12. #include <atlbase.h>
  13. using namespace std;
  14. // This class is only for hiding the details
  15. // of enumerating domain controllers.
  16. class enumNCsAux
  17. {
  18. private:
  19. static
  20. HRESULT
  21. connectToRootDse(IADs** pDSO);
  22. static
  23. HRESULT
  24. getProperty(const wstring &name,CComVariant &property,IADs *pADObj);
  25. static
  26. HRESULT
  27. getStringProperty(const wstring &name,wstring &property,IADs *pADObj);
  28. static
  29. HRESULT
  30. getLongProperty(const wstring &name,long &property,IADs *pADObj);
  31. static
  32. HRESULT
  33. getConfigurationDn(wstring &confDn,IADs *pDSO);
  34. static
  35. HRESULT
  36. getContainer(const wstring &path,IADsContainer **pCont);
  37. static
  38. HRESULT
  39. getObjectClass
  40. (
  41. wstring &className,
  42. IADs *IADsObj
  43. );
  44. static
  45. HRESULT
  46. getIADsFromDispatch
  47. (
  48. const CComVariant &dispatchVar,
  49. IADs **ppiIADsObj
  50. );
  51. static
  52. HRESULT
  53. enumNCsAux::getContainerEnumerator
  54. (
  55. IADsContainer *pPart,
  56. IEnumVARIANT **spEnum
  57. );
  58. public:
  59. static
  60. HRESULT
  61. enumerateNCs(set<wstring> &ncs);
  62. };