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