ホーム › Networking.WindowsWebServices › WsMatchPolicyAlternative
WsMatchPolicyAlternative
関数ポリシーの代替候補が制約に一致するか照合する。
シグネチャ
// webservices.dll
#include <windows.h>
HRESULT WsMatchPolicyAlternative(
WS_POLICY* policy,
DWORD alternativeIndex,
WS_POLICY_CONSTRAINTS* policyConstraints,
BOOL matchRequired,
WS_HEAP* heap,
WS_ERROR* error // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| policy | WS_POLICY* | in |
| alternativeIndex | DWORD | in |
| policyConstraints | WS_POLICY_CONSTRAINTS* | in |
| matchRequired | BOOL | in |
| heap | WS_HEAP* | in |
| error | WS_ERROR* | inoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// webservices.dll
#include <windows.h>
HRESULT WsMatchPolicyAlternative(
WS_POLICY* policy,
DWORD alternativeIndex,
WS_POLICY_CONSTRAINTS* policyConstraints,
BOOL matchRequired,
WS_HEAP* heap,
WS_ERROR* error // optional
);[DllImport("webservices.dll", ExactSpelling = true)]
static extern int WsMatchPolicyAlternative(
ref IntPtr policy, // WS_POLICY*
uint alternativeIndex, // DWORD
IntPtr policyConstraints, // WS_POLICY_CONSTRAINTS*
bool matchRequired, // BOOL
ref IntPtr heap, // WS_HEAP*
IntPtr error // WS_ERROR* optional
);<DllImport("webservices.dll", ExactSpelling:=True)>
Public Shared Function WsMatchPolicyAlternative(
ByRef policy As IntPtr, ' WS_POLICY*
alternativeIndex As UInteger, ' DWORD
policyConstraints As IntPtr, ' WS_POLICY_CONSTRAINTS*
matchRequired As Boolean, ' BOOL
ByRef heap As IntPtr, ' WS_HEAP*
[error] As IntPtr ' WS_ERROR* optional
) As Integer
End Function' policy : WS_POLICY*
' alternativeIndex : DWORD
' policyConstraints : WS_POLICY_CONSTRAINTS*
' matchRequired : BOOL
' heap : WS_HEAP*
' error : WS_ERROR* optional
Declare PtrSafe Function WsMatchPolicyAlternative Lib "webservices" ( _
ByRef policy As LongPtr, _
ByVal alternativeIndex As Long, _
ByVal policyConstraints As LongPtr, _
ByVal matchRequired As Long, _
ByRef heap As LongPtr, _
ByVal error As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WsMatchPolicyAlternative = ctypes.windll.webservices.WsMatchPolicyAlternative
WsMatchPolicyAlternative.restype = ctypes.c_int
WsMatchPolicyAlternative.argtypes = [
ctypes.c_void_p, # policy : WS_POLICY*
wintypes.DWORD, # alternativeIndex : DWORD
ctypes.c_void_p, # policyConstraints : WS_POLICY_CONSTRAINTS*
wintypes.BOOL, # matchRequired : BOOL
ctypes.c_void_p, # heap : WS_HEAP*
ctypes.c_void_p, # error : WS_ERROR* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('webservices.dll')
WsMatchPolicyAlternative = Fiddle::Function.new(
lib['WsMatchPolicyAlternative'],
[
Fiddle::TYPE_VOIDP, # policy : WS_POLICY*
-Fiddle::TYPE_INT, # alternativeIndex : DWORD
Fiddle::TYPE_VOIDP, # policyConstraints : WS_POLICY_CONSTRAINTS*
Fiddle::TYPE_INT, # matchRequired : BOOL
Fiddle::TYPE_VOIDP, # heap : WS_HEAP*
Fiddle::TYPE_VOIDP, # error : WS_ERROR* optional
],
Fiddle::TYPE_INT)#[link(name = "webservices")]
extern "system" {
fn WsMatchPolicyAlternative(
policy: *mut isize, // WS_POLICY*
alternativeIndex: u32, // DWORD
policyConstraints: *mut WS_POLICY_CONSTRAINTS, // WS_POLICY_CONSTRAINTS*
matchRequired: i32, // BOOL
heap: *mut isize, // WS_HEAP*
error: *mut isize // WS_ERROR* optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("webservices.dll")]
public static extern int WsMatchPolicyAlternative(ref IntPtr policy, uint alternativeIndex, IntPtr policyConstraints, bool matchRequired, ref IntPtr heap, IntPtr error);
"@
$api = Add-Type -MemberDefinition $sig -Name 'webservices_WsMatchPolicyAlternative' -Namespace Win32 -PassThru
# $api::WsMatchPolicyAlternative(policy, alternativeIndex, policyConstraints, matchRequired, heap, error)#uselib "webservices.dll"
#func global WsMatchPolicyAlternative "WsMatchPolicyAlternative" sptr, sptr, sptr, sptr, sptr, sptr
; WsMatchPolicyAlternative policy, alternativeIndex, varptr(policyConstraints), matchRequired, heap, error ; 戻り値は stat
; policy : WS_POLICY* -> "sptr"
; alternativeIndex : DWORD -> "sptr"
; policyConstraints : WS_POLICY_CONSTRAINTS* -> "sptr"
; matchRequired : BOOL -> "sptr"
; heap : WS_HEAP* -> "sptr"
; error : WS_ERROR* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "webservices.dll" #cfunc global WsMatchPolicyAlternative "WsMatchPolicyAlternative" int, int, var, int, int, int ; res = WsMatchPolicyAlternative(policy, alternativeIndex, policyConstraints, matchRequired, heap, error) ; policy : WS_POLICY* -> "int" ; alternativeIndex : DWORD -> "int" ; policyConstraints : WS_POLICY_CONSTRAINTS* -> "var" ; matchRequired : BOOL -> "int" ; heap : WS_HEAP* -> "int" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "webservices.dll" #cfunc global WsMatchPolicyAlternative "WsMatchPolicyAlternative" int, int, sptr, int, int, int ; res = WsMatchPolicyAlternative(policy, alternativeIndex, varptr(policyConstraints), matchRequired, heap, error) ; policy : WS_POLICY* -> "int" ; alternativeIndex : DWORD -> "int" ; policyConstraints : WS_POLICY_CONSTRAINTS* -> "sptr" ; matchRequired : BOOL -> "int" ; heap : WS_HEAP* -> "int" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT WsMatchPolicyAlternative(WS_POLICY* policy, DWORD alternativeIndex, WS_POLICY_CONSTRAINTS* policyConstraints, BOOL matchRequired, WS_HEAP* heap, WS_ERROR* error) #uselib "webservices.dll" #cfunc global WsMatchPolicyAlternative "WsMatchPolicyAlternative" int, int, var, int, int, int ; res = WsMatchPolicyAlternative(policy, alternativeIndex, policyConstraints, matchRequired, heap, error) ; policy : WS_POLICY* -> "int" ; alternativeIndex : DWORD -> "int" ; policyConstraints : WS_POLICY_CONSTRAINTS* -> "var" ; matchRequired : BOOL -> "int" ; heap : WS_HEAP* -> "int" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WsMatchPolicyAlternative(WS_POLICY* policy, DWORD alternativeIndex, WS_POLICY_CONSTRAINTS* policyConstraints, BOOL matchRequired, WS_HEAP* heap, WS_ERROR* error) #uselib "webservices.dll" #cfunc global WsMatchPolicyAlternative "WsMatchPolicyAlternative" int, int, intptr, int, int, int ; res = WsMatchPolicyAlternative(policy, alternativeIndex, varptr(policyConstraints), matchRequired, heap, error) ; policy : WS_POLICY* -> "int" ; alternativeIndex : DWORD -> "int" ; policyConstraints : WS_POLICY_CONSTRAINTS* -> "intptr" ; matchRequired : BOOL -> "int" ; heap : WS_HEAP* -> "int" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
webservices = windows.NewLazySystemDLL("webservices.dll")
procWsMatchPolicyAlternative = webservices.NewProc("WsMatchPolicyAlternative")
)
// policy (WS_POLICY*), alternativeIndex (DWORD), policyConstraints (WS_POLICY_CONSTRAINTS*), matchRequired (BOOL), heap (WS_HEAP*), error (WS_ERROR* optional)
r1, _, err := procWsMatchPolicyAlternative.Call(
uintptr(policy),
uintptr(alternativeIndex),
uintptr(policyConstraints),
uintptr(matchRequired),
uintptr(heap),
uintptr(error),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WsMatchPolicyAlternative(
policy: Pointer; // WS_POLICY*
alternativeIndex: DWORD; // DWORD
policyConstraints: Pointer; // WS_POLICY_CONSTRAINTS*
matchRequired: BOOL; // BOOL
heap: Pointer; // WS_HEAP*
error: Pointer // WS_ERROR* optional
): Integer; stdcall;
external 'webservices.dll' name 'WsMatchPolicyAlternative';result := DllCall("webservices\WsMatchPolicyAlternative"
, "Ptr", policy ; WS_POLICY*
, "UInt", alternativeIndex ; DWORD
, "Ptr", policyConstraints ; WS_POLICY_CONSTRAINTS*
, "Int", matchRequired ; BOOL
, "Ptr", heap ; WS_HEAP*
, "Ptr", error ; WS_ERROR* optional
, "Int") ; return: HRESULT●WsMatchPolicyAlternative(policy, alternativeIndex, policyConstraints, matchRequired, heap, error) = DLL("webservices.dll", "int WsMatchPolicyAlternative(void*, dword, void*, bool, void*, void*)")
# 呼び出し: WsMatchPolicyAlternative(policy, alternativeIndex, policyConstraints, matchRequired, heap, error)
# policy : WS_POLICY* -> "void*"
# alternativeIndex : DWORD -> "dword"
# policyConstraints : WS_POLICY_CONSTRAINTS* -> "void*"
# matchRequired : BOOL -> "bool"
# heap : WS_HEAP* -> "void*"
# error : WS_ERROR* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。