ホーム › Graphics.DirectDraw › DDHAL_GETAVAILDRIVERMEMORYDATA
DDHAL_GETAVAILDRIVERMEMORYDATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| lpDD | DDRAWI_DIRECTDRAW_GBL* | 8/4 | +0 | +0 | 対象のグローバルDirectDrawオブジェクトへのポインタ。 |
| DDSCaps | DDSCAPS | 4 | +8 | +4 | 問い合わせ対象のサーフェス能力(DDSCAPS)を示す。 |
| dwTotal | DWORD | 4 | +12 | +8 | 対象種別のビデオメモリ総量(バイト)を返す。 |
| dwFree | DWORD | 4 | +16 | +12 | 対象種別の空きビデオメモリ量(バイト)を返す。 |
| ddRVal | HRESULT | 4 | +20 | +16 | メモリ量取得の実行結果を示すHRESULT。 |
| GetAvailDriverMemory | LPDDHAL_GETAVAILDRIVERMEMORY | 8/4 | +24 | +20 | 実際のメモリ量取得を行うコールバックへのポインタ。 |
| ddsCapsEx | DDSCAPSEX | 12 | +32 | +24 | 問い合わせ対象の拡張サーフェス能力(DDSCAPSEX)を示す。 |
各言語での定義
#include <windows.h>
// DDSCAPS (x64 4 / x86 4 バイト)
typedef struct DDSCAPS {
DWORD dwCaps;
} DDSCAPS;
// DDSCAPSEX (x64 12 / x86 12 バイト)
typedef struct DDSCAPSEX {
DWORD dwCaps2;
DWORD dwCaps3;
_Anonymous_e__Union Anonymous;
} DDSCAPSEX;
// DDHAL_GETAVAILDRIVERMEMORYDATA (x64 48 / x86 36 バイト)
typedef struct DDHAL_GETAVAILDRIVERMEMORYDATA {
DDRAWI_DIRECTDRAW_GBL* lpDD;
DDSCAPS DDSCaps;
DWORD dwTotal;
DWORD dwFree;
HRESULT ddRVal;
LPDDHAL_GETAVAILDRIVERMEMORY GetAvailDriverMemory;
DDSCAPSEX ddsCapsEx;
} DDHAL_GETAVAILDRIVERMEMORYDATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DDSCAPS
{
public uint dwCaps;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DDSCAPSEX
{
public uint dwCaps2;
public uint dwCaps3;
public _Anonymous_e__Union Anonymous;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DDHAL_GETAVAILDRIVERMEMORYDATA
{
public IntPtr lpDD;
public DDSCAPS DDSCaps;
public uint dwTotal;
public uint dwFree;
public int ddRVal;
public IntPtr GetAvailDriverMemory;
public DDSCAPSEX ddsCapsEx;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DDSCAPS
Public dwCaps As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DDSCAPSEX
Public dwCaps2 As UInteger
Public dwCaps3 As UInteger
Public Anonymous As _Anonymous_e__Union
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DDHAL_GETAVAILDRIVERMEMORYDATA
Public lpDD As IntPtr
Public DDSCaps As DDSCAPS
Public dwTotal As UInteger
Public dwFree As UInteger
Public ddRVal As Integer
Public GetAvailDriverMemory As IntPtr
Public ddsCapsEx As DDSCAPSEX
End Structureimport ctypes
from ctypes import wintypes
class DDSCAPS(ctypes.Structure):
_fields_ = [
("dwCaps", wintypes.DWORD),
]
class DDSCAPSEX(ctypes.Structure):
_fields_ = [
("dwCaps2", wintypes.DWORD),
("dwCaps3", wintypes.DWORD),
("Anonymous", _Anonymous_e__Union),
]
class DDHAL_GETAVAILDRIVERMEMORYDATA(ctypes.Structure):
_fields_ = [
("lpDD", ctypes.c_void_p),
("DDSCaps", DDSCAPS),
("dwTotal", wintypes.DWORD),
("dwFree", wintypes.DWORD),
("ddRVal", ctypes.c_int),
("GetAvailDriverMemory", ctypes.c_void_p),
("ddsCapsEx", DDSCAPSEX),
]#[repr(C)]
pub struct DDSCAPS {
pub dwCaps: u32,
}
#[repr(C)]
pub struct DDSCAPSEX {
pub dwCaps2: u32,
pub dwCaps3: u32,
pub Anonymous: _Anonymous_e__Union,
}
#[repr(C)]
pub struct DDHAL_GETAVAILDRIVERMEMORYDATA {
pub lpDD: *mut core::ffi::c_void,
pub DDSCaps: DDSCAPS,
pub dwTotal: u32,
pub dwFree: u32,
pub ddRVal: i32,
pub GetAvailDriverMemory: *mut core::ffi::c_void,
pub ddsCapsEx: DDSCAPSEX,
}import "golang.org/x/sys/windows"
type DDSCAPS struct {
dwCaps uint32
}
type DDSCAPSEX struct {
dwCaps2 uint32
dwCaps3 uint32
Anonymous _Anonymous_e__Union
}
type DDHAL_GETAVAILDRIVERMEMORYDATA struct {
lpDD uintptr
DDSCaps DDSCAPS
dwTotal uint32
dwFree uint32
ddRVal int32
GetAvailDriverMemory uintptr
ddsCapsEx DDSCAPSEX
}type
DDSCAPS = record
dwCaps: DWORD;
end;
DDSCAPSEX = record
dwCaps2: DWORD;
dwCaps3: DWORD;
Anonymous: _Anonymous_e__Union;
end;
DDHAL_GETAVAILDRIVERMEMORYDATA = record
lpDD: Pointer;
DDSCaps: DDSCAPS;
dwTotal: DWORD;
dwFree: DWORD;
ddRVal: Integer;
GetAvailDriverMemory: Pointer;
ddsCapsEx: DDSCAPSEX;
end;const DDSCAPS = extern struct {
dwCaps: u32,
};
const DDSCAPSEX = extern struct {
dwCaps2: u32,
dwCaps3: u32,
Anonymous: _Anonymous_e__Union,
};
const DDHAL_GETAVAILDRIVERMEMORYDATA = extern struct {
lpDD: ?*anyopaque,
DDSCaps: DDSCAPS,
dwTotal: u32,
dwFree: u32,
ddRVal: i32,
GetAvailDriverMemory: ?*anyopaque,
ddsCapsEx: DDSCAPSEX,
};type
DDSCAPS {.bycopy.} = object
dwCaps: uint32
DDSCAPSEX {.bycopy.} = object
dwCaps2: uint32
dwCaps3: uint32
Anonymous: _Anonymous_e__Union
DDHAL_GETAVAILDRIVERMEMORYDATA {.bycopy.} = object
lpDD: pointer
DDSCaps: DDSCAPS
dwTotal: uint32
dwFree: uint32
ddRVal: int32
GetAvailDriverMemory: pointer
ddsCapsEx: DDSCAPSEXstruct DDSCAPS
{
uint dwCaps;
}
struct DDSCAPSEX
{
uint dwCaps2;
uint dwCaps3;
_Anonymous_e__Union Anonymous;
}
struct DDHAL_GETAVAILDRIVERMEMORYDATA
{
void* lpDD;
DDSCAPS DDSCaps;
uint dwTotal;
uint dwFree;
int ddRVal;
void* GetAvailDriverMemory;
DDSCAPSEX ddsCapsEx;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DDHAL_GETAVAILDRIVERMEMORYDATA サイズ: 36 バイト(x86)
dim st, 9 ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; lpDD : DDRAWI_DIRECTDRAW_GBL* (+0, 4byte) varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; DDSCaps : DDSCAPS (+4, 4byte) varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; dwTotal : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwFree : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ddRVal : HRESULT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; GetAvailDriverMemory : LPDDHAL_GETAVAILDRIVERMEMORY (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ddsCapsEx : DDSCAPSEX (+24, 12byte) varptr(st)+24 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DDHAL_GETAVAILDRIVERMEMORYDATA サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; lpDD : DDRAWI_DIRECTDRAW_GBL* (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; DDSCaps : DDSCAPS (+8, 4byte) varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; dwTotal : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwFree : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ddRVal : HRESULT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; GetAvailDriverMemory : LPDDHAL_GETAVAILDRIVERMEMORY (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; ddsCapsEx : DDSCAPSEX (+32, 12byte) varptr(st)+32 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DDSCAPS
#field int dwCaps
#endstruct
#defstruct global DDSCAPSEX
#field int dwCaps2
#field int dwCaps3
#field byte Anonymous 4
#endstruct
#defstruct global DDHAL_GETAVAILDRIVERMEMORYDATA
#field intptr lpDD
#field DDSCAPS DDSCaps
#field int dwTotal
#field int dwFree
#field int ddRVal
#field intptr GetAvailDriverMemory
#field DDSCAPSEX ddsCapsEx
#endstruct
stdim st, DDHAL_GETAVAILDRIVERMEMORYDATA ; NSTRUCT 変数を確保
st->dwTotal = 100
mes "dwTotal=" + st->dwTotal