Win32 API 日本語リファレンス
ホームGraphics.DirectDraw › DD_MORESURFACECAPS

DD_MORESURFACECAPS

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0この構造体のサイズをバイト単位で示す。
ddsCapsMoreDDSCAPSEX12+4+4追加のサーフェス能力を示すDDSCAPSEX。
ddsExtendedHeapRestrictionsNTExtendedHeapRestrictions24+16+16拡張ヒープ制約を示すNTExtendedHeapRestrictions。可変長配列の先頭。

構造体: NTExtendedHeapRestrictions x64 24B / x86 24B

フィールドサイズx64x86
ddsCapsExDDSCAPSEX12+0+0
ddsCapsExAltDDSCAPSEX12+12+12

各言語での定義

#include <windows.h>

// DDSCAPSEX  (x64 12 / x86 12 バイト)
typedef struct DDSCAPSEX {
    DWORD dwCaps2;
    DWORD dwCaps3;
    _Anonymous_e__Union Anonymous;
} DDSCAPSEX;

// DD_MORESURFACECAPS  (x64 40 / x86 40 バイト)
typedef struct DD_MORESURFACECAPS {
    DWORD dwSize;
    DDSCAPSEX ddsCapsMore;
    NTExtendedHeapRestrictions ddsExtendedHeapRestrictions[1];
} DD_MORESURFACECAPS;
using System;
using System.Runtime.InteropServices;

[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 DD_MORESURFACECAPS
{
    public uint dwSize;
    public DDSCAPSEX ddsCapsMore;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public NTExtendedHeapRestrictions[] ddsExtendedHeapRestrictions;
}
Imports System.Runtime.InteropServices

<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 DD_MORESURFACECAPS
    Public dwSize As UInteger
    Public ddsCapsMore As DDSCAPSEX
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public ddsExtendedHeapRestrictions() As NTExtendedHeapRestrictions
End Structure
import ctypes
from ctypes import wintypes

class DDSCAPSEX(ctypes.Structure):
    _fields_ = [
        ("dwCaps2", wintypes.DWORD),
        ("dwCaps3", wintypes.DWORD),
        ("Anonymous", _Anonymous_e__Union),
    ]

class DD_MORESURFACECAPS(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("ddsCapsMore", DDSCAPSEX),
        ("ddsExtendedHeapRestrictions", NTExtendedHeapRestrictions * 1),
    ]
#[repr(C)]
pub struct DDSCAPSEX {
    pub dwCaps2: u32,
    pub dwCaps3: u32,
    pub Anonymous: _Anonymous_e__Union,
}

#[repr(C)]
pub struct DD_MORESURFACECAPS {
    pub dwSize: u32,
    pub ddsCapsMore: DDSCAPSEX,
    pub ddsExtendedHeapRestrictions: [NTExtendedHeapRestrictions; 1],
}
import "golang.org/x/sys/windows"

type DDSCAPSEX struct {
	dwCaps2 uint32
	dwCaps3 uint32
	Anonymous _Anonymous_e__Union
}

type DD_MORESURFACECAPS struct {
	dwSize uint32
	ddsCapsMore DDSCAPSEX
	ddsExtendedHeapRestrictions [1]NTExtendedHeapRestrictions
}
type
  DDSCAPSEX = record
    dwCaps2: DWORD;
    dwCaps3: DWORD;
    Anonymous: _Anonymous_e__Union;
  end;

  DD_MORESURFACECAPS = record
    dwSize: DWORD;
    ddsCapsMore: DDSCAPSEX;
    ddsExtendedHeapRestrictions: array[0..0] of NTExtendedHeapRestrictions;
  end;
const DDSCAPSEX = extern struct {
    dwCaps2: u32,
    dwCaps3: u32,
    Anonymous: _Anonymous_e__Union,
};

const DD_MORESURFACECAPS = extern struct {
    dwSize: u32,
    ddsCapsMore: DDSCAPSEX,
    ddsExtendedHeapRestrictions: [1]NTExtendedHeapRestrictions,
};
type
  DDSCAPSEX {.bycopy.} = object
    dwCaps2: uint32
    dwCaps3: uint32
    Anonymous: _Anonymous_e__Union

  DD_MORESURFACECAPS {.bycopy.} = object
    dwSize: uint32
    ddsCapsMore: DDSCAPSEX
    ddsExtendedHeapRestrictions: array[1, NTExtendedHeapRestrictions]
struct DDSCAPSEX
{
    uint dwCaps2;
    uint dwCaps3;
    _Anonymous_e__Union Anonymous;
}

struct DD_MORESURFACECAPS
{
    uint dwSize;
    DDSCAPSEX ddsCapsMore;
    NTExtendedHeapRestrictions[1] ddsExtendedHeapRestrictions;
}

HSP用 定義

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

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

#defstruct global DD_MORESURFACECAPS
    #field int dwSize
    #field DDSCAPSEX ddsCapsMore
    #field NTExtendedHeapRestrictions ddsExtendedHeapRestrictions 1
#endstruct

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