' ########################################################################################
' Microsoft Windows
' File: ObjSel.inc
' Contents: Object Picker Dialog public header
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_ObjSel_PBI)
#DEFINE PBX_ObjSel_PBI
%EQUATE `OBJSEL_INC = 1
#INCLUDE ONCE "Legacy/COM/Ole2.inc"
$CLSID_DsObjectPicker = GUID$("{17D6CCD8-3B7B-11D2-B9E0-00C04FD8DBF7}")
$IID_IDsObjectPicker = GUID$("{0C87E64E-3B7A-11D2-B9E0-00C04FD8DBF7}")
$IID_IDsObjectPickerCredentials = GUID$("{E2D3EC9B-D041-445A-8F16-4748DE8FB1CF}")
'/*
'CLIPBOARD FORMATS
'=================
'CFSTR_DSOP_DS_SELECTION_LIST
' Returns an HGLOBAL for global memory containing a DS_SELECTION_LIST
' variable length structure.
'*/
$CFSTR_DSOP_DS_SELECTION_LIST = "CFSTR_DSOP_DS_SELECTION_LIST"
'/*
'SCOPE TYPES
'===========
'A scope is an entry in the "Look In" dropdown list of the Object Picker
'dialog.
'When initializing the DS Object Picker, DSOP_SCOPE_TYPEs are used with
'DSOP_SCOPE_INIT_INFO.flType member to specify which types of scopes the
'DS Object Picker should put in the "Look In" list.
'DSOP_SCOPE_TYPE_TARGET_COMPUTER
' Computer specified by DSOP_INIT_INFO.pwzTargetComputer, NULL is
' local computer.
'DSOP_SCOPE_TYPE_UPLEVEL_JOINED_DOMAIN
' Uplevel domain to which target computer is joined.
'DSOP_SCOPE_TYPE_DOWNLEVEL_JOINED_DOMAIN
' Downlevel domain to which target computer is joined.
'DSOP_SCOPE_TYPE_ENTERPRISE_DOMAIN
' All domains in the enterprise to which the target computer belongs
' other than the JOINED_DOMAIN or USER_SPECIFIED_*_SCOPEs.
'DSOP_SCOPE_TYPE_GLOBAL_CATALOG
' The Entire Directory scope.
'DSOP_SCOPE_TYPE_EXTERNAL_UPLEVEL_DOMAIN
' All uplevel domains external to the enterprise but trusted by the
' domain to which the target computer is joined.
'DSOP_SCOPE_TYPE_EXTERNAL_DOWNLEVEL_DOMAIN
' All downlevel domains external to the enterprise but trusted by the
' domain to which the target computer is joined.
'DSOP_SCOPE_TYPE_WORKGROUP
' The workgroup of which TARGET_COMPUTER is a member. Applies only if the
' TARGET_COMPUTER is not joined to a domain.
'DSOP_SCOPE_TYPE_USER_ENTERED_UPLEVEL_SCOPE
'DSOP_SCOPE_TYPE_USER_ENTERED_DOWNLEVEL_SCOPE
' Any uplevel or downlevel scope generated by processing user input. If
' neither of these types is specified, user entries that do not refer to
' one of the scopes in the "Look In" control will be rejected.
'*/
%EQUATE `DSOP_SCOPE_TYPE_TARGET_COMPUTER = &H00000001
%EQUATE `DSOP_SCOPE_TYPE_UPLEVEL_JOINED_DOMAIN = &H00000002
%EQUATE `DSOP_SCOPE_TYPE_DOWNLEVEL_JOINED_DOMAIN = &H00000004
%EQUATE `DSOP_SCOPE_TYPE_ENTERPRISE_DOMAIN = &H00000008
%EQUATE `DSOP_SCOPE_TYPE_GLOBAL_CATALOG = &H00000010
%EQUATE `DSOP_SCOPE_TYPE_EXTERNAL_UPLEVEL_DOMAIN = &H00000020
%EQUATE `DSOP_SCOPE_TYPE_EXTERNAL_DOWNLEVEL_DOMAIN = &H00000040
%EQUATE `DSOP_SCOPE_TYPE_WORKGROUP = &H00000080
%EQUATE `DSOP_SCOPE_TYPE_USER_ENTERED_UPLEVEL_SCOPE = &H00000100
%EQUATE `DSOP_SCOPE_TYPE_USER_ENTERED_DOWNLEVEL_SCOPE = &H00000200
'/*
'DSOP_SCOPE_INIT_INFO flags
'==========================
'The flScope member can contain zero or more of the following flags:
'DSOP_SCOPE_FLAG_STARTING_SCOPE
' The scope should be the first one selected in the Look In control after
' dialog initialization. If more than one scope specifies this flag,
' the one which is chosen to be the starting scope is implementation
' dependant.
'DSOP_SCOPE_FLAG_WANT_PROVIDER_WINNT
' ADs paths for objects selected from this scope should be converted to use
' the WinNT provider.
'DSOP_SCOPE_FLAG_WANT_PROVIDER_LDAP
' ADs paths for objects selected from this scope should be converted to use
' the LDAP provider.
'DSOP_SCOPE_FLAG_WANT_PROVIDER_GC
' ADs paths for objects selected from this scope should be converted to use
' the GC provider.
'DSOP_SCOPE_FLAG_WANT_SID_PATH
' ADs paths for objects selected from this scope having an objectSid
' attribute should be converted to the form LDAP://<SID=x>, where x
' represents the hexidecimal digits of the objectSid attribute value.
'DSOP_SCOPE_FLAG_WANT_DOWNLEVEL_BUILTIN_PATH
' ADs paths for downlevel well-known SID objects (for example,
' DSOP_DOWNLEVEL_FILTER_INTERACTIVE) are an empty string unless this flag is
' specified. If it is, the paths will be of the form
' WinNT://NT AUTHORITY/Interactive or WinNT://Creator owner.
'DSOP_SCOPE_FLAG_DEFAULT_FILTER_USERS
' If the scope filter contains the DSOP_FILTER_USERS or
' DSOP_DOWNLEVEL_FILTER_USERS flag, then check the Users checkbox by
' default in the Look For dialog.
'DSOP_SCOPE_FLAG_DEFAULT_FILTER_GROUPS
'DSOP_SCOPE_FLAG_DEFAULT_FILTER_COMPUTERS
'DSOP_SCOPE_FLAG_DEFAULT_FILTER_CONTACTS
'*/
%EQUATE `DSOP_SCOPE_FLAG_STARTING_SCOPE = &H00000001
%EQUATE `DSOP_SCOPE_FLAG_WANT_PROVIDER_WINNT = &H00000002
%EQUATE `DSOP_SCOPE_FLAG_WANT_PROVIDER_LDAP = &H00000004
%EQUATE `DSOP_SCOPE_FLAG_WANT_PROVIDER_GC = &H00000008
%EQUATE `DSOP_SCOPE_FLAG_WANT_SID_PATH = &H00000010
%EQUATE `DSOP_SCOPE_FLAG_WANT_DOWNLEVEL_BUILTIN_PATH = &H00000020
%EQUATE `DSOP_SCOPE_FLAG_DEFAULT_FILTER_USERS = &H00000040
%EQUATE `DSOP_SCOPE_FLAG_DEFAULT_FILTER_GROUPS = &H00000080
%EQUATE `DSOP_SCOPE_FLAG_DEFAULT_FILTER_COMPUTERS = &H00000100
%EQUATE `DSOP_SCOPE_FLAG_DEFAULT_FILTER_CONTACTS = &H00000200
%EQUATE `DSOP_SCOPE_FLAG_DEFAULT_FILTER_SERVICE_ACCOUNTS = &H00000400
'/*
'The flMixedModeOnly/flNativeModeOnly member of an uplevel scope can
'contain one or more of the following flags (at least one must be specified):
'DSOP_FILTER_INCLUDE_ADVANCED_VIEW
' Include objects which have the attribute showInAdvancedViewOnly set to
' true.
'DSOP_FILTER_USERS
' Include user objects.
'DSOP_FILTER_BUILTIN_GROUPS
' Include group objects with a groupType value having the flag
' GROUP_TYPE_BUILTIN_LOCAL_GROUP.
'DSOP_FILTER_WELL_KNOWN_PRINCIPALS
' Include the contents of the WellKnown Security Principals container.
'DSOP_FILTER_UNIVERSAL_GROUPS_DL
' Include distribution list universal groups.
'DSOP_FILTER_UNIVERSAL_GROUPS_SE
' Include security enabled universal groups.
'DSOP_FILTER_GLOBAL_GROUPS_DL
' Include distribution list global groups.
'DSOP_FILTER_GLOBAL_GROUPS_SE
' Include security enabled global groups.
'DSOP_FILTER_DOMAIN_LOCAL_GROUPS_DL
' Include distribution list domain global groups.
'DSOP_FILTER_DOMAIN_LOCAL_GROUPS_SE
' Include security enabled domain local groups.
'DSOP_FILTER_CONTACTS
' Include contact objects.
'DSOP_FILTER_COMPUTERS
' Include computer objects.
'*/
%EQUATE `DSOP_FILTER_INCLUDE_ADVANCED_VIEW = &H00000001
%EQUATE `DSOP_FILTER_USERS = &H00000002
%EQUATE `DSOP_FILTER_BUILTIN_GROUPS = &H00000004
%EQUATE `DSOP_FILTER_WELL_KNOWN_PRINCIPALS = &H00000008
%EQUATE `DSOP_FILTER_UNIVERSAL_GROUPS_DL = &H00000010
%EQUATE `DSOP_FILTER_UNIVERSAL_GROUPS_SE = &H00000020
%EQUATE `DSOP_FILTER_GLOBAL_GROUPS_DL = &H00000040
%EQUATE `DSOP_FILTER_GLOBAL_GROUPS_SE = &H00000080
%EQUATE `DSOP_FILTER_DOMAIN_LOCAL_GROUPS_DL = &H00000100
%EQUATE `DSOP_FILTER_DOMAIN_LOCAL_GROUPS_SE = &H00000200
%EQUATE `DSOP_FILTER_CONTACTS = &H00000400
%EQUATE `DSOP_FILTER_COMPUTERS = &H00000800
%EQUATE `DSOP_FILTER_SERVICE_ACCOUNTS = &H00001000
'/*
'The flFilter member of a downlevel scope can contain one or more of the
'following flags:
'DSOP_DOWNLEVEL_FILTER_USERS
' Include user objects.
'DSOP_DOWNLEVEL_FILTER_LOCAL_GROUPS
' Include all local groups.
'DSOP_DOWNLEVEL_FILTER_GLOBAL_GROUPS
' Include all global groups.
'DSOP_DOWNLEVEL_FILTER_COMPUTERS
' Include computer objects
'DSOP_DOWNLEVEL_FILTER_WORLD
' Include builtin security principal World (Everyone).
'DSOP_DOWNLEVEL_FILTER_AUTHENTICATED_USER
' Include builtin security principal Authenticated User.
'DSOP_DOWNLEVEL_FILTER_ANONYMOUS
' Include builtin security principal Anonymous.
'DSOP_DOWNLEVEL_FILTER_BATCH
' Include builtin security principal Batch.
'DSOP_DOWNLEVEL_FILTER_CREATOR_OWNER
' Include builtin security principal Creator Owner.
'DSOP_DOWNLEVEL_FILTER_CREATOR_GROUP
' Include builtin security principal Creator Group.
'DSOP_DOWNLEVEL_FILTER_DIALUP
' Include builtin security principal Dialup.
'DSOP_DOWNLEVEL_FILTER_INTERACTIVE
' Include builtin security principal Interactive.
'DSOP_DOWNLEVEL_FILTER_NETWORK
' Include builtin security principal Network.
'DSOP_DOWNLEVEL_FILTER_SERVICE
' Include builtin security principal Service.
'DSOP_DOWNLEVEL_FILTER_SYSTEM
' Include builtin security principal System.
'DSOP_DOWNLEVEL_FILTER_EXCLUDE_BUILTIN_GROUPS
' Exclude local builtin groups returned by groups enumeration.
'DSOP_DOWNLEVEL_FILTER_TERMINAL_SERVER
' Include builtin security principal Terminal Server.
'DSOP_DOWNLEVEL_FILTER_LOCAL_SERVICE
' Include builtin security principal Local Service
'DSOP_DOWNLEVEL_FILTER_NETWORK_SERVICE
' Include builtin security principal Network Service
'DSOP_DOWNLEVEL_FILTER_ALL_WELLKNOWN_SIDS
' Include all builtin security principals.
'DSOP_DOWNLEVEL_FILTER_SERVICES
' Include all services.
'*/
%EQUATE `DSOP_DOWNLEVEL_FILTER_USERS = &H80000001
%EQUATE `DSOP_DOWNLEVEL_FILTER_LOCAL_GROUPS = &H80000002
%EQUATE `DSOP_DOWNLEVEL_FILTER_GLOBAL_GROUPS = &H80000004
%EQUATE `DSOP_DOWNLEVEL_FILTER_COMPUTERS = &H80000008
%EQUATE `DSOP_DOWNLEVEL_FILTER_WORLD = &H80000010
%EQUATE `DSOP_DOWNLEVEL_FILTER_AUTHENTICATED_USER = &H80000020
%EQUATE `DSOP_DOWNLEVEL_FILTER_ANONYMOUS = &H80000040
%EQUATE `DSOP_DOWNLEVEL_FILTER_BATCH = &H80000080
%EQUATE `DSOP_DOWNLEVEL_FILTER_CREATOR_OWNER = &H80000100
%EQUATE `DSOP_DOWNLEVEL_FILTER_CREATOR_GROUP = &H80000200
%EQUATE `DSOP_DOWNLEVEL_FILTER_DIALUP = &H80000400
%EQUATE `DSOP_DOWNLEVEL_FILTER_INTERACTIVE = &H80000800
%EQUATE `DSOP_DOWNLEVEL_FILTER_NETWORK = &H80001000
%EQUATE `DSOP_DOWNLEVEL_FILTER_SERVICE = &H80002000
%EQUATE `DSOP_DOWNLEVEL_FILTER_SYSTEM = &H80004000
%EQUATE `DSOP_DOWNLEVEL_FILTER_EXCLUDE_BUILTIN_GROUPS = &H80008000
%EQUATE `DSOP_DOWNLEVEL_FILTER_TERMINAL_SERVER = &H80010000
%EQUATE `DSOP_DOWNLEVEL_FILTER_ALL_WELLKNOWN_SIDS = &H80020000
%EQUATE `DSOP_DOWNLEVEL_FILTER_LOCAL_SERVICE = &H80040000
%EQUATE `DSOP_DOWNLEVEL_FILTER_NETWORK_SERVICE = &H80080000
%EQUATE `DSOP_DOWNLEVEL_FILTER_REMOTE_LOGON = &H80100000
%EQUATE `DSOP_DOWNLEVEL_FILTER_INTERNET_USER = &H80200000
%EQUATE `DSOP_DOWNLEVEL_FILTER_OWNER_RIGHTS = &H80400000
%EQUATE `DSOP_DOWNLEVEL_FILTER_SERVICES = &H80800000
%EQUATE `DSOP_DOWNLEVEL_FILTER_LOCAL_LOGON = &H81000000
%EQUATE `DSOP_DOWNLEVEL_FILTER_THIS_ORG_CERT = &H82000000
%EQUATE `DSOP_DOWNLEVEL_FILTER_IIS_APP_POOL = &H84000000
'/*
'DSOP_UPLEVEL_FILTER_FLAGS
'=========================
'Contains the DSOP_FILTER_* flags for use with a DSOP_SCOPE_INIT_INFO
'structure when the scope is uplevel (DS-aware).
'flBothModes
' Flags to use for an uplevel scope, regardless of whether it is a
' mixed or native mode domain.
'flMixedModeOnly
' Flags to use when an uplevel domain is in mixed mode.
'flNativeModeOnly
' Flags to use when an uplevel domain is in native mode.
'DSOP_FILTER_FLAGS
'=================
'Uplevel
' Contains flags to use for an uplevel scope.
'flDownlevel
' Flags to use for a downlevel scope.
'*/
' // Size = 12 bytes
TYPE DSOP_UPLEVEL_FILTER_FLAGS DWORD
 flBothModes AS DWORD ' ULONG
 flMixedModeOnly AS DWORD ' ULONG
 flNativeModeOnly AS DWORD ' ULONG
