📄 ntdsapi.h
字号:
pNC (IN) - NC for which to add the replica. The NC record must exist
locally as either an object (instantiated or not) or a reference
phantom (i.e., a phantom with a guid).
pSourceDsaDN (IN) - DN of the source DSA's ntdsDsa object. Required if
ulOptions includes DS_REPADD_ASYNCHRONOUS_REPLICA; ignored otherwise.
pTransportDN (IN) - DN of the interSiteTransport object representing the
transport by which to communicate with the source server. Required if
ulOptions includes INTERSITE_MESSAGING; ignored otherwise.
pszSourceDsaAddress (IN) - Transport-specific address of the source DSA.
pSchedule (IN) - Schedule by which to replicate the NC from this
source in the future.
ulOptions (IN) - flags
RETURNS: WIN32 STATUS
*/
NTDSAPI
DWORD
WINAPI
DsReplicaAddA(
IN HANDLE hDS,
IN LPCSTR NameContext,
IN LPCSTR SourceDsaDn,
IN LPCSTR TransportDn,
IN LPCSTR SourceDsaAddress,
IN const PSCHEDULE pSchedule,
IN DWORD Options
);
NTDSAPI
DWORD
WINAPI
DsReplicaAddW(
IN HANDLE hDS,
IN LPCWSTR NameContext,
IN LPCWSTR SourceDsaDn,
IN LPCWSTR TransportDn,
IN LPCWSTR SourceDsaAddress,
IN const PSCHEDULE pSchedule,
IN DWORD Options
);
#ifdef UNICODE
#define DsReplicaAdd DsReplicaAddW
#else
#define DsReplicaAdd DsReplicaAddA
#endif
// DsReplicaDel
//
// The server that this call is executing on is the destination. The call
// causes the destination to remove a "replication from" reference to the
// indicated source server.
// The source server is identified by string name, not uuid as with Sync.
// The DsaSrc parameter is the transport specific address of the source DSA,
// usually its guid-based dns name. The guid in the guid-based dns name is
// the object-guid of that server's ntds-dsa (settings) object.
//
// PARAMETERS:
// pNC (DSNAME *)
// Name of the NC for which to delete a source.
// pszSourceDRA (SZ)
// DSA for which to delete the source.
// ulOptions (ULONG)
// Bitwise OR of zero or more flags
// RETURNS: WIN32 STATUS
NTDSAPI
DWORD
WINAPI
DsReplicaDelA(
IN HANDLE hDS,
IN LPCSTR NameContext,
IN LPCSTR DsaSrc,
IN ULONG Options
);
NTDSAPI
DWORD
WINAPI
DsReplicaDelW(
IN HANDLE hDS,
IN LPCWSTR NameContext,
IN LPCWSTR DsaSrc,
IN ULONG Options
);
#ifdef UNICODE
#define DsReplicaDel DsReplicaDelW
#else
#define DsReplicaDel DsReplicaDelA
#endif
// DsReplicaModify
//
//
// Modify a source for a given naming context
//
// The value must already exist.
//
// Either the UUID or the address may be used to identify the current value.
// If a UUID is specified, the UUID will be used for comparison. Otherwise,
// the address will be used for comparison.
//
// PARAMETERS:
// pNC (DSNAME *)
// Name of the NC for which the Reps-From should be modified.
// puuidSourceDRA (UUID *)
// Invocation-ID of the referenced DRA. May be NULL if:
// . ulModifyFields does not include DS_REPMOD_UPDATE_ADDRESS and
// . pmtxSourceDRA is non-NULL.
// puuidTransportObj (UUID *)
// objectGuid of the transport by which replication is to be performed
// Ignored if ulModifyFields does not include
// DS_REPMOD_UPDATE_TRANSPORT.
// pszSourceDRA (SZ)
// DSA for which the reference should be added or deleted. Ignored if
// puuidSourceDRA is non-NULL and ulModifyFields does not include
// DS_REPMOD_UPDATE_ADDRESS.
// prtSchedule (REPLTIMES *)
// Periodic replication schedule for this replica. Ignored if
// ulModifyFields does not include DS_REPMOD_UPDATE_SCHEDULE.
// ulReplicaFlags (ULONG)
// Flags to set for this replica. Ignored if ulModifyFields does not
// include DS_REPMOD_UPDATE_FLAGS.
// ulModifyFields (ULONG)
// Fields to update. One or more of the following bit flags:
// UPDATE_ADDRESS
// Update the MTX_ADDR associated with the referenced server.
// UPDATE_SCHEDULE
// Update the periodic replication schedule associated with
// the replica.
// UPDATE_FLAGS
// Update the flags associated with the replica.
// UPDATE_TRANSPORT
// Update the transport associated with the replica.
// ulOptions (ULONG)
// Bitwise OR of zero or more of the following:
// DS_REPMOD_ASYNCHRONOUS_OPERATION
// Perform this operation asynchronously.
// RETURNS: WIN32 STATUS
NTDSAPI
DWORD
WINAPI
DsReplicaModifyA(
IN HANDLE hDS,
IN LPCSTR NameContext,
IN const UUID *pUuidSourceDsa,
IN LPCSTR TransportDn,
IN LPCSTR SourceDsaAddress,
IN const PSCHEDULE pSchedule,
IN DWORD ReplicaFlags,
IN DWORD ModifyFields,
IN DWORD Options
);
NTDSAPI
DWORD
WINAPI
DsReplicaModifyW(
IN HANDLE hDS,
IN LPCWSTR NameContext,
IN const UUID *pUuidSourceDsa,
IN LPCWSTR TransportDn,
IN LPCWSTR SourceDsaAddress,
IN const PSCHEDULE pSchedule,
IN DWORD ReplicaFlags,
IN DWORD ModifyFields,
IN DWORD Options
);
#ifdef UNICODE
#define DsReplicaModify DsReplicaModifyW
#else
#define DsReplicaModify DsReplicaModifyA
#endif
// DsReplicaUpdateRefs
//
// In this case, the RPC is being executed on the "source" of destination-sourc
// replication relationship. This function tells the source that it no longer
// supplies replication information to the indicated destination system.
// Add or remove a target server from the Reps-To property on the given NC.
// Add/remove a reference given the DSNAME of the corresponding NTDS-DSA
// object.
//
// PARAMETERS:
// pNC (DSNAME *)
// Name of the NC for which the Reps-To should be modified.
// DsaDest (SZ)
// Network address of DSA for which the reference should be added
// or deleted.
// pUuidDsaDest (UUID *)
// Invocation-ID of DSA for which the reference should be added
// or deleted.
// ulOptions (ULONG)
// Bitwise OR of zero or more of the following:
// DS_REPUPD_ASYNC_OP
// Perform this operation asynchronously.
// DS_REPUPD_ADD_REFERENCE
// Add the given server to the Reps-To property.
// DS_REPUPD_DEL_REFERENCE
// Remove the given server from the Reps-To property.
// Note that ADD_REF and DEL_REF may be paired to perform
// "add or update".
//
// RETURNS: WIN32 STATUS
NTDSAPI
DWORD
WINAPI
DsReplicaUpdateRefsA(
IN HANDLE hDS,
IN LPCSTR NameContext,
IN LPCSTR DsaDest,
IN const UUID *pUuidDsaDest,
IN ULONG Options
);
NTDSAPI
DWORD
WINAPI
DsReplicaUpdateRefsW(
IN HANDLE hDS,
IN LPCWSTR NameContext,
IN LPCWSTR DsaDest,
IN const UUID *pUuidDsaDest,
IN ULONG Options
);
#ifdef UNICODE
#define DsReplicaUpdateRefs DsReplicaUpdateRefsW
#else
#define DsReplicaUpdateRefs DsReplicaUpdateRefsA
#endif
// Friends of DsReplicaSyncAll
typedef enum {
DS_REPSYNCALL_WIN32_ERROR_CONTACTING_SERVER = 0,
DS_REPSYNCALL_WIN32_ERROR_REPLICATING = 1,
DS_REPSYNCALL_SERVER_UNREACHABLE = 2
} DS_REPSYNCALL_ERROR;
typedef enum {
DS_REPSYNCALL_EVENT_ERROR = 0,
DS_REPSYNCALL_EVENT_SYNC_STARTED = 1,
DS_REPSYNCALL_EVENT_SYNC_COMPLETED = 2,
DS_REPSYNCALL_EVENT_FINISHED = 3
} DS_REPSYNCALL_EVENT;
// Friends of DsReplicaSyncAll
typedef struct {
LPSTR pszSrcId;
LPSTR pszDstId;
LPSTR pszNC;
GUID * pguidSrc;
GUID * pguidDst;
} DS_REPSYNCALL_SYNCA, * PDS_REPSYNCALL_SYNCA;
typedef struct {
LPWSTR pszSrcId;
LPWSTR pszDstId;
LPWSTR pszNC;
GUID * pguidSrc;
GUID * pguidDst;
} DS_REPSYNCALL_SYNCW, * PDS_REPSYNCALL_SYNCW;
typedef struct {
LPSTR pszSvrId;
DS_REPSYNCALL_ERROR error;
DWORD dwWin32Err;
LPSTR pszSrcId;
} DS_REPSYNCALL_ERRINFOA, * PDS_REPSYNCALL_ERRINFOA;
typedef struct {
LPWSTR pszSvrId;
DS_REPSYNCALL_ERROR error;
DWORD dwWin32Err;
LPWSTR pszSrcId;
} DS_REPSYNCALL_ERRINFOW, * PDS_REPSYNCALL_ERRINFOW;
typedef struct {
DS_REPSYNCALL_EVENT event;
DS_REPSYNCALL_ERRINFOA * pErrInfo;
DS_REPSYNCALL_SYNCA * pSync;
} DS_REPSYNCALL_UPDATEA, * PDS_REPSYNCALL_UPDATEA;
typedef struct {
DS_REPSYNCALL_EVENT event;
DS_REPSYNCALL_ERRINFOW * pErrInfo;
DS_REPSYNCALL_SYNCW * pSync;
} DS_REPSYNCALL_UPDATEW, * PDS_REPSYNCALL_UPDATEW;
#ifdef UNICODE
#define DS_REPSYNCALL_SYNC DS_REPSYNCALL_SYNCW
#define DS_REPSYNCALL_ERRINFO DS_REPSYNCALL_ERRINFOW
#define DS_REPSYNCALL_UPDATE DS_REPSYNCALL_UPDATEW
#define PDS_REPSYNCALL_SYNC PDS_REPSYNCALL_SYNCW
#define PDS_REPSYNCALL_ERRINFO PDS_REPSYNCALL_ERRINFOW
#define PDS_REPSYNCALL_UPDATE PDS_REPSYNCALL_UPDATEW
#else
#define DS_REPSYNCALL_SYNC DS_REPSYNCALL_SYNCA
#define DS_REPSYNCALL_ERRINFO DS_REPSYNCALL_ERRINFOA
#define DS_REPSYNCALL_UPDATE DS_REPSYNCALL_UPDATEA
#define PDS_REPSYNCALL_SYNC PDS_REPSYNCALL_SYNCA
#define PDS_REPSYNCALL_ERRINFO PDS_REPSYNCALL_ERRINFOA
#define PDS_REPSYNCALL_UPDATE PDS_REPSYNCALL_UPDATEA
#endif
// **********************
// Replica SyncAll flags
// **********************
// This option has no effect.
#define DS_REPSYNCALL_NO_OPTIONS 0x00000000
// Ordinarily, if a server cannot be contacted, DsReplicaSyncAll tries to
// route around it and replicate from as many servers as possible. Enabling
// this option will cause DsReplicaSyncAll to generate a fatal error if any
// server cannot be contacted, or if any server is unreachable (due to a
// disconnected or broken topology.)
#define DS_REPSYNCALL_ABORT_IF_SERVER_UNAVAILABLE 0x00000001
// This option disables transitive replication; syncs will only be performed
// with adjacent servers and no DsBind calls will be made.
#define DS_REPSYNCALL_SYNC_ADJACENT_SERVERS_ONLY 0x00000002
// Ordinarily, when DsReplicaSyncAll encounters a non-fatal error, it returns
// the GUID DNS of the relevant server(s). Enabling this option causes
// DsReplicaSyncAll to return the servers' DNs instead.
#define DS_REPSYNCALL_ID_SERVERS_BY_DN 0x00000004
// This option disables all syncing. The topology will still be analyzed and
// unavailable / unreachable servers will still be identified.
#define DS_REPSYNCALL_DO_NOT_SYNC 0x00000008
// Ordinarily, DsReplicaSyncAll attempts to bind to all servers before
// generating the topology. If a server cannot be contacted, DsReplicaSyncAll
// excludes that server from the topology and tries to route around it. If
// this option is enabled, checking will be bypassed and DsReplicaSyncAll will
// assume all servers are responding. This will speed operation of
// DsReplicaSyncAll, but if some servers are not responding, some transitive
// replications may be blocked.
#define DS_REPSYNCALL_SKIP_INITIAL_CHECK 0x00000010
// Push mode. Push changes from the home server out to all partners using
// transitive replication. This reverses the direction of replication, and
// the order of execution of the replication sets from the usual "pulling"
// mode of execution.
#define DS_REPSYNCALL_PUSH_CHANGES_OUTWARD 0x00000020
// Cross site boundaries. By default, the only servers that are considered are
// those in the same site as the home system. With this option, all servers in
// the enterprise, across all sites, are eligible. They must be connected by
// a synchronous (RPC) transport, however.
#define DS_REPSYNCALL_CROSS_SITE_BOUNDARIES 0x00000040
// DsReplicaSyncAll. Syncs the destination server with all other servers
// in the site.
//
// PARAMETERS:
// hDS (IN) - A DS connection bound to the destination server.
// pszNameContext (IN) - The naming context to synchronize
// ulFlags (IN) - Bitwise OR of zero or more flags
// pFnCallBack (IN, OPTIONAL) - Callback function for message-passing.
// pCallbackData (IN, OPTIONAL) - A pointer that will be passed to the
// first argument of the callback function.
// pErrors (OUT, OPTIONAL) - Pointer to a (PDS_REPSYNCALL_ERRINFO *)
// object that will hold an array of error structures.
NTDSAPI
DWORD
WINAPI
DsReplicaSyncAllA (
HANDLE hDS,
LPCSTR pszNameContext,
ULONG ulFlags,
BOOL (__stdcall * pFnCallBack) (LPVOID, PDS_REPSYNCALL_UPDATEA),
LPVOID pCallbackData,
PDS_REPSYNCALL_ERRINFOA ** pErrors
);
NTDSAPI
DWORD
WINAPI
DsReplicaSyncAllW (
HANDLE hDS,
LPCWSTR pszNameContext,
ULONG ulFlags,
BOOL (__stdcall * pFnCallBack) (LPVOID, PDS_REPSYNCALL_UPDATEW),
LPVOID pCallbackData,
PDS_REPSYNCALL_ERRINFOW ** pErrors
);
#ifdef UNICODE
#define DsReplicaSyncAll DsReplicaSyncAllW
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -