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

WdsBpQueryOption

関数
WDSブートプログラムパケットから指定オプション値を取得する。
DLLWDSBP.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

DWORD WdsBpQueryOption(
    HANDLE hHandle,
    DWORD uOption,
    DWORD uValueLen,
    void* pValue,
    DWORD* puBytes   // optional
);

パラメーター

名前方向説明
hHandleHANDLEin対象のパケット解析ハンドル。
uOptionDWORDin照会するオプションのコード。
uValueLenDWORDinpValueバッファのサイズ(バイト単位)。
pValuevoid*out取得したオプション値を書き込むバッファ。
puBytesDWORD*outoptional実際に書き込まれたバイト数を受け取るDWORDポインタ。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD WdsBpQueryOption(
    HANDLE hHandle,
    DWORD uOption,
    DWORD uValueLen,
    void* pValue,
    DWORD* puBytes   // optional
);
[DllImport("WDSBP.dll", ExactSpelling = true)]
static extern uint WdsBpQueryOption(
    IntPtr hHandle,   // HANDLE
    uint uOption,   // DWORD
    uint uValueLen,   // DWORD
    IntPtr pValue,   // void* out
    IntPtr puBytes   // DWORD* optional, out
);
<DllImport("WDSBP.dll", ExactSpelling:=True)>
Public Shared Function WdsBpQueryOption(
    hHandle As IntPtr,   ' HANDLE
    uOption As UInteger,   ' DWORD
    uValueLen As UInteger,   ' DWORD
    pValue As IntPtr,   ' void* out
    puBytes As IntPtr   ' DWORD* optional, out
) As UInteger
End Function
' hHandle : HANDLE
' uOption : DWORD
' uValueLen : DWORD
' pValue : void* out
' puBytes : DWORD* optional, out
Declare PtrSafe Function WdsBpQueryOption Lib "wdsbp" ( _
    ByVal hHandle As LongPtr, _
    ByVal uOption As Long, _
    ByVal uValueLen As Long, _
    ByVal pValue As LongPtr, _
    ByVal puBytes As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WdsBpQueryOption = ctypes.windll.wdsbp.WdsBpQueryOption
WdsBpQueryOption.restype = wintypes.DWORD
WdsBpQueryOption.argtypes = [
    wintypes.HANDLE,  # hHandle : HANDLE
    wintypes.DWORD,  # uOption : DWORD
    wintypes.DWORD,  # uValueLen : DWORD
    ctypes.POINTER(None),  # pValue : void* out
    ctypes.POINTER(wintypes.DWORD),  # puBytes : DWORD* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WDSBP.dll')
WdsBpQueryOption = Fiddle::Function.new(
  lib['WdsBpQueryOption'],
  [
    Fiddle::TYPE_VOIDP,  # hHandle : HANDLE
    -Fiddle::TYPE_INT,  # uOption : DWORD
    -Fiddle::TYPE_INT,  # uValueLen : DWORD
    Fiddle::TYPE_VOIDP,  # pValue : void* out
    Fiddle::TYPE_VOIDP,  # puBytes : DWORD* optional, out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "wdsbp")]
extern "system" {
    fn WdsBpQueryOption(
        hHandle: *mut core::ffi::c_void,  // HANDLE
        uOption: u32,  // DWORD
        uValueLen: u32,  // DWORD
        pValue: *mut (),  // void* out
        puBytes: *mut u32  // DWORD* optional, out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WDSBP.dll")]
public static extern uint WdsBpQueryOption(IntPtr hHandle, uint uOption, uint uValueLen, IntPtr pValue, IntPtr puBytes);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WDSBP_WdsBpQueryOption' -Namespace Win32 -PassThru
# $api::WdsBpQueryOption(hHandle, uOption, uValueLen, pValue, puBytes)
#uselib "WDSBP.dll"
#func global WdsBpQueryOption "WdsBpQueryOption" sptr, sptr, sptr, sptr, sptr
; WdsBpQueryOption hHandle, uOption, uValueLen, pValue, varptr(puBytes)   ; 戻り値は stat
; hHandle : HANDLE -> "sptr"
; uOption : DWORD -> "sptr"
; uValueLen : DWORD -> "sptr"
; pValue : void* out -> "sptr"
; puBytes : DWORD* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "WDSBP.dll"
#cfunc global WdsBpQueryOption "WdsBpQueryOption" sptr, int, int, sptr, var
; res = WdsBpQueryOption(hHandle, uOption, uValueLen, pValue, puBytes)
; hHandle : HANDLE -> "sptr"
; uOption : DWORD -> "int"
; uValueLen : DWORD -> "int"
; pValue : void* out -> "sptr"
; puBytes : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD WdsBpQueryOption(HANDLE hHandle, DWORD uOption, DWORD uValueLen, void* pValue, DWORD* puBytes)
#uselib "WDSBP.dll"
#cfunc global WdsBpQueryOption "WdsBpQueryOption" intptr, int, int, intptr, var
; res = WdsBpQueryOption(hHandle, uOption, uValueLen, pValue, puBytes)
; hHandle : HANDLE -> "intptr"
; uOption : DWORD -> "int"
; uValueLen : DWORD -> "int"
; pValue : void* out -> "intptr"
; puBytes : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wdsbp = windows.NewLazySystemDLL("WDSBP.dll")
	procWdsBpQueryOption = wdsbp.NewProc("WdsBpQueryOption")
)

// hHandle (HANDLE), uOption (DWORD), uValueLen (DWORD), pValue (void* out), puBytes (DWORD* optional, out)
r1, _, err := procWdsBpQueryOption.Call(
	uintptr(hHandle),
	uintptr(uOption),
	uintptr(uValueLen),
	uintptr(pValue),
	uintptr(puBytes),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function WdsBpQueryOption(
  hHandle: THandle;   // HANDLE
  uOption: DWORD;   // DWORD
  uValueLen: DWORD;   // DWORD
  pValue: Pointer;   // void* out
  puBytes: Pointer   // DWORD* optional, out
): DWORD; stdcall;
  external 'WDSBP.dll' name 'WdsBpQueryOption';
result := DllCall("WDSBP\WdsBpQueryOption"
    , "Ptr", hHandle   ; HANDLE
    , "UInt", uOption   ; DWORD
    , "UInt", uValueLen   ; DWORD
    , "Ptr", pValue   ; void* out
    , "Ptr", puBytes   ; DWORD* optional, out
    , "UInt")   ; return: DWORD
●WdsBpQueryOption(hHandle, uOption, uValueLen, pValue, puBytes) = DLL("WDSBP.dll", "dword WdsBpQueryOption(void*, dword, dword, void*, void*)")
# 呼び出し: WdsBpQueryOption(hHandle, uOption, uValueLen, pValue, puBytes)
# hHandle : HANDLE -> "void*"
# uOption : DWORD -> "dword"
# uValueLen : DWORD -> "dword"
# pValue : void* out -> "void*"
# puBytes : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

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

typedef WdsBpQueryOptionNative = Uint32 Function(Pointer<Void>, Uint32, Uint32, Pointer<Void>, Pointer<Uint32>);
typedef WdsBpQueryOptionDart = int Function(Pointer<Void>, int, int, Pointer<Void>, Pointer<Uint32>);
final WdsBpQueryOption = DynamicLibrary.open('WDSBP.dll')
    .lookupFunction<WdsBpQueryOptionNative, WdsBpQueryOptionDart>('WdsBpQueryOption');
// hHandle : HANDLE -> Pointer<Void>
// uOption : DWORD -> Uint32
// uValueLen : DWORD -> Uint32
// pValue : void* out -> Pointer<Void>
// puBytes : DWORD* optional, out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function WdsBpQueryOption(
  hHandle: THandle;   // HANDLE
  uOption: DWORD;   // DWORD
  uValueLen: DWORD;   // DWORD
  pValue: Pointer;   // void* out
  puBytes: Pointer   // DWORD* optional, out
): DWORD; stdcall;
  external 'WDSBP.dll' name 'WdsBpQueryOption';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "WdsBpQueryOption"
  c_WdsBpQueryOption :: Ptr () -> Word32 -> Word32 -> Ptr () -> Ptr Word32 -> IO Word32
-- hHandle : HANDLE -> Ptr ()
-- uOption : DWORD -> Word32
-- uValueLen : DWORD -> Word32
-- pValue : void* out -> Ptr ()
-- puBytes : DWORD* optional, out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let wdsbpqueryoption =
  foreign "WdsBpQueryOption"
    ((ptr void) @-> uint32_t @-> uint32_t @-> (ptr void) @-> (ptr uint32_t) @-> returning uint32_t)
(* hHandle : HANDLE -> (ptr void) *)
(* uOption : DWORD -> uint32_t *)
(* uValueLen : DWORD -> uint32_t *)
(* pValue : void* out -> (ptr void) *)
(* puBytes : DWORD* optional, out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library wdsbp (t "WDSBP.dll"))
(cffi:use-foreign-library wdsbp)

(cffi:defcfun ("WdsBpQueryOption" wds-bp-query-option :convention :stdcall) :uint32
  (h-handle :pointer)   ; HANDLE
  (u-option :uint32)   ; DWORD
  (u-value-len :uint32)   ; DWORD
  (p-value :pointer)   ; void* out
  (pu-bytes :pointer))   ; DWORD* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $WdsBpQueryOption = Win32::API::More->new('WDSBP',
    'DWORD WdsBpQueryOption(HANDLE hHandle, DWORD uOption, DWORD uValueLen, LPVOID pValue, LPVOID puBytes)');
# my $ret = $WdsBpQueryOption->Call($hHandle, $uOption, $uValueLen, $pValue, $puBytes);
# hHandle : HANDLE -> HANDLE
# uOption : DWORD -> DWORD
# uValueLen : DWORD -> DWORD
# pValue : void* out -> LPVOID
# puBytes : DWORD* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。