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

ALLOCATOR_PROPERTIES

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

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

フィールド

フィールドサイズx64x86説明
cBuffersINT4+0+0アロケーターが確保するバッファの数を示す。
cbBufferINT4+4+4各バッファのサイズをバイト単位で示す。
cbAlignINT4+8+8バッファのメモリアライメント境界をバイト単位で示す。
cbPrefixINT4+12+12各バッファ前に確保するプレフィックス領域のサイズをバイト単位で示す。

各言語での定義

#include <windows.h>

// ALLOCATOR_PROPERTIES  (x64 16 / x86 16 バイト)
typedef struct ALLOCATOR_PROPERTIES {
    INT cBuffers;
    INT cbBuffer;
    INT cbAlign;
    INT cbPrefix;
} ALLOCATOR_PROPERTIES;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ALLOCATOR_PROPERTIES
{
    public int cBuffers;
    public int cbBuffer;
    public int cbAlign;
    public int cbPrefix;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ALLOCATOR_PROPERTIES
    Public cBuffers As Integer
    Public cbBuffer As Integer
    Public cbAlign As Integer
    Public cbPrefix As Integer
End Structure
import ctypes
from ctypes import wintypes

class ALLOCATOR_PROPERTIES(ctypes.Structure):
    _fields_ = [
        ("cBuffers", ctypes.c_int),
        ("cbBuffer", ctypes.c_int),
        ("cbAlign", ctypes.c_int),
        ("cbPrefix", ctypes.c_int),
    ]
#[repr(C)]
pub struct ALLOCATOR_PROPERTIES {
    pub cBuffers: i32,
    pub cbBuffer: i32,
    pub cbAlign: i32,
    pub cbPrefix: i32,
}
import "golang.org/x/sys/windows"

type ALLOCATOR_PROPERTIES struct {
	cBuffers int32
	cbBuffer int32
	cbAlign int32
	cbPrefix int32
}
type
  ALLOCATOR_PROPERTIES = record
    cBuffers: Integer;
    cbBuffer: Integer;
    cbAlign: Integer;
    cbPrefix: Integer;
  end;
const ALLOCATOR_PROPERTIES = extern struct {
    cBuffers: i32,
    cbBuffer: i32,
    cbAlign: i32,
    cbPrefix: i32,
};
type
  ALLOCATOR_PROPERTIES {.bycopy.} = object
    cBuffers: int32
    cbBuffer: int32
    cbAlign: int32
    cbPrefix: int32
struct ALLOCATOR_PROPERTIES
{
    int cBuffers;
    int cbBuffer;
    int cbAlign;
    int cbPrefix;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ALLOCATOR_PROPERTIES サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; cBuffers : INT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; cbBuffer : INT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; cbAlign : INT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; cbPrefix : INT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global ALLOCATOR_PROPERTIES
    #field int cBuffers
    #field int cbBuffer
    #field int cbAlign
    #field int cbPrefix
#endstruct

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