📄 jwadsclient.pas
字号:
{******************************************************************************}
{ }
{ Active Directory Display API interface Unit for Object Pascal }
{ }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
{ Corporation. All Rights Reserved. }
{ }
{ The original file is: dsclient.h, released June 2000. The original Pascal }
{ code is: DsClient.pas, released December 2000. The initial developer of the }
{ Pascal code is Marcel van Brakel (brakelm@chello.nl). }
{ }
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
{ Marcel van Brakel. All Rights Reserved. }
{ }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
{ }
{ You may retrieve the latest version of this file at the Project JEDI home }
{ page, located at http://delphi-jedi.org or my personal homepage located at }
{ http://members.chello.nl/m.vanbrakel2 }
{ }
{ The contents of this file are used with permission, subject to the Mozilla }
{ Public License Version 1.1 (the "License"); you may not use this file except }
{ in compliance with the License. You may obtain a copy of the License at }
{ http://www.mozilla.org/MPL/MPL-1.1.html }
{ }
{ Software distributed under the License is distributed on an "AS IS" basis, }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
{ the specific language governing rights and limitations under the License. }
{ }
{ Alternatively, the contents of this file may be used under the terms of the }
{ GNU Lesser General Public License (the "LGPL License"), in which case the }
{ provisions of the LGPL License are applicable instead of those above. }
{ If you wish to allow use of your version of this file only under the terms }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting the provisions above and }
{ replace them with the notice and other provisions required by the LGPL }
{ License. If you do not delete the provisions above, a recipient may use }
{ your version of this file under either the MPL or the LGPL License. }
{ }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{ }
{******************************************************************************}
unit JwaDSClient;
{$WEAKPACKAGEUNIT}
{$HPPEMIT ''}
{$HPPEMIT '#include "dsclient.h"'}
{$HPPEMIT ''}
{$I WINDEFINES.INC}
interface
uses
JwaAdsTLB, JwaWinType;
//---------------------------------------------------------------------------//
// CLSIDs exposed for the dsclient.
//---------------------------------------------------------------------------//
// this CLSID is used to signal that the DSOBJECTNAMEs structure originated
// for the Microsoft DS.
const
CLSID_MicrosoftDS: TGUID = (
D1:$fe1290f0; D2:$cfbd; D3:$11cf; D4:($a3, $30, $0, $aa, $0, $c1, $6e, $65));
{$EXTERNALSYM CLSID_MicrosoftDS}
//CLSID_DsFolder: = CLSID_MicrosoftDS;
CLSID_DsFolder: TGUID = (
D1:$fe1290f0; D2:$cfbd; D3:$11cf; D4:($a3, $30, $0, $aa, $0, $c1, $6e, $65));
{$EXTERNALSYM CLSID_DsFolder}
// this is the CLSID used by clients to get the IShellExtInit, IPropSheetExt
// and IContextMenus exposed from dsuiext.dll.
CLSID_DsPropertyPages: TGUID = (
D1:$d45d530; D2:$764b; D3:$11d0; D4:($a1, $ca, $0, $aa, $0, $c1, $6e, $65));
{$EXTERNALSYM CLSID_DsPropertyPages}
CLSID_DsDomainTreeBrowser: TGUID = (
D1:$1698790a; D2:$e2b4; D3:$11d0; D4:($b0, $b1, $00, $c0, $4f, $d8, $dc, $a6));
{$EXTERNALSYM CLSID_DsDomainTreeBrowser}
IID_IDsBrowseDomainTree: TGUID = (
D1:$7cabcf1e; D2:$78f5; D3:$11d2; D4:($96, $c, $0, $c0, $4f, $a3, $1a, $86));
{$EXTERNALSYM IID_IDsBrowseDomainTree}
CLSID_DsDisplaySpecifier: TGUID = (
D1:$1ab4a8c0; D2:$6a0b; D3:$11d2; D4:($ad, $49, $0, $c0, $4f, $a3, $1a, $86));
{$EXTERNALSYM CLSID_DsDisplaySpecifier}
//IID_IDsDisplaySpecifier = CLSID_DsDisplaySpecifier;
IID_IDsDisplaySpecifier: TGUID = (
D1:$1ab4a8c0; D2:$6a0b; D3:$11d2; D4:($ad, $49, $0, $c0, $4f, $a3, $1a, $86));
{$EXTERNALSYM IID_IDsDisplaySpecifier}
CLSID_DsFolderProperties: TGUID = (
D1:$9e51e0d0; D2:$6e0f; D3:$11d2; D4:($96, $1, $0, $c0, $4f, $a3, $1a, $86));
{$EXTERNALSYM CLSID_DsFolderProperties}
//IID_IDsFolderProperties = CLSID_DsFolderProperties;
IID_IDsFolderProperties: TGUID = (
D1:$9e51e0d0; D2:$6e0f; D3:$11d2; D4:($96, $1, $0, $c0, $4f, $a3, $1a, $86));
{$EXTERNALSYM IID_IDsFolderProperties}
// #include "activeds.h"
//---------------------------------------------------------------------------//
// Clipboard formats used within DSUI
//---------------------------------------------------------------------------//
//
// CF_DSOBJECTS
// ------------
// This clipboard format defines the seleciton for an DS IShellFolder to the
// shell extensions. All strings are stored as BSTR's, and an offset == 0
// is used to indicate that the string is not present.
//
const
DSOBJECT_ISCONTAINER = $00000001; // = 1 => object is a container
{$EXTERNALSYM DSOBJECT_ISCONTAINER}
DSOBJECT_READONLYPAGES = DWORD($80000000); // = 1 => read only pages
{$EXTERNALSYM DSOBJECT_READONLYPAGES}
DSPROVIDER_UNUSED_0 = $00000001;
{$EXTERNALSYM DSPROVIDER_UNUSED_0}
DSPROVIDER_UNUSED_1 = $00000002;
{$EXTERNALSYM DSPROVIDER_UNUSED_1}
DSPROVIDER_UNUSED_2 = $00000004;
{$EXTERNALSYM DSPROVIDER_UNUSED_2}
DSPROVIDER_UNUSED_3 = $00000008;
{$EXTERNALSYM DSPROVIDER_UNUSED_3}
DSPROVIDER_ADVANCED = $00000010; // = 1 => advanced mode
{$EXTERNALSYM DSPROVIDER_ADVANCED}
CFSTR_DSOBJECTNAMES = 'DsObjectNames';
{$EXTERNALSYM CFSTR_DSOBJECTNAMES}
type
LPDSOBJECT = ^DSOBJECT;
{$EXTERNALSYM LPDSOBJECT}
DSOBJECT = record
dwFlags: DWORD; // item flags
dwProviderFlags: DWORD; // flags for item provider
offsetName: DWORD; // offset to ADS path of the object
offsetClass: DWORD; // offset to object class name / == 0 not known
end;
{$EXTERNALSYM DSOBJECT}
TDsObject = DSOBJECT;
PDsObject = LPDSOBJECT;
LPDSOBJECTNAMES = ^DSOBJECTNAMES;
{$EXTERNALSYM LPDSOBJECTNAMES}
DSOBJECTNAMES = record
clsidNamespace: CLSID; // namespace identifier (indicates which namespace selection from)
cItems: UINT; // number of objects
aObjects: array [0..0] of DSOBJECT; // array of objects
end;
{$EXTERNALSYM DSOBJECTNAMES}
TDsObjectNames = DSOBJECTNAMES;
PDsObjectNames = LPDSOBJECTNAMES;
//
// CF_DSDISPLAYSPECOPTIONS
// -----------------------
// When invoking an object referenced by a display specifier (context menu, property
// page, etc) we call the IShellExtInit interface passing a IDataObject. This data
// object supports the CF_DSDISPLAYSPECOPTIONS format to give out configuration
// informaiton about admin/shell invocation.
//
// When interacting with dsuiext.dll the interfaces uses this clipboard format
// to determine which display specifier attributes to address (admin/shell)
// and pick up the values accordingly. If no format is suppoted then
// dsuiext.dll defaults to shell.
//
const
CFSTR_DS_DISPLAY_SPEC_OPTIONS = 'DsDisplaySpecOptions';
{$EXTERNALSYM CFSTR_DS_DISPLAY_SPEC_OPTIONS}
CFSTR_DSDISPLAYSPECOPTIONS = CFSTR_DS_DISPLAY_SPEC_OPTIONS;
{$EXTERNALSYM CFSTR_DSDISPLAYSPECOPTIONS}
type
LPDSDISPLAYSPECOPTIONS = ^DSDISPLAYSPECOPTIONS;
{$EXTERNALSYM LPDSDISPLAYSPECOPTIONS}
_DSDISPLAYSPECOPTIONS = record
dwSize: DWORD; // size of struct, for versioning
dwFlags: DWORD; // invocation flags
offsetAttribPrefix: DWORD; // offset to attribute prefix string.
offsetUserName: DWORD; // offset to UNICODE user name
offsetPassword: DWORD; // offset to UNICODE password
offsetServer: DWORD;
offsetServerConfigPath: DWORD;
end;
{$EXTERNALSYM _DSDISPLAYSPECOPTIONS}
DSDISPLAYSPECOPTIONS = _DSDISPLAYSPECOPTIONS;
{$EXTERNALSYM DSDISPLAYSPECOPTIONS}
TDsDisplaySpecOptions = DSDISPLAYSPECOPTIONS;
PDsDisplaySpecOptions = LPDSDISPLAYSPECOPTIONS;
const
DS_PROP_SHELL_PREFIX = 'shell';
{$EXTERNALSYM DS_PROP_SHELL_PREFIX}
DS_PROP_ADMIN_PREFIX = 'admin';
{$EXTERNALSYM DS_PROP_ADMIN_PREFIX}
DSDSOF_HASUSERANDSERVERINFO = $00000001; // = 1 => user name/password are valid
{$EXTERNALSYM DSDSOF_HASUSERANDSERVERINFO}
DSDSOF_SIMPLEAUTHENTICATE = $00000002; // = 1 => don't use secure authentication to DS
{$EXTERNALSYM DSDSOF_SIMPLEAUTHENTICATE}
DSDSOF_DSAVAILABLE = $40000000; // = 1 => ignore DS available checks
{$EXTERNALSYM DSDSOF_DSAVAILABLE}
//
// CF_DSPROPERTYPAGEINFO
// ---------------------
// When the property pages for an object are being displayed the parsed
// display specifier string is passed to the page object via the IDataObject
// in the following clipboard format.
//
// Within the display specifier for a property page, the format for a
// Win32 extension is "n,{clsid}[,bla...]" we take the "bla" section and
// pass it down.
//
CFSTR_DSPROPERTYPAGEINFO = 'DsPropPageInfo';
{$EXTERNALSYM CFSTR_DSPROPERTYPAGEINFO}
type
LPDSPROPERTYPAGEINFO = ^DSPROPERTYPAGEINFO;
{$EXTERNALSYM LPDSPROPERTYPAGEINFO}
DSPROPERTYPAGEINFO = record
offsetString: DWORD; // offset to UNICODE string
end;
{$EXTERNALSYM DSPROPERTYPAGEINFO}
TDsPropertyPageInfo = DSPROPERTYPAGEINFO;
PDsPropertyPageInfo = LPDSPROPERTYPAGEINFO;
//
// To sync property pages and the admin tools this message is broadcast
//
const
DSPROP_ATTRCHANGED_MSG = 'DsPropAttrChanged';
{$EXTERNALSYM DSPROP_ATTRCHANGED_MSG}
//---------------------------------------------------------------------------//
//---------------------------------------------------------------------------//
//
// IDsBrowseDomainTree
// ===================
// This interface returns a list of the domains from a given computer name
// (or the current computer name if none is specified).
//
// NOTES:
// 1) The structure returned by ::GetDomains should be free'd using
// FreeDomains.
//
// 2) ::BrowseTo allocates a string on exit, this is allocated using
// CoTaskMemAlloc, and therefore should be free'd using CoTaskMemFree.
//
//---------------------------------------------------------------------------//
DBDTF_RETURNFQDN = $00000001; // if not set, pszNCName will be blank
{$EXTERNALSYM DBDTF_RETURNFQDN}
DBDTF_RETURNMIXEDDOMAINS = $00000002; // set it if you want downlevel trust domains too
{$EXTERNALSYM DBDTF_RETURNMIXEDDOMAINS}
DBDTF_RETURNEXTERNAL = $00000004; // set it if you want external trust domains too
{$EXTERNALSYM DBDTF_RETURNEXTERNAL}
DBDTF_RETURNINBOUND = $00000008; // set it if you want trusting domains
{$EXTERNALSYM DBDTF_RETURNINBOUND}
DBDTF_RETURNINOUTBOUND = $00000010; // set it if you want both trusted and trusting domains
{$EXTERNALSYM DBDTF_RETURNINOUTBOUND}
type
PDOMAINDESC = ^DOMAINDESC;
{$EXTERNALSYM PDOMAINDESC}
_DOMAINDESC = record
pszName: LPWSTR; // domain name (if no dns, use netbios)
pszPath: LPWSTR; // set to blank
pszNCName: LPWSTR; // FQDN, e.g.,DC=mydomain,DC=microsoft,DC=com
pszTrustParent: LPWSTR; // parent domain name (if no dns, use netbios)
pszObjectClass: LPWSTR; // Object class of the domain object referenced
ulFlags: ULONG; // Flags, from DS_TRUSTED_DOMAINS.Flags
fDownLevel: BOOL; // == 1 if downlevel domain
pdChildList: PDOMAINDESC; // Children of this node
pdNextSibling: PDOMAINDESC; // Siblings of this node
end;
{$EXTERNALSYM _DOMAINDESC}
DOMAINDESC = _DOMAINDESC;
{$EXTERNALSYM DOMAINDESC}
TDomainDesc = DOMAINDESC;
PDOMAIN_TREE = ^DOMAIN_TREE;
{$EXTERNALSYM PDOMAIN_TREE}
DOMAIN_TREE = record
dsSize: DWORD;
dwCount: DWORD;
aDomains: array [0..1 - 1] of DOMAINDESC;
end;
{$EXTERNALSYM DOMAIN_TREE}
DOMAINTREE = DOMAIN_TREE;
{$EXTERNALSYM DOMAINTREE}
TDomainTree = DOMAIN_TREE;
PDomainTree = PDOMAIN_TREE;
IDsBrowseDomainTree = interface (IUnknown)
['{7cabcf1e-78f5-11d2-960c-00c04fa31a86}']
function BrowseTo(hwndParent: HWND; var ppszTargetPath: LPWSTR;
dwFlags: DWORD): HRESULT; stdcall;
function GetDomains(var ppDomainTree: PDOMAIN_TREE;
dwFlags: DWORD): HRESULT; stdcall;
function FreeDomains(var ppDomainTree: PDOMAIN_TREE): HRESULT; stdcall;
function FlushCachedDomains: HRESULT; stdcall;
function SetComputer(pszComputerName, pszUserName,
pszPassword: LPCWSTR): HRESULT; stdcall;
end;
{$EXTERNALSYM IDsBrowseDomainTree}
//---------------------------------------------------------------------------//
//---------------------------------------------------------------------------//
//
// IDsDisplaySpecifier
// ===================
// This interface gives client UI access to the display specifiers for
// specific attributes.
//
//---------------------------------------------------------------------------//
//
// IDsDisplaySpecifier::SetServer flags
//
const
DSSSF_SIMPLEAUTHENTICATE = $00000001; // = 1 => don't use secure authentication to DS
{$EXTERNALSYM DSSSF_SIMPLEAUTHENTICATE}
DSSSF_DSAVAILABLE = DWORD($80000000); // = 1 => ignore DS available checks
{$EXTERNALSYM DSSSF_DSAVAILABLE}
//
// Flags for IDsDisplaySpecifier::GetIcon / GetIconLocation
//
DSGIF_ISNORMAL = $0000000; // = icon is in normal state (default)
{$EXTERNALSYM DSGIF_ISNORMAL}
DSGIF_ISOPEN = $0000001; // = icon is in open state
{$EXTERNALSYM DSGIF_ISOPEN}
DSGIF_ISDISABLED = $0000002; // = icon is in a disabled state
{$EXTERNALSYM DSGIF_ISDISABLED}
DSGIF_ISMASK = $000000f;
{$EXTERNALSYM DSGIF_ISMASK}
DSGIF_GETDEFAULTICON = $0000010; // = 1 => if no icon then get default (from shell32.dll)
{$EXTERNALSYM DSGIF_GETDEFAULTICON}
DSGIF_DEFAULTISCONTAINER = $0000020; // = 1 => if returning default icon, return it as a container
{$EXTERNALSYM DSGIF_DEFAULTISCONTAINER}
//
// Flags for IDsDisplaySpecifier::IsClassContainer
//
DSICCF_IGNORETREATASLEAF = $00000001; // = 1 => igore the "treatAsLeaf" and use only schema information
{$EXTERNALSYM DSICCF_IGNORETREATASLEAF}
//
// Callback function used for IDsDisplaySpecifier::EnumClassAttributes
//
DSECAF_NOTLISTED = $00000001; // = 1 => hide from the field drop down in the query UI
{$EXTERNALSYM DSECAF_NOTLISTED}
type
LPDSENUMATTRIBUTES = function (lParam: LPARAM; pszAttributeName: LPCWSTR;
pszDisplayName: LPCWSTR; dwFlags: DWORD): HRESULT; stdcall;
{$EXTERNALSYM LPDSENUMATTRIBUTES}
TDsEnumAttributes = LPDSENUMATTRIBUTES;
//
// IDsDisplaySpecifier::GetClassCreationInfo information
//
const
DSCCIF_HASWIZARDDIALOG = $00000001; // = 1 => return the wizard dialog CLSID
{$EXTERNALSYM DSCCIF_HASWIZARDDIALOG}
DSCCIF_HASWIZARDPRIMARYPAGE = $00000002; // = 1 => returning a primary wizard dlg CLSID
{$EXTERNALSYM DSCCIF_HASWIZARDPRIMARYPAGE}
type
LPDSCLASSCREATIONINFO = ^DSCLASSCREATIONINFO;
{$EXTERNALSYM LPDSCLASSCREATIONINFO}
DSCLASSCREATIONINFO = record
dwFlags: DWORD;
clsidWizardDialog: CLSID;
clsidWizardPrimaryPage: CLSID;
cWizardExtensions: DWORD; // how many extension CLSIDs?
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -