/*
 * Copyright 2005 Francois Gouget
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

import "oaidl.idl";

#ifndef __WIDL__
#define threading(model)
#define progid(str)
#define vi_progid(str)
#endif

[
    helpstring("Active DS Type Library"),
    uuid(97d25db0-0363-11cf-abc4-02608c9e7553),
    version(1.0)
]
library ActiveDs
{

importlib("stdole2.tlb");

typedef enum
{
    ADS_RIGHT_DS_CREATE_CHILD         = 0x00000001,
    ADS_RIGHT_DS_DELETE_CHILD         = 0x00000002,
    ADS_RIGHT_ACTRL_DS_LIST           = 0x00000004,
    ADS_RIGHT_DS_SELF                 = 0x00000008,
    ADS_RIGHT_DS_READ_PROP            = 0x00000010,
    ADS_RIGHT_DS_WRITE_PROP           = 0x00000020,
    ADS_RIGHT_DS_DELETE_TREE          = 0x00000040,
    ADS_RIGHT_DS_LIST_OBJECT          = 0x00000080,
    ADS_RIGHT_DS_CONTROL_ACCESS       = 0x00000100,

    ADS_RIGHT_DELETE                  = 0x00010000,
    ADS_RIGHT_READ_CONTROL            = 0x00020000,
    ADS_RIGHT_WRITE_DAC               = 0x00040000,
    ADS_RIGHT_WRITE_OWNER             = 0x00080000,
    ADS_RIGHT_SYNCHRONIZE             = 0x00100000,
    ADS_RIGHT_ACCESS_SYSTEM_SECURITY  = 0x00200000,

    ADS_RIGHT_GENERIC_ALL             = 0x10000000,
    ADS_RIGHT_GENERIC_EXECUTE         = 0x20000000,
    ADS_RIGHT_GENERIC_WRITE           = 0x40000000,
    ADS_RIGHT_GENERIC_READ            = 0x80000000
} ADS_RIGHTS_ENUM;

typedef enum
{
    ADS_SECURE_AUTHENTICATION     = 0x1,
    ADS_USE_ENCRYPTION            = 0x2,
    ADS_USE_SSL                   = 0x2,
    ADS_READONLY_SERVER           = 0x4,
    ADS_PROMPT_CREDENTIALS        = 0x8,
    ADS_NO_AUTHENTICATION         = 0x10,
    ADS_FAST_BIND                 = 0x20,
    ADS_USE_SIGNING               = 0x40,
    ADS_USE_SEALING               = 0x80,
    ADS_USE_DELEGATION            = 0x100,
    ADS_SERVER_BIND               = 0x200,
    ADS_NO_REFERRAL_CHASING       = 0x400,
    ADS_AUTH_RESERVED             = 0x80000000
} ADS_AUTHENTICATION_ENUM;

typedef enum
{
    ADS_SEARCHPREF_ASYNCHRONOUS,
    ADS_SEARCHPREF_DEREF_ALIASES,
    ADS_SEARCHPREF_SIZE_LIMIT,
    ADS_SEARCHPREF_TIME_LIMIT,
    ADS_SEARCHPREF_ATTRIBTYPES_ONLY,
    ADS_SEARCHPREF_SEARCH_SCOPE,
    ADS_SEARCHPREF_TIMEOUT,
    ADS_SEARCHPREF_PAGESIZE,
    ADS_SEARCHPREF_PAGED_TIME_LIMIT,
    ADS_SEARCHPREF_CHASE_REFERRALS,
    ADS_SEARCHPREF_SORT_ON,
    ADS_SEARCHPREF_CACHE_RESULTS,
    ADS_SEARCHPREF_DIRSYNC,
    ADS_SEARCHPREF_TOMBSTONE,
    ADS_SEARCHPREF_VLV,
    ADS_SEARCHPREF_ATTRIBUTE_QUERY,
    ADS_SEARCHPREF_SECURITY_MASK,
    ADS_SEARCHPREF_DIRSYNC_FLAG,
    ADS_SEARCHPREF_EXTENDED_DN
} ADS_SEARCHPREF_ENUM;

typedef enum
{
    ADS_STATUS_S_OK,
    ADS_STATUS_INVALID_SEARCHPREF,
    ADS_STATUS_INVALID_SEARCHPREFVALUE
} ADS_STATUSENUM;

typedef enum
{
    ADSTYPE_INVALID,
    ADSTYPE_DN_STRING,
    ADSTYPE_CASE_EXACT_STRING,
    ADSTYPE_CASE_IGNORE_STRING,
    ADSTYPE_PRINTABLE_STRING,
    ADSTYPE_NUMERIC_STRING,
    ADSTYPE_BOOLEAN,
    ADSTYPE_INTEGER,
    ADSTYPE_OCTET_STRING,
    ADSTYPE_UTC_TIME,
    ADSTYPE_LARGE_INTEGER,
    ADSTYPE_PROV_SPECIFIC,
    ADSTYPE_OBJECT_CLASS,
    ADSTYPE_CASEIGNORE_LIST,
    ADSTYPE_OCTET_LIST,
    ADSTYPE_PATH,
    ADSTYPE_POSTALADDRESS,
    ADSTYPE_TIMESTAMP,
    ADSTYPE_BACKLINK,
    ADSTYPE_TYPEDNAME,
    ADSTYPE_HOLD,
    ADSTYPE_NETADDRESS,
    ADSTYPE_REPLICAPOINTER,
    ADSTYPE_FAXNUMBER,
    ADSTYPE_EMAIL,
    ADSTYPE_NT_SECURITY_DESCRIPTOR,
    ADSTYPE_UNKNOWN,
    ADSTYPE_DN_WITH_BINARY,
    ADSTYPE_DN_WITH_STRING
} ADSTYPEENUM;

typedef enum
{
    ADS_SCOPE_BASE,
    ADS_SCOPE_ONELEVEL,
    ADS_SCOPE_SUBTREE
} ADS_SCOPEENUM;

typedef enum
{
    ADS_PASSWORD_ENCODE_REQUIRE_SSL,
    ADS_PASSWORD_ENCODE_CLEAR
} ADS_PASSWORD_ENCODING_ENUM;

typedef enum
{
    ADS_OPTION_SERVERNAME,
    ADS_OPTION_REFERRALS,
    ADS_OPTION_PAGE_SIZE,
    ADS_OPTION_SECURITY_MASK,
    ADS_OPTION_MUTUAL_AUTH_STATUS,
    ADS_OPTION_QUOTA,
    ADS_OPTION_PASSWORD_PORTNUMBER,
    ADS_OPTION_PASSWORD_METHOD,
    ADS_OPTION_ACCUMULATIVE_MODIFICATION,
    ADS_OPTION_SKIP_SID_LOOKUP
} ADS_OPTION_ENUM;

typedef struct _ADS_CASEIGNORE_LIST
{
    struct _ADS_CASEIGNORE_LIST *Next;
    LPWSTR String;
} ADS_CASEIGNORE_LIST;

typedef struct _ADS_OCTET_LIST
{
    struct _ADS_OCTET_LIST *Next;
    DWORD Length;
    BYTE *Data;
} ADS_OCTET_LIST;

typedef struct
{
    DWORD Type;
    LPWSTR VolumeName;
    LPWSTR Path;
} ADS_PATH, *PADS_PATH;

typedef struct
{
    DWORD WholeSeconds;
    DWORD EventID;
} ADS_TIMESTAMP;


typedef ADSTYPEENUM ADSTYPE;
typedef LPWSTR ADS_DN_STRING;
typedef LPWSTR *PADS_DN_STRING;
typedef LPWSTR ADS_CASE_EXACT_STRING;
typedef LPWSTR *PADS_CASE_EXACT_STRING;
typedef LPWSTR ADS_CASE_IGNORE_STRING;
typedef LPWSTR *PADS_CASE_IGNORE_STRING;
typedef LPWSTR ADS_PRINTABLE_STRING;
typedef LPWSTR *PADS_PRINTABLE_STRING;
typedef LPWSTR ADS_NUMERIC_STRING;
typedef LPWSTR *PADS_NUMERIC_STRING;
typedef DWORD ADS_BOOLEAN;
typedef DWORD *LPNDS_BOOLEAN;
typedef DWORD ADS_INTEGER;
typedef DWORD *PADS_INTEGER;
typedef SYSTEMTIME ADS_UTC_TIME;
typedef SYSTEMTIME *PADS_UTC_TIME;
typedef LARGE_INTEGER ADS_LARGE_INTEGER;
typedef LARGE_INTEGER *PADS_LARGE_INTEGER;
typedef LPWSTR ADS_OBJECT_CLASS;
typedef LPWSTR *PADS_OBJECT_CLASS;
typedef struct _ADS_OCTET_LIST *PADS_OCTET_LIST;
typedef struct _ADS_CASEIGNORE_LIST *PADS_CASEIGNORE_LIST;
typedef ADS_STATUSENUM ADS_STATUS;
typedef ADS_SEARCHPREF_ENUM ADS_SEARCHPREF;
typedef HANDLE ADS_SEARCH_HANDLE;
typedef HANDLE *PADS_SEARCH_HANDLE;


typedef struct
{
    DWORD dwLength;
    BYTE *lpValue;
} ADS_OCTET_STRING;

typedef struct
{
    DWORD dwLength;
    BYTE *lpValue;
} ADS_PROV_SPECIFIC;

typedef struct
{
    LPWSTR PostalAddress[ 6 ];
} ADS_POSTALADDRESS, *PADS_POSTALADDRESS;

typedef struct
{
    LPWSTR ObjectName;
    DWORD Level;
    DWORD Interval;
} ADS_TYPEDNAME, *PADS_TYPEDNAME;

typedef struct
{
    DWORD RemoteID;
    LPWSTR ObjectName;
} ADS_BACKLINK;

typedef struct
{
    LPWSTR ObjectName;
    DWORD Amount;
} ADS_HOLD;

typedef struct
{
    DWORD AddressType;
    DWORD AddressLength;
    BYTE *Address;
} ADS_NETADDRESS, *PADS_NETADDRESS;

typedef struct
{
    LPWSTR ServerName;
    DWORD ReplicaType;
    DWORD ReplicaNumber;
    DWORD Count;
    PADS_NETADDRESS ReplicaAddressHints;
} ADS_REPLICAPOINTER, *PADS_REPLICAPOINTER;

typedef struct
{
    LPWSTR TelephoneNumber;
    DWORD NumberOfBits;
    BYTE *Parameters;
} ADS_FAXNUMBER, *PADS_FAXNUMBER;


typedef struct
{
    LPWSTR Address;
    DWORD Type;
} ADS_EMAIL, *PADS_EMAIL;

typedef struct
{
    DWORD dwLength;
    BYTE *lpValue;
} ADS_NT_SECURITY_DESCRIPTOR;

typedef struct
{
    DWORD dwLength;
    BYTE *lpBinaryValue;
    LPWSTR pszDNString;
} ADS_DN_WITH_BINARY, *PADS_DN_WITH_BINARY;

typedef struct
{
    LPWSTR pszStringValue;
    LPWSTR pszDNString;
} ADS_DN_WITH_STRING, *PADS_DN_WITH_STRING;

typedef struct _adsvalue
{
    ADSTYPE dwType;
    union
    {
        ADS_DN_STRING DNString;
        ADS_CASE_EXACT_STRING CaseExactString;
        ADS_CASE_IGNORE_STRING CaseIgnoreString;
        ADS_PRINTABLE_STRING PrintableString;
        ADS_NUMERIC_STRING NumericString;
        ADS_BOOLEAN Boolean;
        ADS_INTEGER Integer;
        ADS_OCTET_STRING OctetString;
        ADS_UTC_TIME UTCTime;
        ADS_LARGE_INTEGER LargeInteger;
        ADS_OBJECT_CLASS ClassName;
        ADS_PROV_SPECIFIC ProviderSpecific;
        PADS_CASEIGNORE_LIST pCaseIgnoreList;
        PADS_OCTET_LIST pOctetList;
        PADS_PATH pPath;
        PADS_POSTALADDRESS pPostalAddress;
        ADS_TIMESTAMP Timestamp;
        ADS_BACKLINK BackLink;
        PADS_TYPEDNAME pTypedName;
        ADS_HOLD Hold;
        PADS_NETADDRESS pNetAddress;
        PADS_REPLICAPOINTER pReplicaPointer;
        PADS_FAXNUMBER pFaxNumber;
        ADS_EMAIL Email;
        ADS_NT_SECURITY_DESCRIPTOR SecurityDescriptor;
        PADS_DN_WITH_BINARY pDNWithBinary;
        PADS_DN_WITH_STRING pDNWithString;
    } DUMMYUNIONNAME;
} ADSVALUE, *PADSVALUE;

typedef struct ads_searchpref_info
{
    ADS_SEARCHPREF dwSearchPref;
    ADSVALUE vValue;
    ADS_STATUS dwStatus;
} ADS_SEARCHPREF_INFO, *PADS_SEARCHPREF_INFO;

typedef struct ads_search_column
{
    LPWSTR pszAttrName;
    ADSTYPE dwADsType;
    PADSVALUE pADsValues;
    DWORD dwNumValues;
    HANDLE hReserved;
} ADS_SEARCH_COLUMN, *PADS_SEARCH_COLUMN;

typedef struct _ads_object_info
{
    LPWSTR pszRDN;
    LPWSTR pszObjectDN;
    LPWSTR pszParentDN;
    LPWSTR pszSchemaDN;
    LPWSTR pszClassName;
} ADS_OBJECT_INFO, *PADS_OBJECT_INFO;

typedef struct _ads_attr_info
{
    LPWSTR pszAttrName;
    DWORD dwControlCode;
    ADSTYPE dwADsType;
    PADSVALUE pADsValues;
    DWORD dwNumValues;
} ADS_ATTR_INFO, *PADS_ATTR_INFO;

typedef enum
{
    ADS_SECURITY_INFO_OWNER = 0x1,
    ADS_SECURITY_INFO_GROUP = 0x2,
    ADS_SECURITY_INFO_DACL  = 0x4,
    ADS_SECURITY_INFO_SACL  = 0x8
} ADS_SECURITY_INFO_ENUM;

typedef enum
{
    ADS_SETTYPE_FULL = 1,
    ADS_SETTYPE_PROVIDER = 2,
    ADS_SETTYPE_SERVER = 3,
    ADS_SETTYPE_DN = 4
} ADS_SETTYPE_ENUM;

typedef enum
{
    ADS_FORMAT_WINDOWS = 1,
    ADS_FORMAT_WINDOWS_NO_SERVER = 2,
    ADS_FORMAT_WINDOWS_DN = 3,
    ADS_FORMAT_WINDOWS_PARENT = 4,
    ADS_FORMAT_X500 = 5,
    ADS_FORMAT_X500_NO_SERVER = 6,
    ADS_FORMAT_X500_DN = 7,
    ADS_FORMAT_X500_PARENT = 8,
    ADS_FORMAT_SERVER = 9,
    ADS_FORMAT_PROVIDER = 10,
    ADS_FORMAT_LEAF = 11
} ADS_FORMAT_ENUM;

/*****************************************************************************
 *    IADsContainer interface
 */
