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.

469 lines
18 KiB

  1. #ifndef __dsclient_h
  2. #define __dsclient_h
  3. //---------------------------------------------------------------------------//
  4. // CLSIDs exposed for the dsclient.
  5. //---------------------------------------------------------------------------//
  6. // this CLSID is used to signal that the DSOBJECTNAMEs structure originated
  7. // for the Microsoft DS.
  8. DEFINE_GUID(CLSID_MicrosoftDS, 0xfe1290f0, 0xcfbd, 0x11cf, 0xa3, 0x30, 0x0, 0xaa, 0x0, 0xc1, 0x6e, 0x65);
  9. #define CLSID_DsFolder CLSID_MicrosoftDS
  10. // this is the CLSID used by clients to get the IShellExtInit, IPropSheetExt
  11. // and IContextMenus exposed from dsuiext.dll.
  12. DEFINE_GUID(CLSID_DsPropertyPages, 0xd45d530, 0x764b, 0x11d0, 0xa1, 0xca, 0x0, 0xaa, 0x0, 0xc1, 0x6e, 0x65);
  13. DEFINE_GUID(CLSID_DsDomainTreeBrowser, 0x1698790a, 0xe2b4, 0x11d0, 0xb0, 0xb1, 0x00, 0xc0, 0x4f, 0xd8, 0xdc, 0xa6);
  14. DEFINE_GUID(IID_IDsBrowseDomainTree, 0x7cabcf1e, 0x78f5, 0x11d2, 0x96, 0xc, 0x0, 0xc0, 0x4f, 0xa3, 0x1a, 0x86);
  15. DEFINE_GUID(CLSID_DsDisplaySpecifier, 0x1ab4a8c0, 0x6a0b, 0x11d2, 0xad, 0x49, 0x0, 0xc0, 0x4f, 0xa3, 0x1a, 0x86);
  16. #define IID_IDsDisplaySpecifier CLSID_DsDisplaySpecifier
  17. DEFINE_GUID(CLSID_DsFolderProperties, 0x9e51e0d0, 0x6e0f, 0x11d2, 0x96, 0x1, 0x0, 0xc0, 0x4f, 0xa3, 0x1a, 0x86);
  18. #define IID_IDsFolderProperties CLSID_DsFolderProperties
  19. #ifndef GUID_DEFS_ONLY
  20. #include "activeds.h"
  21. //---------------------------------------------------------------------------//
  22. // Clipboard formats used within DSUI
  23. //---------------------------------------------------------------------------//
  24. //
  25. // CF_DSOBJECTS
  26. // ------------
  27. // This clipboard format defines the seleciton for an DS IShellFolder to the
  28. // shell extensions. All strings are stored as BSTR's, and an offset == 0
  29. // is used to indicate that the string is not present.
  30. //
  31. #define DSOBJECT_ISCONTAINER 0x00000001 // = 1 => object is a container
  32. #define DSOBJECT_READONLYPAGES 0x80000000 // = 1 => read only pages
  33. #define DSPROVIDER_UNUSED_0 0x00000001
  34. #define DSPROVIDER_UNUSED_1 0x00000002
  35. #define DSPROVIDER_UNUSED_2 0x00000004
  36. #define DSPROVIDER_UNUSED_3 0x00000008
  37. #define DSPROVIDER_ADVANCED 0x00000010 // = 1 => advanced mode
  38. #define CFSTR_DSOBJECTNAMES TEXT("DsObjectNames")
  39. typedef struct
  40. {
  41. DWORD dwFlags; // item flags
  42. DWORD dwProviderFlags; // flags for item provider
  43. DWORD offsetName; // offset to ADS path of the object
  44. DWORD offsetClass; // offset to object class name / == 0 not known
  45. } DSOBJECT, * LPDSOBJECT;
  46. typedef struct
  47. {
  48. CLSID clsidNamespace; // namespace identifier (indicates which namespace selection from)
  49. UINT cItems; // number of objects
  50. DSOBJECT aObjects[1]; // array of objects
  51. } DSOBJECTNAMES, * LPDSOBJECTNAMES;
  52. //
  53. // CF_DSDISPLAYSPECOPTIONS
  54. // -----------------------
  55. // When invoking an object referenced by a display specifier (context menu, property
  56. // page, etc) we call the IShellExtInit interface passing a IDataObject. This data
  57. // object supports the CF_DSDISPLAYSPECOPTIONS format to give out configuration
  58. // informaiton about admin/shell invocation.
  59. //
  60. // When interacting with dsuiext.dll the interfaces uses this clipboard format
  61. // to determine which display specifier attributes to address (admin/shell)
  62. // and pick up the values accordingly. If no format is suppoted then
  63. // dsuiext.dll defaults to shell.
  64. //
  65. #define CFSTR_DS_DISPLAY_SPEC_OPTIONS TEXT("DsDisplaySpecOptions")
  66. #define CFSTR_DSDISPLAYSPECOPTIONS CFSTR_DS_DISPLAY_SPEC_OPTIONS
  67. typedef struct _DSDISPLAYSPECOPTIONS
  68. {
  69. DWORD dwSize; // size of struct, for versioning
  70. DWORD dwFlags; // invocation flags
  71. DWORD offsetAttribPrefix; // offset to attribute prefix string.
  72. DWORD offsetUserName; // offset to UNICODE user name
  73. DWORD offsetPassword; // offset to UNICODE password
  74. DWORD offsetServer;
  75. DWORD offsetServerConfigPath;
  76. } DSDISPLAYSPECOPTIONS, * PDSDISPLAYSPECOPTIONS, * LPDSDISPLAYSPECOPTIONS;
  77. #define DS_PROP_SHELL_PREFIX L"shell"
  78. #define DS_PROP_ADMIN_PREFIX L"admin"
  79. #define DSDSOF_HASUSERANDSERVERINFO 0x00000001 // = 1 => user name/password are valid
  80. #define DSDSOF_SIMPLEAUTHENTICATE 0x00000002 // = 1 => don't use secure authentication to DS
  81. #define DSDSOF_DSAVAILABLE 0x40000000 // = 1 => ignore DS available checks
  82. //
  83. // CF_DSPROPERTYPAGEINFO
  84. // ---------------------
  85. // When the property pages for an object are being displayed the parsed
  86. // display specifier string is passed to the page object via the IDataObject
  87. // in the following clipboard format.
  88. //
  89. // Within the display specifier for a property page, the format for a
  90. // Win32 extension is "n,{clsid}[,bla...]" we take the "bla" section and
  91. // pass it down.
  92. //
  93. #define CFSTR_DSPROPERTYPAGEINFO TEXT("DsPropPageInfo")
  94. typedef struct
  95. {
  96. DWORD offsetString; // offset to UNICODE string
  97. } DSPROPERTYPAGEINFO, * LPDSPROPERTYPAGEINFO;
  98. //
  99. // To sync property pages and the admin tools this message is broadcast
  100. //
  101. #define DSPROP_ATTRCHANGED_MSG TEXT("DsPropAttrChanged")
  102. //---------------------------------------------------------------------------//
  103. //---------------------------------------------------------------------------//
  104. //
  105. // IDsBrowseDomainTree
  106. // ===================
  107. // This interface returns a list of the domains from a given computer name
  108. // (or the current computer name if none is specified).
  109. //
  110. // NOTES:
  111. // 1) The structure returned by ::GetDomains should be free'd using
  112. // FreeDomains.
  113. //
  114. // 2) ::BrowseTo allocates a string on exit, this is allocated using
  115. // CoTaskMemAlloc, and therefore should be free'd using CoTaskMemFree.
  116. //
  117. //---------------------------------------------------------------------------//
  118. #define DBDTF_RETURNFQDN 0x00000001 // if not set, pszNCName will be blank
  119. #define DBDTF_RETURNMIXEDDOMAINS 0x00000002 // set it if you want downlevel trust domains too
  120. #define DBDTF_RETURNEXTERNAL 0x00000004 // set it if you want external trust domains too
  121. #define DBDTF_RETURNINBOUND 0x00000008 // set it if you want trusting domains
  122. #define DBDTF_RETURNINOUTBOUND 0x00000010 // set it if you want both trusted and trusting domains
  123. typedef struct _DOMAINDESC
  124. {
  125. LPWSTR pszName; // domain name (if no dns, use netbios)
  126. LPWSTR pszPath; // set to blank
  127. LPWSTR pszNCName; // FQDN, e.g.,DC=mydomain,DC=microsoft,DC=com
  128. LPWSTR pszTrustParent; // parent domain name (if no dns, use netbios)
  129. LPWSTR pszObjectClass; // Object class of the domain object referenced
  130. ULONG ulFlags; // Flags, from DS_TRUSTED_DOMAINS.Flags
  131. BOOL fDownLevel; // == 1 if downlevel domain
  132. struct _DOMAINDESC *pdChildList; // Children of this node
  133. struct _DOMAINDESC *pdNextSibling; // Siblings of this node
  134. } DOMAIN_DESC, DOMAINDESC, * PDOMAIN_DESC, * LPDOMAINDESC;
  135. typedef struct
  136. {
  137. DWORD dsSize;
  138. DWORD dwCount;
  139. DOMAINDESC aDomains[1];
  140. } DOMAIN_TREE, DOMAINTREE, * PDOMAIN_TREE, * LPDOMAINTREE;
  141. #undef INTERFACE
  142. #define INTERFACE IDsBrowseDomainTree
  143. DECLARE_INTERFACE_(IDsBrowseDomainTree, IUnknown)
  144. {
  145. // *** IUnknown methods ***
  146. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  147. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  148. STDMETHOD_(ULONG,Release)(THIS) PURE;
  149. // *** IDsBrowseDomainTree methods ***
  150. STDMETHOD(BrowseTo)(THIS_ HWND hwndParent, LPWSTR *ppszTargetPath, DWORD dwFlags) PURE;
  151. STDMETHOD(GetDomains)(THIS_ PDOMAIN_TREE *ppDomainTree, DWORD dwFlags) PURE;
  152. STDMETHOD(FreeDomains)(THIS_ PDOMAIN_TREE *ppDomainTree) PURE;
  153. STDMETHOD(FlushCachedDomains)(THIS) PURE;
  154. STDMETHOD(SetComputer)(THIS_ LPCWSTR pszComputerName, LPCWSTR pszUserName, LPCWSTR pszPassword) PURE;
  155. };
  156. //---------------------------------------------------------------------------//
  157. //---------------------------------------------------------------------------//
  158. //
  159. // IDsDisplaySpecifier
  160. // ===================
  161. // This interface gives client UI access to the display specifiers for
  162. // specific attributes.
  163. //
  164. //---------------------------------------------------------------------------//
  165. //
  166. // IDsDisplaySpecifier::SetServer flags
  167. //
  168. #define DSSSF_SIMPLEAUTHENTICATE 0x00000001 // = 1 => don't use secure authentication to DS
  169. #define DSSSF_DSAVAILABLE 0x80000000 // = 1 => ignore DS available checks
  170. //
  171. // Flags for IDsDisplaySpecifier::GetIcon / GetIconLocation
  172. //
  173. #define DSGIF_ISNORMAL 0x0000000 // = icon is in normal state (default)
  174. #define DSGIF_ISOPEN 0x0000001 // = icon is in open state
  175. #define DSGIF_ISDISABLED 0x0000002 // = icon is in a disabled state
  176. #define DSGIF_ISMASK 0x000000f
  177. #define DSGIF_GETDEFAULTICON 0x0000010 // = 1 => if no icon then get default (from shell32.dll)
  178. #define DSGIF_DEFAULTISCONTAINER 0x0000020 // = 1 => if returning default icon, return it as a container
  179. //
  180. // Flags for IDsDisplaySpecifier::IsClassContainer
  181. //
  182. #define DSICCF_IGNORETREATASLEAF 0x00000001 // = 1 => igore the "treatAsLeaf" and use only schema information
  183. //
  184. // Callback function used for IDsDisplaySpecifier::EnumClassAttributes
  185. //
  186. #define DSECAF_NOTLISTED 0x00000001 // = 1 => hide from the field drop down in the query UI
  187. typedef HRESULT (CALLBACK *LPDSENUMATTRIBUTES)(LPARAM lParam, LPCWSTR pszAttributeName, LPCWSTR pszDisplayName, DWORD dwFlags);
  188. //
  189. // IDsDisplaySpecifier::GetClassCreationInfo information
  190. //
  191. #define DSCCIF_HASWIZARDDIALOG 0x00000001 // = 1 => return the wizard dialog CLSID
  192. #define DSCCIF_HASWIZARDPRIMARYPAGE 0x00000002 // = 1 => returning a primary wizard dlg CLSID
  193. typedef struct
  194. {
  195. DWORD dwFlags;
  196. CLSID clsidWizardDialog;
  197. CLSID clsidWizardPrimaryPage;
  198. DWORD cWizardExtensions; // how many extension CLSIDs?
  199. CLSID aWizardExtensions[1];
  200. } DSCLASSCREATIONINFO, * LPDSCLASSCREATIONINFO;
  201. //
  202. // IDsDisplaySpecifier - a COM object for interacting with display specifiers
  203. //
  204. #undef INTERFACE
  205. #define INTERFACE IDsDisplaySpecifier
  206. DECLARE_INTERFACE_(IDsDisplaySpecifier, IUnknown)
  207. {
  208. // *** IUnknown methods ***
  209. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  210. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  211. STDMETHOD_(ULONG,Release)(THIS) PURE;
  212. // *** IDsDisplaySpecifier methods ***
  213. STDMETHOD(SetServer)(THIS_ LPCWSTR pszServer, LPCWSTR pszUserName, LPCWSTR pszPassword, DWORD dwFlags) PURE;
  214. STDMETHOD(SetLanguageID)(THIS_ LANGID langid) PURE;
  215. STDMETHOD(GetDisplaySpecifier)(THIS_ LPCWSTR pszObjectClass, REFIID riid, void **ppv) PURE;
  216. STDMETHOD(GetIconLocation)(THIS_ LPCWSTR pszObjectClass, DWORD dwFlags, LPWSTR pszBuffer, INT cchBuffer, INT *presid) PURE;
  217. STDMETHOD_(HICON, GetIcon)(THIS_ LPCWSTR pszObjectClass, DWORD dwFlags, INT cxIcon, INT cyIcon) PURE;
  218. STDMETHOD(GetFriendlyClassName)(THIS_ LPCWSTR pszObjectClass, LPWSTR pszBuffer, INT cchBuffer) PURE;
  219. STDMETHOD(GetFriendlyAttributeName)(THIS_ LPCWSTR pszObjectClass, LPCWSTR pszAttributeName, LPWSTR pszBuffer, UINT cchBuffer) PURE;
  220. STDMETHOD_(BOOL, IsClassContainer)(THIS_ LPCWSTR pszObjectClass, LPCWSTR pszADsPath, DWORD dwFlags) PURE;
  221. STDMETHOD(GetClassCreationInfo)(THIS_ LPCWSTR pszObjectClass, LPDSCLASSCREATIONINFO* ppdscci) PURE;
  222. STDMETHOD(EnumClassAttributes)(THIS_ LPCWSTR pszObjectClass, LPDSENUMATTRIBUTES pcbEnum, LPARAM lParam) PURE;
  223. STDMETHOD_(ADSTYPE, GetAttributeADsType)(THIS_ LPCWSTR pszAttributeName) PURE;
  224. };
  225. //---------------------------------------------------------------------------//
  226. //
  227. // DsBrowseForContainer
  228. // --------------------
  229. // Provides a container browser similar to the SHBrowseForFolder, except
  230. // targetting the DS.
  231. //
  232. // In:
  233. // pInfo -> DSBROWSEINFO structure
  234. //
  235. // Out:
  236. // == IDOK/IDCANCEL depending on buttons, -1 if error
  237. //
  238. //---------------------------------------------------------------------------//
  239. typedef struct
  240. {
  241. DWORD cbStruct; // size of structure in bytes
  242. HWND hwndOwner; // dialog owner
  243. LPCWSTR pszCaption; // dialog caption text (can be NULL)
  244. LPCWSTR pszTitle; // displayed above the tree view control (can be NULL)
  245. LPCWSTR pszRoot; // ADS path to root (NULL == root of DS namespace)
  246. LPWSTR pszPath; // [in/out] initial selection & returned path (required)
  247. ULONG cchPath; // size of pszPath buffer in characters
  248. DWORD dwFlags;
  249. BFFCALLBACK pfnCallback; // callback function (see SHBrowseForFolder)
  250. LPARAM lParam; // passed to pfnCallback as lpUserData
  251. DWORD dwReturnFormat; // ADS_FORMAT_* (default is ADS_FORMAT_X500_NO_SERVER)
  252. LPCWSTR pUserName; // Username and Password to authenticate against DS with
  253. LPCWSTR pPassword;
  254. LPWSTR pszObjectClass; // UNICODE string for the object class
  255. ULONG cchObjectClass;
  256. } DSBROWSEINFOW, *PDSBROWSEINFOW;
  257. typedef struct
  258. {
  259. DWORD cbStruct;
  260. HWND hwndOwner;
  261. LPCSTR pszCaption;
  262. LPCSTR pszTitle;
  263. LPCWSTR pszRoot; // ADS paths are always UNICODE
  264. LPWSTR pszPath; // ditto
  265. ULONG cchPath;
  266. DWORD dwFlags;
  267. BFFCALLBACK pfnCallback;
  268. LPARAM lParam;
  269. DWORD dwReturnFormat;
  270. LPCWSTR pUserName; // Username and Password to authenticate against DS with
  271. LPCWSTR pPassword;
  272. LPWSTR pszObjectClass; // object class of the selected object
  273. ULONG cchObjectClass;
  274. } DSBROWSEINFOA, *PDSBROWSEINFOA;
  275. #ifdef UNICODE
  276. #define DSBROWSEINFO DSBROWSEINFOW
  277. #define PDSBROWSEINFO PDSBROWSEINFOW
  278. #else
  279. #define DSBROWSEINFO DSBROWSEINFOA
  280. #define PDSBROWSEINFO PDSBROWSEINFOA
  281. #endif
  282. // DSBROWSEINFO flags
  283. #define DSBI_NOBUTTONS 0x00000001 // NOT TVS_HASBUTTONS
  284. #define DSBI_NOLINES 0x00000002 // NOT TVS_HASLINES
  285. #define DSBI_NOLINESATROOT 0x00000004 // NOT TVS_LINESATROOT
  286. #define DSBI_CHECKBOXES 0x00000100 // TVS_CHECKBOXES
  287. #define DSBI_NOROOT 0x00010000 // don't include pszRoot in tree (its children become top level nodes)
  288. #define DSBI_INCLUDEHIDDEN 0x00020000 // display hidden objects
  289. #define DSBI_EXPANDONOPEN 0x00040000 // expand to the path specified in pszPath when opening the dialog
  290. #define DSBI_ENTIREDIRECTORY 0x00090000 // browse the entire directory (defaults to having DSBI_NOROOT set)
  291. #define DSBI_RETURN_FORMAT 0x00100000 // dwReturnFormat field is valid
  292. #define DSBI_HASCREDENTIALS 0x00200000 // pUserName & pPassword are valid
  293. #define DSBI_IGNORETREATASLEAF 0x00400000 // ignore the treat as leaf flag when calling IsClassContainer
  294. #define DSBI_SIMPLEAUTHENTICATE 0x00800000 // don't use secure authentication to DS
  295. #define DSBI_RETURNOBJECTCLASS 0x01000000 // return object class of selected object
  296. #define DSB_MAX_DISPLAYNAME_CHARS 64
  297. typedef struct
  298. {
  299. DWORD cbStruct;
  300. LPCWSTR pszADsPath; // ADS paths are always Unicode
  301. LPCWSTR pszClass; // ADS properties are always Unicode
  302. DWORD dwMask;
  303. DWORD dwState;
  304. DWORD dwStateMask;
  305. WCHAR szDisplayName[DSB_MAX_DISPLAYNAME_CHARS];
  306. WCHAR szIconLocation[MAX_PATH];
  307. INT iIconResID;
  308. } DSBITEMW, *PDSBITEMW;
  309. typedef struct
  310. {
  311. DWORD cbStruct;
  312. LPCWSTR pszADsPath; // ADS paths are always Unicode
  313. LPCWSTR pszClass; // ADS properties are always Unicode
  314. DWORD dwMask;
  315. DWORD dwState;
  316. DWORD dwStateMask;
  317. CHAR szDisplayName[DSB_MAX_DISPLAYNAME_CHARS];
  318. CHAR szIconLocation[MAX_PATH];
  319. INT iIconResID;
  320. } DSBITEMA, *PDSBITEMA;
  321. #ifdef UNICODE
  322. #define DSBITEM DSBITEMW
  323. #define PDSBITEM PDSBITEMW
  324. #else
  325. #define DSBITEM DSBITEMA
  326. #define PDSBITEM PDSBITEMA
  327. #endif
  328. // DSBITEM mask flags
  329. #define DSBF_STATE 0x00000001
  330. #define DSBF_ICONLOCATION 0x00000002
  331. #define DSBF_DISPLAYNAME 0x00000004
  332. // DSBITEM state flags
  333. #define DSBS_CHECKED 0x00000001
  334. #define DSBS_HIDDEN 0x00000002
  335. #define DSBS_ROOT 0x00000004
  336. //
  337. // this message is sent to the callback to see if it wants to insert or modify
  338. // the item that is about to be inserted into the view.
  339. //
  340. #define DSBM_QUERYINSERTW 100 // lParam = PDSBITEMW (state, icon & name may be modified). Return TRUE if handled.
  341. #define DSBM_QUERYINSERTA 101 // lParam = PDSBITEMA (state, icon & name may be modified). Return TRUE if handled.
  342. #ifdef UNICODE
  343. #define DSBM_QUERYINSERT DSBM_QUERYINSERTW
  344. #else
  345. #define DSBM_QUERYINSERT DSBM_QUERYINSERTA
  346. #endif
  347. //
  348. // Called before we change the state of the icon (on tree collapse/expand)
  349. //
  350. #define DSBM_CHANGEIMAGESTATE 102 // lParam = adspath. Return TRUE/FALSE top allow/disallow
  351. //
  352. // The dialog receives a WM_HELP
  353. //
  354. #define DSBM_HELP 103 // lParam == LPHELPINFO structure
  355. //
  356. // The dialog receives a WM_CONTEXTMENU, DSBID_xxx are the control ID's for this
  357. // dialog so that you can display suitable help.
  358. //
  359. #define DSBM_CONTEXTMENU 104 // lParam == window handle to retrieve help for
  360. //
  361. // These are the control IDs for the controls in the dialog. The callback can use
  362. // these to modify the contents of the dialog as required.
  363. //
  364. #define DSBID_BANNER 256
  365. #define DSBID_CONTAINERLIST 257
  366. //
  367. // API exported for browsing for containers.
  368. //
  369. STDAPI_(int) DsBrowseForContainerW(PDSBROWSEINFOW pInfo);
  370. STDAPI_(int) DsBrowseForContainerA(PDSBROWSEINFOA pInfo);
  371. #ifdef UNICODE
  372. #define DsBrowseForContainer DsBrowseForContainerW
  373. #else
  374. #define DsBrowseForContainer DsBrowseForContainerA
  375. #endif
  376. // NOTE: these are here to keep old clients building - remove soon
  377. STDAPI_(HICON) DsGetIcon(DWORD dwFlags, LPWSTR pszObjectClass, INT cxImage, INT cyImage);
  378. STDAPI DsGetFriendlyClassName(LPWSTR pszObjectClass, LPWSTR pszBuffer, UINT cchBuffer);
  379. #endif // GUID_DEFS_ONLY
  380. #endif