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

KSSTREAMALLOCATOR_STATUS

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

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

フィールド

フィールドサイズx64x86説明
FramingKSALLOCATOR_FRAMING24+0+0アロケータのフレーミング情報(KSALLOCATOR_FRAMING)。確保仕様を示す。
AllocatedFramesDWORD4+24+24実際に確保済みのフレーム数を示す。
ReservedDWORD4+28+28予約領域。将来拡張用で通常は0とする。

各言語での定義

#include <windows.h>

// KSALLOCATOR_FRAMING  (x64 24 / x86 24 バイト)
typedef struct KSALLOCATOR_FRAMING {
    _Anonymous1_e__Union Anonymous1;
    DWORD PoolType;
    DWORD Frames;
    DWORD FrameSize;
    _Anonymous2_e__Union Anonymous2;
    DWORD Reserved;
} KSALLOCATOR_FRAMING;

// KSSTREAMALLOCATOR_STATUS  (x64 32 / x86 32 バイト)
typedef struct KSSTREAMALLOCATOR_STATUS {
    KSALLOCATOR_FRAMING Framing;
    DWORD AllocatedFrames;
    DWORD Reserved;
} KSSTREAMALLOCATOR_STATUS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KSALLOCATOR_FRAMING
{
    public _Anonymous1_e__Union Anonymous1;
    public uint PoolType;
    public uint Frames;
    public uint FrameSize;
    public _Anonymous2_e__Union Anonymous2;
    public uint Reserved;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KSSTREAMALLOCATOR_STATUS
{
    public KSALLOCATOR_FRAMING Framing;
    public uint AllocatedFrames;
    public uint Reserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KSALLOCATOR_FRAMING
    Public Anonymous1 As _Anonymous1_e__Union
    Public PoolType As UInteger
    Public Frames As UInteger
    Public FrameSize As UInteger
    Public Anonymous2 As _Anonymous2_e__Union
    Public Reserved As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KSSTREAMALLOCATOR_STATUS
    Public Framing As KSALLOCATOR_FRAMING
    Public AllocatedFrames As UInteger
    Public Reserved As UInteger
End Structure
import ctypes
from ctypes import wintypes

class KSALLOCATOR_FRAMING(ctypes.Structure):
    _fields_ = [
        ("Anonymous1", _Anonymous1_e__Union),
        ("PoolType", wintypes.DWORD),
        ("Frames", wintypes.DWORD),
        ("FrameSize", wintypes.DWORD),
        ("Anonymous2", _Anonymous2_e__Union),
        ("Reserved", wintypes.DWORD),
    ]

class KSSTREAMALLOCATOR_STATUS(ctypes.Structure):
    _fields_ = [
        ("Framing", KSALLOCATOR_FRAMING),
        ("AllocatedFrames", wintypes.DWORD),
        ("Reserved", wintypes.DWORD),
    ]
#[repr(C)]
pub struct KSALLOCATOR_FRAMING {
    pub Anonymous1: _Anonymous1_e__Union,
    pub PoolType: u32,
    pub Frames: u32,
    pub FrameSize: u32,
    pub Anonymous2: _Anonymous2_e__Union,
    pub Reserved: u32,
}

#[repr(C)]
pub struct KSSTREAMALLOCATOR_STATUS {
    pub Framing: KSALLOCATOR_FRAMING,
    pub AllocatedFrames: u32,
    pub Reserved: u32,
}
import "golang.org/x/sys/windows"

type KSALLOCATOR_FRAMING struct {
	Anonymous1 _Anonymous1_e__Union
	PoolType uint32
	Frames uint32
	FrameSize uint32
	Anonymous2 _Anonymous2_e__Union
	Reserved uint32
}

type KSSTREAMALLOCATOR_STATUS struct {
	Framing KSALLOCATOR_FRAMING
	AllocatedFrames uint32
	Reserved uint32
}
type
  KSALLOCATOR_FRAMING = record
    Anonymous1: _Anonymous1_e__Union;
    PoolType: DWORD;
    Frames: DWORD;
    FrameSize: DWORD;
    Anonymous2: _Anonymous2_e__Union;
    Reserved: DWORD;
  end;

  KSSTREAMALLOCATOR_STATUS = record
    Framing: KSALLOCATOR_FRAMING;
    AllocatedFrames: DWORD;
    Reserved: DWORD;
  end;
const KSALLOCATOR_FRAMING = extern struct {
    Anonymous1: _Anonymous1_e__Union,
    PoolType: u32,
    Frames: u32,
    FrameSize: u32,
    Anonymous2: _Anonymous2_e__Union,
    Reserved: u32,
};

const KSSTREAMALLOCATOR_STATUS = extern struct {
    Framing: KSALLOCATOR_FRAMING,
    AllocatedFrames: u32,
    Reserved: u32,
};
type
  KSALLOCATOR_FRAMING {.bycopy.} = object
    Anonymous1: _Anonymous1_e__Union
    PoolType: uint32
    Frames: uint32
    FrameSize: uint32
    Anonymous2: _Anonymous2_e__Union
    Reserved: uint32

  KSSTREAMALLOCATOR_STATUS {.bycopy.} = object
    Framing: KSALLOCATOR_FRAMING
    AllocatedFrames: uint32
    Reserved: uint32
struct KSALLOCATOR_FRAMING
{
    _Anonymous1_e__Union Anonymous1;
    uint PoolType;
    uint Frames;
    uint FrameSize;
    _Anonymous2_e__Union Anonymous2;
    uint Reserved;
}

struct KSSTREAMALLOCATOR_STATUS
{
    KSALLOCATOR_FRAMING Framing;
    uint AllocatedFrames;
    uint Reserved;
}

HSP用 定義

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

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

#defstruct global KSSTREAMALLOCATOR_STATUS
    #field KSALLOCATOR_FRAMING Framing
    #field int AllocatedFrames
    #field int Reserved
#endstruct

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