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.

179 lines
5.6 KiB

  1. #ifndef _ADSDATASOURCE_H_
  2. #define _ADSDATASOURCE_H_
  3. //#define ROWS 10L
  4. #define ROWS 1L
  5. typedef struct _tagSEARCHPREF
  6. {
  7. TCHAR szSource [ MAX_PATH ];
  8. TCHAR szQuery [ 2048 ];
  9. TCHAR szAttributes [ MAX_PATH ];
  10. TCHAR szScope [ MAX_PATH ];
  11. TCHAR szUserName [ 2 * MAX_PATH ];
  12. TCHAR szPassword [ MAX_PATH ];
  13. BOOL bEncryptPassword;
  14. BOOL bUseSQL;
  15. int nAsynchronous;
  16. int nDerefAliases;
  17. int nSizeLimit;
  18. int nTimeLimit;
  19. int nAttributesOnly;
  20. int nScope;
  21. int nTimeOut;
  22. int nPageSize;
  23. int nChaseReferrals;
  24. } SEARCHPREF;
  25. class CADsDataSource: public CObject
  26. {
  27. public:
  28. CADsDataSource( );
  29. ~CADsDataSource( );
  30. public:
  31. /*void SetQueryParameters( CString& strSource,
  32. CString& strQuery,
  33. CString& strAttributes,
  34. CString& strScope,
  35. CString& strUserName,
  36. CString& strPassword,
  37. BOOL bEncryptPassword,
  38. BOOL bUseSQL );*/
  39. void SetQueryParameters( SEARCHPREF* pSerachPref );
  40. virtual int GetColumnsCount ( int nRow );
  41. virtual BOOL GetValue ( int nRow, int nColumn, CString& );
  42. virtual BOOL GetValue ( int nRow, CString& strColumn, CString& );
  43. virtual BOOL GetADsPath ( int nRow, CString& );
  44. virtual BOOL GetColumnText ( int nRow, int nColumn, CString& );
  45. BOOL Refresh ( void );
  46. virtual BOOL RunTheQuery ( void );
  47. protected:
  48. DBORDINAL m_nColumnsCount;
  49. int m_nAddOne;
  50. BOOL m_bNoQuery;
  51. BOOL m_bNoMoreData;
  52. int m_nFirstRow;
  53. int m_nLastRow;
  54. int m_nCurrentRow;
  55. ULONG m_cRows;
  56. ULONG m_cColumns;
  57. CString m_strAttributes;
  58. /*CString m_strSource;
  59. CString m_strQuery;
  60. CString m_strScope;
  61. CString m_strPassword;
  62. CString m_strUserName;
  63. BOOL m_bEncryptPassword;
  64. BOOL m_bUseSQL;*/
  65. CStringArray m_ADsPath;
  66. SEARCHPREF* m_pSearchPref;
  67. };
  68. /*typedef struct tagData {
  69. void *obValue;
  70. DATE dateValue;
  71. ULONG obLength;
  72. LARGE_INTEGER aLargeInteger;
  73. ULONG status;
  74. } Data;*/
  75. typedef struct tagData {
  76. union {
  77. void *obValue;
  78. double obValue2;
  79. };
  80. ULONG obLength;
  81. ULONG status;
  82. } Data;
  83. class CADsOleDBDataSource: public CADsDataSource
  84. {
  85. public:
  86. CADsOleDBDataSource( );
  87. ~CADsOleDBDataSource( );
  88. public:
  89. HRESULT SetQueryCredentials( IDBInitialize* pInit, ICommandText* pCommand );
  90. virtual int GetColumnsCount ( int nRow );
  91. virtual BOOL GetValue ( int nRow, int nColumn, CString& );
  92. virtual BOOL GetADsPath ( int nRow, CString& );
  93. virtual BOOL GetColumnText ( int nRow, int nColumn, CString& );
  94. virtual BOOL RunTheQuery ( void );
  95. private:
  96. void DestroyInternalData ( void );
  97. BOOL AdvanceCursor ( void );
  98. BOOL CreateAccessorHelp ( void );
  99. BOOL BringRowInBuffer ( int nRow );
  100. CString ExtractData ( int );
  101. void ReadADsPath ( void );
  102. private:
  103. Data* m_pData;
  104. IRowset* m_pIRowset;
  105. IMalloc* m_pIMalloc;
  106. IAccessor* m_pAccessor;
  107. IColumnsInfo* m_pIColsInfo;
  108. HROW* m_hRows;
  109. HACCESSOR m_hAccessor;
  110. DBCOLUMNINFO* m_prgColInfo;
  111. DBBINDSTATUS* m_pBindStatus;
  112. OLECHAR* m_szColNames;
  113. };
  114. class CADsSearchDataSource: public CADsDataSource
  115. {
  116. public:
  117. CADsSearchDataSource( );
  118. ~CADsSearchDataSource( );
  119. public:
  120. virtual int GetColumnsCount ( int nRow );
  121. virtual BOOL GetValue ( int nRow, int nColumn, CString& );
  122. virtual BOOL GetValue ( int nRow, CString& rColumn, CString& );
  123. virtual BOOL GetADsPath ( int nRow, CString& );
  124. virtual BOOL GetColumnText ( int nRow, int nColumn, CString& );
  125. virtual BOOL RunTheQuery ( void );
  126. private:
  127. void DestroyInternalData ( void );
  128. HRESULT CreateSearchInterface( );
  129. BOOL BringRowInBuffer ( int nRow );
  130. BOOL ReadColumnNames ( int nRow );
  131. HRESULT SetQueryPreferences ( );
  132. HRESULT SetSearchPreferences ( );
  133. HRESULT SetAttributesName ( );
  134. void ReadADsPath ( void );
  135. private:
  136. IDirectorySearch* m_pSearch;
  137. ADS_SEARCH_HANDLE m_hSearch;
  138. CStringArray m_strColumns;
  139. /*BOOL m_bAsynchronous; //ADS_SEARCHPREF_ASYNCHRONOUS
  140. BOOL m_bDerefAliases; //ADS_SEARCHPREF_DEREF_ALIASES
  141. int m_nSizeLimit; //ADS_SEARCHPREF_SIZE_LIMIT
  142. int m_nTimeLimit; //ADS_SEARCHPREF_TIME_LIMIT
  143. BOOL m_bAttributesOnly; //ADS_SEARCHPREF_ATTRIBTYPES_ONLY
  144. CString m_strScope; //ADS_SEARCHPREF_SEARCH_SCOPE
  145. int m_nTimeOut; //ADS_SEARCHPREF_TIMEOUT
  146. int m_nPageSize; //ADS_SEARCHPREF_PAGESIZE*/
  147. };
  148. #endif