Win32 API 日本語リファレンス
ホームMedia.KernelStreaming › PIPE_TERMINATION

PIPE_TERMINATION

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

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

フィールド

フィールドサイズx64x86説明
FlagsDWORD4+0+0終端の挙動を制御するフラグ群。フレーミング処理のオプションをビットで指定する。
OutsideFactorsDWORD4+4+4外部要因による制約を示す値。パイプ外部からの寸法影響を表す。
WeigthDWORD4+8+8終端の重み付け値。最適バッファ計算における優先度を示す(綴りはWeigthのまま)。
PhysicalRangeKS_FRAMING_RANGE12+12+12物理的に許容されるフレーミング範囲を示すKS_FRAMING_RANGE。
OptimalRangeKS_FRAMING_RANGE_WEIGHTED20+24+24重み付き最適フレーミング範囲を示すKS_FRAMING_RANGE_WEIGHTED。
CompressionKS_COMPRESSION12+44+44この終端での圧縮/膨張特性を示すKS_COMPRESSION。

各言語での定義

#include <windows.h>

// KS_FRAMING_RANGE  (x64 12 / x86 12 バイト)
typedef struct KS_FRAMING_RANGE {
    DWORD MinFrameSize;
    DWORD MaxFrameSize;
    DWORD Stepping;
} KS_FRAMING_RANGE;

// KS_FRAMING_RANGE_WEIGHTED  (x64 20 / x86 20 バイト)
typedef struct KS_FRAMING_RANGE_WEIGHTED {
    KS_FRAMING_RANGE Range;
    DWORD InPlaceWeight;
    DWORD NotInPlaceWeight;
} KS_FRAMING_RANGE_WEIGHTED;

// KS_COMPRESSION  (x64 12 / x86 12 バイト)
typedef struct KS_COMPRESSION {
    DWORD RatioNumerator;
    DWORD RatioDenominator;
    DWORD RatioConstantMargin;
} KS_COMPRESSION;

