Win32 API 日本語リファレンス
ホームDevices.WebServicesOnDevices › WSDSetConfigurationOption

WSDSetConfigurationOption

関数
WSDAPIの指定した構成オプションに値を設定する。
DLLwsdapi.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT WSDSetConfigurationOption(
    DWORD dwOption,
    void* pVoid,
    DWORD cbInBuffer
);

パラメーター

名前方向
dwOptionDWORDin
pVoidvoid*in
cbInBufferDWORDin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WSDSetConfigurationOption(
    DWORD dwOption,
    void* pVoid,
    DWORD cbInBuffer
);
[DllImport("wsdapi.dll", ExactSpelling = true)]
static extern int WSDSetConfigurationOption(
    uint dwOption,   // DWORD
    IntPtr pVoid,   // void*
    uint cbInBuffer   // DWORD
);
<DllImport("wsdapi.dll", ExactSpelling:=True)>
Public Shared Function WSDSetConfigurationOption(
    dwOption As UInteger,   ' DWORD
    pVoid As IntPtr,   ' void*
    cbInBuffer As UInteger   ' DWORD
) As Integer
End Function
' dwOption : DWORD
' pVoid : void*
' cbInBuffer : DWORD
Declare PtrSafe Function WSDSetConfigurationOption Lib "wsdapi" ( _
    ByVal dwOption As Long, _
    ByVal pVoid As LongPtr, _
    ByVal cbInBuffer As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WSDSetConfigurationOption = ctypes.windll.wsdapi.WSDSetConfigurationOption
WSDSetConfigurationOption.restype = ctypes.c_int
WSDSetConfigurationOption.argtypes = [
    wintypes.DWORD,  # dwOption : DWORD
    ctypes.POINTER(None),  # pVoid : void*
    wintypes.DWORD,  # cbInBuffer : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('wsdapi.dll')
WSDSetConfigurationOption = Fiddle::Function.new(
  lib['WSDSetConfigurationOption'],
  [
    -Fiddle::TYPE_INT,  # dwOption : DWORD
    Fiddle::TYPE_VOIDP,  # pVoid : void*
    -Fiddle::TYPE_INT,  # cbInBuffer : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "wsdapi")]
extern "system" {
    fn WSDSetConfigurationOption(
        dwOption: u32,  // DWORD
        pVoid: *mut (),  // void*
        cbInBuffer: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("wsdapi.dll")]
public static extern int WSDSetConfigurationOption(uint dwOption, IntPtr pVoid, uint cbInBuffer);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wsdapi_WSDSetConfigurationOption' -Namespace Win32 -PassThru
# $api::WSDSetConfigurationOption(dwOption, pVoid, cbInBuffer)
#uselib "wsdapi.dll"
#func global WSDSetConfigurationOption "WSDSetConfigurationOption" sptr, sptr, sptr
; WSDSetConfigurationOption dwOption, pVoid, cbInBuffer   ; 戻り値は stat
; dwOption : DWORD -> "sptr"
; pVoid : void* -> "sptr"
; cbInBuffer : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "wsdapi.dll"
#cfunc global WSDSetConfigurationOption "WSDSetConfigurationOption" int, sptr, int
; res = WSDSetConfigurationOption(dwOption, pVoid, cbInBuffer)
; dwOption : DWORD -> "int"
; pVoid : void* -> "sptr"
; cbInBuffer : DWORD -> "int"
; HRESULT WSDSetConfigurationOption(DWORD dwOption, void* pVoid, DWORD cbInBuffer)
#uselib "wsdapi.dll"
#cfunc global WSDSetConfigurationOption "WSDSetConfigurationOption" int, intptr, int
; res = WSDSetConfigurationOption(dwOption, pVoid, cbInBuffer)
; dwOption : DWORD -> "int"
; pVoid : void* -> "intptr"
; cbInBuffer : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wsdapi = windows.NewLazySystemDLL("wsdapi.dll")
	procWSDSetConfigurationOption = wsdapi.NewProc("WSDSetConfigurationOption")
)

// dwOption (DWORD), pVoid (void*), cbInBuffer (DWORD)
r1, _, err := procWSDSetConfigurationOption.Call(
	uintptr(dwOption),
	uintptr(pVoid),
	uintptr(cbInBuffer),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WSDSetConfigurationOption(
  dwOption: DWORD;   // DWORD
  pVoid: Pointer;   // void*
  cbInBuffer: DWORD   // DWORD
): Integer; stdcall;
  external 'wsdapi.dll' name 'WSDSetConfigurationOption';
result := DllCall("wsdapi\WSDSetConfigurationOption"
    , "UInt", dwOption   ; DWORD
    , "Ptr", pVoid   ; void*
    , "UInt", cbInBuffer   ; DWORD
    , "Int")   ; return: HRESULT
●WSDSetConfigurationOption(dwOption, pVoid, cbInBuffer) = DLL("wsdapi.dll", "int WSDSetConfigurationOption(dword, void*, dword)")
# 呼び出し: WSDSetConfigurationOption(dwOption, pVoid, cbInBuffer)
# dwOption : DWORD -> "dword"
# pVoid : void* -> "void*"
# cbInBuffer : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。