END TYPE
' // Size = 16 bytes
TYPE DSOP_FILTER_FLAGS DWORD
 Uplevel AS DSOP_UPLEVEL_FILTER_FLAGS
 flDownlevel AS DWORD ' ULONG
END TYPE
'/*
'DSOP_SCOPE_INIT_INFO
'====================
'Each DSOP_SCOPE_INIT_INFO structure in the array DSOP_INIT_INFO.aDsScopeInfos
'describes a single scope or a group of scopes with the same settings.
'cbSize
' Size, in bytes, of the entire structure.
'flType
' DSOP_SCOPE_TYPE_* flags. It is legal to combine multiple values via
' bitwise OR if all of the types of scopes combined in this way require
' the same settings.
'flScope
' DSOP_SCOPE_ * flags.
'FilterFlags
' DSOP_FILTER_* flags that indicate which types of objects should be
' presented to the user in this scope.
'pwzDcName
' Name of the DC of a domain. This member is used only if the flType
' member contains the flag DSOP_SCOPE_TYPE_JOINED_DOMAIN. If that flag is
' not set, this member must be NULL.
'pwzADsPath
' Currently not supported, must be NULL.
'hr
' Filled with S_OK if the scope represented by this structure could be
' created, or an error message indicating why it could not. If
' IDsObjectPicker::SetScopes returns a success code, this value will
' also be a success code.
'*/
' // Size = 40 bytes
TYPE DSOP_SCOPE_INIT_INFO DWORD
 cbSize AS DWORD ' ULONG
 flType AS DWORD ' ULONG
 flScope AS DWORD ' ULONG
 FilterFlags AS DSOP_FILTER_FLAGS ' DSOP_FILTER_FLAGS
 pwzDcName AS WSTRINGZ PTR ' PCWSTR // OPTIONAL
 pwzADsPath AS WSTRINGZ PTR ' PCWSTR // OPTIONAL
 hr AS LONG