[
    object,
    uuid(001677d0-fd16-11ce-abc4-02608c9e7553)
]
interface IADsContainer: IDispatch
{
    [propget] HRESULT Count(
        [out, retval] long *retval);
    [propget, restricted] HRESULT _NewEnum(
        [out, retval] IUnknown **retval);
    [propget] HRESULT Filter(
        [out, retval] VARIANT *pvFilter);
    [propput] HRESULT Filter(
        [in] VARIANT vFilter);
    [propget] HRESULT Hints(
        [out, retval] VARIANT *pvHints);
    [propput] HRESULT Hints(
        [in] VARIANT vHints);
    HRESULT GetObject(
        [in] BSTR bstrClassName,
        [in] BSTR bstrRelativeName,
        [out, retval] IDispatch **ppObject);
    HRESULT Create(
        [in] BSTR bstrClassName,
        [in] BSTR bstrRelativeName,
        [out, retval] IDispatch **ppObject);
    HRESULT Delete(
        [in] BSTR bstrClassName,
        [in] BSTR bstrRelativeName);
    HRESULT CopyHere(
        [in] BSTR bstrSourceName,
        [in] BSTR bstrNewName,
        [out, retval] IDispatch **ppObject);
    HRESULT MoveHere(
        [in] BSTR bstrSourceName,
        [in] BSTR bstrNewName,
        [out, retval] IDispatch **ppObject);
}

