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.

215 lines
8.2 KiB

  1. #ifndef __query_h
  2. #define __query_h
  3. //
  4. // Resource IDs used for the menus
  5. //
  6. // File menu
  7. #define DSQH_FILE_CONTEXT_FIRST (CQID_MINHANDLERMENUID + 0x0000)
  8. #define DSQH_FILE_CONTEXT_LAST (CQID_MINHANDLERMENUID + 0x0fff)
  9. #define DSQH_FILE_OPENCONTAINER (CQID_MINHANDLERMENUID + 0x1001)
  10. #define DSQH_FILE_PROPERTIES (CQID_MINHANDLERMENUID + 0x1002)
  11. #define DSQH_FILE_CREATESHORTCUT (CQID_MINHANDLERMENUID + 0x1003)
  12. #define DSQH_FILE_SAVEQUERY (CQID_MINHANDLERMENUID + 0x1004)
  13. // Edit menu
  14. #define DSQH_EDIT_SELECTALL (CQID_MINHANDLERMENUID + 0x1100)
  15. #define DSQH_EDIT_INVERTSELECTION (CQID_MINHANDLERMENUID + 0x1101)
  16. // View menu
  17. #define DSQH_VIEW_FILTER (CQID_MINHANDLERMENUID + 0x1200)
  18. #define DSQH_VIEW_LARGEICONS (CQID_MINHANDLERMENUID + 0x1201)
  19. #define DSQH_VIEW_SMALLICONS (CQID_MINHANDLERMENUID + 0x1202)
  20. #define DSQH_VIEW_LIST (CQID_MINHANDLERMENUID + 0x1203)
  21. #define DSQH_VIEW_DETAILS (CQID_MINHANDLERMENUID + 0x1204)
  22. #define DSQH_VIEW_ARRANGEICONS (CQID_MINHANDLERMENUID + 0x1205)
  23. #define DSQH_VIEW_REFRESH (CQID_MINHANDLERMENUID + 0x1206)
  24. #define DSQH_VIEW_PICKCOLUMNS (CQID_MINHANDLERMENUID + 0x1207)
  25. #define DSQH_VIEW_ARRANGEFIRST (CQID_MINHANDLERMENUID + 0x1280)
  26. #define DSQH_VIEW_ARRANGELAST (CQID_MINHANDLERMENUID + 0x12FF)
  27. // Help menu
  28. #define DSQH_HELP_CONTENTS (CQID_MINHANDLERMENUID + 0x1300)
  29. #define DSQH_HELP_WHATISTHIS (CQID_MINHANDLERMENUID + 0x1301)
  30. #define DSQH_HELP_ABOUT (CQID_MINHANDLERMENUID + 0x1302)
  31. // Extra background verbs
  32. #define DSQH_BG_SELECT (CQID_MINHANDLERMENUID + 0x1400)
  33. // Filter verbs
  34. #define DSQH_CLEARFILTER (CQID_MINHANDLERMENUID + 0x1500)
  35. #define DSQH_CLEARALLFILTERS (CQID_MINHANDLERMENUID + 0x1501)
  36. //
  37. // CDsQueryHandler global information
  38. //
  39. //
  40. // The bg thread communicates with the view using the following messages
  41. //
  42. #define DSQVM_ADDRESULTS (WM_USER+0) // lParam = HDPA containing results
  43. #define DSQVM_FINISHED (WM_USER+1) // lParam = fMaxResult
  44. //
  45. // Column DSA contains these items
  46. //
  47. #define PROPERTY_ISUNDEFINED 0x00000000 // property is undefined
  48. #define PROPERTY_ISUNKNOWN 0x00000001 // only operator is exacly
  49. #define PROPERTY_ISSTRING 0x00000002 // starts with, ends with, is exactly, not equal
  50. #define PROPERTY_ISNUMBER 0x00000003 // greater, less, equal, not equal
  51. #define PROPERTY_ISBOOL 0x00000004 // equal, not equal
  52. #define PROPERTY_ISDNSTRING 0x00000005 // is exactly, not equal
  53. #define DEFAULT_WIDTH 20
  54. #define DEFAULT_WIDTH_DESCRIPTION 40
  55. typedef struct
  56. {
  57. INT iPropertyType; // type of property
  58. union
  59. {
  60. LPTSTR pszText; // iPropertyType == PROPERTY_ISSTRING
  61. INT iValue; // iPropertyType == PROPERTY_ISNUMBER
  62. };
  63. } COLUMNVALUE, * LPCOLUMNVALUE;
  64. typedef struct
  65. {
  66. BOOL fHasColumnHandler:1; // column handler specified?
  67. LPWSTR pProperty; // property name
  68. LPTSTR pHeading; // column heading
  69. INT cx; // width of column (% of view)
  70. INT fmt; // formatting information
  71. INT iPropertyType; // type of property
  72. UINT idOperator; // currently selected operator
  73. COLUMNVALUE filter; // the filter applied
  74. CLSID clsidColumnHandler; // CLSID and IDsQueryColumnHandler objects
  75. IDsQueryColumnHandler* pColumnHandler;
  76. } COLUMN, * LPCOLUMN;
  77. typedef struct
  78. {
  79. LPWSTR pObjectClass; // object class (UNICODE)
  80. LPWSTR pPath; // directory object (UNICODE)
  81. INT iImage; // image / == -1 if none
  82. BOOL fIsContainer:1; // object is a container (used later)
  83. COLUMNVALUE aColumn[1]; // column data
  84. } QUERYRESULT, * LPQUERYRESULT;
  85. STDAPI CDsQuery_CreateInstance(IUnknown* punkOuter, IUnknown** ppunk, LPCOBJECTINFO poi);
  86. //
  87. // The outside world commmunicates with the thread using messages (sent via PostThreadMessage).
  88. //
  89. #define RVTM_FIRST (WM_USER)
  90. #define RVTM_LAST (WM_USER+32)
  91. #define RVTM_STOPQUERY (WM_USER) // wParam = 0, lParam =0
  92. #define RVTM_REFRESH (WM_USER+1) // wParam = 0, lParam = 0
  93. #define RVTM_SETCOLUMNTABLE (WM_USER+2) // wParam = 0, lParam = HDSA columns
  94. //
  95. // THREADINITDATA strucutre, this is passed when the query thread is being
  96. // created, it contains all the parameters required to issue the query,
  97. // and populate the view.
  98. //
  99. typedef struct
  100. {
  101. DWORD dwReference; // reference value for query
  102. LPWSTR pQuery; // base filter to be applied
  103. LPWSTR pScope; // scope to search
  104. LPWSTR pServer; // server to target
  105. LPWSTR pUserName; // user name and password to authenticate with
  106. LPWSTR pPassword;
  107. BOOL fShowHidden:1; // show hidden objects in results
  108. HWND hwndView; // handle of our result view to be filled
  109. HDSA hdsaColumns; // column table
  110. } THREADINITDATA, * LPTHREADINITDATA;
  111. //
  112. // Query thread, this is passed the THREADINITDATA structure
  113. //
  114. DWORD WINAPI QueryThread(LPVOID pThreadParams);
  115. VOID QueryThread_FreeThreadInitData(LPTHREADINITDATA* ppTID);
  116. STDAPI CQueryThreadCH_CreateInstance(IUnknown* punkOuter, IUnknown** ppunk, LPCOBJECTINFO poi);
  117. //
  118. // Scope logic
  119. //
  120. #define OBJECT_NAME_FROM_SCOPE(pDsScope)\
  121. ((LPWSTR)ByteOffset(pDsScope, pDsScope->dwOffsetADsPath))
  122. #define OBJECT_CLASS_FROM_SCOPE(pDsScope)\
  123. ((LPWSTR)(!pDsScope->dwOffsetClass ? NULL : ByteOffset(pDsScope, pDsScope->dwOffsetClass)))
  124. typedef struct
  125. {
  126. CQSCOPE cq; // all scopes must have this as a header
  127. INT iIndent; // indent
  128. DWORD dwOffsetADsPath; // offset to scope
  129. DWORD dwOffsetClass; // offset to class of scope / = 0 if none
  130. WCHAR szStrings[1]; // string data (all UNICODE)
  131. } DSQUERYSCOPE, * LPDSQUERYSCOPE;
  132. typedef struct
  133. {
  134. HWND hwndFrame; // frame window to display message boxes on
  135. LPWSTR pDefaultScope; // scope for this object
  136. LPWSTR pServer; // server to target
  137. LPWSTR pUserName; // user name and password to authenticate with
  138. LPWSTR pPassword;
  139. } SCOPETHREADDATA, * LPSCOPETHREADDATA;
  140. #define GC_OBJECTCLASS L"domainDNS" // objectClass used for GC objects
  141. HRESULT GetGlobalCatalogPath(LPCWSTR pszServer, LPWSTR pszPath, INT cchBuffer);
  142. HRESULT AddScope(HWND hwndFrame, INT index, INT iIndent, LPWSTR pPath, LPWSTR pObjectClass, BOOL fSelect);
  143. HRESULT AllocScope(LPCQSCOPE* ppScope, INT iIndent, LPWSTR pPath, LPWSTR pObjectClass);
  144. DWORD WINAPI AddScopesThread(LPVOID pThreadParams);
  145. //
  146. // helpers for all to use
  147. //
  148. VOID MergeMenu(HMENU hMenu, HMENU hMenuToInsert, INT iIndex);
  149. INT FreeQueryResultCB(LPVOID pItem, LPVOID pData);
  150. VOID FreeQueryResult(LPQUERYRESULT pResult, INT cColumns);
  151. VOID FreeColumnValue(LPCOLUMNVALUE pColumnValue);
  152. INT FreeColumnCB(LPVOID pItem, LPVOID pData);
  153. VOID FreeColumn(LPCOLUMN pColumn);
  154. DWORD PropertyIsFromAttribute(LPCWSTR pszAttributeName, IDsDisplaySpecifier *pdds);
  155. BOOL MatchPattern(LPTSTR pString, LPTSTR pPattern);
  156. HRESULT EnumClassAttributes(IDsDisplaySpecifier *pdds, LPCWSTR pszObjectClass, LPDSENUMATTRIBUTES pcbEnum, LPARAM lParam);
  157. HRESULT GetFriendlyAttributeName(IDsDisplaySpecifier *pdds, LPCWSTR pszObjectClass, LPCWSTR pszAttributeName, LPWSTR pszBuffer, UINT cch);
  158. HRESULT GetColumnHandlerFromProperty(LPCOLUMN pColumn, LPWSTR pProperty);
  159. HRESULT GetPropertyFromColumn(LPWSTR* ppProperty, LPCOLUMN pColumn);
  160. STDAPI ADsPathToIdList(LPITEMIDLIST* ppidl, LPWSTR pPath, LPWSTR pObjectClass, BOOL fRelative);
  161. #endif