Win32 API 日本語リファレンス
ホームSystem.WindowsProgramming › WldpQueryDeviceSecurityInformation

WldpQueryDeviceSecurityInformation

関数
デバイスのセキュリティ情報を問い合わせる。
DLLWldp.dll呼出規約winapi

シグネチャ

// Wldp.dll
#include <windows.h>

HRESULT WldpQueryDeviceSecurityInformation(
    WLDP_DEVICE_SECURITY_INFORMATION* information,   // optional
    DWORD informationLength,
    DWORD* returnLength
);

パラメーター

名前方向説明
informationWLDP_DEVICE_SECURITY_INFORMATION*outoptional出力としてデバイスセキュリティ情報を受け取るWLDP_DEVICE_SECURITY_INFORMATION構造体へのポインタ。
informationLengthDWORDininformationバッファのバイトサイズ。
returnLengthDWORD*out出力として実際に書き込まれた、または必要なバイト数を受け取るDWORDポインタ。

戻り値の型: 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 方式にも切替可。
出力引数:
; 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 方式にも切替可。
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   // HRESULT
function 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)。
const std = @import("std");

extern "wldp" fn WldpQueryDeviceSecurityInformation(
    information: [*c]WLDP_DEVICE_SECURITY_INFORMATION, // WLDP_DEVICE_SECURITY_INFORMATION* optional, out
    informationLength: u32, // DWORD
    returnLength: [*c]u32 // DWORD* out
) callconv(std.os.windows.WINAPI) i32;
proc WldpQueryDeviceSecurityInformation(
    information: ptr WLDP_DEVICE_SECURITY_INFORMATION,  # WLDP_DEVICE_SECURITY_INFORMATION* optional, out
    informationLength: uint32,  # DWORD
    returnLength: ptr uint32  # DWORD* out
): int32 {.importc: "WldpQueryDeviceSecurityInformation", stdcall, dynlib: "Wldp.dll".}
pragma(lib, "wldp");
extern(Windows)
int WldpQueryDeviceSecurityInformation(
    WLDP_DEVICE_SECURITY_INFORMATION* information,   // WLDP_DEVICE_SECURITY_INFORMATION* optional, out
    uint informationLength,   // DWORD
    uint* returnLength   // DWORD* out
);
ccall((:WldpQueryDeviceSecurityInformation, "Wldp.dll"), stdcall, Int32,
      (Ptr{WLDP_DEVICE_SECURITY_INFORMATION}, UInt32, Ptr{UInt32}),
      information, informationLength, returnLength)
# information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out -> Ptr{WLDP_DEVICE_SECURITY_INFORMATION}
# informationLength : DWORD -> UInt32
# returnLength : DWORD* out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t WldpQueryDeviceSecurityInformation(
    void* information,
    uint32_t informationLength,
    uint32_t* returnLength);
]]
local wldp = ffi.load("wldp")
-- wldp.WldpQueryDeviceSecurityInformation(information, informationLength, returnLength)
-- information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out
-- informationLength : DWORD
-- returnLength : DWORD* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('Wldp.dll');
const WldpQueryDeviceSecurityInformation = lib.func('__stdcall', 'WldpQueryDeviceSecurityInformation', 'int32_t', ['void *', 'uint32_t', 'uint32_t *']);
// WldpQueryDeviceSecurityInformation(information, informationLength, returnLength)
// information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out -> 'void *'
// informationLength : DWORD -> 'uint32_t'
// returnLength : DWORD* out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("Wldp.dll", {
  WldpQueryDeviceSecurityInformation: { parameters: ["pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.WldpQueryDeviceSecurityInformation(information, informationLength, returnLength)
// information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out -> "pointer"
// informationLength : DWORD -> "u32"
// returnLength : DWORD* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t WldpQueryDeviceSecurityInformation(
    void* information,
    uint32_t informationLength,
    uint32_t* returnLength);
C, "Wldp.dll");
// $ffi->WldpQueryDeviceSecurityInformation(information, informationLength, returnLength);
// information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out
// informationLength : DWORD
// returnLength : DWORD* 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 Wldp extends StdCallLibrary {
    Wldp INSTANCE = Native.load("wldp", Wldp.class);
    int WldpQueryDeviceSecurityInformation(
        Pointer information,   // WLDP_DEVICE_SECURITY_INFORMATION* optional, out
        int informationLength,   // DWORD
        IntByReference returnLength   // DWORD* out
    );
}
@[Link("wldp")]
lib LibWldp
  fun WldpQueryDeviceSecurityInformation = WldpQueryDeviceSecurityInformation(
    information : WLDP_DEVICE_SECURITY_INFORMATION*,   # WLDP_DEVICE_SECURITY_INFORMATION* optional, out
    informationLength : UInt32,   # DWORD
    returnLength : UInt32*   # DWORD* out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef WldpQueryDeviceSecurityInformationNative = Int32 Function(Pointer<Void>, Uint32, Pointer<Uint32>);
typedef WldpQueryDeviceSecurityInformationDart = int Function(Pointer<Void>, int, Pointer<Uint32>);
final WldpQueryDeviceSecurityInformation = DynamicLibrary.open('Wldp.dll')
    .lookupFunction<WldpQueryDeviceSecurityInformationNative, WldpQueryDeviceSecurityInformationDart>('WldpQueryDeviceSecurityInformation');
// information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out -> Pointer<Void>
// informationLength : DWORD -> Uint32
// returnLength : DWORD* out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function WldpQueryDeviceSecurityInformation(
  information: Pointer;   // WLDP_DEVICE_SECURITY_INFORMATION* optional, out
  informationLength: DWORD;   // DWORD
  returnLength: Pointer   // DWORD* out
): Integer; stdcall;
  external 'Wldp.dll' name 'WldpQueryDeviceSecurityInformation';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "WldpQueryDeviceSecurityInformation"
  c_WldpQueryDeviceSecurityInformation :: Ptr () -> Word32 -> Ptr Word32 -> IO Int32
-- information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out -> Ptr ()
-- informationLength : DWORD -> Word32
-- returnLength : DWORD* out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let wldpquerydevicesecurityinformation =
  foreign "WldpQueryDeviceSecurityInformation"
    ((ptr void) @-> uint32_t @-> (ptr uint32_t) @-> returning int32_t)
(* information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out -> (ptr void) *)
(* informationLength : DWORD -> uint32_t *)
(* returnLength : DWORD* out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wldp (t "Wldp.dll"))
(cffi:use-foreign-library wldp)

(cffi:defcfun ("WldpQueryDeviceSecurityInformation" wldp-query-device-security-information :convention :stdcall) :int32
  (information :pointer)   ; WLDP_DEVICE_SECURITY_INFORMATION* optional, out
  (information-length :uint32)   ; DWORD
  (return-length :pointer))   ; DWORD* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $WldpQueryDeviceSecurityInformation = Win32::API::More->new('Wldp',
    'int WldpQueryDeviceSecurityInformation(LPVOID information, DWORD informationLength, LPVOID returnLength)');
# my $ret = $WldpQueryDeviceSecurityInformation->Call($information, $informationLength, $returnLength);
# information : WLDP_DEVICE_SECURITY_INFORMATION* optional, out -> LPVOID
# informationLength : DWORD -> DWORD
# returnLength : DWORD* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型