/*****************************************************************************
 *    IADs interface
 */
[
    odl,
    uuid(FD8256D0-FD15-11CE-ABC4-02608C9E7553),
    dual,
    oleautomation
]
interface IADs : IDispatch
{
    [id(0x00000002), propget]
    HRESULT Name([out, retval] BSTR* retval);

    [id(0x00000003), propget]
    HRESULT Class([out, retval] BSTR* retval);

    [id(0x00000004), propget]
    HRESULT GUID([out, retval] BSTR* retval);

    [id(0x00000005), propget]
    HRESULT ADsPath([out, retval] BSTR* retval);

    [id(0x00000006), propget]
    HRESULT Parent([out, retval] BSTR* retval);

    [id(0x00000007), propget]
    HRESULT Schema([out, retval] BSTR* retval);

    [id(0x00000008)]
    HRESULT GetInfo();

    [id(0x00000009)]
    HRESULT SetInfo();

    [id(0x0000000a)]
    HRESULT Get([in] BSTR bstrName, [out, retval] VARIANT* pvProp);

    [id(0x0000000b)]
    HRESULT Put([in] BSTR bstrName, [in] VARIANT vProp);

    [id(0x0000000c)]
    HRESULT GetEx([in] BSTR bstrName, [out, retval] VARIANT* pvProp);

