ホーム › Networking.ActiveDirectory › DsGetForestTrustInformationW
DsGetForestTrustInformationW
関数信頼するフォレストの信頼情報を取得する。
シグネチャ
// NETAPI32.dll
#include <windows.h>
DWORD DsGetForestTrustInformationW(
LPCWSTR ServerName, // optional
LPCWSTR TrustedDomainName, // optional
DWORD Flags,
LSA_FOREST_TRUST_INFORMATION** ForestTrustInfo
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ServerName | LPCWSTR | inoptional |
| TrustedDomainName | LPCWSTR | inoptional |
| Flags | DWORD | in |
| ForestTrustInfo | LSA_FOREST_TRUST_INFORMATION** | out |
戻り値の型: DWORD
各言語での呼び出し定義
// NETAPI32.dll
#include <windows.h>
DWORD DsGetForestTrustInformationW(
LPCWSTR ServerName, // optional
LPCWSTR TrustedDomainName, // optional
DWORD Flags,
LSA_FOREST_TRUST_INFORMATION** ForestTrustInfo
);[DllImport("NETAPI32.dll", ExactSpelling = true)]
static extern uint DsGetForestTrustInformationW(
[MarshalAs(UnmanagedType.LPWStr)] string ServerName, // LPCWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string TrustedDomainName, // LPCWSTR optional
uint Flags, // DWORD
IntPtr ForestTrustInfo // LSA_FOREST_TRUST_INFORMATION** out
);<DllImport("NETAPI32.dll", ExactSpelling:=True)>
Public Shared Function DsGetForestTrustInformationW(
<MarshalAs(UnmanagedType.LPWStr)> ServerName As String, ' LPCWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> TrustedDomainName As String, ' LPCWSTR optional
Flags As UInteger, ' DWORD
ForestTrustInfo As IntPtr ' LSA_FOREST_TRUST_INFORMATION** out
) As UInteger
End Function' ServerName : LPCWSTR optional
' TrustedDomainName : LPCWSTR optional
' Flags : DWORD
' ForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out
Declare PtrSafe Function DsGetForestTrustInformationW Lib "netapi32" ( _
ByVal ServerName As LongPtr, _
ByVal TrustedDomainName As LongPtr, _
ByVal Flags As Long, _
ByVal ForestTrustInfo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DsGetForestTrustInformationW = ctypes.windll.netapi32.DsGetForestTrustInformationW
DsGetForestTrustInformationW.restype = wintypes.DWORD
DsGetForestTrustInformationW.argtypes = [
wintypes.LPCWSTR, # ServerName : LPCWSTR optional
wintypes.LPCWSTR, # TrustedDomainName : LPCWSTR optional
wintypes.DWORD, # Flags : DWORD
ctypes.c_void_p, # ForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('NETAPI32.dll')
DsGetForestTrustInformationW = Fiddle::Function.new(
lib['DsGetForestTrustInformationW'],
[
Fiddle::TYPE_VOIDP, # ServerName : LPCWSTR optional
Fiddle::TYPE_VOIDP, # TrustedDomainName : LPCWSTR optional
-Fiddle::TYPE_INT, # Flags : DWORD
Fiddle::TYPE_VOIDP, # ForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out
],
-Fiddle::TYPE_INT)#[link(name = "netapi32")]
extern "system" {
fn DsGetForestTrustInformationW(
ServerName: *const u16, // LPCWSTR optional
TrustedDomainName: *const u16, // LPCWSTR optional
Flags: u32, // DWORD
ForestTrustInfo: *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 DsGetForestTrustInformationW([MarshalAs(UnmanagedType.LPWStr)] string ServerName, [MarshalAs(UnmanagedType.LPWStr)] string TrustedDomainName, uint Flags, IntPtr ForestTrustInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'NETAPI32_DsGetForestTrustInformationW' -Namespace Win32 -PassThru
# $api::DsGetForestTrustInformationW(ServerName, TrustedDomainName, Flags, ForestTrustInfo)#uselib "NETAPI32.dll"
#func global DsGetForestTrustInformationW "DsGetForestTrustInformationW" sptr, sptr, sptr, sptr
; DsGetForestTrustInformationW ServerName, TrustedDomainName, Flags, varptr(ForestTrustInfo) ; 戻り値は stat
; ServerName : LPCWSTR optional -> "sptr"
; TrustedDomainName : LPCWSTR optional -> "sptr"
; Flags : DWORD -> "sptr"
; ForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "NETAPI32.dll" #cfunc global DsGetForestTrustInformationW "DsGetForestTrustInformationW" wstr, wstr, int, var ; res = DsGetForestTrustInformationW(ServerName, TrustedDomainName, Flags, ForestTrustInfo) ; ServerName : LPCWSTR optional -> "wstr" ; TrustedDomainName : LPCWSTR optional -> "wstr" ; Flags : DWORD -> "int" ; ForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "NETAPI32.dll" #cfunc global DsGetForestTrustInformationW "DsGetForestTrustInformationW" wstr, wstr, int, sptr ; res = DsGetForestTrustInformationW(ServerName, TrustedDomainName, Flags, varptr(ForestTrustInfo)) ; ServerName : LPCWSTR optional -> "wstr" ; TrustedDomainName : LPCWSTR optional -> "wstr" ; Flags : DWORD -> "int" ; ForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD DsGetForestTrustInformationW(LPCWSTR ServerName, LPCWSTR TrustedDomainName, DWORD Flags, LSA_FOREST_TRUST_INFORMATION** ForestTrustInfo) #uselib "NETAPI32.dll" #cfunc global DsGetForestTrustInformationW "DsGetForestTrustInformationW" wstr, wstr, int, var ; res = DsGetForestTrustInformationW(ServerName, TrustedDomainName, Flags, ForestTrustInfo) ; ServerName : LPCWSTR optional -> "wstr" ; TrustedDomainName : LPCWSTR optional -> "wstr" ; Flags : DWORD -> "int" ; ForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD DsGetForestTrustInformationW(LPCWSTR ServerName, LPCWSTR TrustedDomainName, DWORD Flags, LSA_FOREST_TRUST_INFORMATION** ForestTrustInfo) #uselib "NETAPI32.dll" #cfunc global DsGetForestTrustInformationW "DsGetForestTrustInformationW" wstr, wstr, int, intptr ; res = DsGetForestTrustInformationW(ServerName, TrustedDomainName, Flags, varptr(ForestTrustInfo)) ; ServerName : LPCWSTR optional -> "wstr" ; TrustedDomainName : LPCWSTR optional -> "wstr" ; Flags : DWORD -> "int" ; ForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
netapi32 = windows.NewLazySystemDLL("NETAPI32.dll")
procDsGetForestTrustInformationW = netapi32.NewProc("DsGetForestTrustInformationW")
)
// ServerName (LPCWSTR optional), TrustedDomainName (LPCWSTR optional), Flags (DWORD), ForestTrustInfo (LSA_FOREST_TRUST_INFORMATION** out)
r1, _, err := procDsGetForestTrustInformationW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(ServerName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(TrustedDomainName))),
uintptr(Flags),
uintptr(ForestTrustInfo),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction DsGetForestTrustInformationW(
ServerName: PWideChar; // LPCWSTR optional
TrustedDomainName: PWideChar; // LPCWSTR optional
Flags: DWORD; // DWORD
ForestTrustInfo: Pointer // LSA_FOREST_TRUST_INFORMATION** out
): DWORD; stdcall;
external 'NETAPI32.dll' name 'DsGetForestTrustInformationW';result := DllCall("NETAPI32\DsGetForestTrustInformationW"
, "WStr", ServerName ; LPCWSTR optional
, "WStr", TrustedDomainName ; LPCWSTR optional
, "UInt", Flags ; DWORD
, "Ptr", ForestTrustInfo ; LSA_FOREST_TRUST_INFORMATION** out
, "UInt") ; return: DWORD●DsGetForestTrustInformationW(ServerName, TrustedDomainName, Flags, ForestTrustInfo) = DLL("NETAPI32.dll", "dword DsGetForestTrustInformationW(char*, char*, dword, void*)")
# 呼び出し: DsGetForestTrustInformationW(ServerName, TrustedDomainName, Flags, ForestTrustInfo)
# ServerName : LPCWSTR optional -> "char*"
# TrustedDomainName : LPCWSTR optional -> "char*"
# Flags : DWORD -> "dword"
# ForestTrustInfo : LSA_FOREST_TRUST_INFORMATION** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。