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

PIPE_DIMENSIONS

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

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

フィールド

フィールドサイズx64x86説明
AllocatorPinKS_COMPRESSION12+0+0アロケータピンにおける圧縮特性を示すKS_COMPRESSION。バッファ寸法の比率を保持する。
MaxExpansionPinKS_COMPRESSION12+12+12最大拡張を行うピンの圧縮特性。データ膨張の最大比率を表す。
EndPinKS_COMPRESSION12+24+24終端ピンの圧縮特性。パイプ末端でのバッファ寸法計算に用いる。

各言語での定義

#include <windows.h>

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

// PIPE_DIMENSIONS  (x64 36 / x86 36 バイト)
typedef struct PIPE_DIMENSIONS {
    KS_COMPRESSION AllocatorPin;
    KS_COMPRESSION MaxExpansionPin;
    KS_COMPRESSION EndPin;
} PIPE_DIMENSIONS;
using System;
using System.Runtime.InteropServices;

[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_DIMENSIONS
{
    public KS_COMPRESSION AllocatorPin;
    public KS_COMPRESSION MaxExpansionPin;
    public KS_COMPRESSION EndPin;
}
Imports System.Runtime.InteropServices

<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_DIMENSIONS
    Public AllocatorPin As KS_COMPRESSION
    Public MaxExpansionPin As KS_COMPRESSION
    Public EndPin As KS_COMPRESSION
End Structure
import ctypes
from ctypes import wintypes

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

class PIPE_DIMENSIONS(ctypes.Structure):
    _fields_ = [
        ("AllocatorPin", KS_COMPRESSION),
        ("MaxExpansionPin", KS_COMPRESSION),
        ("EndPin", KS_COMPRESSION),
    ]
#[repr(C)]
pub struct KS_COMPRESSION {
    pub RatioNumerator: u32,
    pub RatioDenominator: u32,
    pub RatioConstantMargin: u32,
}

#[repr(C)]
pub struct PIPE_DIMENSIONS {
    pub AllocatorPin: KS_COMPRESSION,
    pub MaxExpansionPin: KS_COMPRESSION,
    pub EndPin: KS_COMPRESSION,
}
import "golang.org/x/sys/windows"

type KS_COMPRESSION struct {
	RatioNumerator uint32
	RatioDenominator uint32
	RatioConstantMargin uint32
}

type PIPE_DIMENSIONS struct {
	AllocatorPin KS_COMPRESSION
	MaxExpansionPin KS_COMPRESSION
	EndPin KS_COMPRESSION
}
type
  KS_COMPRESSION = record
    RatioNumerator: DWORD;
    RatioDenominator: DWORD;
    RatioConstantMargin: DWORD;
  end;

  PIPE_DIMENSIONS = record
    AllocatorPin: KS_COMPRESSION;
    MaxExpansionPin: KS_COMPRESSION;
    EndPin: KS_COMPRESSION;
  end;
const KS_COMPRESSION = extern struct {
    RatioNumerator: u32,
    RatioDenominator: u32,
    RatioConstantMargin: u32,
};

const PIPE_DIMENSIONS = extern struct {
    AllocatorPin: KS_COMPRESSION,
    MaxExpansionPin: KS_COMPRESSION,
    EndPin: KS_COMPRESSION,
};
type
  KS_COMPRESSION {.bycopy.} = object
    RatioNumerator: uint32
    RatioDenominator: uint32
    RatioConstantMargin: uint32

  PIPE_DIMENSIONS {.bycopy.} = object
    AllocatorPin: KS_COMPRESSION
    MaxExpansionPin: KS_COMPRESSION
    EndPin: KS_COMPRESSION
struct KS_COMPRESSION
{
    uint RatioNumerator;
    uint RatioDenominator;
    uint RatioConstantMargin;
}

struct PIPE_DIMENSIONS
{
    KS_COMPRESSION AllocatorPin;
    KS_COMPRESSION MaxExpansionPin;
    KS_COMPRESSION EndPin;
}

HSP用 定義

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

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

#defstruct global PIPE_DIMENSIONS
    #field KS_COMPRESSION AllocatorPin
    #field KS_COMPRESSION MaxExpansionPin
    #field KS_COMPRESSION EndPin
#endstruct

stdim st, PIPE_DIMENSIONS        ; NSTRUCT 変数を確保