ホーム › System.WindowsProgramming › WldpQueryDeviceSecurityInformation
WldpQueryDeviceSecurityInformation
関数デバイスのセキュリティ情報を問い合わせる。
シグネチャ
// Wldp.dll
#include <windows.h>
HRESULT WldpQueryDeviceSecurityInformation(
WLDP_DEVICE_SECURITY_INFORMATION* information, // optional
DWORD informationLength,
DWORD* returnLength
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| information | WLDP_DEVICE_SECURITY_INFORMATION* | outoptional |
| informationLength | DWORD | in |
| returnLength | DWORD* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// Wldp.dll
#include <windows.h>
HRESULT WldpQueryDeviceSecurityInformation(
WLDP_DEVICE_SECURITY_INFORMATION* information, // optional
DWORD informationLength,
DWORD* returnLength
);[DllImport("Wldp.dll", ExactSpelling = true)]
static extern int WldpQueryDeviceSecurityInformation(
IntPtr information, // WLDP_DEVICE_SECURITY_INFORMATION* optional, out
uint informationLength, // DWORD
out uint returnLength // DWORD* out
);<DllImport("Wldp.dll", ExactSpelling:=True)>
Public Shared Function WldpQueryDeviceSecurityInformation(
information As IntPtr, ' WLDP_DEVICE_SECURITY_INFORMATION* optional, out
informationLength As UInteger, ' DWORD
<Out> ByRef returnLength As UInteger ' DWORD* out
) As Integer
End Function' information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out
' informationLength : DWORD
' returnLength : DWORD* out
Declare PtrSafe Function WldpQueryDeviceSecurityInformation Lib "wldp" ( _
ByVal information As LongPtr, _
ByVal informationLength As Long, _
ByRef returnLength As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WldpQueryDeviceSecurityInformation = ctypes.windll.wldp.WldpQueryDeviceSecurityInformation
WldpQueryDeviceSecurityInformation.restype = ctypes.c_int
WldpQueryDeviceSecurityInformation.argtypes = [
ctypes.c_void_p, # information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out
wintypes.DWORD, # informationLength : DWORD
ctypes.POINTER(wintypes.DWORD), # returnLength : DWORD* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('Wldp.dll')
WldpQueryDeviceSecurityInformation = Fiddle::Function.new(
lib['WldpQueryDeviceSecurityInformation'],
[
Fiddle::TYPE_VOIDP, # information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out
-Fiddle::TYPE_INT, # informationLength : DWORD
Fiddle::TYPE_VOIDP, # returnLength : DWORD* out
],
Fiddle::TYPE_INT)#[link(name = "wldp")]
extern "system" {
fn WldpQueryDeviceSecurityInformation(
information: *mut WLDP_DEVICE_SECURITY_INFORMATION, // WLDP_DEVICE_SECURITY_INFORMATION* optional, out
informationLength: u32, // DWORD
returnLength: *mut u32 // DWORD* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("Wldp.dll")]
public static extern int WldpQueryDeviceSecurityInformation(IntPtr information, uint informationLength, out uint returnLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'Wldp_WldpQueryDeviceSecurityInformation' -Namespace Win32 -PassThru
# $api::WldpQueryDeviceSecurityInformation(information, informationLength, returnLength)#uselib "Wldp.dll"
#func global WldpQueryDeviceSecurityInformation "WldpQueryDeviceSecurityInformation" sptr, sptr, sptr
; WldpQueryDeviceSecurityInformation varptr(information), informationLength, varptr(returnLength) ; 戻り値は stat
; information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out -> "sptr"
; informationLength : DWORD -> "sptr"
; returnLength : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "Wldp.dll" #cfunc global WldpQueryDeviceSecurityInformation "WldpQueryDeviceSecurityInformation" var, int, var ; res = WldpQueryDeviceSecurityInformation(information, informationLength, returnLength) ; information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out -> "var" ; informationLength : DWORD -> "int" ; returnLength : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "Wldp.dll" #cfunc global WldpQueryDeviceSecurityInformation "WldpQueryDeviceSecurityInformation" sptr, int, sptr ; res = WldpQueryDeviceSecurityInformation(varptr(information), informationLength, varptr(returnLength)) ; information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out -> "sptr" ; informationLength : DWORD -> "int" ; returnLength : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT WldpQueryDeviceSecurityInformation(WLDP_DEVICE_SECURITY_INFORMATION* information, DWORD informationLength, DWORD* returnLength) #uselib "Wldp.dll" #cfunc global WldpQueryDeviceSecurityInformation "WldpQueryDeviceSecurityInformation" var, int, var ; res = WldpQueryDeviceSecurityInformation(information, informationLength, returnLength) ; information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out -> "var" ; informationLength : DWORD -> "int" ; returnLength : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WldpQueryDeviceSecurityInformation(WLDP_DEVICE_SECURITY_INFORMATION* information, DWORD informationLength, DWORD* returnLength) #uselib "Wldp.dll" #cfunc global WldpQueryDeviceSecurityInformation "WldpQueryDeviceSecurityInformation" intptr, int, intptr ; res = WldpQueryDeviceSecurityInformation(varptr(information), informationLength, varptr(returnLength)) ; information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out -> "intptr" ; informationLength : DWORD -> "int" ; returnLength : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wldp = windows.NewLazySystemDLL("Wldp.dll")
procWldpQueryDeviceSecurityInformation = wldp.NewProc("WldpQueryDeviceSecurityInformation")
)
// information (WLDP_DEVICE_SECURITY_INFORMATION* optional, out), informationLength (DWORD), returnLength (DWORD* out)
r1, _, err := procWldpQueryDeviceSecurityInformation.Call(
uintptr(information),
uintptr(informationLength),
uintptr(returnLength),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WldpQueryDeviceSecurityInformation(
information: Pointer; // WLDP_DEVICE_SECURITY_INFORMATION* optional, out
informationLength: DWORD; // DWORD
returnLength: Pointer // DWORD* out
): Integer; stdcall;
external 'Wldp.dll' name 'WldpQueryDeviceSecurityInformation';result := DllCall("Wldp\WldpQueryDeviceSecurityInformation"
, "Ptr", information ; WLDP_DEVICE_SECURITY_INFORMATION* optional, out
, "UInt", informationLength ; DWORD
, "Ptr", returnLength ; DWORD* out
, "Int") ; return: HRESULT●WldpQueryDeviceSecurityInformation(information, informationLength, returnLength) = DLL("Wldp.dll", "int WldpQueryDeviceSecurityInformation(void*, dword, void*)")
# 呼び出し: WldpQueryDeviceSecurityInformation(information, informationLength, returnLength)
# information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out -> "void*"
# informationLength : DWORD -> "dword"
# returnLength : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。