ホーム › Security.Authentication.Identity › LsaSetTrustedDomainInformation
LsaSetTrustedDomainInformation
関数SIDで指定した信頼ドメインの情報を設定する。
シグネチャ
// ADVAPI32.dll
#include <windows.h>
NTSTATUS LsaSetTrustedDomainInformation(
LSA_HANDLE PolicyHandle,
PSID TrustedDomainSid,
TRUSTED_INFORMATION_CLASS InformationClass,
void* Buffer
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| PolicyHandle | LSA_HANDLE | in |
| TrustedDomainSid | PSID | in |
| InformationClass | TRUSTED_INFORMATION_CLASS | in |
| Buffer | void* | in |
戻り値の型: NTSTATUS
各言語での呼び出し定義
// ADVAPI32.dll
#include <windows.h>
NTSTATUS LsaSetTrustedDomainInformation(
LSA_HANDLE PolicyHandle,
PSID TrustedDomainSid,
TRUSTED_INFORMATION_CLASS InformationClass,
void* Buffer
);[DllImport("ADVAPI32.dll", ExactSpelling = true)]
static extern int LsaSetTrustedDomainInformation(
IntPtr PolicyHandle, // LSA_HANDLE
IntPtr TrustedDomainSid, // PSID
int InformationClass, // TRUSTED_INFORMATION_CLASS
IntPtr Buffer // void*
);<DllImport("ADVAPI32.dll", ExactSpelling:=True)>
Public Shared Function LsaSetTrustedDomainInformation(
PolicyHandle As IntPtr, ' LSA_HANDLE
TrustedDomainSid As IntPtr, ' PSID
InformationClass As Integer, ' TRUSTED_INFORMATION_CLASS
Buffer As IntPtr ' void*
) As Integer
End Function' PolicyHandle : LSA_HANDLE
' TrustedDomainSid : PSID
' InformationClass : TRUSTED_INFORMATION_CLASS
' Buffer : void*
Declare PtrSafe Function LsaSetTrustedDomainInformation Lib "advapi32" ( _
ByVal PolicyHandle As LongPtr, _
ByVal TrustedDomainSid As LongPtr, _
ByVal InformationClass As Long, _
ByVal Buffer As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
LsaSetTrustedDomainInformation = ctypes.windll.advapi32.LsaSetTrustedDomainInformation
LsaSetTrustedDomainInformation.restype = ctypes.c_int
LsaSetTrustedDomainInformation.argtypes = [
ctypes.c_ssize_t, # PolicyHandle : LSA_HANDLE
wintypes.HANDLE, # TrustedDomainSid : PSID
ctypes.c_int, # InformationClass : TRUSTED_INFORMATION_CLASS
ctypes.POINTER(None), # Buffer : void*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ADVAPI32.dll')
LsaSetTrustedDomainInformation = Fiddle::Function.new(
lib['LsaSetTrustedDomainInformation'],
[
Fiddle::TYPE_INTPTR_T, # PolicyHandle : LSA_HANDLE
Fiddle::TYPE_VOIDP, # TrustedDomainSid : PSID
Fiddle::TYPE_INT, # InformationClass : TRUSTED_INFORMATION_CLASS
Fiddle::TYPE_VOIDP, # Buffer : void*
],
Fiddle::TYPE_INT)#[link(name = "advapi32")]
extern "system" {
fn LsaSetTrustedDomainInformation(
PolicyHandle: isize, // LSA_HANDLE
TrustedDomainSid: *mut core::ffi::c_void, // PSID
InformationClass: i32, // TRUSTED_INFORMATION_CLASS
Buffer: *mut () // void*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ADVAPI32.dll")]
public static extern int LsaSetTrustedDomainInformation(IntPtr PolicyHandle, IntPtr TrustedDomainSid, int InformationClass, IntPtr Buffer);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVAPI32_LsaSetTrustedDomainInformation' -Namespace Win32 -PassThru
# $api::LsaSetTrustedDomainInformation(PolicyHandle, TrustedDomainSid, InformationClass, Buffer)#uselib "ADVAPI32.dll"
#func global LsaSetTrustedDomainInformation "LsaSetTrustedDomainInformation" sptr, sptr, sptr, sptr
; LsaSetTrustedDomainInformation PolicyHandle, TrustedDomainSid, InformationClass, Buffer ; 戻り値は stat
; PolicyHandle : LSA_HANDLE -> "sptr"
; TrustedDomainSid : PSID -> "sptr"
; InformationClass : TRUSTED_INFORMATION_CLASS -> "sptr"
; Buffer : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ADVAPI32.dll"
#cfunc global LsaSetTrustedDomainInformation "LsaSetTrustedDomainInformation" sptr, sptr, int, sptr
; res = LsaSetTrustedDomainInformation(PolicyHandle, TrustedDomainSid, InformationClass, Buffer)
; PolicyHandle : LSA_HANDLE -> "sptr"
; TrustedDomainSid : PSID -> "sptr"
; InformationClass : TRUSTED_INFORMATION_CLASS -> "int"
; Buffer : void* -> "sptr"; NTSTATUS LsaSetTrustedDomainInformation(LSA_HANDLE PolicyHandle, PSID TrustedDomainSid, TRUSTED_INFORMATION_CLASS InformationClass, void* Buffer)
#uselib "ADVAPI32.dll"
#cfunc global LsaSetTrustedDomainInformation "LsaSetTrustedDomainInformation" intptr, intptr, int, intptr
; res = LsaSetTrustedDomainInformation(PolicyHandle, TrustedDomainSid, InformationClass, Buffer)
; PolicyHandle : LSA_HANDLE -> "intptr"
; TrustedDomainSid : PSID -> "intptr"
; InformationClass : TRUSTED_INFORMATION_CLASS -> "int"
; Buffer : void* -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
advapi32 = windows.NewLazySystemDLL("ADVAPI32.dll")
procLsaSetTrustedDomainInformation = advapi32.NewProc("LsaSetTrustedDomainInformation")
)
// PolicyHandle (LSA_HANDLE), TrustedDomainSid (PSID), InformationClass (TRUSTED_INFORMATION_CLASS), Buffer (void*)
r1, _, err := procLsaSetTrustedDomainInformation.Call(
uintptr(PolicyHandle),
uintptr(TrustedDomainSid),
uintptr(InformationClass),
uintptr(Buffer),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // NTSTATUSfunction LsaSetTrustedDomainInformation(
PolicyHandle: NativeInt; // LSA_HANDLE
TrustedDomainSid: THandle; // PSID
InformationClass: Integer; // TRUSTED_INFORMATION_CLASS
Buffer: Pointer // void*
): Integer; stdcall;
external 'ADVAPI32.dll' name 'LsaSetTrustedDomainInformation';result := DllCall("ADVAPI32\LsaSetTrustedDomainInformation"
, "Ptr", PolicyHandle ; LSA_HANDLE
, "Ptr", TrustedDomainSid ; PSID
, "Int", InformationClass ; TRUSTED_INFORMATION_CLASS
, "Ptr", Buffer ; void*
, "Int") ; return: NTSTATUS●LsaSetTrustedDomainInformation(PolicyHandle, TrustedDomainSid, InformationClass, Buffer) = DLL("ADVAPI32.dll", "int LsaSetTrustedDomainInformation(int, void*, int, void*)")
# 呼び出し: LsaSetTrustedDomainInformation(PolicyHandle, TrustedDomainSid, InformationClass, Buffer)
# PolicyHandle : LSA_HANDLE -> "int"
# TrustedDomainSid : PSID -> "void*"
# InformationClass : TRUSTED_INFORMATION_CLASS -> "int"
# Buffer : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。