// PIPE_TERMINATION  (x64 56 / x86 56 バイト)
typedef struct PIPE_TERMINATION {
    DWORD Flags;
    DWORD OutsideFactors;
    DWORD Weigth;
    KS_FRAMING_RANGE PhysicalRange;
    KS_FRAMING_RANGE_WEIGHTED OptimalRange;
    KS_COMPRESSION Compression;
} PIPE_TERMINATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KS_FRAMING_RANGE
{
    public uint MinFrameSize;
    public uint MaxFrameSize;
    public uint Stepping;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KS_FRAMING_RANGE_WEIGHTED
{
    public KS_FRAMING_RANGE Range;
    public uint InPlaceWeight;
    public uint NotInPlaceWeight;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KS_COMPRESSION
{
    public uint RatioNumerator;
    public uint RatioDenominator;
    public uint RatioConstantMargin;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PIPE_TERMINATION
{
    public uint Flags;
    public uint OutsideFactors;
    public uint Weigth;
    public KS_FRAMING_RANGE PhysicalRange;
    public KS_FRAMING_RANGE_WEIGHTED OptimalRange;
    public KS_COMPRESSION Compression;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KS_FRAMING_RANGE
    Public MinFrameSize As UInteger
    Public MaxFrameSize As UInteger
    Public Stepping As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KS_FRAMING_RANGE_WEIGHTED
    Public Range As KS_FRAMING_RANGE
    Public InPlaceWeight As UInteger
    Public NotInPlaceWeight As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KS_COMPRESSION
    Public RatioNumerator As UInteger
    Public RatioDenominator As UInteger
    Public RatioConstantMargin As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PIPE_TERMINATION
    Public Flags As UInteger
    Public OutsideFactors As UInteger
    Public Weigth As UInteger
    Public PhysicalRange As KS_FRAMING_RANGE
    Public OptimalRange As KS_FRAMING_RANGE_WEIGHTED
    Public Compression As KS_COMPRESSION
End Structure
import ctypes
from ctypes import wintypes

class KS_FRAMING_RANGE(ctypes.Structure):
    _fields_ = [
        ("MinFrameSize", wintypes.DWORD),
        ("MaxFrameSize", wintypes.DWORD),
        ("Stepping", wintypes.DWORD),
    ]

class KS_FRAMING_RANGE_WEIGHTED(ctypes.Structure):
    _fields_ = [
        ("Range", KS_FRAMING_RANGE),
        ("InPlaceWeight", wintypes.DWORD),
        ("NotInPlaceWeight", wintypes.DWORD),
    ]

class KS_COMPRESSION(ctypes.Structure):
    _fields_ = [
        ("RatioNumerator", wintypes.DWORD),
        ("RatioDenominator", wintypes.DWORD),
        ("RatioConstantMargin", wintypes.DWORD),
    ]

class PIPE_TERMINATION(ctypes.Structure):
    _fields_ = [
        ("Flags", wintypes.DWORD),
        ("OutsideFactors", wintypes.DWORD),
        ("Weigth", wintypes.DWORD),
        ("PhysicalRange", KS_FRAMING_RANGE),
        ("OptimalRange", KS_FRAMING_RANGE_WEIGHTED),
        ("Compression", KS_COMPRESSION),
    ]
#[repr(C)]
pub struct KS_FRAMING_RANGE {
    pub MinFrameSize: u32,
    pub MaxFrameSize: u32,
    pub Stepping: u32,
}

#[repr(C)]
pub struct KS_FRAMING_RANGE_WEIGHTED {
    pub Range: KS_FRAMING_RANGE,
    pub InPlaceWeight: u32,
    pub NotInPlaceWeight: u32,
}

#[repr(C)]
pub struct KS_COMPRESSION {
    pub RatioNumerator: u32,
    pub RatioDenominator: u32,
    pub RatioConstantMargin: u32,
}

#[repr(C)]
pub struct PIPE_TERMINATION {
    pub Flags: u32,
    pub OutsideFactors: u32,
    pub Weigth: u32,
    pub PhysicalRange: KS_FRAMING_RANGE,
    pub OptimalRange: KS_FRAMING_RANGE_WEIGHTED,
    pub Compression: KS_COMPRESSION,
}
import "golang.org/x/sys/windows"

type KS_FRAMING_RANGE struct {
	MinFrameSize uint32
	MaxFrameSize uint32
	Stepping uint32
}

type KS_FRAMING_RANGE_WEIGHTED struct {
	Range KS_FRAMING_RANGE
	InPlaceWeight uint32
	NotInPlaceWeight uint32
}

type KS_COMPRESSION struct {
	RatioNumerator uint32
	RatioDenominator uint32
	RatioConstantMargin uint32
}

type PIPE_TERMINATION struct {
	Flags uint32
	OutsideFactors uint32
	Weigth uint32
	PhysicalRange KS_FRAMING_RANGE
	OptimalRange KS_FRAMING_RANGE_WEIGHTED
	Compression KS_COMPRESSION
}
type
  KS_FRAMING_RANGE = record
    MinFrameSize: DWORD;
    MaxFrameSize: DWORD;
    Stepping: DWORD;
  end;

  KS_FRAMING_RANGE_WEIGHTED = record
    Range: KS_FRAMING_RANGE;
    InPlaceWeight: DWORD;
    NotInPlaceWeight: DWORD;
  end;

  KS_COMPRESSION = record
    RatioNumerator: DWORD;
    RatioDenominator: DWORD;
    RatioConstantMargin: DWORD;
  end;

  PIPE_TERMINATION = record
    Flags: DWORD;
    OutsideFactors: DWORD;
    Weigth: DWORD;
    PhysicalRange: KS_FRAMING_RANGE;
    OptimalRange: KS_FRAMING_RANGE_WEIGHTED;
    Compression: KS_COMPRESSION;
  end;
const KS_FRAMING_RANGE = extern struct {
    MinFrameSize: u32,
    MaxFrameSize: u32,
    Stepping: u32,
};

const KS_FRAMING_RANGE_WEIGHTED = extern struct {
    Range: KS_FRAMING_RANGE,
    InPlaceWeight: u32,
    NotInPlaceWeight: u32,
};

const KS_COMPRESSION = extern struct {
    RatioNumerator: u32,
    RatioDenominator: u32,
    RatioConstantMargin: u32,
};

const PIPE_TERMINATION = extern struct {
    Flags: u32,
    OutsideFactors: u32,
    Weigth: u32,
    PhysicalRange: KS_FRAMING_RANGE,
    OptimalRange: KS_FRAMING_RANGE_WEIGHTED,
    Compression: KS_COMPRESSION,
};
type
  KS_FRAMING_RANGE {.bycopy.} = object
    MinFrameSize: uint32
    MaxFrameSize: uint32
    Stepping: uint32

  KS_FRAMING_RANGE_WEIGHTED {.bycopy.} = object
    Range: KS_FRAMING_RANGE
    InPlaceWeight: uint32
    NotInPlaceWeight: uint32

  KS_COMPRESSION {.bycopy.} = object
    RatioNumerator: uint32
    RatioDenominator: uint32
    RatioConstantMargin: uint32

  PIPE_TERMINATION {.bycopy.} = object
    Flags: uint32
    OutsideFactors: uint32
    Weigth: uint32
    PhysicalRange: KS_FRAMING_RANGE
    OptimalRange: KS_FRAMING_RANGE_WEIGHTED
    Compression: KS_COMPRESSION
struct KS_FRAMING_RANGE
{
    uint MinFrameSize;
    uint MaxFrameSize;
    uint Stepping;
}

struct KS_FRAMING_RANGE_WEIGHTED
{
    KS_FRAMING_RANGE Range;
    uint InPlaceWeight;
    uint NotInPlaceWeight;
}

struct KS_COMPRESSION
{
    uint RatioNumerator;
    uint RatioDenominator;
    uint RatioConstantMargin;
}

struct PIPE_TERMINATION
{
    uint Flags;
    uint OutsideFactors;
    uint Weigth;
    KS_FRAMING_RANGE PhysicalRange;
    KS_FRAMING_RANGE_WEIGHTED OptimalRange;
    KS_COMPRESSION Compression;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PIPE_TERMINATION サイズ: 56 バイト(x64)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; Flags : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; OutsideFactors : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Weigth : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; PhysicalRange : KS_FRAMING_RANGE (+12, 12byte)  varptr(st)+12 を基点に操作(12byte:入れ子/配列)
; OptimalRange : KS_FRAMING_RANGE_WEIGHTED (+24, 20byte)  varptr(st)+24 を基点に操作(20byte:入れ子/配列)
; Compression : KS_COMPRESSION (+44, 12byte)  varptr(st)+44 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global KS_FRAMING_RANGE
    #field int MinFrameSize
    #field int MaxFrameSize
    #field int Stepping
#endstruct

#defstruct global KS_FRAMING_RANGE_WEIGHTED
    #field KS_FRAMING_RANGE Range
    #field int InPlaceWeight
    #field int NotInPlaceWeight
#endstruct

#defstruct global KS_COMPRESSION
    #field int RatioNumerator
    #field int RatioDenominator
    #field int RatioConstantMargin
#endstruct

#defstruct global PIPE_TERMINATION
    #field int Flags
    #field int OutsideFactors
    #field int Weigth
    #field KS_FRAMING_RANGE PhysicalRange
    #field KS_FRAMING_RANGE_WEIGHTED OptimalRange
    #field KS_COMPRESSION Compression
#endstruct

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