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
uValueLenDWORDin
pValuevoid*out
puBytesDWORD*outoptional

戻り値の型: 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)。