END TYPE
'/*
'DSOP_INIT_INFO flags
'====================
'The following flags may be set in DSOP_INIT_INFO.flOptions:
'DSOP_FLAG_MULTISELECT
' Allow multiple selections. If this flag is not set, the dialog will
' return zero or one objects.
'DSOP_FLAG_SKIP_TARGET_COMPUTER_DC_CHECK
' If this flag is NOT set, then the DSOP_SCOPE_TYPE_TARGET_COMPUTER flag
' will be ignored if the target computer is a DC. This flag has no effect
' unless DSOP_SCOPE_TYPE_TARGET_COMPUTER is specified.
'*/
%EQUATE `DSOP_FLAG_MULTISELECT = &H00000001
%EQUATE `DSOP_FLAG_SKIP_TARGET_COMPUTER_DC_CHECK = &H00000002
'/*
'DSOP_INIT_INFO
'==============
'Used to configure the DS Object Picker dialog.
'cbSize
' Size, in bytes, of entire structure.
'pwzTargetComputer
' Sets the computer associated with DSOP_SCOPE_TARGET_COMPUTER, and
' which is used to determine the joined domain and enterprise.
' If this value is NULL, the target computer is the local machine.
'cDsScopeInfos
' Count of elements in aDsScopeInfos. Must be at least 1, since
' the object picker cannot operate without at least one scope.
'aDsScopeInfos
' Array of scope initialization structures. Must be present and
' contain at least one element.
'flOptions
' Various DS Object Picker flags (DSOP_FLAG_MULTISELECT).
'cAttributesToFetch
' Count of elements in apwzAttributeNames. Can be 0.
'apwzAttributeNames
' Array of names of attributes to fetch for each object. Ignored
' if cAttributesToFetch is 0.
'*/
' // Size = 28 bytes
TYPE DSOP_INIT_INFO DWORD
 cbSize AS DWORD ' ULONG
 pwzTargetComputer AS WSTRINGZ PTR
 cDsScopeInfos AS DWORD ' ULONG
 aDsScopeInfos AS DSOP_SCOPE_INIT_INFO PTR ' PDSOP_SCOPE_INIT_INFO
 flOptions AS DWORD ' ULONG
 cAttributesToFetch AS DWORD ' ULONG
 apwzAttributeNames AS WSTRINGZ PTR ' PCWSTR*