    [id(0x0000000d)]
    HRESULT PutEx([in] long lnControlCode, [in] BSTR bstrName, [in] VARIANT vProp);

    [id(0x0000000e)]
    HRESULT GetInfoEx( [in] VARIANT vProperties, [in] long lnReserved);
}

/*****************************************************************************
 *    IADsObjectOptions interface
 */
[
    odl,
    uuid(46F14FDA-232B-11D1-A808-00C04FD8D5A8),
    dual,
    oleautomation
]
interface IADsObjectOptions : IDispatch
{
    [id(0x00000002)]
    HRESULT GetOption([in] long option, [out, retval] VARIANT *var);
    [id(0x00000003)]
    HRESULT SetOption([in] long option, [in] VARIANT var);
}

/*****************************************************************************
 *    IADsMembers interface
 */
[
    odl,
    uuid(451A0030-72EC-11CF-B03B-00AA006E0975),
    dual,
    oleautomation
]
interface IADsMembers : IDispatch
{
    [id(0x00000002), propget]
    HRESULT Count([out, retval] long* plCount);

    [id(0xfffffffc), propget]
    HRESULT _NewEnum([out, retval] IUnknown** ppEnumerator);

    [id(0x00000003), propget]
    HRESULT Filter([out, retval] VARIANT* pvFilter);

