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

KSALLOCATOR_FRAMING_EX

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

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

フィールド

フィールドサイズx64x86説明
CountItemsDWORD4+0+0FramingItem配列の項目数を示す。
PinFlagsDWORD4+4+4ピンに関するフラグ。アロケータの動作属性を示す。
OutputCompressionKS_COMPRESSION12+8+8出力側の圧縮情報(KS_COMPRESSION)。出力サイズ比を示す。
PinWeightDWORD4+20+20ピンの重み付け値。アロケータ選択時の評価値を示す。
FramingItemKS_FRAMING_ITEM88+24+24フレーミング項目(KS_FRAMING_ITEM)の先頭要素。可変長配列へのアンカー。

各言語での定義

#include <windows.h>

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

// 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_FRAMING_ITEM  (x64 88 / x86 88 バイト)
typedef struct KS_FRAMING_ITEM {
    GUID MemoryType;
    GUID BusType;
    DWORD MemoryFlags;
    DWORD BusFlags;
    DWORD Flags;
    DWORD Frames;
    _Anonymous_e__Union Anonymous;
    DWORD MemoryTypeWeight;
    KS_FRAMING_RANGE PhysicalRange;
    KS_FRAMING_RANGE_WEIGHTED FramingRange;
} KS_FRAMING_ITEM;

// KSALLOCATOR_FRAMING_EX  (x64 112 / x86 112 バイト)
typedef struct KSALLOCATOR_FRAMING_EX {
    DWORD CountItems;
    DWORD PinFlags;
    KS_COMPRESSION OutputCompression;
    DWORD PinWeight;
    KS_FRAMING_ITEM FramingItem[1];
} KSALLOCATOR_FRAMING_EX;
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 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_FRAMING_ITEM
{
    public Guid MemoryType;
    public Guid BusType;
    public uint MemoryFlags;
    public uint BusFlags;
    public uint Flags;
    public uint Frames;
    public _Anonymous_e__Union Anonymous;
    public uint MemoryTypeWeight;
    public KS_FRAMING_RANGE PhysicalRange;
    public KS_FRAMING_RANGE_WEIGHTED FramingRange;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KSALLOCATOR_FRAMING_EX
{
    public uint CountItems;
    public uint PinFlags;
    public KS_COMPRESSION OutputCompression;
    public uint PinWeight;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public KS_FRAMING_ITEM[] FramingItem;
}
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 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_FRAMING_ITEM
    Public MemoryType As Guid
    Public BusType As Guid
    Public MemoryFlags As UInteger
    Public BusFlags As UInteger
    Public Flags As UInteger
    Public Frames As UInteger
    Public Anonymous As _Anonymous_e__Union
    Public MemoryTypeWeight As UInteger
    Public PhysicalRange As KS_FRAMING_RANGE
    Public FramingRange As KS_FRAMING_RANGE_WEIGHTED
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KSALLOCATOR_FRAMING_EX
    Public CountItems As UInteger
    Public PinFlags As UInteger
    Public OutputCompression As KS_COMPRESSION
    Public PinWeight As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public FramingItem() As KS_FRAMING_ITEM
End Structure
import ctypes
from ctypes import wintypes

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

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_FRAMING_ITEM(ctypes.Structure):
    _fields_ = [
        ("MemoryType", GUID),
        ("BusType", GUID),
        ("MemoryFlags", wintypes.DWORD),
        ("BusFlags", wintypes.DWORD),
        ("Flags", wintypes.DWORD),
        ("Frames", wintypes.DWORD),
        ("Anonymous", _Anonymous_e__Union),
        ("MemoryTypeWeight", wintypes.DWORD),
        ("PhysicalRange", KS_FRAMING_RANGE),
        ("FramingRange", KS_FRAMING_RANGE_WEIGHTED),
    ]

class KSALLOCATOR_FRAMING_EX(ctypes.Structure):
    _fields_ = [
        ("CountItems", wintypes.DWORD),
        ("PinFlags", wintypes.DWORD),
        ("OutputCompression", KS_COMPRESSION),
        ("PinWeight", wintypes.DWORD),
        ("FramingItem", KS_FRAMING_ITEM * 1),
    ]
#[repr(C)]
pub struct KS_COMPRESSION {
    pub RatioNumerator: u32,
    pub RatioDenominator: u32,
    pub RatioConstantMargin: u32,
}

#[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_FRAMING_ITEM {
    pub MemoryType: GUID,
    pub BusType: GUID,
    pub MemoryFlags: u32,
    pub BusFlags: u32,
    pub Flags: u32,
    pub Frames: u32,
    pub Anonymous: _Anonymous_e__Union,
    pub MemoryTypeWeight: u32,
    pub PhysicalRange: KS_FRAMING_RANGE,
    pub FramingRange: KS_FRAMING_RANGE_WEIGHTED,
}

#[repr(C)]
pub struct KSALLOCATOR_FRAMING_EX {
    pub CountItems: u32,
    pub PinFlags: u32,
    pub OutputCompression: KS_COMPRESSION,
    pub PinWeight: u32,
    pub FramingItem: [KS_FRAMING_ITEM; 1],
}
import "golang.org/x/sys/windows"

