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

VRAM_SURFACE_INFO

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

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

フィールド

フィールドサイズx64x86説明
hSurfaceUINT_PTR8/4+0+0VRAMサーフェスを識別するハンドル値。ポインタ幅の整数で保持する。
VramPhysicalAddressLONGLONG8+8+8VRAMサーフェスの物理アドレス。64ビット符号付き整数で表す。
cbCapturedDWORD4+16+16実際にキャプチャされたデータのバイト数を示す。
dwWidthDWORD4+20+20サーフェスの幅をピクセル単位で示す。
dwHeightDWORD4+24+24サーフェスの高さをピクセル単位で示す。
dwLinearSizeDWORD4+28+28サーフェス全体のリニアサイズをバイト単位で示す。
lPitchINT4+32+321ライン分のバイト数(ピッチ/ストライド)を示す。
ullReservedULONGLONG128+40+40予約フィールド。将来の拡張用で通常は0を設定する。

各言語での定義

#include <windows.h>

// VRAM_SURFACE_INFO  (x64 168 / x86 168 バイト)
typedef struct VRAM_SURFACE_INFO {
    UINT_PTR hSurface;
    LONGLONG VramPhysicalAddress;
    DWORD cbCaptured;
    DWORD dwWidth;
    DWORD dwHeight;
    DWORD dwLinearSize;
    INT lPitch;
    ULONGLONG ullReserved[16];
} VRAM_SURFACE_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VRAM_SURFACE_INFO
{
    public UIntPtr hSurface;
    public long VramPhysicalAddress;
    public uint cbCaptured;
    public uint dwWidth;
    public uint dwHeight;
    public uint dwLinearSize;
    public int lPitch;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public ulong[] ullReserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VRAM_SURFACE_INFO
    Public hSurface As UIntPtr
    Public VramPhysicalAddress As Long
    Public cbCaptured As UInteger
    Public dwWidth As UInteger
    Public dwHeight As UInteger
    Public dwLinearSize As UInteger
    Public lPitch As Integer
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public ullReserved() As ULong
End Structure
import ctypes
from ctypes import wintypes

class VRAM_SURFACE_INFO(ctypes.Structure):
    _fields_ = [
        ("hSurface", ctypes.c_size_t),
        ("VramPhysicalAddress", ctypes.c_longlong),
        ("cbCaptured", wintypes.DWORD),
        ("dwWidth", wintypes.DWORD),
        ("dwHeight", wintypes.DWORD),
        ("dwLinearSize", wintypes.DWORD),
        ("lPitch", ctypes.c_int),
        ("ullReserved", ctypes.c_ulonglong * 16),
    ]
#[repr(C)]
pub struct VRAM_SURFACE_INFO {
    pub hSurface: usize,
    pub VramPhysicalAddress: i64,
    pub cbCaptured: u32,
    pub dwWidth: u32,
    pub dwHeight: u32,
    pub dwLinearSize: u32,
    pub lPitch: i32,
    pub ullReserved: [u64; 16],
}
import "golang.org/x/sys/windows"

type VRAM_SURFACE_INFO struct {
	hSurface uintptr
	VramPhysicalAddress int64
	cbCaptured uint32
	dwWidth uint32
	dwHeight uint32
	dwLinearSize uint32
	lPitch int32
	ullReserved [16]uint64
}
type
  VRAM_SURFACE_INFO = record
    hSurface: NativeUInt;
    VramPhysicalAddress: Int64;
    cbCaptured: DWORD;
    dwWidth: DWORD;
    dwHeight: DWORD;
    dwLinearSize: DWORD;
    lPitch: Integer;
    ullReserved: array[0..15] of UInt64;
  end;
const VRAM_SURFACE_INFO = extern struct {
    hSurface: usize,
    VramPhysicalAddress: i64,
    cbCaptured: u32,
    dwWidth: u32,
    dwHeight: u32,
    dwLinearSize: u32,
    lPitch: i32,
    ullReserved: [16]u64,
};
type
  VRAM_SURFACE_INFO {.bycopy.} = object
    hSurface: uint
    VramPhysicalAddress: int64
    cbCaptured: uint32
    dwWidth: uint32
    dwHeight: uint32
    dwLinearSize: uint32
    lPitch: int32
    ullReserved: array[16, uint64]
struct VRAM_SURFACE_INFO
{
    size_t hSurface;
    long VramPhysicalAddress;
    uint cbCaptured;
    uint dwWidth;
    uint dwHeight;
    uint dwLinearSize;
    int lPitch;
    ulong[16] ullReserved;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; VRAM_SURFACE_INFO サイズ: 168 バイト(x86)
dim st, 42    ; 4byte整数×42(構造体サイズ 168 / 4 切り上げ)
; hSurface : UINT_PTR (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; VramPhysicalAddress : LONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; cbCaptured : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwWidth : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwHeight : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwLinearSize : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; lPitch : INT (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ullReserved : ULONGLONG (+40, 128byte)  varptr(st)+40 を基点に操作(128byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VRAM_SURFACE_INFO サイズ: 168 バイト(x64)
dim st, 42    ; 4byte整数×42(構造体サイズ 168 / 4 切り上げ)
; hSurface : UINT_PTR (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; VramPhysicalAddress : LONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; cbCaptured : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwWidth : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwHeight : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwLinearSize : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; lPitch : INT (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ullReserved : ULONGLONG (+40, 128byte)  varptr(st)+40 を基点に操作(128byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global VRAM_SURFACE_INFO
    #field intptr hSurface
    #field int64 VramPhysicalAddress
    #field int cbCaptured
    #field int dwWidth
    #field int dwHeight
    #field int dwLinearSize
    #field int lPitch
    #field int64 ullReserved 16
#endstruct

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