/*++

Copyright (c) 1991  Microsoft Corporation

Module Name:

    dssetup.idl

Abstract:


Author:

    Mac McLain  (MacM)          09-April-1997

Environment:

    User Mode

Revision History:

--*/

[
    uuid(3919286a-b10c-11d0-9ba8-00c04fd92ef5),
    version(0.0),
    pointer_default(unique)
]

interface dssetup

{

import "dssetimp.idl" ;
#include <lmcons.h>
#include <dssetcon.h>

typedef [handle] LPWSTR PDSROLE_SERVER_NAME, *PPDSROLE_SERVER_NAME;

typedef [context_handle] PVOID DSROLER_HANDLE;

typedef DSROLER_HANDLE *PDSROLER_HANDLE;

typedef struct _DSROLER_PRIMARY_DOMAIN_INFO_BASIC {

    DSROLE_MACHINE_ROLE MachineRole;
    ULONG Flags;
    [ unique, string ] LPWSTR DomainNameFlat;
    [ unique, string ] LPWSTR DomainNameDns;
    [ unique, string ] LPWSTR DomainForestName;
    GUID DomainGuid;

} DSROLER_PRIMARY_DOMAIN_INFO_BASIC, *PDSROLER_PRIMARY_DOMAIN_INFO_BASIC;


typedef [switch_type(DSROLE_PRIMARY_DOMAIN_INFO_LEVEL)] union

_DSROLER_PRIMARY_DOMAIN_INFORMATION {

    [case(DsRolePrimaryDomainInfoBasic)]    DSROLER_PRIMARY_DOMAIN_INFO_BASIC   DomainInfoBasic;
    [case(DsRoleUpgradeStatus)]             DSROLE_UPGRADE_STATUS_INFO UpgradStatusInfo;
    [case(DsRoleOperationState)]            DSROLE_OPERATION_STATE_INFO OperationStateInfo;

} DSROLER_PRIMARY_DOMAIN_INFORMATION, *PDSROLER_PRIMARY_DOMAIN_INFORMATION;

typedef struct _DSROLER_SERVEROP_STATUS {

    [ unique, string ] LPWSTR CurrentOperationDisplayString;
    ULONG OperationStatus;
    ULONG CurrentOperationDisplayStringIndex;

} DSROLER_SERVEROP_STATUS, *PDSROLER_SERVEROP_STATUS;

typedef struct _DSROLER_SERVEROP_RESULTS {

    ULONG OperationStatus;
    [ unique, string ] LPWSTR OperationStatusDisplayString;
    [ unique, string ] LPWSTR ServerInstalledSite;
    ULONG OperationResultsFlags;

} DSROLER_SERVEROP_RESULTS, *PDSROLER_SERVEROP_RESULTS;


//
// Structure to pass an encrypted password over the wire.  The Length is the
// length of the password, which should be placed at the end of the buffer.
//
typedef struct _DSROLEPR_USER_PASSWORD {
    UCHAR Obfuscator[DSROLE_OBFUSCATOR_LENGTH];
    WCHAR Buffer[DSROLE_MAX_PASSWORD_LENGTH];
    ULONG Length;
} DSROLEPR_USER_PASSWORD, *PDSROLEPR_USER_PASSWORD;

//
// Buffer - contains random fill with the password filling up the end
//          of the buffer (the last Length bytes).
// Length - Length, in bytes, of the password.
//

//
// This is the encrypted version of the above structure, and is passed
// on the wire.
//

typedef struct _DSROLEPR_ENCRYPTED_USER_PASSWORD {
    UCHAR Buffer[ DSROLE_OBFUSCATOR_LENGTH + (DSROLE_MAX_PASSWORD_LENGTH * sizeof(WCHAR)) + sizeof(ULONG) ];
} DSROLEPR_ENCRYPTED_USER_PASSWORD, *PDSROLEPR_ENCRYPTED_USER_PASSWORD;

DWORD
DsRolerGetPrimaryDomainInformation(
    [in] handle_t hBinding,
    [in] DSROLE_PRIMARY_DOMAIN_INFO_LEVEL InfoLevel,
    [out, switch_is( InfoLevel )] PDSROLER_PRIMARY_DOMAIN_INFORMATION *DomainInfo );

DWORD
DsRolerDnsNameToFlatName(
    [in] handle_t hBinding,
    [in, string] LPWSTR lpDnsName,
    [out, string] LPWSTR *lpFlatName,
    [out] PDWORD lpStatusFlag
    );

DWORD
DsRolerDcAsDc(
    [in] handle_t hBinding,
    [in, string]  LPWSTR lpDnsDomainName,
    [in, string]  LPWSTR lpFlatDomainName,
    [in, unique]  PDSROLEPR_ENCRYPTED_USER_PASSWORD DomainAdminPassword,
    [in, unique, string]  LPWSTR lpSiteName,
    [in, string]  LPWSTR lpDsDatabasePath,
    [in, string]  LPWSTR lpDsLogPath,
    [in, string]  LPWSTR lpSystemVolumeRootPath,
    [in, unique, string]  LPWSTR lpParentDnsDomainName,
    [in, unique, string]  LPWSTR lpParentServer,
    [in, unique, string]  LPWSTR lpAccount,
    [in, unique]  PDSROLEPR_ENCRYPTED_USER_PASSWORD Password,
    [in, unique]  PDSROLEPR_ENCRYPTED_USER_PASSWORD DsRepairPassword,
    [in]  ULONG Options,
    [out] PDSROLER_HANDLE DsOperationHandle
    );

DWORD
DsRolerDcAsReplica(
    [in] handle_t hBinding,
    [in, string]  LPWSTR lpDnsDomainName,
    [in, unique, string]  LPWSTR lpReplicaServer,
    [in, unique, string]  LPWSTR lpSiteName,
    [in, string]  LPWSTR lpDsDatabasePath,
    [in, string]  LPWSTR lpDsLogPath,
    [in, unique, string]  LPWSTR lpRestorePath,
    [in, string]  LPWSTR lpSystemVolumeRootPath,
    [in, unique] PUNICODE_STRING lpBootkey,
    [in, unique, string]  LPWSTR lpAccount,
    [in, unique]  PDSROLEPR_ENCRYPTED_USER_PASSWORD Password,
    [in, unique]  PDSROLEPR_ENCRYPTED_USER_PASSWORD DsRepairPassword,
    [in]  ULONG Options,
    [out] PDSROLER_HANDLE DsOperationHandle
    );

DWORD
DsRolerDemoteDc(
    [in] handle_t hBinding,
    [in, unique, string]  LPWSTR lpDnsDomainName,
    [in]  DSROLE_SERVEROP_DEMOTE_ROLE ServerRole,
    [in, unique, string]  LPWSTR lpAccount,
    [in, unique]  PDSROLEPR_ENCRYPTED_USER_PASSWORD Password,
    [in]  ULONG Options,
    [in] BOOL fLastDcInDomain,
    [in, unique]  PDSROLEPR_ENCRYPTED_USER_PASSWORD AdminPassword,
    [out] PDSROLER_HANDLE DsOperationHandle
    );

DWORD
DsRolerGetDcOperationProgress(
    [in] handle_t hBinding,
    [in] PDSROLER_HANDLE DsOperationHandle,
    [out] PDSROLER_SERVEROP_STATUS *ServerOperationStatus
    );

DWORD
DsRolerGetDcOperationResults(
    [in] handle_t hBinding,
    [in] PDSROLER_HANDLE DsOperationHandle,
    [out] PDSROLER_SERVEROP_RESULTS *ServerOperationResults
    );

DWORD
DsRolerCancel(
    [in] handle_t hBinding,
    [in] PDSROLER_HANDLE DsOperationHandle
    );

DWORD
DsRolerServerSaveStateForUpgrade(
    [in] handle_t hBinding,
    [in, unique, string] LPWSTR AnswerFile
    );

DWORD
DsRolerUpgradeDownlevelServer(
    [in] handle_t hBinding,
    [in, string]  LPWSTR lpDnsDomainName,
    [in, unique, string]  LPWSTR lpSiteName,
    [in, string]  LPWSTR lpDsDatabasePath,
    [in, string]  LPWSTR lpDsLogPath,
    [in, string]  LPWSTR lpSystemVolumeRootPath,
    [in, unique, string]  LPWSTR lpParentDnsDomainName,
    [in, unique, string]  LPWSTR lpParentServer,
    [in, unique, string]  LPWSTR lpAccount,
    [in, unique]  PDSROLEPR_ENCRYPTED_USER_PASSWORD Password,
    [in, unique]  PDSROLEPR_ENCRYPTED_USER_PASSWORD DsRepairPassword,
    [in]  ULONG Options,
    [out] PDSROLER_HANDLE DsOperationHandle
    );

DWORD
DsRolerAbortDownlevelServerUpgrade(
    [in] handle_t hBinding,
    [in, unique, string] LPWSTR lpAccount,
    [in, unique]  PDSROLEPR_ENCRYPTED_USER_PASSWORD Password,
    [in, unique]  PDSROLEPR_ENCRYPTED_USER_PASSWORD AdminPassword,
    [in] ULONG Options
    );

DWORD
DsRolerGetDatabaseFacts(
    [in] handle_t hBinding,
    [in, string]  LPWSTR RestorePath,
    [out, string] LPWSTR *ppDNSDomainName,
    [out] PULONG State    
    );
    
}

