/*++

Copyright (c) 1995  Microsoft Corporation

Module Name:

    dscomm.idl


Abstract:

    IDL file for DS API (called by remote - DS, performed by DS Server)


Author:

    Ronit Hartmann (ronith) ??-???-??
    Erez Haba (erezh) 27-Jan-96
    Gadi Ittah (t-gadii) 20-Mar-96

--*/

import "mqtypes.idl";

[
    version(1.0),
    uuid(77df7a80-f298-11d0-8358-00a024c480a8),
    pointer_default(unique)
]


interface dscomm
{
/*==================================================
        Structures
===================================================*/
typedef struct SERVER_AUTH_STRUCT_tag
{
    LPVOID pvhContext;
    DWORD  cbHeader;
    DWORD  cbTrailer;
} SERVER_AUTH_STRUCT;

/*==================================================
        Context Handles
===================================================*/
typedef [context_handle] void * PCONTEXT_HANDLE_TYPE;
typedef [ref] PCONTEXT_HANDLE_TYPE * PPCONTEXT_HANDLE_TYPE;

typedef [context_handle] void * PCONTEXT_HANDLE_READONLY_TYPE;
typedef [ref] PCONTEXT_HANDLE_READONLY_TYPE * PPCONTEXT_HANDLE_READONLY_TYPE;

typedef [context_handle] SERVER_AUTH_STRUCT *PCONTEXT_HANDLE_SERVER_AUTH_TYPE;
typedef [ref] PCONTEXT_HANDLE_SERVER_AUTH_TYPE *PPCONTEXT_HANDLE_SERVER_AUTH_TYPE;

typedef [context_handle] void * PCONTEXT_HANDLE_DELETE_TYPE;
typedef [ref] PCONTEXT_HANDLE_DELETE_TYPE *PPCONTEXT_HANDLE_DELETE_TYPE;

/*==========================================================================================
        MQDS API
============================================================================================*/

HRESULT
S_DSCreateObject(
    [in]                        handle_t            hBind,
    [in]                        DWORD               dwObjectType,
    [in, unique]                LPCWSTR             pwcsPathName,
    [in]                        DWORD               dwSDLength,
    [in,size_is(dwSDLength), unique] unsigned char* SecurityDescriptor,
    [in]                        DWORD               cp,
    [in, size_is(cp)]           PROPID              aProp[],
    [in, size_is(cp)]           PROPVARIANT         apVar[],
    [in, out, unique]           GUID*               pObjGuid);

HRESULT
S_DSDeleteObject(
    [in]  handle_t              hBind,
    [in]  DWORD                 dwObjectType,
    [in]  LPCWSTR               pwcsPathName
    );

HRESULT
S_DSGetProps(
    [in]                    handle_t            hBind,
    [in]                    DWORD               dwObjectType,
    [in]                    LPCWSTR             pwcsPathName,
    [in]                    DWORD               cp,
    [in, size_is(cp)]       PROPID              aProp[],
    [in, out, size_is(cp)]  PROPVARIANT         apVar[],
    [in]                    PCONTEXT_HANDLE_SERVER_AUTH_TYPE
                                                phServerAuth,
    [out, size_is(*pdwServerSignatureSize)]
                            UCHAR*              pbServerSignature,
    [in, out]               DWORD *             pdwServerSignatureSize
    );

HRESULT
S_DSSetProps(
    [in]                handle_t                hBind,
    [in]                DWORD                   dwObjectType,
    [in]                LPCWSTR                 pwcsPathName,
    [in]                DWORD                   cp,
    [in, size_is(cp)]   PROPID                  aProp[],
    [in, size_is(cp)]   PROPVARIANT             apVar[]
    );

HRESULT
S_DSGetObjectSecurity(
    [in]                handle_t                hBind,
    [in]                DWORD                   dwObjectType,
    [in]                LPCWSTR                 pwcsPathName,
    [in]                DWORD                   RequestedInformation,
    [out, size_is(nLength)] unsigned char*      pSecurityDescriptor,
    [in]                DWORD                   nLength,
    [out]               DWORD*                  lpnLengthNeeded,
    [in]                PCONTEXT_HANDLE_SERVER_AUTH_TYPE
                                                phServerAuth,
    [out, size_is(*pdwServerSignatureSize)]
                        UCHAR*                  pbServerSignature,
    [in, out]           DWORD *                 pdwServerSignatureSize
    );

HRESULT
S_DSSetObjectSecurity(
    [in]                handle_t                hBind,
    [in]                DWORD                   dwObjectType,
    [in]                LPCWSTR                 pwcsPathName,
    [in]                DWORD                   SecurityInformation,
    [in, unique, size_is(nLength)] unsigned char* pSecurityDescriptor,
    [in]                DWORD                   nLength
    );

HRESULT
S_DSLookupBegin(
    [in]            handle_t                hBind,
    [out]           PPCONTEXT_HANDLE_TYPE   pHandle,
    [in, unique]    LPWSTR                  pwcsContext,
    [in, unique]    MQRESTRICTION*          pRestriction,
    [in, ref]       MQCOLUMNSET*            pColumns,
    [in, unique]    MQSORTSET*              pSort,
    [in]            PCONTEXT_HANDLE_SERVER_AUTH_TYPE phServerAuth
    );

HRESULT
S_DSLookupNext(
    [in]                        handle_t                hBind,
    [in]                        PCONTEXT_HANDLE_TYPE    Handle,
    [in]                        DWORD*                  dwSize,
    [out]                       DWORD*                  dwOutSize,
    [out, size_is(*dwSize), length_is(*dwOutSize)]
                                PROPVARIANT             pbBuffer[],
    [in]                        PCONTEXT_HANDLE_SERVER_AUTH_TYPE
                                                        phServerAuth,
    [out, size_is(*pdwServerSignatureSize)]
                                UCHAR*                  pbServerSignature,
    [in, out]                   DWORD *                 pdwServerSignatureSize
    );

HRESULT
S_DSLookupEnd(
        [in]            handle_t                hBind,
        [in, out]       PPCONTEXT_HANDLE_TYPE   phContext
    );

HRESULT
S_DSFlush(
    [in]  handle_t              hBind
    );


HRESULT
S_DSDeleteObjectGuid(
    [in]  handle_t              hBind,
    [in]  DWORD                 dwObjectType,
    [in]  const GUID*           pGuid
    );

HRESULT
S_DSGetPropsGuid(
    [in]                    handle_t         hBind,
    [in]                    DWORD            dwObjectType,
    [in, unique]            const GUID*      pGuid,
    [in]                    DWORD            cp,
    [in, size_is(cp)]       PROPID           aProp[],
    [in, out, size_is(cp)]  PROPVARIANT      apVar[],
    [in]                    PCONTEXT_HANDLE_SERVER_AUTH_TYPE
                                             phServerAuth,
    [out, size_is(*pdwServerSignatureSize)]
                            UCHAR*           pbServerSignature,
    [in, out]               DWORD *          pdwServerSignatureSize
    );

HRESULT
S_DSSetPropsGuid(
    [in]                handle_t             hBind,
    [in]                DWORD                dwObjectType,
    [in]                const GUID *         pGuid,
    [in]                DWORD                cp,
    [in, size_is(cp)]   PROPID               aProp[],
    [in, size_is(cp)]   PROPVARIANT          apVar[]
    );

HRESULT
S_DSGetObjectSecurityGuid(
    [in]                handle_t                hBind,
    [in]                DWORD                   dwObjectType,
    [in]                const GUID *            pGuid,
    [in]                DWORD                   RequestedInformation,
    [out, size_is(nLength)] unsigned char*      pSecurityDescriptor,
    [in]                DWORD                   nLength,
    [out]               DWORD*                  lpnLengthNeeded,
    [in]                PCONTEXT_HANDLE_SERVER_AUTH_TYPE
                                                phServerAuth,
    [out, size_is(*pdwServerSignatureSize)]
                        UCHAR*                  pbServerSignature,
    [in, out]           DWORD *                 pdwServerSignatureSize
    );

HRESULT
S_DSSetObjectSecurityGuid(
    [in]                handle_t                hBind,
    [in]                DWORD                   dwObjectType,
    [in]                const GUID *            pGuid,
    [in]                DWORD                   SecurityInformation,
    [in, unique, size_is(nLength)] unsigned char* pSecurityDescriptor,
    [in]                DWORD                   nLength
    );

HRESULT
S_DSDemoteStopWrite(
    [in]    handle_t     hBind
         );

HRESULT
S_DSDemotePSC(
    [in]    handle_t    hBind,
    [in]    LPCWSTR     lpwcsNewPscName,
    [out]   DWORD *     pdwNumberOfLSN,
    [out, size_is(2),length_is(*pdwNumberOfLSN)]    _SEQNUM      asnLSN[]
         );

HRESULT
S_DSCheckDemotedPSC(
     [in]    handle_t    hBind,
     [in]    LPCWSTR    lpwcsNewPscName
         );

HRESULT
S_DSGetUserParams(
    [in]        handle_t                                hBind,
    [in]        DWORD                                   dwFlags,
    [in]        DWORD                                   dwSidLength,
    [out, size_is(dwSidLength)] unsigned char *         pUserSid,
    [out]       DWORD *                                 pdwSidReqLength,
    [out, string, size_is(*pdwAccounNameLen+1)]
                LPWSTR                                  szAccountName,
    [in, out]   DWORD *                                 pdwAccounNameLen,
    [out, string, size_is(*pdwDomainNameLen+1)]
                LPWSTR                                  szDomainName,
    [in, out]   DWORD *                                 pdwDomainNameLen,
    [in]        PCONTEXT_HANDLE_SERVER_AUTH_TYPE        phServerAuth,
    [out, size_is(*pdwServerSignatureSize)] UCHAR *     pbServerSignature,
    [in, out]   DWORD *                                 pdwServerSignatureSize
    );

HRESULT
S_DSQMSetMachineProperties(
    [in]                handle_t                hBind,
    [in]                LPCWSTR                 pwcsPathName,
    [in]                DWORD                   cp,
    [in, size_is(cp)]   PROPID                  aProp[],
    [in, size_is(cp)]   PROPVARIANT             apVar[],
    [in]                DWORD                   dwContext);

HRESULT
S_DSCreateServersCache(
    [in] handle_t                                       hBind,
    [in, out] DWORD *                                   pdwIndex,
    [in, out, ptr, string] LPWSTR *                     lplpSiteServers,
    [in] PCONTEXT_HANDLE_SERVER_AUTH_TYPE               phServerAuth,
    [out, size_is(*pdwServerSignatureSize)] UCHAR *     pbServerSignature,
    [in, out]   DWORD *                                 pdwServerSignatureSize);

[callback]
HRESULT
S_DSQMSetMachinePropertiesSignProc(
    [in, size_is(dwCallengeSize)]
                         BYTE                    *abChallenge,
    [in]                 DWORD                   dwCallengeSize,
    [in]                 DWORD                   dwContext,
    [in, out, size_is(dwSignatureMaxSize), length_is(*pdwSignatureSize)]
                         BYTE                    *abSignature,
    [in, out]            DWORD                   *pdwSignatureSize,
    [in]                 DWORD                   dwSignatureMaxSize);

HRESULT
S_DSQMGetObjectSecurity(
    [in]                handle_t                hBind,
    [in]                DWORD                   dwObjectType,
    [in]                const GUID *            pGuid,
    [in]                DWORD                   RequestedInformation,
    [out, size_is(nLength)] unsigned char*      pSecurityDescriptor,
    [in]                DWORD                   nLength,
    [out]               DWORD*                  lpnLengthNeeded,
    [in]                DWORD                   dwContext,
    [in]                PCONTEXT_HANDLE_SERVER_AUTH_TYPE
                                                phServerAuth,
    [out, size_is(*pdwServerSignatureSize)]
                        UCHAR*                  pbServerSignature,
    [in, out]           DWORD *                 pdwServerSignatureSize);

[callback]
HRESULT
S_DSQMGetObjectSecurityChallengeResponceProc(
    [in, size_is(dwCallengeSize)]
                         BYTE                    *abChallenge,
    [in]                 DWORD                   dwCallengeSize,
    [in]                 DWORD                   dwContext,
    [in, out, size_is(dwCallengeResponceMaxSize), length_is(*pdwCallengeResponceSize)]
                         BYTE                    *abCallengeResponce,
    [in, out]            DWORD                   *pdwCallengeResponceSize,
    [in]                 DWORD                   dwCallengeResponceMaxSize);

[callback]
HRESULT
S_InitSecCtx(
    [in]                DWORD                   dwContext,
    [in, size_is(dwServerBuffSize)]
                        UCHAR *                 pServerbuff,
    [in]                DWORD                   dwServerBuffSize,
    [in]                DWORD                   dwClientBuffMaxSize,
    [out, size_is(dwClientBuffMaxSize), length_is(*pdwClientBuffSize)]
                        UCHAR *                 pClientBuff,
    [out]               DWORD *                 pdwClientBuffSize);

HRESULT
S_DSValidateServer(
    [in]                handle_t                hBind,
    [in]                const GUID *            pguidEnterpriseId,
    [in]                BOOL                    fSetupMode,
    [in]                DWORD                   dwContext,
    [in]                DWORD                   dwClientBuffMaxSize,
    [in, size_is(dwClientBuffMaxSize), length_is(dwClientBuffSize)]
                        UCHAR *                 pClientBuff,
    [in]                DWORD                   dwClientBuffSize,
    [out]               PPCONTEXT_HANDLE_SERVER_AUTH_TYPE
                                                pphServerAuth);

HRESULT
S_DSCloseServerHandle(
    [in, out] PPCONTEXT_HANDLE_SERVER_AUTH_TYPE pphServerAuth
    );

HRESULT
S_DSMQISStats(
    [in]                                      handle_t      hBind,
    [in, out, unique, size_is(,*pdwStatElem), length_is(,*pdwStatElem)]        MQISSTAT      * * ppStat,
    [in, out]                                 LPDWORD       pdwStatElem);


HRESULT
S_DSDisableWriteOperations(
    [in]            handle_t                         hBind,
    [out]           PPCONTEXT_HANDLE_READONLY_TYPE   phContext
    );


HRESULT
S_DSEnableWriteOperations(
    [in]            handle_t                         hBind,
    [in, out]       PPCONTEXT_HANDLE_READONLY_TYPE   phContext
    );


DWORD
S_DSGetServerPort( [in]  handle_t  hBind,
                   [in]  DWORD     fIP ) ;

}
/*==================================================

	dscomm2 interface

	additional interface for ADS support
==================================================*/

