ホーム › Devices.WebServicesOnDevices › WSDCreateDiscoveryPublisher2
WSDCreateDiscoveryPublisher2
関数構成パラメータ付きでディスカバリパブリッシャを作成する。
シグネチャ
// wsdapi.dll
#include <windows.h>
HRESULT WSDCreateDiscoveryPublisher2(
IWSDXMLContext* pContext,
WSD_CONFIG_PARAM* pConfigParams, // optional
DWORD dwConfigParamCount,
IWSDiscoveryPublisher** ppPublisher
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pContext | IWSDXMLContext* | in | XML処理に用いるIWSDXMLContextへのポインタ。NULL可で既定を使う。 |
| pConfigParams | WSD_CONFIG_PARAM* | inoptional | パブリッシャー動作を構成するWSD_CONFIG_PARAM配列へのポインタ。 |
| dwConfigParamCount | DWORD | in | pConfigParamsの要素数。 |
| ppPublisher | IWSDiscoveryPublisher** | out | 作成したIWSDiscoveryPublisherオブジェクトを受け取る出力先ポインタ。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// wsdapi.dll
#include <windows.h>
HRESULT WSDCreateDiscoveryPublisher2(
IWSDXMLContext* pContext,
WSD_CONFIG_PARAM* pConfigParams, // optional
DWORD dwConfigParamCount,
IWSDiscoveryPublisher** ppPublisher
);[DllImport("wsdapi.dll", ExactSpelling = true)]
static extern int WSDCreateDiscoveryPublisher2(
IntPtr pContext, // IWSDXMLContext*
IntPtr pConfigParams, // WSD_CONFIG_PARAM* optional
uint dwConfigParamCount, // DWORD
IntPtr ppPublisher // IWSDiscoveryPublisher** out
);<DllImport("wsdapi.dll", ExactSpelling:=True)>
Public Shared Function WSDCreateDiscoveryPublisher2(
pContext As IntPtr, ' IWSDXMLContext*
pConfigParams As IntPtr, ' WSD_CONFIG_PARAM* optional
dwConfigParamCount As UInteger, ' DWORD
ppPublisher As IntPtr ' IWSDiscoveryPublisher** out
) As Integer
End Function' pContext : IWSDXMLContext*
' pConfigParams : WSD_CONFIG_PARAM* optional
' dwConfigParamCount : DWORD
' ppPublisher : IWSDiscoveryPublisher** out
Declare PtrSafe Function WSDCreateDiscoveryPublisher2 Lib "wsdapi" ( _
ByVal pContext As LongPtr, _
ByVal pConfigParams As LongPtr, _
ByVal dwConfigParamCount As Long, _
ByVal ppPublisher As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WSDCreateDiscoveryPublisher2 = ctypes.windll.wsdapi.WSDCreateDiscoveryPublisher2
WSDCreateDiscoveryPublisher2.restype = ctypes.c_int
WSDCreateDiscoveryPublisher2.argtypes = [
ctypes.c_void_p, # pContext : IWSDXMLContext*
ctypes.c_void_p, # pConfigParams : WSD_CONFIG_PARAM* optional
wintypes.DWORD, # dwConfigParamCount : DWORD
ctypes.c_void_p, # ppPublisher : IWSDiscoveryPublisher** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('wsdapi.dll')
WSDCreateDiscoveryPublisher2 = Fiddle::Function.new(
lib['WSDCreateDiscoveryPublisher2'],
[
Fiddle::TYPE_VOIDP, # pContext : IWSDXMLContext*
Fiddle::TYPE_VOIDP, # pConfigParams : WSD_CONFIG_PARAM* optional
-Fiddle::TYPE_INT, # dwConfigParamCount : DWORD
Fiddle::TYPE_VOIDP, # ppPublisher : IWSDiscoveryPublisher** out
],
Fiddle::TYPE_INT)#[link(name = "wsdapi")]
extern "system" {
fn WSDCreateDiscoveryPublisher2(
pContext: *mut core::ffi::c_void, // IWSDXMLContext*
pConfigParams: *mut WSD_CONFIG_PARAM, // WSD_CONFIG_PARAM* optional
dwConfigParamCount: u32, // DWORD
ppPublisher: *mut *mut core::ffi::c_void // IWSDiscoveryPublisher** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("wsdapi.dll")]
public static extern int WSDCreateDiscoveryPublisher2(IntPtr pContext, IntPtr pConfigParams, uint dwConfigParamCount, IntPtr ppPublisher);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wsdapi_WSDCreateDiscoveryPublisher2' -Namespace Win32 -PassThru
# $api::WSDCreateDiscoveryPublisher2(pContext, pConfigParams, dwConfigParamCount, ppPublisher)#uselib "wsdapi.dll"
#func global WSDCreateDiscoveryPublisher2 "WSDCreateDiscoveryPublisher2" sptr, sptr, sptr, sptr
; WSDCreateDiscoveryPublisher2 pContext, varptr(pConfigParams), dwConfigParamCount, ppPublisher ; 戻り値は stat
; pContext : IWSDXMLContext* -> "sptr"
; pConfigParams : WSD_CONFIG_PARAM* optional -> "sptr"
; dwConfigParamCount : DWORD -> "sptr"
; ppPublisher : IWSDiscoveryPublisher** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "wsdapi.dll" #cfunc global WSDCreateDiscoveryPublisher2 "WSDCreateDiscoveryPublisher2" sptr, var, int, sptr ; res = WSDCreateDiscoveryPublisher2(pContext, pConfigParams, dwConfigParamCount, ppPublisher) ; pContext : IWSDXMLContext* -> "sptr" ; pConfigParams : WSD_CONFIG_PARAM* optional -> "var" ; dwConfigParamCount : DWORD -> "int" ; ppPublisher : IWSDiscoveryPublisher** out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "wsdapi.dll" #cfunc global WSDCreateDiscoveryPublisher2 "WSDCreateDiscoveryPublisher2" sptr, sptr, int, sptr ; res = WSDCreateDiscoveryPublisher2(pContext, varptr(pConfigParams), dwConfigParamCount, ppPublisher) ; pContext : IWSDXMLContext* -> "sptr" ; pConfigParams : WSD_CONFIG_PARAM* optional -> "sptr" ; dwConfigParamCount : DWORD -> "int" ; ppPublisher : IWSDiscoveryPublisher** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT WSDCreateDiscoveryPublisher2(IWSDXMLContext* pContext, WSD_CONFIG_PARAM* pConfigParams, DWORD dwConfigParamCount, IWSDiscoveryPublisher** ppPublisher) #uselib "wsdapi.dll" #cfunc global WSDCreateDiscoveryPublisher2 "WSDCreateDiscoveryPublisher2" intptr, var, int, intptr ; res = WSDCreateDiscoveryPublisher2(pContext, pConfigParams, dwConfigParamCount, ppPublisher) ; pContext : IWSDXMLContext* -> "intptr" ; pConfigParams : WSD_CONFIG_PARAM* optional -> "var" ; dwConfigParamCount : DWORD -> "int" ; ppPublisher : IWSDiscoveryPublisher** out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WSDCreateDiscoveryPublisher2(IWSDXMLContext* pContext, WSD_CONFIG_PARAM* pConfigParams, DWORD dwConfigParamCount, IWSDiscoveryPublisher** ppPublisher) #uselib "wsdapi.dll" #cfunc global WSDCreateDiscoveryPublisher2 "WSDCreateDiscoveryPublisher2" intptr, intptr, int, intptr ; res = WSDCreateDiscoveryPublisher2(pContext, varptr(pConfigParams), dwConfigParamCount, ppPublisher) ; pContext : IWSDXMLContext* -> "intptr" ; pConfigParams : WSD_CONFIG_PARAM* optional -> "intptr" ; dwConfigParamCount : DWORD -> "int" ; ppPublisher : IWSDiscoveryPublisher** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wsdapi = windows.NewLazySystemDLL("wsdapi.dll")
procWSDCreateDiscoveryPublisher2 = wsdapi.NewProc("WSDCreateDiscoveryPublisher2")
)
// pContext (IWSDXMLContext*), pConfigParams (WSD_CONFIG_PARAM* optional), dwConfigParamCount (DWORD), ppPublisher (IWSDiscoveryPublisher** out)
r1, _, err := procWSDCreateDiscoveryPublisher2.Call(
uintptr(pContext),
uintptr(pConfigParams),
uintptr(dwConfigParamCount),
uintptr(ppPublisher),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WSDCreateDiscoveryPublisher2(
pContext: Pointer; // IWSDXMLContext*
pConfigParams: Pointer; // WSD_CONFIG_PARAM* optional
dwConfigParamCount: DWORD; // DWORD
ppPublisher: Pointer // IWSDiscoveryPublisher** out
): Integer; stdcall;
external 'wsdapi.dll' name 'WSDCreateDiscoveryPublisher2';result := DllCall("wsdapi\WSDCreateDiscoveryPublisher2"
, "Ptr", pContext ; IWSDXMLContext*
, "Ptr", pConfigParams ; WSD_CONFIG_PARAM* optional
, "UInt", dwConfigParamCount ; DWORD
, "Ptr", ppPublisher ; IWSDiscoveryPublisher** out
, "Int") ; return: HRESULT●WSDCreateDiscoveryPublisher2(pContext, pConfigParams, dwConfigParamCount, ppPublisher) = DLL("wsdapi.dll", "int WSDCreateDiscoveryPublisher2(void*, void*, dword, void*)")
# 呼び出し: WSDCreateDiscoveryPublisher2(pContext, pConfigParams, dwConfigParamCount, ppPublisher)
# pContext : IWSDXMLContext* -> "void*"
# pConfigParams : WSD_CONFIG_PARAM* optional -> "void*"
# dwConfigParamCount : DWORD -> "dword"
# ppPublisher : IWSDiscoveryPublisher** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。