ホーム › Networking.ActiveDirectory › DsReplicaDelW
DsReplicaDelW
関数複製元サーバーをレプリケーション構成から削除する(Unicode版)。
シグネチャ
// NTDSAPI.dll (Unicode / -W)
#include <windows.h>
DWORD DsReplicaDelW(
HANDLE hDS,
LPCWSTR NameContext,
LPCWSTR DsaSrc,
DWORD Options
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hDS | HANDLE | in |
| NameContext | LPCWSTR | in |
| DsaSrc | LPCWSTR | in |
| Options | DWORD | in |
戻り値の型: DWORD
各言語での呼び出し定義
// NTDSAPI.dll (Unicode / -W)
#include <windows.h>
DWORD DsReplicaDelW(
HANDLE hDS,
LPCWSTR NameContext,
LPCWSTR DsaSrc,
DWORD Options
);[DllImport("NTDSAPI.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint DsReplicaDelW(
IntPtr hDS, // HANDLE
[MarshalAs(UnmanagedType.LPWStr)] string NameContext, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string DsaSrc, // LPCWSTR
uint Options // DWORD
);<DllImport("NTDSAPI.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function DsReplicaDelW(
hDS As IntPtr, ' HANDLE
<MarshalAs(UnmanagedType.LPWStr)> NameContext As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> DsaSrc As String, ' LPCWSTR
Options As UInteger ' DWORD
) As UInteger
End Function' hDS : HANDLE
' NameContext : LPCWSTR
' DsaSrc : LPCWSTR
' Options : DWORD
Declare PtrSafe Function DsReplicaDelW Lib "ntdsapi" ( _
ByVal hDS As LongPtr, _
ByVal NameContext As LongPtr, _
ByVal DsaSrc As LongPtr, _
ByVal Options As Long) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DsReplicaDelW = ctypes.windll.ntdsapi.DsReplicaDelW
DsReplicaDelW.restype = wintypes.DWORD
DsReplicaDelW.argtypes = [
wintypes.HANDLE, # hDS : HANDLE
wintypes.LPCWSTR, # NameContext : LPCWSTR
wintypes.LPCWSTR, # DsaSrc : LPCWSTR
wintypes.DWORD, # Options : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('NTDSAPI.dll')
DsReplicaDelW = Fiddle::Function.new(
lib['DsReplicaDelW'],
[
Fiddle::TYPE_VOIDP, # hDS : HANDLE
Fiddle::TYPE_VOIDP, # NameContext : LPCWSTR
Fiddle::TYPE_VOIDP, # DsaSrc : LPCWSTR
-Fiddle::TYPE_INT, # Options : DWORD
],
-Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "ntdsapi")]
extern "system" {
fn DsReplicaDelW(
hDS: *mut core::ffi::c_void, // HANDLE
NameContext: *const u16, // LPCWSTR
DsaSrc: *const u16, // LPCWSTR
Options: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("NTDSAPI.dll", CharSet = CharSet.Unicode)]
public static extern uint DsReplicaDelW(IntPtr hDS, [MarshalAs(UnmanagedType.LPWStr)] string NameContext, [MarshalAs(UnmanagedType.LPWStr)] string DsaSrc, uint Options);
"@
$api = Add-Type -MemberDefinition $sig -Name 'NTDSAPI_DsReplicaDelW' -Namespace Win32 -PassThru
# $api::DsReplicaDelW(hDS, NameContext, DsaSrc, Options)#uselib "NTDSAPI.dll"
#func global DsReplicaDelW "DsReplicaDelW" wptr, wptr, wptr, wptr
; DsReplicaDelW hDS, NameContext, DsaSrc, Options ; 戻り値は stat
; hDS : HANDLE -> "wptr"
; NameContext : LPCWSTR -> "wptr"
; DsaSrc : LPCWSTR -> "wptr"
; Options : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "NTDSAPI.dll"
#cfunc global DsReplicaDelW "DsReplicaDelW" sptr, wstr, wstr, int
; res = DsReplicaDelW(hDS, NameContext, DsaSrc, Options)
; hDS : HANDLE -> "sptr"
; NameContext : LPCWSTR -> "wstr"
; DsaSrc : LPCWSTR -> "wstr"
; Options : DWORD -> "int"; DWORD DsReplicaDelW(HANDLE hDS, LPCWSTR NameContext, LPCWSTR DsaSrc, DWORD Options)
#uselib "NTDSAPI.dll"
#cfunc global DsReplicaDelW "DsReplicaDelW" intptr, wstr, wstr, int
; res = DsReplicaDelW(hDS, NameContext, DsaSrc, Options)
; hDS : HANDLE -> "intptr"
; NameContext : LPCWSTR -> "wstr"
; DsaSrc : LPCWSTR -> "wstr"
; Options : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ntdsapi = windows.NewLazySystemDLL("NTDSAPI.dll")
procDsReplicaDelW = ntdsapi.NewProc("DsReplicaDelW")
)
// hDS (HANDLE), NameContext (LPCWSTR), DsaSrc (LPCWSTR), Options (DWORD)
r1, _, err := procDsReplicaDelW.Call(
uintptr(hDS),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(NameContext))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(DsaSrc))),
uintptr(Options),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction DsReplicaDelW(
hDS: THandle; // HANDLE
NameContext: PWideChar; // LPCWSTR
DsaSrc: PWideChar; // LPCWSTR
Options: DWORD // DWORD
): DWORD; stdcall;
external 'NTDSAPI.dll' name 'DsReplicaDelW';result := DllCall("NTDSAPI\DsReplicaDelW"
, "Ptr", hDS ; HANDLE
, "WStr", NameContext ; LPCWSTR
, "WStr", DsaSrc ; LPCWSTR
, "UInt", Options ; DWORD
, "UInt") ; return: DWORD●DsReplicaDelW(hDS, NameContext, DsaSrc, Options) = DLL("NTDSAPI.dll", "dword DsReplicaDelW(void*, char*, char*, dword)")
# 呼び出し: DsReplicaDelW(hDS, NameContext, DsaSrc, Options)
# hDS : HANDLE -> "void*"
# NameContext : LPCWSTR -> "char*"
# DsaSrc : LPCWSTR -> "char*"
# Options : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。