Win32 API 日本語リファレンス
ホームNetworking.WindowsWebServices › WS_POLICY_CONSTRAINTS

WS_POLICY_CONSTRAINTS

構造体
サイズx64: 48 バイト / x86: 24 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
channelBindingWS_CHANNEL_BINDING4+0+0許容するチャネルバインディング種別を示す列挙値。HTTP/TCP等の通信形態を指定する。
channelPropertyConstraintsWS_CHANNEL_PROPERTY_CONSTRAINT*8/4+8+4チャネルプロパティ制約の配列へのポインタ。許容するチャネル設定を列挙する。
channelPropertyConstraintCountDWORD4+16+8channelPropertyConstraints配列の要素数。
securityConstraintsWS_SECURITY_CONSTRAINTS*8/4+24+12適用するセキュリティ制約へのポインタ。許容するセキュリティ構成を指定する。NULL可。
policyExtensionsWS_POLICY_EXTENSION**8/4+32+16ポリシー拡張へのポインタ配列。独自のポリシーアサーション処理を追加する。
policyExtensionCountDWORD4+40+20policyExtensions配列の要素数。

各言語での定義

#include <windows.h>

// WS_POLICY_CONSTRAINTS  (x64 48 / x86 24 バイト)
typedef struct WS_POLICY_CONSTRAINTS {
    WS_CHANNEL_BINDING channelBinding;
    WS_CHANNEL_PROPERTY_CONSTRAINT* channelPropertyConstraints;
    DWORD channelPropertyConstraintCount;
    WS_SECURITY_CONSTRAINTS* securityConstraints;
    WS_POLICY_EXTENSION** policyExtensions;
    DWORD policyExtensionCount;
} WS_POLICY_CONSTRAINTS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WS_POLICY_CONSTRAINTS
{
    public int channelBinding;
    public IntPtr channelPropertyConstraints;
    public uint channelPropertyConstraintCount;
    public IntPtr securityConstraints;
    public IntPtr policyExtensions;
    public uint policyExtensionCount;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WS_POLICY_CONSTRAINTS
    Public channelBinding As Integer
    Public channelPropertyConstraints As IntPtr
    Public channelPropertyConstraintCount As UInteger
    Public securityConstraints As IntPtr
    Public policyExtensions As IntPtr
    Public policyExtensionCount As UInteger
End Structure
import ctypes
from ctypes import wintypes

class WS_POLICY_CONSTRAINTS(ctypes.Structure):
    _fields_ = [
        ("channelBinding", ctypes.c_int),
        ("channelPropertyConstraints", ctypes.c_void_p),
        ("channelPropertyConstraintCount", wintypes.DWORD),
        ("securityConstraints", ctypes.c_void_p),
        ("policyExtensions", ctypes.c_void_p),
        ("policyExtensionCount", wintypes.DWORD),
    ]
#[repr(C)]
pub struct WS_POLICY_CONSTRAINTS {
    pub channelBinding: i32,
    pub channelPropertyConstraints: *mut core::ffi::c_void,
    pub channelPropertyConstraintCount: u32,
    pub securityConstraints: *mut core::ffi::c_void,
    pub policyExtensions: *mut core::ffi::c_void,
    pub policyExtensionCount: u32,
}
import "golang.org/x/sys/windows"

type WS_POLICY_CONSTRAINTS struct {
	channelBinding int32
	channelPropertyConstraints uintptr
	channelPropertyConstraintCount uint32
	securityConstraints uintptr
	policyExtensions uintptr
	policyExtensionCount uint32
}
type
  WS_POLICY_CONSTRAINTS = record
    channelBinding: Integer;
    channelPropertyConstraints: Pointer;
    channelPropertyConstraintCount: DWORD;
    securityConstraints: Pointer;
    policyExtensions: Pointer;
    policyExtensionCount: DWORD;
  end;
const WS_POLICY_CONSTRAINTS = extern struct {
    channelBinding: i32,
    channelPropertyConstraints: ?*anyopaque,
    channelPropertyConstraintCount: u32,
    securityConstraints: ?*anyopaque,
    policyExtensions: ?*anyopaque,
    policyExtensionCount: u32,
};
type
  WS_POLICY_CONSTRAINTS {.bycopy.} = object
    channelBinding: int32
    channelPropertyConstraints: pointer
    channelPropertyConstraintCount: uint32
    securityConstraints: pointer
    policyExtensions: pointer
    policyExtensionCount: uint32
struct WS_POLICY_CONSTRAINTS
{
    int channelBinding;
    void* channelPropertyConstraints;
    uint channelPropertyConstraintCount;
    void* securityConstraints;
    void* policyExtensions;
    uint policyExtensionCount;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; WS_POLICY_CONSTRAINTS サイズ: 24 バイト(x86)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; channelBinding : WS_CHANNEL_BINDING (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; channelPropertyConstraints : WS_CHANNEL_PROPERTY_CONSTRAINT* (+4, 4byte)  varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; channelPropertyConstraintCount : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; securityConstraints : WS_SECURITY_CONSTRAINTS* (+12, 4byte)  varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; policyExtensions : WS_POLICY_EXTENSION** (+16, 4byte)  varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; policyExtensionCount : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WS_POLICY_CONSTRAINTS サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; channelBinding : WS_CHANNEL_BINDING (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; channelPropertyConstraints : WS_CHANNEL_PROPERTY_CONSTRAINT* (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; channelPropertyConstraintCount : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; securityConstraints : WS_SECURITY_CONSTRAINTS* (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; policyExtensions : WS_POLICY_EXTENSION** (+32, 8byte)  varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; policyExtensionCount : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WS_POLICY_CONSTRAINTS
    #field int channelBinding
    #field intptr channelPropertyConstraints
    #field int channelPropertyConstraintCount
    #field intptr securityConstraints
    #field intptr policyExtensions
    #field int policyExtensionCount
#endstruct

stdim st, WS_POLICY_CONSTRAINTS        ; NSTRUCT 変数を確保
st->channelBinding = 100
mes "channelBinding=" + st->channelBinding