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

KS_FRAMING_ITEM

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

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

フィールド

フィールドサイズx64x86説明
MemoryTypeGUID16+0+0メモリ種別を示すGUID。バッファのメモリ区分を識別する。
BusTypeGUID16+16+16バス種別を示すGUID。データ転送に用いるバスを識別する。
MemoryFlagsDWORD4+32+32メモリに関するフラグ。確保属性や転送方向を示す。
BusFlagsDWORD4+36+36バスに関するフラグ。バス転送の属性を示す。
FlagsDWORD4+40+40本フレーミング項目全体のフラグ。種別属性を示す。
FramesDWORD4+44+44確保するフレーム数を示す。
Anonymous_Anonymous_e__Union4+48+48メモリタイプ重みまたは関連値を保持する無名共用体。
MemoryTypeWeightDWORD4+52+52メモリ種別の優先度重み。選択時の評価値を示す。
PhysicalRangeKS_FRAMING_RANGE12+56+56物理フレームサイズ範囲(KS_FRAMING_RANGE)を示す。
FramingRangeKS_FRAMING_RANGE_WEIGHTED20+68+68重み付きフレーミング範囲(KS_FRAMING_RANGE_WEIGHTED)を示す。

共用体: _Anonymous_e__Union x64 4B / x86 4B

フィールドサイズx64x86
FileAlignmentDWORD4+0+0
FramePitchINT4+0+0

各言語での定義

#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_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;
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_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;
}
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_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
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_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),
    ]
#[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,
}
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_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
  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;
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,
};
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_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
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;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KS_FRAMING_ITEM サイズ: 88 バイト(x64)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; MemoryType : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; BusType : GUID (+16, 16byte)  varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; MemoryFlags : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; BusFlags : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; Flags : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; Frames : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+48, 4byte)  varptr(st)+48 を基点に操作(4byte:入れ子/配列)
; MemoryTypeWeight : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; PhysicalRange : KS_FRAMING_RANGE (+56, 12byte)  varptr(st)+56 を基点に操作(12byte:入れ子/配列)
; FramingRange : KS_FRAMING_RANGE_WEIGHTED (+68, 20byte)  varptr(st)+68 を基点に操作(20byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#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

stdim st, KS_FRAMING_ITEM        ; NSTRUCT 変数を確保
st->MemoryFlags = 100
mes "MemoryFlags=" + st->MemoryFlags
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。