ホーム › Networking.ActiveDirectory › DsMergeForestTrustInformationW
DsMergeForestTrustInformationW
関数新旧のフォレスト信頼情報をマージする。
シグネチャ
// NETAPI32.dll
#include <windows.h>
DWORD DsMergeForestTrustInformationW(
LPCWSTR DomainName,
LSA_FOREST_TRUST_INFORMATION* NewForestTrustInfo,
LSA_FOREST_TRUST_INFORMATION* OldForestTrustInfo, // optional
LSA_FOREST_TRUST_INFORMATION** MergedForestTrustInfo
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| DomainName | LPCWSTR | in | 対象となる信頼ドメイン名を指すワイド文字列。 |
| NewForestTrustInfo | LSA_FOREST_TRUST_INFORMATION* | in | 新しいフォレスト信頼情報構造体へのポインタ。マージのソースとなる。 |
| OldForestTrustInfo | LSA_FOREST_TRUST_INFORMATION* | inoptional | 既存のフォレスト信頼情報構造体へのポインタ。除外フラグの引き継ぎに使用し不要ならNULL可。 |
| MergedForestTrustInfo | LSA_FOREST_TRUST_INFORMATION** | out | マージ結果のフォレスト信頼情報へのポインタを受け取る出力。使用後はNetApiBufferFreeで解放する。 |
戻り値の型: DWORD
各言語での呼び出し定義
// NETAPI32.dll
#include <windows.h>
DWORD DsMergeForestTrustInformationW(
LPCWSTR DomainName,
LSA_FOREST_TRUST_INFORMATION* NewForestTrustInfo,
LSA_FOREST_TRUST_INFORMATION* OldForestTrustInfo, // optional
LSA_FOREST_TRUST_INFORMATION** MergedForestTrustInfo
);[DllImport("NETAPI32.dll", ExactSpelling = true)]
static extern uint DsMergeForestTrustInformationW(
[MarshalAs(UnmanagedType.LPWStr)] string DomainName, // LPCWSTR
IntPtr NewForestTrustInfo, // LSA_FOREST_TRUST_INFORMATION*
IntPtr OldForestTrustInfo, // LSA_FOREST_TRUST_INFORMATION* optional
IntPtr MergedForestTrustInfo // LSA_FOREST_TRUST_INFORMATION** out
);<DllImport("NETAPI32.dll", ExactSpelling:=True)>
Public Shared Function DsMergeForestTrustInformationW(
<MarshalAs(UnmanagedType.LPWStr)> DomainName As String, ' LPCWSTR
NewForestTrustInfo As IntPtr, ' LSA_FOREST_TRUST_INFORMATION*
OldForestTrustInfo As IntPtr, ' LSA_FOREST_TRUST_INFORMATION* optional
MergedForestTrustInfo As IntPtr ' LSA_FOREST_TRUST_INFORMATION** out
) As UInteger
End Function' DomainName : LPCWSTR
' NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION*
' OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional
' MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out
Declare PtrSafe Function DsMergeForestTrustInformationW Lib "netapi32" ( _
ByVal DomainName As LongPtr, _
ByVal NewForestTrustInfo As LongPtr, _
ByVal OldForestTrustInfo As LongPtr, _
ByVal MergedForestTrustInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DsMergeForestTrustInformationW = ctypes.windll.netapi32.DsMergeForestTrustInformationW
DsMergeForestTrustInformationW.restype = wintypes.DWORD
DsMergeForestTrustInformationW.argtypes = [
wintypes.LPCWSTR, # DomainName : LPCWSTR
ctypes.c_void_p, # NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION*
ctypes.c_void_p, # OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional
ctypes.c_void_p, # MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('NETAPI32.dll')
DsMergeForestTrustInformationW = Fiddle::Function.new(
lib['DsMergeForestTrustInformationW'],
[
Fiddle::TYPE_VOIDP, # DomainName : LPCWSTR
Fiddle::TYPE_VOIDP, # NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION*
Fiddle::TYPE_VOIDP, # OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional
Fiddle::TYPE_VOIDP, # MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out
],
-Fiddle::TYPE_INT)#[link(name = "netapi32")]
extern "system" {
fn DsMergeForestTrustInformationW(
DomainName: *const u16, // LPCWSTR
NewForestTrustInfo: *mut LSA_FOREST_TRUST_INFORMATION, // LSA_FOREST_TRUST_INFORMATION*
OldForestTrustInfo: *mut LSA_FOREST_TRUST_INFORMATION, // LSA_FOREST_TRUST_INFORMATION* optional
MergedForestTrustInfo: *mut *mut LSA_FOREST_TRUST_INFORMATION // LSA_FOREST_TRUST_INFORMATION** out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("NETAPI32.dll")]
public static extern uint DsMergeForestTrustInformationW([MarshalAs(UnmanagedType.LPWStr)] string DomainName, IntPtr NewForestTrustInfo, IntPtr OldForestTrustInfo, IntPtr MergedForestTrustInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'NETAPI32_DsMergeForestTrustInformationW' -Namespace Win32 -PassThru
# $api::DsMergeForestTrustInformationW(DomainName, NewForestTrustInfo, OldForestTrustInfo, MergedForestTrustInfo)#uselib "NETAPI32.dll"
#func global DsMergeForestTrustInformationW "DsMergeForestTrustInformationW" sptr, sptr, sptr, sptr
; DsMergeForestTrustInformationW DomainName, varptr(NewForestTrustInfo), varptr(OldForestTrustInfo), varptr(MergedForestTrustInfo) ; 戻り値は stat
; DomainName : LPCWSTR -> "sptr"
; NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* -> "sptr"
; OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional -> "sptr"
; MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "NETAPI32.dll" #cfunc global DsMergeForestTrustInformationW "DsMergeForestTrustInformationW" wstr, var, var, var ; res = DsMergeForestTrustInformationW(DomainName, NewForestTrustInfo, OldForestTrustInfo, MergedForestTrustInfo) ; DomainName : LPCWSTR -> "wstr" ; NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* -> "var" ; OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional -> "var" ; MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "NETAPI32.dll" #cfunc global DsMergeForestTrustInformationW "DsMergeForestTrustInformationW" wstr, sptr, sptr, sptr ; res = DsMergeForestTrustInformationW(DomainName, varptr(NewForestTrustInfo), varptr(OldForestTrustInfo), varptr(MergedForestTrustInfo)) ; DomainName : LPCWSTR -> "wstr" ; NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* -> "sptr" ; OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional -> "sptr" ; MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD DsMergeForestTrustInformationW(LPCWSTR DomainName, LSA_FOREST_TRUST_INFORMATION* NewForestTrustInfo, LSA_FOREST_TRUST_INFORMATION* OldForestTrustInfo, LSA_FOREST_TRUST_INFORMATION** MergedForestTrustInfo) #uselib "NETAPI32.dll" #cfunc global DsMergeForestTrustInformationW "DsMergeForestTrustInformationW" wstr, var, var, var ; res = DsMergeForestTrustInformationW(DomainName, NewForestTrustInfo, OldForestTrustInfo, MergedForestTrustInfo) ; DomainName : LPCWSTR -> "wstr" ; NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* -> "var" ; OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional -> "var" ; MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD DsMergeForestTrustInformationW(LPCWSTR DomainName, LSA_FOREST_TRUST_INFORMATION* NewForestTrustInfo, LSA_FOREST_TRUST_INFORMATION* OldForestTrustInfo, LSA_FOREST_TRUST_INFORMATION** MergedForestTrustInfo) #uselib "NETAPI32.dll" #cfunc global DsMergeForestTrustInformationW "DsMergeForestTrustInformationW" wstr, intptr, intptr, intptr ; res = DsMergeForestTrustInformationW(DomainName, varptr(NewForestTrustInfo), varptr(OldForestTrustInfo), varptr(MergedForestTrustInfo)) ; DomainName : LPCWSTR -> "wstr" ; NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* -> "intptr" ; OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional -> "intptr" ; MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
netapi32 = windows.NewLazySystemDLL("NETAPI32.dll")
procDsMergeForestTrustInformationW = netapi32.NewProc("DsMergeForestTrustInformationW")
)
// DomainName (LPCWSTR), NewForestTrustInfo (LSA_FOREST_TRUST_INFORMATION*), OldForestTrustInfo (LSA_FOREST_TRUST_INFORMATION* optional), MergedForestTrustInfo (LSA_FOREST_TRUST_INFORMATION** out)
r1, _, err := procDsMergeForestTrustInformationW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(DomainName))),
uintptr(NewForestTrustInfo),
uintptr(OldForestTrustInfo),
uintptr(MergedForestTrustInfo),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction DsMergeForestTrustInformationW(
DomainName: PWideChar; // LPCWSTR
NewForestTrustInfo: Pointer; // LSA_FOREST_TRUST_INFORMATION*
OldForestTrustInfo: Pointer; // LSA_FOREST_TRUST_INFORMATION* optional
MergedForestTrustInfo: Pointer // LSA_FOREST_TRUST_INFORMATION** out
): DWORD; stdcall;
external 'NETAPI32.dll' name 'DsMergeForestTrustInformationW';result := DllCall("NETAPI32\DsMergeForestTrustInformationW"
, "WStr", DomainName ; LPCWSTR
, "Ptr", NewForestTrustInfo ; LSA_FOREST_TRUST_INFORMATION*
, "Ptr", OldForestTrustInfo ; LSA_FOREST_TRUST_INFORMATION* optional
, "Ptr", MergedForestTrustInfo ; LSA_FOREST_TRUST_INFORMATION** out
, "UInt") ; return: DWORD●DsMergeForestTrustInformationW(DomainName, NewForestTrustInfo, OldForestTrustInfo, MergedForestTrustInfo) = DLL("NETAPI32.dll", "dword DsMergeForestTrustInformationW(char*, void*, void*, void*)")
# 呼び出し: DsMergeForestTrustInformationW(DomainName, NewForestTrustInfo, OldForestTrustInfo, MergedForestTrustInfo)
# DomainName : LPCWSTR -> "char*"
# NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* -> "void*"
# OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional -> "void*"
# MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "netapi32" fn DsMergeForestTrustInformationW(
DomainName: [*c]const u16, // LPCWSTR
NewForestTrustInfo: [*c]LSA_FOREST_TRUST_INFORMATION, // LSA_FOREST_TRUST_INFORMATION*
OldForestTrustInfo: [*c]LSA_FOREST_TRUST_INFORMATION, // LSA_FOREST_TRUST_INFORMATION* optional
MergedForestTrustInfo: [*c][*c]LSA_FOREST_TRUST_INFORMATION // LSA_FOREST_TRUST_INFORMATION** out
) callconv(std.os.windows.WINAPI) u32;proc DsMergeForestTrustInformationW(
DomainName: WideCString, # LPCWSTR
NewForestTrustInfo: ptr LSA_FOREST_TRUST_INFORMATION, # LSA_FOREST_TRUST_INFORMATION*
OldForestTrustInfo: ptr LSA_FOREST_TRUST_INFORMATION, # LSA_FOREST_TRUST_INFORMATION* optional
MergedForestTrustInfo: ptr LSA_FOREST_TRUST_INFORMATION # LSA_FOREST_TRUST_INFORMATION** out
): uint32 {.importc: "DsMergeForestTrustInformationW", stdcall, dynlib: "NETAPI32.dll".}pragma(lib, "netapi32");
extern(Windows)
uint DsMergeForestTrustInformationW(
const(wchar)* DomainName, // LPCWSTR
LSA_FOREST_TRUST_INFORMATION* NewForestTrustInfo, // LSA_FOREST_TRUST_INFORMATION*
LSA_FOREST_TRUST_INFORMATION* OldForestTrustInfo, // LSA_FOREST_TRUST_INFORMATION* optional
LSA_FOREST_TRUST_INFORMATION** MergedForestTrustInfo // LSA_FOREST_TRUST_INFORMATION** out
);ccall((:DsMergeForestTrustInformationW, "NETAPI32.dll"), stdcall, UInt32,
(Cwstring, Ptr{LSA_FOREST_TRUST_INFORMATION}, Ptr{LSA_FOREST_TRUST_INFORMATION}, Ptr{LSA_FOREST_TRUST_INFORMATION}),
DomainName, NewForestTrustInfo, OldForestTrustInfo, MergedForestTrustInfo)
# DomainName : LPCWSTR -> Cwstring
# NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* -> Ptr{LSA_FOREST_TRUST_INFORMATION}
# OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional -> Ptr{LSA_FOREST_TRUST_INFORMATION}
# MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> Ptr{LSA_FOREST_TRUST_INFORMATION}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t DsMergeForestTrustInformationW(
const uint16_t* DomainName,
void* NewForestTrustInfo,
void* OldForestTrustInfo,
void* MergedForestTrustInfo);
]]
local netapi32 = ffi.load("netapi32")
-- netapi32.DsMergeForestTrustInformationW(DomainName, NewForestTrustInfo, OldForestTrustInfo, MergedForestTrustInfo)
-- DomainName : LPCWSTR
-- NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION*
-- OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional
-- MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('NETAPI32.dll');
const DsMergeForestTrustInformationW = lib.func('__stdcall', 'DsMergeForestTrustInformationW', 'uint32_t', ['str16', 'void *', 'void *', 'void *']);
// DsMergeForestTrustInformationW(DomainName, NewForestTrustInfo, OldForestTrustInfo, MergedForestTrustInfo)
// DomainName : LPCWSTR -> 'str16'
// NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* -> 'void *'
// OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional -> 'void *'
// MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("NETAPI32.dll", {
DsMergeForestTrustInformationW: { parameters: ["buffer", "pointer", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.DsMergeForestTrustInformationW(DomainName, NewForestTrustInfo, OldForestTrustInfo, MergedForestTrustInfo)
// DomainName : LPCWSTR -> "buffer"
// NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* -> "pointer"
// OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional -> "pointer"
// MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t DsMergeForestTrustInformationW(
const uint16_t* DomainName,
void* NewForestTrustInfo,
void* OldForestTrustInfo,
void* MergedForestTrustInfo);
C, "NETAPI32.dll");
// $ffi->DsMergeForestTrustInformationW(DomainName, NewForestTrustInfo, OldForestTrustInfo, MergedForestTrustInfo);
// DomainName : LPCWSTR
// NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION*
// OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional
// MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Netapi32 extends StdCallLibrary {
Netapi32 INSTANCE = Native.load("netapi32", Netapi32.class);
int DsMergeForestTrustInformationW(
WString DomainName, // LPCWSTR
Pointer NewForestTrustInfo, // LSA_FOREST_TRUST_INFORMATION*
Pointer OldForestTrustInfo, // LSA_FOREST_TRUST_INFORMATION* optional
Pointer MergedForestTrustInfo // LSA_FOREST_TRUST_INFORMATION** out
);
}@[Link("netapi32")]
lib LibNETAPI32
fun DsMergeForestTrustInformationW = DsMergeForestTrustInformationW(
DomainName : UInt16*, # LPCWSTR
NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION*, # LSA_FOREST_TRUST_INFORMATION*
OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION*, # LSA_FOREST_TRUST_INFORMATION* optional
MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** # LSA_FOREST_TRUST_INFORMATION** out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DsMergeForestTrustInformationWNative = Uint32 Function(Pointer<Utf16>, Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef DsMergeForestTrustInformationWDart = int Function(Pointer<Utf16>, Pointer<Void>, Pointer<Void>, Pointer<Void>);
final DsMergeForestTrustInformationW = DynamicLibrary.open('NETAPI32.dll')
.lookupFunction<DsMergeForestTrustInformationWNative, DsMergeForestTrustInformationWDart>('DsMergeForestTrustInformationW');
// DomainName : LPCWSTR -> Pointer<Utf16>
// NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* -> Pointer<Void>
// OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional -> Pointer<Void>
// MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DsMergeForestTrustInformationW(
DomainName: PWideChar; // LPCWSTR
NewForestTrustInfo: Pointer; // LSA_FOREST_TRUST_INFORMATION*
OldForestTrustInfo: Pointer; // LSA_FOREST_TRUST_INFORMATION* optional
MergedForestTrustInfo: Pointer // LSA_FOREST_TRUST_INFORMATION** out
): DWORD; stdcall;
external 'NETAPI32.dll' name 'DsMergeForestTrustInformationW';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DsMergeForestTrustInformationW"
c_DsMergeForestTrustInformationW :: CWString -> Ptr () -> Ptr () -> Ptr () -> IO Word32
-- DomainName : LPCWSTR -> CWString
-- NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* -> Ptr ()
-- OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional -> Ptr ()
-- MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let dsmergeforesttrustinformationw =
foreign "DsMergeForestTrustInformationW"
((ptr uint16_t) @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> returning uint32_t)
(* DomainName : LPCWSTR -> (ptr uint16_t) *)
(* NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* -> (ptr void) *)
(* OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional -> (ptr void) *)
(* MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library netapi32 (t "NETAPI32.dll"))
(cffi:use-foreign-library netapi32)
(cffi:defcfun ("DsMergeForestTrustInformationW" ds-merge-forest-trust-information-w :convention :stdcall) :uint32
(domain-name (:string :encoding :utf-16le)) ; LPCWSTR
(new-forest-trust-info :pointer) ; LSA_FOREST_TRUST_INFORMATION*
(old-forest-trust-info :pointer) ; LSA_FOREST_TRUST_INFORMATION* optional
(merged-forest-trust-info :pointer)) ; LSA_FOREST_TRUST_INFORMATION** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DsMergeForestTrustInformationW = Win32::API::More->new('NETAPI32',
'DWORD DsMergeForestTrustInformationW(LPCWSTR DomainName, LPVOID NewForestTrustInfo, LPVOID OldForestTrustInfo, LPVOID MergedForestTrustInfo)');
# my $ret = $DsMergeForestTrustInformationW->Call($DomainName, $NewForestTrustInfo, $OldForestTrustInfo, $MergedForestTrustInfo);
# DomainName : LPCWSTR -> LPCWSTR
# NewForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* -> LPVOID
# OldForestTrustInfo : LSA_FOREST_TRUST_INFORMATION* optional -> LPVOID
# MergedForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。