END TYPE
'/*
'DS_SELECTION
'============
'Describes an object selected by the user.
'pwzName
' The object's RDN.
'pwzADsPath
' The object's ADsPath.
'pwzClass
' The object's class attribute value.
'pwzUPN
' The object's userPrincipalName attribute value.
'pvarFetchedAttributes
' An array of VARIANTs, one for each attribute fetched.
'flScopeType
' A single DSOP_SCOPE_TYPE_* flag describing the type of the scope
' from which this object was selected.
'DS_SELECTION_LIST
'=================
'Available as a clipboard format from the data object returned by
'IDsObjectPicker::InvokeDialog. Contains a list of objects that the user
'selected.
'cItems
' Number of elements in the aDsSelection array.
'cFetchedAttributes
' Number of elements in each DSSELECTION.avarFetchedAttributes member.
'aDsSelection
' Array of cItems DSSELECTION structures.
'*/
' // Size = 24 bytes
TYPE DS_SELECTION DWORD
 pwzName AS WSTRINGZ PTR
 pwzADsPath AS WSTRINGZ PTR
 pwzClass AS WSTRINGZ PTR
 pwzUPN AS WSTRINGZ PTR
 pvarFetchedAttributes AS tagVARIANT PTR ' VARIANT *
 flScopeType AS DWORD ' ULONG
END TYPE
' // Size = 32 bytes
TYPE DS_SELECTION_LIST DWORD
 cItems AS DWORD ' ULONG
 cFetchedAttributes AS DWORD ' ULONG
 aDsSelection(0) AS DS_SELECTION ' DS_SELECTION - ANYSIZE_ARRAY
END TYPE
'//
'// Object Picker Interfaces
'//
'//
'// The main interface to the DS Object Picker, used to initialize it,
'// invoke the dialog, and return the user's selections.
'//
' ########################################################################################
' Interface name = IDsObjectPicker
' IID = 0C87E64E-3B7A-11D2-B9E0-00C04FD8DBF7
' Inherited interface = IUnknown
' ########################################################################################
INTERFACE IDsObjectPicker $IID_IDsObjectPicker
 INHERIT IUnknown
 ' =====================================================================================
 METHOD Initialize ( ' VTable offset = 12
 BYREF pInitInfo AS DSOP_INIT_INFO
 ) AS LONG
 ' =====================================================================================
 METHOD InvokeDialog ( ' VTable offset = 16
 BYVAL hwndParent AS DWORD
 , BYREF ppdoSelections AS IDataObject
 ) AS LONG
 ' =====================================================================================
END INTERFACE
' ########################################################################################
' Interface name = IDsObjectPickerCredentials
' IID = E2D3EC9B-D041-445A-8F16-4748DE8FB1CF
' Inherited interface = IUnknown
' ########################################################################################
INTERFACE IDsObjectPickerCredentials $IID_IDsObjectPickerCredentials
 INHERIT IUnknown
 ' =====================================================================================
 METHOD SetCredentials ( ' VTable offset = 12
 BYREF szUserName AS WSTRINGZ
 , BYREF szPassword AS WSTRINGZ
 ) AS LONG
 ' =====================================================================================
END INTERFACE
#ENDIF