type KS_COMPRESSION struct {
	RatioNumerator uint32
	RatioDenominator uint32
	RatioConstantMargin uint32
}

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_FRAMING_ITEM struct {
	MemoryType windows.GUID
	BusType windows.GUID
	MemoryFlags uint32
	BusFlags uint32
	Flags uint32
	Frames uint32
	Anonymous _Anonymous_e__Union
	MemoryTypeWeight uint32
	PhysicalRange KS_FRAMING_RANGE
	FramingRange KS_FRAMING_RANGE_WEIGHTED
}

type KSALLOCATOR_FRAMING_EX struct {
	CountItems uint32
	PinFlags uint32
	OutputCompression KS_COMPRESSION
	PinWeight uint32
	FramingItem [1]KS_FRAMING_ITEM
}
type
  KS_COMPRESSION = record
    RatioNumerator: DWORD;
    RatioDenominator: DWORD;
    RatioConstantMargin: DWORD;
  end;

  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_FRAMING_ITEM = record
    MemoryType: TGUID;
    BusType: TGUID;
    MemoryFlags: DWORD;
    BusFlags: DWORD;
    Flags: DWORD;
    Frames: DWORD;
    Anonymous: _Anonymous_e__Union;
    MemoryTypeWeight: DWORD;
    PhysicalRange: KS_FRAMING_RANGE;
    FramingRange: KS_FRAMING_RANGE_WEIGHTED;
  end;

  KSALLOCATOR_FRAMING_EX = record
    CountItems: DWORD;
    PinFlags: DWORD;
    OutputCompression: KS_COMPRESSION;
    PinWeight: DWORD;
    FramingItem: array[0..0] of KS_FRAMING_ITEM;
  end;
const KS_COMPRESSION = extern struct {
    RatioNumerator: u32,
    RatioDenominator: u32,
    RatioConstantMargin: u32,
};

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_FRAMING_ITEM = extern struct {
    MemoryType: GUID,
    BusType: GUID,
    MemoryFlags: u32,
    BusFlags: u32,
    Flags: u32,
    Frames: u32,
    Anonymous: _Anonymous_e__Union,
    MemoryTypeWeight: u32,
    PhysicalRange: KS_FRAMING_RANGE,
    FramingRange: KS_FRAMING_RANGE_WEIGHTED,
};

const KSALLOCATOR_FRAMING_EX = extern struct {
    CountItems: u32,
    PinFlags: u32,
    OutputCompression: KS_COMPRESSION,
    PinWeight: u32,
    FramingItem: [1]KS_FRAMING_ITEM,
};
type
  KS_COMPRESSION {.bycopy.} = object
    RatioNumerator: uint32
    RatioDenominator: uint32
    RatioConstantMargin: uint32

  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_FRAMING_ITEM {.bycopy.} = object
    MemoryType: GUID
    BusType: GUID
    MemoryFlags: uint32
    BusFlags: uint32
    Flags: uint32
    Frames: uint32
    Anonymous: _Anonymous_e__Union
    MemoryTypeWeight: uint32
    PhysicalRange: KS_FRAMING_RANGE
    FramingRange: KS_FRAMING_RANGE_WEIGHTED

  KSALLOCATOR_FRAMING_EX {.bycopy.} = object
    CountItems: uint32
    PinFlags: uint32
    OutputCompression: KS_COMPRESSION
    PinWeight: uint32
    FramingItem: array[1, KS_FRAMING_ITEM]
struct KS_COMPRESSION
{
    uint RatioNumerator;
    uint RatioDenominator;
    uint RatioConstantMargin;
}

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_FRAMING_ITEM
{
    GUID MemoryType;
    GUID BusType;
    uint MemoryFlags;
    uint BusFlags;
    uint Flags;
    uint Frames;
    _Anonymous_e__Union Anonymous;
    uint MemoryTypeWeight;
    KS_FRAMING_RANGE PhysicalRange;
    KS_FRAMING_RANGE_WEIGHTED FramingRange;
}

struct KSALLOCATOR_FRAMING_EX
{
    uint CountItems;
    uint PinFlags;
    KS_COMPRESSION OutputCompression;
    uint PinWeight;
    KS_FRAMING_ITEM[1] FramingItem;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KSALLOCATOR_FRAMING_EX サイズ: 112 バイト(x64)
dim st, 28    ; 4byte整数×28(構造体サイズ 112 / 4 切り上げ)
; CountItems : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; PinFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; OutputCompression : KS_COMPRESSION (+8, 12byte)  varptr(st)+8 を基点に操作(12byte:入れ子/配列)
; PinWeight : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; FramingItem : KS_FRAMING_ITEM (+24, 88byte)  varptr(st)+24 を基点に操作(88byte:入れ子/配列)
; ※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 GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#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_FRAMING_ITEM
    #field GUID MemoryType
    #field GUID BusType
    #field int MemoryFlags
    #field int BusFlags
    #field int Flags
    #field int Frames
    #field byte Anonymous 4
    #field int MemoryTypeWeight
    #field KS_FRAMING_RANGE PhysicalRange
    #field KS_FRAMING_RANGE_WEIGHTED FramingRange
#endstruct

#defstruct global KSALLOCATOR_FRAMING_EX
    #field int CountItems
    #field int PinFlags
    #field KS_COMPRESSION OutputCompression
    #field int PinWeight
    #field KS_FRAMING_ITEM FramingItem 1
#endstruct

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