    [id(0x00000003), propput]
    HRESULT Filter([in] VARIANT pvFilter);
}

/*****************************************************************************
 *    IADsGroup interface
 */
[
    odl,
    uuid(27636B00-410F-11CF-B1FF-02608C9E7553),
    dual,
    oleautomation
]
interface IADsGroup : IADs {
    [id(0x0000000f), propget]
    HRESULT Description([out, retval] BSTR* retval);

    [id(0x0000000f), propput]
    HRESULT Description([in] BSTR retval);

    [id(0x00000010)]
    HRESULT Members([out, retval] IADsMembers** ppMembers);

    [id(0x00000011)]
    HRESULT IsMember([in] BSTR bstrMember, [out, retval] VARIANT_BOOL* bMember);

    [id(0x00000012)]
    HRESULT Add([in] BSTR bstrNewItem);

    [id(0x00000013)]
    HRESULT Remove([in] BSTR bstrItemToBeRemoved);
}

/*****************************************************************************
 *    IADsUser interface
 */
[
    odl,
    uuid(3E37E320-17E2-11CF-ABC4-02608C9E7553),
    dual,
    oleautomation
]
interface IADsUser : IADs
{
    [id(0x00000035), propget]
    HRESULT BadLoginAddress([out, retval] BSTR* retval);

    [id(0x00000036), propget]
    HRESULT BadLoginCount([out, retval] long* retval);

    [id(0x00000038), propget]
    HRESULT LastLogin([out, retval] DATE* retval);

    [id(0x00000039), propget]
    HRESULT LastLogoff([out, retval] DATE* retval);

    [id(0x0000003a), propget]
    HRESULT LastFailedLogin([out, retval] DATE* retval);

    [id(0x0000003b), propget]
    HRESULT PasswordLastChanged([out, retval] DATE* retval);

    [id(0x0000000f), propget]
    HRESULT Description([out, retval] BSTR* retval);

    [id(0x0000000f), propput]
    HRESULT Description([in] BSTR retval);

    [id(0x00000013), propget]
    HRESULT Division([out, retval] BSTR* retval);

    [id(0x00000013), propput]
    HRESULT Division([in] BSTR retval);

    [id(0x0000007a), propget]
    HRESULT Department([out, retval] BSTR* retval);

    [id(0x0000007a), propput]
    HRESULT Department([in] BSTR retval);

    [id(0x00000014), propget]
    HRESULT EmployeeID([out, retval] BSTR* retval);

    [id(0x00000014), propput]
    HRESULT EmployeeID([in] BSTR retval);

    [id(0x00000017), propget]
    HRESULT FullName([out, retval] BSTR* retval);

    [id(0x00000017), propput]
    HRESULT FullName([in] BSTR retval);

    [id(0x00000016), propget]
    HRESULT FirstName([out, retval] BSTR* retval);

    [id(0x00000016), propput]
    HRESULT FirstName([in] BSTR retval);

    [id(0x00000019), propget]
    HRESULT LastName([out, retval] BSTR* retval);

    [id(0x00000019), propput]
    HRESULT LastName([in] BSTR retval);

    [id(0x0000001b), propget]
    HRESULT OtherName([out, retval] BSTR* retval);

    [id(0x0000001b), propput]
    HRESULT OtherName([in] BSTR retval);

    [id(0x00000072), propget]
    HRESULT NamePrefix([out, retval] BSTR* retval);

    [id(0x00000072), propput]
    HRESULT NamePrefix([in] BSTR retval);

    [id(0x00000073), propget]
    HRESULT NameSuffix([out, retval] BSTR* retval);

    [id(0x00000073), propput]
    HRESULT NameSuffix([in] BSTR retval);

    [id(0x00000024), propget]
    HRESULT Title([out, retval] BSTR* retval);

    [id(0x00000024), propput]
    HRESULT Title([in] BSTR retval);

    [id(0x0000001a), propget]
    HRESULT Manager([out, retval] BSTR* retval);

    [id(0x0000001a), propput]
    HRESULT Manager([in] BSTR retval);

    [id(0x00000020), propget]
    HRESULT TelephoneHome([out, retval] VARIANT* retval);

    [id(0x00000020), propput]
    HRESULT TelephoneHome([in] VARIANT retval);

    [id(0x00000021), propget]
    HRESULT TelephoneMobile([out, retval] VARIANT* retval);

    [id(0x00000021), propput]
    HRESULT TelephoneMobile([in] VARIANT retval);

    [id(0x00000022), propget]
    HRESULT TelephoneNumber([out, retval] VARIANT* retval);

    [id(0x00000022), propput]
    HRESULT TelephoneNumber([in] VARIANT retval);

    [id(0x00000011), propget]
    HRESULT TelephonePager([out, retval] VARIANT* retval);

    [id(0x00000011), propput]
    HRESULT TelephonePager([in] VARIANT retval);

    [id(0x00000010), propget]
    HRESULT FaxNumber([out, retval] VARIANT* retval);

    [id(0x00000010), propput]
    HRESULT FaxNumber([in] VARIANT retval);

    [id(0x0000001c), propget]
    HRESULT OfficeLocations([out, retval] VARIANT* retval);

    [id(0x0000001c), propput]
    HRESULT OfficeLocations([in] VARIANT retval);

    [id(0x0000001e), propget]
    HRESULT PostalAddresses([out, retval] VARIANT* retval);

    [id(0x0000001e), propput]
    HRESULT PostalAddresses([in] VARIANT retval);

    [id(0x0000001f), propget]
    HRESULT PostalCodes([out, retval] VARIANT* retval);

    [id(0x0000001f), propput]
    HRESULT PostalCodes([in] VARIANT retval);

    [id(0x00000075), propget]
    HRESULT SeeAlso([out, retval] VARIANT* retval);

    [id(0x00000075), propput]
    HRESULT SeeAlso([in] VARIANT retval);

    [id(0x00000025), propget]
    HRESULT AccountDisabled([out, retval] VARIANT_BOOL* retval);

    [id(0x00000025), propput]
    HRESULT AccountDisabled([in] VARIANT_BOOL retval);

    [id(0x00000026), propget]
    HRESULT AccountExpirationDate([out, retval] DATE* retval);

    [id(0x00000026), propput]
    HRESULT AccountExpirationDate([in] DATE retval);

    [id(0x00000029), propget]
    HRESULT GraceLoginsAllowed([out, retval] long* retval);

    [id(0x00000029), propput]
    HRESULT GraceLoginsAllowed([in] long retval);

    [id(0x0000002a), propget]
    HRESULT GraceLoginsRemaining([out, retval] long* retval);

    [id(0x0000002a), propput]
    HRESULT GraceLoginsRemaining([in] long retval);

    [id(0x0000002b), propget]
    HRESULT IsAccountLocked([out, retval] VARIANT_BOOL* retval);

    [id(0x0000002b), propput]
    HRESULT IsAccountLocked([in] VARIANT_BOOL retval);

    [id(0x0000002d), propget]
    HRESULT LoginHours([out, retval] VARIANT* retval);

    [id(0x0000002d), propput]
    HRESULT LoginHours([in] VARIANT retval);

    [id(0x0000002e), propget]
    HRESULT LoginWorkstations([out, retval] VARIANT* retval);

    [id(0x0000002e), propput]
    HRESULT LoginWorkstations([in] VARIANT retval);

    [id(0x0000002f), propget]
    HRESULT MaxLogins([out, retval] long* retval);

    [id(0x0000002f), propput]
    HRESULT MaxLogins([in] long retval);

    [id(0x00000030), propget]
    HRESULT MaxStorage([out, retval] long* retval);

    [id(0x00000030), propput]
    HRESULT MaxStorage([in] long retval);

    [id(0x00000031), propget]
    HRESULT PasswordExpirationDate([out, retval] DATE* retval);

    [id(0x00000031), propput]
    HRESULT PasswordExpirationDate([in] DATE retval);

    [id(0x00000032), propget]
    HRESULT PasswordMinimumLength([out, retval] long* retval);

    [id(0x00000032), propput]
    HRESULT PasswordMinimumLength([in] long retval);

    [id(0x00000033), propget]
    HRESULT PasswordRequired([out, retval] VARIANT_BOOL* retval);

    [id(0x00000033), propput]
    HRESULT PasswordRequired([in] VARIANT_BOOL retval);

    [id(0x00000034), propget]
    HRESULT RequireUniquePassword([out, retval] VARIANT_BOOL* retval);

    [id(0x00000034), propput]
    HRESULT RequireUniquePassword([in] VARIANT_BOOL retval);

    [id(0x0000003c), propget]
    HRESULT EmailAddress([out, retval] BSTR* retval);

    [id(0x0000003c), propput]
    HRESULT EmailAddress([in] BSTR retval);

    [id(0x0000003d), propget]
    HRESULT HomeDirectory([out, retval] BSTR* retval);

    [id(0x0000003d), propput]
    HRESULT HomeDirectory([in] BSTR retval);

    [id(0x0000003e), propget]
    HRESULT Languages([out, retval] VARIANT* retval);

    [id(0x0000003e), propput]
    HRESULT Languages([in] VARIANT retval);

    [id(0x0000003f), propget]
    HRESULT Profile([out, retval] BSTR* retval);

    [id(0x0000003f), propput]
    HRESULT Profile([in] BSTR retval);

    [id(0x00000040), propget]
    HRESULT LoginScript([out, retval] BSTR* retval);

    [id(0x00000040), propput]
    HRESULT LoginScript([in] BSTR retval);

    [id(0x00000041), propget]
    HRESULT Picture([out, retval] VARIANT* retval);

    [id(0x00000041), propput]
    HRESULT Picture([in] VARIANT retval);

    [id(0x00000078), propget]
    HRESULT HomePage([out, retval] BSTR* retval);

    [id(0x00000078), propput]
    HRESULT HomePage([in] BSTR retval);

    [id(0x00000042)]
    HRESULT Groups([out, retval] IADsMembers** ppGroups);

    [id(0x00000043)]
    HRESULT SetPassword([in] BSTR NewPassword);

    [id(0x00000044)]
    HRESULT ChangePassword([in] BSTR bstrOldPassword, [in] BSTR bstrNewPassword);
}

/*****************************************************************************
 *    IDirectorySearch interface
 */
[
    odl,
    local,
    uuid(109BA8EC-92F0-11D0-A790-00C04FD8D5A8)
]
interface IDirectorySearch : IUnknown
{
    HRESULT SetSearchPreference([in] PADS_SEARCHPREF_INFO pSearchPrefs, [in] DWORD dwNumPrefs);
    HRESULT ExecuteSearch([in] LPWSTR pszSearchFilter, [in] LPWSTR* pAttributeNames,
                    [in] DWORD dwNumberAttributes, [out] PADS_SEARCH_HANDLE phSearchResult);
    HRESULT AbandonSearch([in] ADS_SEARCH_HANDLE phSearchResult);
    HRESULT GetFirstRow([in] ADS_SEARCH_HANDLE hSearchResult);
    HRESULT GetNextRow([in] ADS_SEARCH_HANDLE hSearchResult);
    HRESULT GetPreviousRow([in] ADS_SEARCH_HANDLE hSearchResult);
    HRESULT GetNextColumnName([in] ADS_SEARCH_HANDLE hSearchHandle, [out] LPWSTR* ppszColumnName);
    HRESULT GetColumn( [in] ADS_SEARCH_HANDLE hSearchResult, [in] LPWSTR szColumnName,
                    [out] PADS_SEARCH_COLUMN pSearchColumn);
    HRESULT FreeColumn([in] PADS_SEARCH_COLUMN pSearchColumn);
    HRESULT CloseSearchHandle([in] ADS_SEARCH_HANDLE hSearchResult);
}

/*****************************************************************************
 *    IDirectoryObject interface
 */
[
    odl,
    local,
    uuid(e798de2c-22e4-11d0-84fe-00c04fd8d503)
]
interface IDirectoryObject : IUnknown
{
    HRESULT GetObjectInformation(PADS_OBJECT_INFO *info);
    HRESULT GetObjectAttributes(LPWSTR *names, DWORD count, PADS_ATTR_INFO *attrs, DWORD *count_returned);
    HRESULT SetObjectAttributes(PADS_ATTR_INFO attrs, DWORD count, DWORD *count_set);
    HRESULT CreateDSObject(LPWSTR name, PADS_ATTR_INFO attrs, DWORD count, IDispatch **obj);
    HRESULT DeleteDSObject(LPWSTR name);
}

/*****************************************************************************
 *    IID_IADsOpenDSObject interface
 */
[
    odl,
    uuid(ddf2891e-0f9c-11d0-8ad4-00c04fd8d503),
    dual,
    oleautomation
]
interface IADsOpenDSObject : IDispatch
{
    HRESULT OpenDSObject([in] BSTR path, [in] BSTR user, [in] BSTR password, [in] long reserved, [out,retval] IDispatch **obj);
}

/*****************************************************************************
 *   IADsPathname interface
 */