[
    version(1.0),
    uuid(708cca10-9569-11d1-b2a5-0060977d8118),
    pointer_default(unique)
]
interface dscomm2
{

HRESULT
S_DSGetComputerSites(
    [in]                    handle_t            hBind,
    [in, unique]            LPCWSTR             pwcsPathName,
    [out]                   DWORD *             pdwNumberOfSites,
    [out, size_is(,*pdwNumberOfSites), length_is(,*pdwNumberOfSites)]    GUID **    ppguidSites,
    [in]                    PCONTEXT_HANDLE_SERVER_AUTH_TYPE
                                                phServerAuth,
    [out, size_is(*pdwServerSignatureSize)]
                            UCHAR*              pbServerSignature,
    [in, out]               DWORD *             pdwServerSignatureSize
	);

HRESULT
S_DSGetPropsEx(
    [in]                    handle_t            hBind,
    [in]                    DWORD               dwObjectType,
    [in]                    LPCWSTR             pwcsPathName,
    [in]                    DWORD               cp,
    [in, size_is(cp)]       PROPID              aProp[],
    [in, out, size_is(cp)]  PROPVARIANT         apVar[],
    [in]                    PCONTEXT_HANDLE_SERVER_AUTH_TYPE
                                                phServerAuth,
    [out, size_is(*pdwServerSignatureSize)]
                            UCHAR*              pbServerSignature,
    [in, out]               DWORD *             pdwServerSignatureSize
    );

HRESULT
S_DSGetPropsGuidEx(
    [in]                    handle_t         hBind,
    [in]                    DWORD            dwObjectType,
    [in, unique]            const GUID*      pGuid,
    [in]                    DWORD            cp,
    [in, size_is(cp)]       PROPID           aProp[],
    [in, out, size_is(cp)]  PROPVARIANT      apVar[],
    [in]                    PCONTEXT_HANDLE_SERVER_AUTH_TYPE
                                                phServerAuth,
    [out, size_is(*pdwServerSignatureSize)]
                            UCHAR*              pbServerSignature,
    [in, out]               DWORD *             pdwServerSignatureSize
    );

HRESULT
S_DSBeginDeleteNotification(
    [in]                  handle_t			   hBind,
    [in]                  LPCWSTR			   pwcsQueueName,
    [out]                 PPCONTEXT_HANDLE_DELETE_TYPE     pHandle,
    [in]                  PCONTEXT_HANDLE_SERVER_AUTH_TYPE phServerAuth
	);

HRESULT
S_DSNotifyDelete(
    [in]                    handle_t				hBind,
    [in]                     PCONTEXT_HANDLE_DELETE_TYPE        Handle
	);

void
S_DSEndDeleteNotification(
    [in]                handle_t			hBind,
    [in, out]		PPCONTEXT_HANDLE_DELETE_TYPE	pHandle
	);

BOOL
S_DSIsServerGC( [in] handle_t	hBind ) ;

HRESULT
S_DSUpdateMachineDacl( [in] handle_t   hBind ) ;

HRESULT
S_DSGetGCListInDomain(
        [in] handle_t                            hBind,
        [in, ptr] LPCWSTR                        lpwszComputerName,
        [in, ptr] LPCWSTR                        lpwszDomainName,
        [out, string] LPWSTR                    *lplpwszGCList,
        [in]   PCONTEXT_HANDLE_SERVER_AUTH_TYPE  phServerAuth,
        [out, size_is(*pdwServerSignatureSize)]
                        UCHAR                   *pbServerSignature,
        [in, out]       DWORD                   *pdwServerSignatureSize ) ;

}

