ObjSel.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:17k
源码类别:

模拟服务器

开发平台:

C/C++

  1. //+--------------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //  Copyright (C) Microsoft Corporation, 1994 - 1999.
  5. //
  6. //  File:       objsel.h
  7. //
  8. //  Contents:   Object Picker Dialog public header
  9. //
  10. //---------------------------------------------------------------------------
  11. #ifndef __OBJSEL_H_
  12. #define __OBJSEL_H_
  13. #if _MSC_VER > 1000
  14. #pragma once
  15. #endif
  16. #ifndef DECLSPEC_SELECTANY
  17. #if (_MSC_VER >= 1100)
  18. #define DECLSPEC_SELECTANY  __declspec(selectany)
  19. #else
  20. #define DECLSPEC_SELECTANY
  21. #endif
  22. #endif
  23. #ifndef EXTERN_C
  24. #ifdef __cplusplus
  25. #define EXTERN_C    extern "C"
  26. #else
  27. #define EXTERN_C    extern
  28. #endif
  29. #endif
  30. EXTERN_C const GUID DECLSPEC_SELECTANY CLSID_DsObjectPicker =
  31.     {0x17d6ccd8,0x3b7b,0x11d2,{0xb9, 0xe0, 0x00, 0xc0, 0x4f, 0xd8, 0xdb, 0xf7}};
  32. EXTERN_C const GUID DECLSPEC_SELECTANY IID_IDsObjectPicker =
  33.     {0x0c87e64e,0x3b7a,0x11d2,{0xb9,0xe0,0x00,0xc0,0x4f,0xd8,0xdb,0xf7}};
  34. /*
  35. CLIPBOARD FORMATS
  36. =================
  37. CFSTR_DSOP_DS_SELECTION_LIST
  38.     Returns an HGLOBAL for global memory containing a DS_SELECTION_LIST
  39.     variable length structure.
  40. */
  41. #define CFSTR_DSOP_DS_SELECTION_LIST    TEXT("CFSTR_DSOP_DS_SELECTION_LIST")
  42. /*
  43. SCOPE TYPES
  44. ===========
  45. A scope is an entry in the "Look In" dropdown list of the Object Picker
  46. dialog.
  47. When initializing the DS Object Picker, DSOP_SCOPE_TYPEs are used with
  48. DSOP_SCOPE_INIT_INFO.flType member to specify which types of scopes the
  49. DS Object Picker should put in the "Look In" list.
  50. DSOP_SCOPE_TYPE_TARGET_COMPUTER
  51.     Computer specified by DSOP_INIT_INFO.pwzTargetComputer, NULL is
  52.     local computer.
  53. DSOP_SCOPE_TYPE_UPLEVEL_JOINED_DOMAIN
  54.     Uplevel domain to which target computer is joined.
  55. DSOP_SCOPE_TYPE_DOWNLEVEL_JOINED_DOMAIN
  56.     Downlevel domain to which target computer is joined.
  57. DSOP_SCOPE_TYPE_ENTERPRISE_DOMAIN
  58.     All domains in the enterprise to which the target computer belongs
  59.     other than the JOINED_DOMAIN or USER_SPECIFIED_*_SCOPEs.
  60. DSOP_SCOPE_TYPE_GLOBAL_CATALOG
  61.     The Entire Directory scope.
  62. DSOP_SCOPE_TYPE_EXTERNAL_UPLEVEL_DOMAIN
  63.     All uplevel domains external to the enterprise but trusted by the
  64.     domain to which the target computer is joined.
  65. DSOP_SCOPE_TYPE_EXTERNAL_DOWNLEVEL_DOMAIN
  66.     All downlevel domains external to the enterprise but trusted by the
  67.     domain to which the target computer is joined.
  68. DSOP_SCOPE_TYPE_WORKGROUP
  69.     The workgroup of which TARGET_COMPUTER is a member.  Applies only if the
  70.     TARGET_COMPUTER is not joined to a domain.
  71. DSOP_SCOPE_TYPE_USER_ENTERED_UPLEVEL_SCOPE
  72. DSOP_SCOPE_TYPE_USER_ENTERED_DOWNLEVEL_SCOPE
  73.     Any uplevel or downlevel scope generated by processing user input.  If
  74.     neither of these types is specified, user entries that do not refer to
  75.     one of the scopes in the "Look In" control will be rejected.
  76. */
  77. #define DSOP_SCOPE_TYPE_TARGET_COMPUTER                 0x00000001
  78. #define DSOP_SCOPE_TYPE_UPLEVEL_JOINED_DOMAIN           0x00000002
  79. #define DSOP_SCOPE_TYPE_DOWNLEVEL_JOINED_DOMAIN         0x00000004
  80. #define DSOP_SCOPE_TYPE_ENTERPRISE_DOMAIN               0x00000008
  81. #define DSOP_SCOPE_TYPE_GLOBAL_CATALOG                  0x00000010
  82. #define DSOP_SCOPE_TYPE_EXTERNAL_UPLEVEL_DOMAIN         0x00000020
  83. #define DSOP_SCOPE_TYPE_EXTERNAL_DOWNLEVEL_DOMAIN       0x00000040
  84. #define DSOP_SCOPE_TYPE_WORKGROUP                       0x00000080
  85. #define DSOP_SCOPE_TYPE_USER_ENTERED_UPLEVEL_SCOPE      0x00000100
  86. #define DSOP_SCOPE_TYPE_USER_ENTERED_DOWNLEVEL_SCOPE    0x00000200
  87. /*
  88. DSOP_SCOPE_INIT_INFO flags
  89. ==========================
  90. The flScope member can contain zero or more of the following flags:
  91. DSOP_SCOPE_FLAG_STARTING_SCOPE
  92.     The scope should be the first one selected in the Look In control after
  93.     dialog initialization.  If more than one scope specifies this flag,
  94.     the one which is chosen to be the starting scope is implementation
  95.     dependant.
  96. DSOP_SCOPE_FLAG_WANT_PROVIDER_WINNT
  97.     ADs paths for objects selected from this scope should be converted to use
  98.     the WinNT provider.
  99. DSOP_SCOPE_FLAG_WANT_PROVIDER_LDAP
  100.     ADs paths for objects selected from this scope should be converted to use
  101.     the LDAP provider.
  102. DSOP_SCOPE_FLAG_WANT_PROVIDER_GC
  103.     ADs paths for objects selected from this scope should be converted to use
  104.     the GC provider.
  105. DSOP_SCOPE_FLAG_WANT_SID_PATH
  106.     ADs paths for objects selected from this scope having an objectSid
  107.     attribute should be converted to the form LDAP://<SID=x>, where x
  108.     represents the hexidecimal digits of the objectSid attribute value.
  109. DSOP_SCOPE_FLAG_WANT_DOWNLEVEL_BUILTIN_PATH
  110.     ADs paths for downlevel well-known SID objects (for example,
  111.     DSOP_DOWNLEVEL_FILTER_INTERACTIVE) are an empty string unless this flag is
  112.     specified.  If it is, the paths will be of the form
  113.     WinNT://NT AUTHORITY/Interactive or WinNT://Creator owner.
  114. DSOP_SCOPE_FLAG_DEFAULT_FILTER_USERS
  115.     If the scope filter contains the DSOP_FILTER_USERS or
  116.     DSOP_DOWNLEVEL_FILTER_USERS flag, then check the Users checkbox by
  117.     default in the Look For dialog.
  118. DSOP_SCOPE_FLAG_DEFAULT_FILTER_GROUPS
  119. DSOP_SCOPE_FLAG_DEFAULT_FILTER_COMPUTERS
  120. DSOP_SCOPE_FLAG_DEFAULT_FILTER_CONTACTS
  121. */
  122. #define DSOP_SCOPE_FLAG_STARTING_SCOPE              0x00000001
  123. #define DSOP_SCOPE_FLAG_WANT_PROVIDER_WINNT         0x00000002
  124. #define DSOP_SCOPE_FLAG_WANT_PROVIDER_LDAP          0x00000004
  125. #define DSOP_SCOPE_FLAG_WANT_PROVIDER_GC            0x00000008
  126. #define DSOP_SCOPE_FLAG_WANT_SID_PATH               0x00000010
  127. #define DSOP_SCOPE_FLAG_WANT_DOWNLEVEL_BUILTIN_PATH 0x00000020
  128. #define DSOP_SCOPE_FLAG_DEFAULT_FILTER_USERS        0x00000040
  129. #define DSOP_SCOPE_FLAG_DEFAULT_FILTER_GROUPS       0x00000080
  130. #define DSOP_SCOPE_FLAG_DEFAULT_FILTER_COMPUTERS    0x00000100
  131. #define DSOP_SCOPE_FLAG_DEFAULT_FILTER_CONTACTS     0x00000200
  132. /*
  133. The flMixedModeOnly/flNativeModeOnly member of an uplevel scope can
  134. contain one or more of the following flags (at least one must be specified):
  135. DSOP_FILTER_INCLUDE_ADVANCED_VIEW
  136.     Include objects which have the attribute showInAdvancedViewOnly set to
  137.     true.
  138. DSOP_FILTER_USERS
  139.     Include user objects.
  140. DSOP_FILTER_BUILTIN_GROUPS
  141.     Include group objects with a groupType value having the flag
  142.     GROUP_TYPE_BUILTIN_LOCAL_GROUP.
  143. DSOP_FILTER_WELL_KNOWN_PRINCIPALS
  144.     Include the contents of the WellKnown Security Principals container.
  145. DSOP_FILTER_UNIVERSAL_GROUPS_DL
  146.     Include distribution list universal groups.
  147. DSOP_FILTER_UNIVERSAL_GROUPS_SE
  148.     Include security enabled universal groups.
  149. DSOP_FILTER_GLOBAL_GROUPS_DL
  150.     Include distribution list global groups.
  151. DSOP_FILTER_GLOBAL_GROUPS_SE
  152.     Include security enabled global groups.
  153. DSOP_FILTER_DOMAIN_LOCAL_GROUPS_DL
  154.     Include distribution list domain global groups.
  155. DSOP_FILTER_DOMAIN_LOCAL_GROUPS_SE
  156.     Include security enabled domain local groups.
  157. DSOP_FILTER_CONTACTS
  158.     Include contact objects.
  159. DSOP_FILTER_COMPUTERS
  160.     Include computer objects.
  161. */
  162. #define DSOP_FILTER_INCLUDE_ADVANCED_VIEW   0x00000001
  163. #define DSOP_FILTER_USERS                   0x00000002
  164. #define DSOP_FILTER_BUILTIN_GROUPS          0x00000004
  165. #define DSOP_FILTER_WELL_KNOWN_PRINCIPALS   0x00000008
  166. #define DSOP_FILTER_UNIVERSAL_GROUPS_DL     0x00000010
  167. #define DSOP_FILTER_UNIVERSAL_GROUPS_SE     0x00000020
  168. #define DSOP_FILTER_GLOBAL_GROUPS_DL        0x00000040
  169. #define DSOP_FILTER_GLOBAL_GROUPS_SE        0x00000080
  170. #define DSOP_FILTER_DOMAIN_LOCAL_GROUPS_DL  0x00000100
  171. #define DSOP_FILTER_DOMAIN_LOCAL_GROUPS_SE  0x00000200
  172. #define DSOP_FILTER_CONTACTS                0x00000400
  173. #define DSOP_FILTER_COMPUTERS               0x00000800
  174. /*
  175. The flFilter member of a downlevel scope can contain one or more of the
  176. following flags:
  177. DSOP_DOWNLEVEL_FILTER_USERS
  178.     Include user objects.
  179. DSOP_DOWNLEVEL_FILTER_LOCAL_GROUPS
  180.     Include all local groups.
  181. DSOP_DOWNLEVEL_FILTER_GLOBAL_GROUPS
  182.     Include all global groups.
  183. DSOP_DOWNLEVEL_FILTER_COMPUTERS
  184.     Include computer objects
  185. DSOP_DOWNLEVEL_FILTER_WORLD
  186.     Include builtin security principal World (Everyone).
  187. DSOP_DOWNLEVEL_FILTER_AUTHENTICATED_USER
  188.     Include builtin security principal Authenticated User.
  189. DSOP_DOWNLEVEL_FILTER_ANONYMOUS
  190.     Include builtin security principal Anonymous.
  191. DSOP_DOWNLEVEL_FILTER_BATCH
  192.     Include builtin security principal Batch.
  193. DSOP_DOWNLEVEL_FILTER_CREATOR_OWNER
  194.     Include builtin security principal Creator Owner.
  195. DSOP_DOWNLEVEL_FILTER_CREATOR_GROUP
  196.     Include builtin security principal Creator Group.
  197. DSOP_DOWNLEVEL_FILTER_DIALUP
  198.     Include builtin security principal Dialup.
  199. DSOP_DOWNLEVEL_FILTER_INTERACTIVE
  200.     Include builtin security principal Interactive.
  201. DSOP_DOWNLEVEL_FILTER_NETWORK
  202.     Include builtin security principal Network.
  203. DSOP_DOWNLEVEL_FILTER_SERVICE
  204.     Include builtin security principal Service.
  205. DSOP_DOWNLEVEL_FILTER_SYSTEM
  206.     Include builtin security principal System.
  207. DSOP_DOWNLEVEL_FILTER_EXCLUDE_BUILTIN_GROUPS
  208.     Exclude local builtin groups returned by groups enumeration.
  209. DSOP_DOWNLEVEL_FILTER_TERMINAL_SERVER
  210.     Include builtin security principal Terminal Server.
  211. DSOP_DOWNLEVEL_FILTER_LOCAL_SERVICE
  212.     Include builtin security principal Local Service
  213. DSOP_DOWNLEVEL_FILTER_NETWORK_SERVICE
  214.     Include builtin security principal Network Service
  215. DSOP_DOWNLEVEL_FILTER_ALL_WELLKNOWN_SIDS
  216.     Include all builtin security principals.
  217. */
  218. #define DSOP_DOWNLEVEL_FILTER_USERS                   0x80000001
  219. #define DSOP_DOWNLEVEL_FILTER_LOCAL_GROUPS            0x80000002
  220. #define DSOP_DOWNLEVEL_FILTER_GLOBAL_GROUPS           0x80000004
  221. #define DSOP_DOWNLEVEL_FILTER_COMPUTERS               0x80000008
  222. #define DSOP_DOWNLEVEL_FILTER_WORLD                   0x80000010
  223. #define DSOP_DOWNLEVEL_FILTER_AUTHENTICATED_USER      0x80000020
  224. #define DSOP_DOWNLEVEL_FILTER_ANONYMOUS               0x80000040
  225. #define DSOP_DOWNLEVEL_FILTER_BATCH                   0x80000080
  226. #define DSOP_DOWNLEVEL_FILTER_CREATOR_OWNER           0x80000100
  227. #define DSOP_DOWNLEVEL_FILTER_CREATOR_GROUP           0x80000200
  228. #define DSOP_DOWNLEVEL_FILTER_DIALUP                  0x80000400
  229. #define DSOP_DOWNLEVEL_FILTER_INTERACTIVE             0x80000800
  230. #define DSOP_DOWNLEVEL_FILTER_NETWORK                 0x80001000
  231. #define DSOP_DOWNLEVEL_FILTER_SERVICE                 0x80002000
  232. #define DSOP_DOWNLEVEL_FILTER_SYSTEM                  0x80004000
  233. #define DSOP_DOWNLEVEL_FILTER_EXCLUDE_BUILTIN_GROUPS  0x80008000
  234. #define DSOP_DOWNLEVEL_FILTER_TERMINAL_SERVER         0x80010000
  235. #define DSOP_DOWNLEVEL_FILTER_ALL_WELLKNOWN_SIDS      0x80020000
  236. #define DSOP_DOWNLEVEL_FILTER_LOCAL_SERVICE           0x80040000
  237. #define DSOP_DOWNLEVEL_FILTER_NETWORK_SERVICE         0x80080000
  238. #define DSOP_DOWNLEVEL_FILTER_REMOTE_LOGON            0x80100000
  239. /*
  240. DSOP_UPLEVEL_FILTER_FLAGS
  241. =========================
  242. Contains the DSOP_FILTER_* flags for use with a DSOP_SCOPE_INIT_INFO
  243. structure when the scope is uplevel (DS-aware).
  244. flBothModes
  245.     Flags to use for an uplevel scope, regardless of whether it is a
  246.     mixed or native mode domain.
  247. flMixedModeOnly
  248.     Flags to use when an uplevel domain is in mixed mode.
  249. flNativeModeOnly
  250.     Flags to use when an uplevel domain is in native mode.
  251. DSOP_FILTER_FLAGS
  252. =================
  253. Uplevel
  254.     Contains flags to use for an uplevel scope.
  255. flDownlevel
  256.     Flags to use for a downlevel scope.
  257. */
  258. typedef struct _DSOP_UPLEVEL_FILTER_FLAGS
  259. {
  260.     ULONG       flBothModes;
  261.     ULONG       flMixedModeOnly;
  262.     ULONG       flNativeModeOnly;
  263. } DSOP_UPLEVEL_FILTER_FLAGS;
  264. typedef struct _DSOP_FILTER_FLAGS
  265. {
  266.     DSOP_UPLEVEL_FILTER_FLAGS   Uplevel;
  267.     ULONG                       flDownlevel;
  268. } DSOP_FILTER_FLAGS;
  269. /*
  270. DSOP_SCOPE_INIT_INFO
  271. ====================
  272. Each DSOP_SCOPE_INIT_INFO structure in the array DSOP_INIT_INFO.aDsScopeInfos
  273. describes a single scope or a group of scopes with the same settings.
  274. cbSize
  275.     Size, in bytes, of the entire structure.
  276. flType
  277.     DSOP_SCOPE_TYPE_* flags.  It is legal to combine multiple values via
  278.     bitwise OR if all of the types of scopes combined in this way require
  279.     the same settings.
  280. flScope
  281.     DSOP_SCOPE_ * flags.
  282. FilterFlags
  283.     DSOP_FILTER_* flags that indicate which types of objects should be
  284.     presented to the user in this scope.
  285. pwzDcName
  286.     Name of the DC of a domain.  This member is used only if the flType
  287.     member contains the flag DSOP_SCOPE_TYPE_JOINED_DOMAIN.  If that flag is
  288.     not set, this member must be NULL.
  289. pwzADsPath
  290.     Currently not supported, must be NULL.
  291. hr
  292.     Filled with S_OK if the scope represented by this structure could be
  293.     created, or an error message indicating why it could not.  If
  294.     IDsObjectPicker::SetScopes returns a success code, this value will
  295.     also be a success code.
  296. */
  297. typedef struct _DSOP_SCOPE_INIT_INFO
  298. {
  299.     ULONG               cbSize;
  300.     ULONG               flType;
  301.     ULONG               flScope;
  302.     DSOP_FILTER_FLAGS   FilterFlags;
  303.     PCWSTR              pwzDcName;      // OPTIONAL
  304.     PCWSTR              pwzADsPath;     // OPTIONAL
  305.     HRESULT             hr;
  306. } DSOP_SCOPE_INIT_INFO, *PDSOP_SCOPE_INIT_INFO;
  307. typedef const DSOP_SCOPE_INIT_INFO *PCDSOP_SCOPE_INIT_INFO;
  308. /*
  309. DSOP_INIT_INFO flags
  310. ====================
  311. The following flags may be set in DSOP_INIT_INFO.flOptions:
  312. DSOP_FLAG_MULTISELECT
  313.     Allow multiple selections.  If this flag is not set, the dialog will
  314.     return zero or one objects.
  315. DSOP_FLAG_SKIP_TARGET_COMPUTER_DC_CHECK
  316.     If this flag is NOT set, then the DSOP_SCOPE_TYPE_TARGET_COMPUTER flag
  317.     will be ignored if the target computer is a DC.  This flag has no effect
  318.     unless DSOP_SCOPE_TYPE_TARGET_COMPUTER is specified.
  319. */
  320. #define DSOP_FLAG_MULTISELECT                    0x00000001
  321. #define DSOP_FLAG_SKIP_TARGET_COMPUTER_DC_CHECK  0x00000002
  322. /*
  323. DSOP_INIT_INFO
  324. ==============
  325. Used to configure the DS Object Picker dialog.
  326. cbSize
  327.     Size, in bytes, of entire structure.
  328. pwzTargetComputer
  329.     Sets the computer associated with DSOP_SCOPE_TARGET_COMPUTER, and
  330.     which is used to determine the joined domain and enterprise.
  331.     If this value is NULL, the target computer is the local machine.
  332. cDsScopeInfos
  333.     Count of elements in aDsScopeInfos.  Must be at least 1, since
  334.     the object picker cannot operate without at least one scope.
  335. aDsScopeInfos
  336.     Array of scope initialization structures.  Must be present and
  337.     contain at least one element.
  338. flOptions
  339.     Various DS Object Picker flags (DSOP_FLAG_MULTISELECT).
  340. cAttributesToFetch
  341.     Count of elements in apwzAttributeNames.  Can be 0.
  342. apwzAttributeNames
  343.     Array of names of attributes to fetch for each object.  Ignored
  344.     if cAttributesToFetch is 0.
  345. */
  346. typedef struct _DSOP_INIT_INFO
  347. {
  348.     ULONG                       cbSize;
  349.     PCWSTR                      pwzTargetComputer;
  350.     ULONG                       cDsScopeInfos;
  351.     PDSOP_SCOPE_INIT_INFO       aDsScopeInfos;
  352.     ULONG                       flOptions;
  353.     ULONG                       cAttributesToFetch;
  354.     PCWSTR                     *apwzAttributeNames;
  355. } DSOP_INIT_INFO, *PDSOP_INIT_INFO;
  356. typedef const DSOP_INIT_INFO *PCDSOP_INIT_INFO;
  357. /*
  358. DS_SELECTION
  359. ============
  360. Describes an object selected by the user.
  361. pwzName
  362.     The object's RDN.
  363. pwzADsPath
  364.     The object's ADsPath.
  365. pwzClass
  366.     The object's class attribute value.
  367. pwzUPN
  368.     The object's userPrincipalName attribute value.
  369. pvarFetchedAttributes
  370.     An array of VARIANTs, one for each attribute fetched.
  371. flScopeType
  372.     A single DSOP_SCOPE_TYPE_* flag describing the type of the scope
  373.     from which this object was selected.
  374. DS_SELECTION_LIST
  375. =================
  376. Available as a clipboard format from the data object returned by
  377. IDsObjectPicker::InvokeDialog.  Contains a list of objects that the user
  378. selected.
  379. cItems
  380.     Number of elements in the aDsSelection array.
  381. cFetchedAttributes
  382.     Number of elements in each DSSELECTION.avarFetchedAttributes member.
  383. aDsSelection
  384.     Array of cItems DSSELECTION structures.
  385. */
  386. typedef struct _DS_SELECTION
  387. {
  388.     PWSTR      pwzName;
  389.     PWSTR      pwzADsPath;
  390.     PWSTR      pwzClass;
  391.     PWSTR      pwzUPN;
  392.     VARIANT   *pvarFetchedAttributes;
  393.     ULONG      flScopeType;
  394. } DS_SELECTION, *PDS_SELECTION;
  395. typedef struct _DS_SELECTION_LIST
  396. {
  397.     ULONG           cItems;
  398.     ULONG           cFetchedAttributes;
  399.     DS_SELECTION    aDsSelection[ANYSIZE_ARRAY];
  400. } DS_SELECTION_LIST, *PDS_SELECTION_LIST;
  401. //
  402. // Object Picker Interfaces
  403. //
  404. //
  405. // The main interface to the DS Object Picker, used to initialize it,
  406. // invoke the dialog, and return the user's selections.
  407. //
  408. #undef INTERFACE
  409. #define INTERFACE IDsObjectPicker
  410. DECLARE_INTERFACE_(IDsObjectPicker, IUnknown)
  411. {
  412.     // *** IUnknown methods ***
  413.     STDMETHOD(QueryInterface)(
  414.         THIS_
  415.         REFIID riid,
  416.         PVOID *ppv) PURE;
  417.     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  418.     STDMETHOD_(ULONG,Release)(THIS) PURE;
  419.     // *** IDsObjectPicker methods ***
  420.     // Sets scope, filter, etc. for use with next invocation of dialog
  421.     STDMETHOD(Initialize)(
  422.         THIS_
  423.         PDSOP_INIT_INFO pInitInfo) PURE;
  424.     // Creates the modal DS Object Picker dialog.
  425.     STDMETHOD(InvokeDialog)(
  426.          THIS_
  427.          HWND               hwndParent,
  428.          IDataObject      **ppdoSelections) PURE;
  429. };
  430. #endif // __OBJSEL_H_