[
    odl,
    uuid(d592aed4-f420-11d0-a36e-00c04fb950dc),
    dual,
    oleautomation
]
interface IADsPathname : IDispatch
{
    HRESULT Set(BSTR path, long type);
    HRESULT SetDisplayType(long type);
    HRESULT Retrieve(long type, BSTR *path);
    HRESULT GetNumElements(long *count);
    HRESULT GetElement(long index, BSTR *element);
    HRESULT AddLeafElement(BSTR element);
    HRESULT RemoveLeafElement(void);
    HRESULT CopyPath(IDispatch **path);
    HRESULT GetEscapedElement(long reserved, BSTR element, BSTR *str);
    HRESULT get_EscapedMode(long *mode);
    HRESULT put_EscapedMode(long mode);
}

[
    helpstring("ADs LDAP Pathname Descriptor Object"),
    uuid(080d0d78-f421-11d0-a36e-00c04fb950dc),
    progid("Pathname"),
    version(1.0)
]
coclass Pathname
{
    interface IADsPathname;
}

/*****************************************************************************
 *    IADsADSystemInfo interface
 */
[
    odl,
    uuid(5bb11929-afd1-11d2-9cb9-0000f87a369e),
    dual,
    oleautomation
]
interface IADsADSystemInfo : IDispatch
{
    [id(0x00000002), propget]
    HRESULT UserName([out, retval] BSTR *retval);
    [id(0x00000003), propget]
    HRESULT ComputerName([out, retval] BSTR *retval);
    [id(0x00000004), propget]
    HRESULT SiteName([out, retval] BSTR *retval);
    [id(0x00000005), propget]
    HRESULT DomainShortName([out, retval] BSTR *retval);
    [id(0x00000006), propget]
    HRESULT DomainDNSName([out, retval] BSTR *retval);
    [id(0x00000007), propget]
    HRESULT ForestDNSName([out, retval] BSTR *retval);
    [id(0x00000008), propget]
    HRESULT PDCRoleOwner([out, retval] BSTR *retval);
    [id(0x00000009), propget]
    HRESULT SchemaRoleOwner([out, retval] BSTR *retval);
    [id(0x0000000a), propget]
    HRESULT IsNativeMode([out, retval] VARIANT_BOOL *retval);
    [id(0x0000000b)]
    HRESULT GetAnyDCName([out, retval] BSTR *retval);
    [id(0x0000000c)]
    HRESULT GetDCSiteName([in] BSTR server, [out, retval] BSTR *retval);
    [id(0x0000000d)]
    HRESULT RefreshSchemaCache();
    [id(0x0000000e)]
    HRESULT GetTrees([out, retval] VARIANT *retval);
}

[
    helpstring("AD System Info Object"),
    uuid(50b6327f-afd1-11d2-9cb9-0000f87a369e),
    progid("ADSystemInfo"),
    version(1.0)
]
coclass ADSystemInfo
{
    interface IADsADSystemInfo;
}

/*****************************************************************************
 *    IADsDNWithBinary interface
 */
[
    odl,
    uuid(7e99c0a2-f935-11d2-ba96-00c04fb6d0d1),
    dual,
    oleautomation
]
interface IADsDNWithBinary : IDispatch
{
    [id(0x00000002), propget]
    HRESULT BinaryValue([out, retval] VARIANT *value);
    [id(0x00000002), propput]
    HRESULT BinaryValue([in] VARIANT value);
    [id(0x00000003), propget]
    HRESULT DNString([out, retval] BSTR *value);
    [id(0x00000003), propput]
    HRESULT DNString([in] BSTR value);
}

[
    helpstring("ADs DN With Binary Object"),
    uuid(7e99c0a3-f935-11d2-ba96-00c04fb6d0d1),
    progid("DNWithBinary"),
    version(1.0)
]
coclass DNWithBinary
{
    interface IADsDNWithBinary;
}

/*****************************************************************************
 *    IADsDNWithString interface
 */
[
    odl,
    uuid(370df02e-f934-11d2-ba96-00c04fb6d0d1),
    dual,
    oleautomation
]
interface IADsDNWithString : IDispatch
{
    [id(0x00000002), propget]
    HRESULT StringValue([out, retval] BSTR *value);
    [id(0x00000002), propput]
    HRESULT StringValue([in] BSTR value);
    [id(0x00000003), propget]
    HRESULT DNString([out, retval] BSTR *value);
    [id(0x00000003), propput]
    HRESULT DNString([in] BSTR value);
}

[
    helpstring("ADs DN With String Object"),
    uuid(334857cc-f934-11d2-ba96-00c04fb6d0d1),
    progid("DNWithString"),
    version(1.0)
]
coclass DNWithString
{
    interface IADsDNWithString;
}

} /* library */
