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.

172 lines
3.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 2000.
  5. //
  6. // File: cconnect.hxx
  7. //
  8. // Contents: Header for Connection Object - object that implements the
  9. // IUmiConnection interface.
  10. //
  11. // History: 03-03-00 AjayR Created.
  12. //
  13. //----------------------------------------------------------------------------
  14. #ifndef __CCONNECT_H__
  15. #define __CCONNECT_H__
  16. class CLDAPConObject : INHERIT_TRACKING,
  17. public IUmiConnection
  18. {
  19. public:
  20. //
  21. // IUknown support.
  22. //
  23. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) ;
  24. DECLARE_STD_REFCOUNTING
  25. //
  26. // IUmiConnection Methods.
  27. //
  28. STDMETHOD(Open)(
  29. IN IUmiURL *pURL,
  30. IN ULONG uFlags,
  31. IN REFIID TargetIID,
  32. OUT void **ppvRes
  33. );
  34. // IUmiBaseObject Methods (connection inherits from base object).
  35. //
  36. STDMETHOD(GetLastStatus)(
  37. IN ULONG uFlags,
  38. OUT ULONG *puSpecificStatus,
  39. IN REFIID riid,
  40. OUT LPVOID *pStatusObj
  41. );
  42. STDMETHOD(GetInterfacePropList)(
  43. IN ULONG uFlags,
  44. OUT IUmiPropList **pPropList
  45. );
  46. //
  47. // IUmiPropList Methods (base object inherits from proplist).
  48. //
  49. STDMETHOD(Put)(
  50. IN LPCWSTR pszName,
  51. IN ULONG uFlags,
  52. OUT UMI_PROPERTY_VALUES *pProp
  53. );
  54. STDMETHOD(Get)(
  55. IN LPCWSTR pszName,
  56. IN ULONG uFlags,
  57. OUT UMI_PROPERTY_VALUES **pProp
  58. );
  59. STDMETHOD(GetAt)(
  60. IN LPCWSTR pszName,
  61. IN ULONG uFlags,
  62. IN ULONG uBufferLength,
  63. OUT LPVOID pExistingMem
  64. );
  65. STDMETHOD(GetAs)(
  66. IN LPCWSTR pszName,
  67. IN ULONG uFlags,
  68. IN ULONG uCoercionType,
  69. OUT UMI_PROPERTY_VALUES **pProp
  70. );
  71. STDMETHOD (Delete)(
  72. IN LPCWSTR pszUrl,
  73. IN OPTIONAL ULONG uFlags
  74. );
  75. STDMETHOD(FreeMemory)(
  76. ULONG uReserved,
  77. LPVOID pMem
  78. );
  79. STDMETHOD(GetProps)(
  80. IN LPCWSTR *pszNames,
  81. IN ULONG uNameCount,
  82. IN ULONG uFlags,
  83. OUT UMI_PROPERTY_VALUES **pProps
  84. );
  85. STDMETHOD(PutProps)(
  86. IN LPCWSTR *pszNames,
  87. IN ULONG uNameCount,
  88. IN ULONG uFlags,
  89. IN UMI_PROPERTY_VALUES *pProps
  90. );
  91. STDMETHOD(PutFrom)(
  92. IN LPCWSTR pszName,
  93. IN ULONG uFlags,
  94. IN ULONG uBufferLength,
  95. IN LPVOID pExistingMem
  96. );
  97. //
  98. // Other public methods.
  99. //
  100. CLDAPConObject::
  101. CLDAPConObject();
  102. CLDAPConObject::
  103. ~CLDAPConObject();
  104. //
  105. // Use this to initialize with property cache object.
  106. // The ldap handle is optional. If a handle is passed in, then
  107. // the connection objects is considered already initialized.
  108. // This is to handle the case of someone getting the connection
  109. // object after using ADsGetObject say.
  110. //
  111. static
  112. HRESULT
  113. CLDAPConObject::
  114. CreateConnectionObject(
  115. CLDAPConObject FAR * FAR * ppConnectionObject,
  116. PADSLDP pLdapHandle = NULL
  117. );
  118. protected:
  119. //
  120. // These are internal methods.
  121. //
  122. PADSLDP
  123. CLDAPConObject::GetLdapHandle()
  124. {
  125. return _pLdapHandle;
  126. }
  127. BOOL
  128. CLDAPConObject::IsConnected()
  129. {
  130. return _fConnected;
  131. }
  132. void
  133. SetLastStatus(ULONG ulErrorStatus)
  134. {
  135. _ulErrorStatus = ulErrorStatus;
  136. }
  137. protected:
  138. CPropertyManager * _pPropMgr; // used to handle GetInterfacePropList.
  139. BOOL _fConnected; // indicates if we are already connected.
  140. PADSLDP _pLdapHandle; // Handle to the ldap connection.
  141. CCredentials *_pCredentials; // Holds credentials.
  142. ULONG _ulErrorStatus;
  143. };
  144. #endif // __CCONNECT_H__