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

DDRAWI_DIRECTDRAW_GBL

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

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

フィールド

フィールドサイズx64x86説明
dwRefCntDWORD4+0+0グローバルDirectDrawオブジェクトの参照カウントを示す。
dwFlagsDWORD4+4+4DirectDrawオブジェクトの属性を示すフラグを示す。
fpPrimaryOrigUINT_PTR8/4+8+8元のプライマリサーフェスのアドレス(オフセット)を示す。
ddCapsDDCORECAPS316+16+12ハードウェアの能力(DDCORECAPS)を示す。
dwInternal1DWORD4+332+328DirectDraw内部用フィールド(その1)を示す。
dwUnused1DWORD36+336+332未使用の予約フィールド。
lpDDCBtmpDDHAL_CALLBACKS*8/4+376+368一時的なHALコールバック構造体へのポインタを示す。
dsListDDRAWI_DDRAWSURFACE_INT*8/4+384+372サーフェスインターフェイスリストの先頭へのポインタ。
palListDDRAWI_DDRAWPALETTE_INT*8/4+392+376パレットインターフェイスリストの先頭へのポインタ。
clipperListDDRAWI_DDRAWCLIPPER_INT*8/4+400+380クリッパーインターフェイスリストの先頭へのポインタ。
lp16DDDDRAWI_DIRECTDRAW_GBL*8/4+408+38416ビット版DirectDrawグローバルオブジェクトへのポインタ。
dwMaxOverlaysDWORD4+416+388サポートされるオーバーレイの最大数を示す。
dwCurrOverlaysDWORD4+420+392現在使用中のオーバーレイ数を示す。
dwMonitorFrequencyDWORD4+424+396モニタのリフレッシュ周波数(Hz)を示す。
ddHELCapsDDCORECAPS316+428+400HEL(ソフトウェアエミュレーション)の能力(DDCORECAPS)。
dwUnused2DWORD200+744+716未使用の予約フィールド。
ddckCKDestOverlayDDCOLORKEY8+944+916転送先オーバーレイ用カラーキー(DDCOLORKEY)。
ddckCKSrcOverlayDDCOLORKEY8+952+924転送元オーバーレイ用カラーキー(DDCOLORKEY)。
vmiDataVIDMEMINFO96/80+960+932ビデオメモリ情報(VIDMEMINFO)を示す。
lpDriverHandlevoid*8/4+1056+1012ドライバハンドルへのポインタを示す。
lpExclusiveOwnerDDRAWI_DIRECTDRAW_LCL*8/4+1064+1016排他モードを所有するローカルオブジェクトへのポインタ。NULL可。
dwModeIndexDWORD4+1072+1020現在のディスプレイモードのインデックスを示す。
dwModeIndexOrigDWORD4+1076+1024起動時の元のモードインデックスを示す。
dwNumFourCCDWORD4+1080+1028対応FourCCコードの数を示す。
lpdwFourCCDWORD*8/4+1088+1032対応FourCCコードの配列へのポインタを示す。
dwNumModesDWORD4+1096+1036利用可能なディスプレイモード数を示す。
lpModeInfoDDHALMODEINFO*8/4+1104+1040ディスプレイモード情報(DDHALMODEINFO)配列へのポインタ。
plProcessListPROCESS_LIST24/20+1112+1044このオブジェクトを使うプロセスのリスト(PROCESS_LIST)。
dwSurfaceLockCountDWORD4+1136+1064サーフェスロックの総カウントを示す。
dwAliasedLockCntDWORD4+1140+1068エイリアスされたロックのカウントを示す。
dwReserved3UINT_PTR8/4+1144+1072予約フィールド。0とする。
hDDUINT_PTR8/4+1152+1076ドライバが用いるDirectDrawハンドルを示す。
cObsoleteCHAR12+1160+1080廃止された名前用のANSI文字配列を示す。
dwReserved1DWORD4+1172+1092予約フィールド。0とする。
dwReserved2DWORD4+1176+1096予約フィールド。0とする。
dbnOverlayRootDBLNODE32/16+1184+1100オーバーレイZ順管理用のルートノード(DBLNODE)。
lpwPDeviceFlagsWORD*8/4+1216+1116物理デバイスのフラグ配列へのポインタを示す。
dwPDeviceDWORD4+1224+1120物理デバイスのアドレス/識別子を示す。
dwWin16LockCntDWORD4+1228+1124Win16ロックのカウントを示す。
dwUnused3DWORD4+1232+1128未使用の予約フィールド。
hInstanceDWORD4+1236+1132ドライバDLLのインスタンスハンドルを示す。
dwEvent16DWORD4+1240+113616ビット側との同期に用いるイベントハンドルを示す。
dwSaveNumModesDWORD4+1244+1140保存されたモード数を示す。
lpD3DGlobalDriverDataUINT_PTR8/4+1248+1144Direct3Dグローバルドライバデータへのポインタを示す。
lpD3DHALCallbacksUINT_PTR8/4+1256+1148Direct3D HALコールバックへのポインタを示す。
ddBothCapsDDCORECAPS316+1264+1152HALとHELの共通(両対応)能力(DDCORECAPS)を示す。
lpDDVideoPortCapsDDVIDEOPORTCAPS*8/4+1584+1468ビデオポート能力(DDVIDEOPORTCAPS)へのポインタ。NULL可。
dvpListDDRAWI_DDVIDEOPORT_INT*8/4+1592+1472ビデオポートインターフェイスリストの先頭へのポインタ。
lpD3DHALCallbacks2UINT_PTR8/4+1600+1476Direct3D HALコールバック(その2)へのポインタを示す。
rectDeviceRECT16+1608+1480デバイス領域を表す矩形(RECT)を示す。
cMonitorsDWORD4+1624+1496システムに接続されたモニタ数を示す。
gpbmiSrcvoid*8/4+1632+1500転送元のビットマップ情報ヘッダへのポインタを示す。
gpbmiDestvoid*8/4+1640+1504転送先のビットマップ情報ヘッダへのポインタを示す。
phaiHeapAliasesHEAPALIASINFO*8/4+1648+1508ヒープエイリアス情報(HEAPALIASINFO)へのポインタを示す。
hKernelHandleUINT_PTR8/4+1656+1512カーネルモードオブジェクトのハンドルを示す。
pfnNotifyProcUINT_PTR8/4+1664+1516通知コールバック関数へのポインタを示す。
lpDDKernelCapsDDKERNELCAPS*8/4+1672+1520カーネルモード能力(DDKERNELCAPS)へのポインタを示す。
lpddNLVCapsDDNONLOCALVIDMEMCAPS*8/4+1680+1524非ローカルビデオメモリ能力(HAL)へのポインタを示す。
lpddNLVHELCapsDDNONLOCALVIDMEMCAPS*8/4+1688+1528非ローカルビデオメモリ能力(HEL)へのポインタを示す。
lpddNLVBothCapsDDNONLOCALVIDMEMCAPS*8/4+1696+1532非ローカルビデオメモリの共通能力へのポインタを示す。
lpD3DExtendedCapsUINT_PTR8/4+1704+1536Direct3D拡張能力データへのポインタを示す。
dwDOSBoxEventDWORD4+1712+1540DOSボックス同期用のイベントハンドルを示す。
rectDesktopRECT16+1716+1544デスクトップ全体を表す矩形(RECT)を示す。
cDriverNameCHAR32+1732+1560ドライバ名を格納するANSI文字配列を示す。
lpD3DHALCallbacks3UINT_PTR8/4+1768+1592Direct3D HALコールバック(その3)へのポインタを示す。
dwNumZPixelFormatsDWORD4+1776+1596対応するZバッファピクセル形式の数を示す。
lpZPixelFormatsDDPIXELFORMAT*8/4+1784+1600Zバッファピクセル形式(DDPIXELFORMAT)配列へのポインタ。
mcListDDRAWI_DDMOTIONCOMP_INT*8/4+1792+1604モーション補償インターフェイスリストの先頭へのポインタ。
hDDVxdDWORD4+1800+1608DirectDraw VxD(仮想デバイスドライバ)のハンドルを示す。
ddsCapsMoreDDSCAPSEX12+1804+1612追加のサーフェス能力(DDSCAPSEX)を示す。

各言語での定義

#include <windows.h>

// DDSCAPS  (x64 4 / x86 4 バイト)
typedef struct DDSCAPS {
    DWORD dwCaps;
} DDSCAPS;

// DDCORECAPS  (x64 316 / x86 316 バイト)
typedef struct DDCORECAPS {
    DWORD dwSize;
    DWORD dwCaps;
    DWORD dwCaps2;
    DWORD dwCKeyCaps;
    DWORD dwFXCaps;
    DWORD dwFXAlphaCaps;
    DWORD dwPalCaps;
    DWORD dwSVCaps;
    DWORD dwAlphaBltConstBitDepths;
    DWORD dwAlphaBltPixelBitDepths;
    DWORD dwAlphaBltSurfaceBitDepths;
    DWORD dwAlphaOverlayConstBitDepths;
    DWORD dwAlphaOverlayPixelBitDepths;
    DWORD dwAlphaOverlaySurfaceBitDepths;
    DWORD dwZBufferBitDepths;
    DWORD dwVidMemTotal;
    DWORD dwVidMemFree;
    DWORD dwMaxVisibleOverlays;
    DWORD dwCurrVisibleOverlays;
    DWORD dwNumFourCCCodes;
    DWORD dwAlignBoundarySrc;
    DWORD dwAlignSizeSrc;
    DWORD dwAlignBoundaryDest;
    DWORD dwAlignSizeDest;
    DWORD dwAlignStrideAlign;
    DWORD dwRops[8];
    DDSCAPS ddsCaps;
    DWORD dwMinOverlayStretch;
    DWORD dwMaxOverlayStretch;
    DWORD dwMinLiveVideoStretch;
    DWORD dwMaxLiveVideoStretch;
    DWORD dwMinHwCodecStretch;
    DWORD dwMaxHwCodecStretch;
    DWORD dwReserved1;
    DWORD dwReserved2;
    DWORD dwReserved3;
    DWORD dwSVBCaps;
    DWORD dwSVBCKeyCaps;
    DWORD dwSVBFXCaps;
    DWORD dwSVBRops[8];
    DWORD dwVSBCaps;
    DWORD dwVSBCKeyCaps;
    DWORD dwVSBFXCaps;
    DWORD dwVSBRops[8];
    DWORD dwSSBCaps;
    DWORD dwSSBCKeyCaps;
    DWORD dwSSBFXCaps;
    DWORD dwSSBRops[8];
    DWORD dwMaxVideoPorts;
    DWORD dwCurrVideoPorts;
    DWORD dwSVBCaps2;
} DDCORECAPS;

// DDCOLORKEY  (x64 8 / x86 8 バイト)
typedef struct DDCOLORKEY {
    DWORD dwColorSpaceLowValue;
    DWORD dwColorSpaceHighValue;
} DDCOLORKEY;

// DDPIXELFORMAT  (x64 40 / x86 32 バイト)
typedef struct DDPIXELFORMAT {
    DWORD dwSize;
    DWORD dwFlags;
    DWORD dwFourCC;
    _Anonymous1_e__Union Anonymous1;
    _Anonymous2_e__Union Anonymous2;
    _Anonymous3_e__Union Anonymous3;
    _Anonymous4_e__Union Anonymous4;
    _Anonymous5_e__Union Anonymous5;
} DDPIXELFORMAT;

// VIDMEMINFO  (x64 96 / x86 80 バイト)
typedef struct VIDMEMINFO {
    UINT_PTR fpPrimary;
    DWORD dwFlags;
    DWORD dwDisplayWidth;
    DWORD dwDisplayHeight;
    INT lDisplayPitch;
    DDPIXELFORMAT ddpfDisplay;
    DWORD dwOffscreenAlign;
    DWORD dwOverlayAlign;
    DWORD dwTextureAlign;
    DWORD dwZBufferAlign;
    DWORD dwAlphaAlign;
    DWORD dwNumHeaps;
    VIDMEM* pvmList;
} VIDMEMINFO;

// PROCESS_LIST  (x64 24 / x86 20 バイト)
typedef struct PROCESS_LIST {
    PROCESS_LIST* lpLink;
    DWORD dwProcessId;
    DWORD dwRefCnt;
    DWORD dwAlphaDepth;
    DWORD dwZDepth;
} PROCESS_LIST;

// DBLNODE  (x64 32 / x86 16 バイト)
typedef struct DBLNODE {
    DBLNODE* next;
    DBLNODE* prev;
    DDRAWI_DDRAWSURFACE_LCL* object;
    DDRAWI_DDRAWSURFACE_INT* object_int;
} DBLNODE;

// RECT  (x64 16 / x86 16 バイト)
typedef struct RECT {
    INT left;
    INT top;
    INT right;
    INT bottom;
} RECT;

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

// DDRAWI_DIRECTDRAW_GBL  (x64 1816 / x86 1624 バイト)
typedef struct DDRAWI_DIRECTDRAW_GBL {
    DWORD dwRefCnt;
    DWORD dwFlags;
    UINT_PTR fpPrimaryOrig;
    DDCORECAPS ddCaps;
    DWORD dwInternal1;
    DWORD dwUnused1[9];
    DDHAL_CALLBACKS* lpDDCBtmp;
    DDRAWI_DDRAWSURFACE_INT* dsList;
    DDRAWI_DDRAWPALETTE_INT* palList;
    DDRAWI_DDRAWCLIPPER_INT* clipperList;
    DDRAWI_DIRECTDRAW_GBL* lp16DD;
    DWORD dwMaxOverlays;
    DWORD dwCurrOverlays;
    DWORD dwMonitorFrequency;
    DDCORECAPS ddHELCaps;
    DWORD dwUnused2[50];
    DDCOLORKEY ddckCKDestOverlay;
    DDCOLORKEY ddckCKSrcOverlay;
    VIDMEMINFO vmiData;
    void* lpDriverHandle;
    DDRAWI_DIRECTDRAW_LCL* lpExclusiveOwner;
    DWORD dwModeIndex;
    DWORD dwModeIndexOrig;
    DWORD dwNumFourCC;
    DWORD* lpdwFourCC;
    DWORD dwNumModes;
    DDHALMODEINFO* lpModeInfo;
    PROCESS_LIST plProcessList;
    DWORD dwSurfaceLockCount;
    DWORD dwAliasedLockCnt;
    UINT_PTR dwReserved3;
    UINT_PTR hDD;
    CHAR cObsolete[12];
    DWORD dwReserved1;
    DWORD dwReserved2;
    DBLNODE dbnOverlayRoot;
    WORD* lpwPDeviceFlags;
    DWORD dwPDevice;
    DWORD dwWin16LockCnt;
    DWORD dwUnused3;
    DWORD hInstance;
    DWORD dwEvent16;
    DWORD dwSaveNumModes;
    UINT_PTR lpD3DGlobalDriverData;
    UINT_PTR lpD3DHALCallbacks;
    DDCORECAPS ddBothCaps;
    DDVIDEOPORTCAPS* lpDDVideoPortCaps;
    DDRAWI_DDVIDEOPORT_INT* dvpList;
    UINT_PTR lpD3DHALCallbacks2;
    RECT rectDevice;
    DWORD cMonitors;
    void* gpbmiSrc;
    void* gpbmiDest;
    HEAPALIASINFO* phaiHeapAliases;
    UINT_PTR hKernelHandle;
    UINT_PTR pfnNotifyProc;
    DDKERNELCAPS* lpDDKernelCaps;
    DDNONLOCALVIDMEMCAPS* lpddNLVCaps;
    DDNONLOCALVIDMEMCAPS* lpddNLVHELCaps;
    DDNONLOCALVIDMEMCAPS* lpddNLVBothCaps;
    UINT_PTR lpD3DExtendedCaps;
    DWORD dwDOSBoxEvent;
    RECT rectDesktop;
    CHAR cDriverName[32];
    UINT_PTR lpD3DHALCallbacks3;
    DWORD dwNumZPixelFormats;
    DDPIXELFORMAT* lpZPixelFormats;
    DDRAWI_DDMOTIONCOMP_INT* mcList;
    DWORD hDDVxd;
    DDSCAPSEX ddsCapsMore;
} DDRAWI_DIRECTDRAW_GBL;
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 DDCORECAPS
{
    public uint dwSize;
    public uint dwCaps;
    public uint dwCaps2;
    public uint dwCKeyCaps;
    public uint dwFXCaps;
    public uint dwFXAlphaCaps;
    public uint dwPalCaps;
    public uint dwSVCaps;
    public uint dwAlphaBltConstBitDepths;
    public uint dwAlphaBltPixelBitDepths;
    public uint dwAlphaBltSurfaceBitDepths;
    public uint dwAlphaOverlayConstBitDepths;
    public uint dwAlphaOverlayPixelBitDepths;
    public uint dwAlphaOverlaySurfaceBitDepths;
    public uint dwZBufferBitDepths;
    public uint dwVidMemTotal;
    public uint dwVidMemFree;
    public uint dwMaxVisibleOverlays;
    public uint dwCurrVisibleOverlays;
    public uint dwNumFourCCCodes;
    public uint dwAlignBoundarySrc;
    public uint dwAlignSizeSrc;
    public uint dwAlignBoundaryDest;
    public uint dwAlignSizeDest;
    public uint dwAlignStrideAlign;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public uint[] dwRops;
    public DDSCAPS ddsCaps;
    public uint dwMinOverlayStretch;
    public uint dwMaxOverlayStretch;
    public uint dwMinLiveVideoStretch;
    public uint dwMaxLiveVideoStretch;
    public uint dwMinHwCodecStretch;
    public uint dwMaxHwCodecStretch;
    public uint dwReserved1;
    public uint dwReserved2;
    public uint dwReserved3;
    public uint dwSVBCaps;
    public uint dwSVBCKeyCaps;
    public uint dwSVBFXCaps;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public uint[] dwSVBRops;
    public uint dwVSBCaps;
    public uint dwVSBCKeyCaps;
    public uint dwVSBFXCaps;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public uint[] dwVSBRops;
    public uint dwSSBCaps;
    public uint dwSSBCKeyCaps;
    public uint dwSSBFXCaps;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public uint[] dwSSBRops;
    public uint dwMaxVideoPorts;
    public uint dwCurrVideoPorts;
    public uint dwSVBCaps2;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DDCOLORKEY
{
    public uint dwColorSpaceLowValue;
    public uint dwColorSpaceHighValue;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DDPIXELFORMAT
{
    public uint dwSize;
    public uint dwFlags;
    public uint dwFourCC;
    public _Anonymous1_e__Union Anonymous1;
    public _Anonymous2_e__Union Anonymous2;
    public _Anonymous3_e__Union Anonymous3;
    public _Anonymous4_e__Union Anonymous4;
    public _Anonymous5_e__Union Anonymous5;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VIDMEMINFO
{
    public UIntPtr fpPrimary;
    public uint dwFlags;
    public uint dwDisplayWidth;
    public uint dwDisplayHeight;
    public int lDisplayPitch;
    public DDPIXELFORMAT ddpfDisplay;
    public uint dwOffscreenAlign;
    public uint dwOverlayAlign;
    public uint dwTextureAlign;
    public uint dwZBufferAlign;
    public uint dwAlphaAlign;
    public uint dwNumHeaps;
    public IntPtr pvmList;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PROCESS_LIST
{
    public IntPtr lpLink;
    public uint dwProcessId;
    public uint dwRefCnt;
    public uint dwAlphaDepth;
    public uint dwZDepth;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DBLNODE
{
    public IntPtr next;
    public IntPtr prev;
    public IntPtr object;
    public IntPtr object_int;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RECT
{
    public int left;
    public int top;
    public int right;
    public int bottom;
}

[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 DDRAWI_DIRECTDRAW_GBL
{
    public uint dwRefCnt;
    public uint dwFlags;
    public UIntPtr fpPrimaryOrig;
    public DDCORECAPS ddCaps;
    public uint dwInternal1;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] public uint[] dwUnused1;
    public IntPtr lpDDCBtmp;
    public IntPtr dsList;
    public IntPtr palList;
    public IntPtr clipperList;
    public IntPtr lp16DD;
    public uint dwMaxOverlays;
    public uint dwCurrOverlays;
    public uint dwMonitorFrequency;
    public DDCORECAPS ddHELCaps;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)] public uint[] dwUnused2;
    public DDCOLORKEY ddckCKDestOverlay;
    public DDCOLORKEY ddckCKSrcOverlay;
    public VIDMEMINFO vmiData;
    public IntPtr lpDriverHandle;
    public IntPtr lpExclusiveOwner;
    public uint dwModeIndex;
    public uint dwModeIndexOrig;
    public uint dwNumFourCC;
    public IntPtr lpdwFourCC;
    public uint dwNumModes;
    public IntPtr lpModeInfo;
    public PROCESS_LIST plProcessList;
    public uint dwSurfaceLockCount;
    public uint dwAliasedLockCnt;
    public UIntPtr dwReserved3;
    public UIntPtr hDD;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public sbyte[] cObsolete;
    public uint dwReserved1;
    public uint dwReserved2;
    public DBLNODE dbnOverlayRoot;
    public IntPtr lpwPDeviceFlags;
    public uint dwPDevice;
    public uint dwWin16LockCnt;
    public uint dwUnused3;
    public uint hInstance;
    public uint dwEvent16;
    public uint dwSaveNumModes;
    public UIntPtr lpD3DGlobalDriverData;
    public UIntPtr lpD3DHALCallbacks;
    public DDCORECAPS ddBothCaps;
    public IntPtr lpDDVideoPortCaps;
    public IntPtr dvpList;
    public UIntPtr lpD3DHALCallbacks2;
    public RECT rectDevice;
    public uint cMonitors;
    public IntPtr gpbmiSrc;
    public IntPtr gpbmiDest;
    public IntPtr phaiHeapAliases;
    public UIntPtr hKernelHandle;
    public UIntPtr pfnNotifyProc;
    public IntPtr lpDDKernelCaps;
    public IntPtr lpddNLVCaps;
    public IntPtr lpddNLVHELCaps;
    public IntPtr lpddNLVBothCaps;
    public UIntPtr lpD3DExtendedCaps;
    public uint dwDOSBoxEvent;
    public RECT rectDesktop;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public sbyte[] cDriverName;
    public UIntPtr lpD3DHALCallbacks3;
    public uint dwNumZPixelFormats;
    public IntPtr lpZPixelFormats;
    public IntPtr mcList;
    public uint hDDVxd;
    public DDSCAPSEX ddsCapsMore;
}
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 DDCORECAPS
    Public dwSize As UInteger
    Public dwCaps As UInteger
    Public dwCaps2 As UInteger
    Public dwCKeyCaps As UInteger
    Public dwFXCaps As UInteger
    Public dwFXAlphaCaps As UInteger
    Public dwPalCaps As UInteger
    Public dwSVCaps As UInteger
    Public dwAlphaBltConstBitDepths As UInteger
    Public dwAlphaBltPixelBitDepths As UInteger
    Public dwAlphaBltSurfaceBitDepths As UInteger
    Public dwAlphaOverlayConstBitDepths As UInteger
    Public dwAlphaOverlayPixelBitDepths As UInteger
    Public dwAlphaOverlaySurfaceBitDepths As UInteger
    Public dwZBufferBitDepths As UInteger
    Public dwVidMemTotal As UInteger
    Public dwVidMemFree As UInteger
    Public dwMaxVisibleOverlays As UInteger
    Public dwCurrVisibleOverlays As UInteger
    Public dwNumFourCCCodes As UInteger
    Public dwAlignBoundarySrc As UInteger
    Public dwAlignSizeSrc As UInteger
    Public dwAlignBoundaryDest As UInteger
    Public dwAlignSizeDest As UInteger
    Public dwAlignStrideAlign As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public dwRops() As UInteger
    Public ddsCaps As DDSCAPS
    Public dwMinOverlayStretch As UInteger
    Public dwMaxOverlayStretch As UInteger
    Public dwMinLiveVideoStretch As UInteger
    Public dwMaxLiveVideoStretch As UInteger
    Public dwMinHwCodecStretch As UInteger
    Public dwMaxHwCodecStretch As UInteger
    Public dwReserved1 As UInteger
    Public dwReserved2 As UInteger
    Public dwReserved3 As UInteger
    Public dwSVBCaps As UInteger
    Public dwSVBCKeyCaps As UInteger
    Public dwSVBFXCaps As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public dwSVBRops() As UInteger
    Public dwVSBCaps As UInteger
    Public dwVSBCKeyCaps As UInteger
    Public dwVSBFXCaps As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public dwVSBRops() As UInteger
    Public dwSSBCaps As UInteger
    Public dwSSBCKeyCaps As UInteger
    Public dwSSBFXCaps As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public dwSSBRops() As UInteger
    Public dwMaxVideoPorts As UInteger
    Public dwCurrVideoPorts As UInteger
    Public dwSVBCaps2 As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DDCOLORKEY
    Public dwColorSpaceLowValue As UInteger
    Public dwColorSpaceHighValue As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DDPIXELFORMAT
    Public dwSize As UInteger
    Public dwFlags As UInteger
    Public dwFourCC As UInteger
    Public Anonymous1 As _Anonymous1_e__Union
    Public Anonymous2 As _Anonymous2_e__Union
    Public Anonymous3 As _Anonymous3_e__Union
    Public Anonymous4 As _Anonymous4_e__Union
    Public Anonymous5 As _Anonymous5_e__Union
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VIDMEMINFO
    Public fpPrimary As UIntPtr
    Public dwFlags As UInteger
    Public dwDisplayWidth As UInteger
    Public dwDisplayHeight As UInteger
    Public lDisplayPitch As Integer
    Public ddpfDisplay As DDPIXELFORMAT
    Public dwOffscreenAlign As UInteger
    Public dwOverlayAlign As UInteger
    Public dwTextureAlign As UInteger
    Public dwZBufferAlign As UInteger
    Public dwAlphaAlign As UInteger
    Public dwNumHeaps As UInteger
    Public pvmList As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PROCESS_LIST
    Public lpLink As IntPtr
    Public dwProcessId As UInteger
    Public dwRefCnt As UInteger
    Public dwAlphaDepth As UInteger
    Public dwZDepth As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DBLNODE
    Public next As IntPtr
    Public prev As IntPtr
    Public object As IntPtr
    Public object_int As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECT
    Public left As Integer
    Public top As Integer
    Public right As Integer
    Public bottom As Integer
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 DDRAWI_DIRECTDRAW_GBL
    Public dwRefCnt As UInteger
    Public dwFlags As UInteger
    Public fpPrimaryOrig As UIntPtr
    Public ddCaps As DDCORECAPS
    Public dwInternal1 As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=9)> Public dwUnused1() As UInteger
    Public lpDDCBtmp As IntPtr
    Public dsList As IntPtr
    Public palList As IntPtr
    Public clipperList As IntPtr
    Public lp16DD As IntPtr
    Public dwMaxOverlays As UInteger
    Public dwCurrOverlays As UInteger
    Public dwMonitorFrequency As UInteger
    Public ddHELCaps As DDCORECAPS
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=50)> Public dwUnused2() As UInteger
    Public ddckCKDestOverlay As DDCOLORKEY
    Public ddckCKSrcOverlay As DDCOLORKEY
    Public vmiData As VIDMEMINFO
    Public lpDriverHandle As IntPtr
    Public lpExclusiveOwner As IntPtr
    Public dwModeIndex As UInteger
    Public dwModeIndexOrig As UInteger
    Public dwNumFourCC As UInteger
    Public lpdwFourCC As IntPtr
    Public dwNumModes As UInteger
    Public lpModeInfo As IntPtr
    Public plProcessList As PROCESS_LIST
    Public dwSurfaceLockCount As UInteger
    Public dwAliasedLockCnt As UInteger
    Public dwReserved3 As UIntPtr
    Public hDD As UIntPtr
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=12)> Public cObsolete() As SByte
    Public dwReserved1 As UInteger
    Public dwReserved2 As UInteger
    Public dbnOverlayRoot As DBLNODE
    Public lpwPDeviceFlags As IntPtr
    Public dwPDevice As UInteger
    Public dwWin16LockCnt As UInteger
    Public dwUnused3 As UInteger
    Public hInstance As UInteger
    Public dwEvent16 As UInteger
    Public dwSaveNumModes As UInteger
    Public lpD3DGlobalDriverData As UIntPtr
    Public lpD3DHALCallbacks As UIntPtr
    Public ddBothCaps As DDCORECAPS
    Public lpDDVideoPortCaps As IntPtr
    Public dvpList As IntPtr
    Public lpD3DHALCallbacks2 As UIntPtr
    Public rectDevice As RECT
    Public cMonitors As UInteger
    Public gpbmiSrc As IntPtr
    Public gpbmiDest As IntPtr
    Public phaiHeapAliases As IntPtr
    Public hKernelHandle As UIntPtr
    Public pfnNotifyProc As UIntPtr
    Public lpDDKernelCaps As IntPtr
    Public lpddNLVCaps As IntPtr
    Public lpddNLVHELCaps As IntPtr
    Public lpddNLVBothCaps As IntPtr
    Public lpD3DExtendedCaps As UIntPtr
    Public dwDOSBoxEvent As UInteger
    Public rectDesktop As RECT
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public cDriverName() As SByte
    Public lpD3DHALCallbacks3 As UIntPtr
    Public dwNumZPixelFormats As UInteger
    Public lpZPixelFormats As IntPtr
    Public mcList As IntPtr
    Public hDDVxd As UInteger
    Public ddsCapsMore As DDSCAPSEX
End Structure
import ctypes
from ctypes import wintypes

class DDSCAPS(ctypes.Structure):
    _fields_ = [
        ("dwCaps", wintypes.DWORD),
    ]

class DDCORECAPS(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwCaps", wintypes.DWORD),
        ("dwCaps2", wintypes.DWORD),
        ("dwCKeyCaps", wintypes.DWORD),
        ("dwFXCaps", wintypes.DWORD),
        ("dwFXAlphaCaps", wintypes.DWORD),
        ("dwPalCaps", wintypes.DWORD),
        ("dwSVCaps", wintypes.DWORD),
        ("dwAlphaBltConstBitDepths", wintypes.DWORD),
        ("dwAlphaBltPixelBitDepths", wintypes.DWORD),
        ("dwAlphaBltSurfaceBitDepths", wintypes.DWORD),
        ("dwAlphaOverlayConstBitDepths", wintypes.DWORD),
        ("dwAlphaOverlayPixelBitDepths", wintypes.DWORD),
        ("dwAlphaOverlaySurfaceBitDepths", wintypes.DWORD),
        ("dwZBufferBitDepths", wintypes.DWORD),
        ("dwVidMemTotal", wintypes.DWORD),
        ("dwVidMemFree", wintypes.DWORD),
        ("dwMaxVisibleOverlays", wintypes.DWORD),
        ("dwCurrVisibleOverlays", wintypes.DWORD),
        ("dwNumFourCCCodes", wintypes.DWORD),
        ("dwAlignBoundarySrc", wintypes.DWORD),
        ("dwAlignSizeSrc", wintypes.DWORD),
        ("dwAlignBoundaryDest", wintypes.DWORD),
        ("dwAlignSizeDest", wintypes.DWORD),
        ("dwAlignStrideAlign", wintypes.DWORD),
        ("dwRops", wintypes.DWORD * 8),
        ("ddsCaps", DDSCAPS),
        ("dwMinOverlayStretch", wintypes.DWORD),
        ("dwMaxOverlayStretch", wintypes.DWORD),
        ("dwMinLiveVideoStretch", wintypes.DWORD),
        ("dwMaxLiveVideoStretch", wintypes.DWORD),
        ("dwMinHwCodecStretch", wintypes.DWORD),
        ("dwMaxHwCodecStretch", wintypes.DWORD),
        ("dwReserved1", wintypes.DWORD),
        ("dwReserved2", wintypes.DWORD),
        ("dwReserved3", wintypes.DWORD),
        ("dwSVBCaps", wintypes.DWORD),
        ("dwSVBCKeyCaps", wintypes.DWORD),
        ("dwSVBFXCaps", wintypes.DWORD),
        ("dwSVBRops", wintypes.DWORD * 8),
        ("dwVSBCaps", wintypes.DWORD),
        ("dwVSBCKeyCaps", wintypes.DWORD),
        ("dwVSBFXCaps", wintypes.DWORD),
        ("dwVSBRops", wintypes.DWORD * 8),
        ("dwSSBCaps", wintypes.DWORD),
        ("dwSSBCKeyCaps", wintypes.DWORD),
        ("dwSSBFXCaps", wintypes.DWORD),
        ("dwSSBRops", wintypes.DWORD * 8),
        ("dwMaxVideoPorts", wintypes.DWORD),
        ("dwCurrVideoPorts", wintypes.DWORD),
        ("dwSVBCaps2", wintypes.DWORD),
    ]

class DDCOLORKEY(ctypes.Structure):
    _fields_ = [
        ("dwColorSpaceLowValue", wintypes.DWORD),
        ("dwColorSpaceHighValue", wintypes.DWORD),
    ]

class DDPIXELFORMAT(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
        ("dwFourCC", wintypes.DWORD),
        ("Anonymous1", _Anonymous1_e__Union),
        ("Anonymous2", _Anonymous2_e__Union),
        ("Anonymous3", _Anonymous3_e__Union),
        ("Anonymous4", _Anonymous4_e__Union),
        ("Anonymous5", _Anonymous5_e__Union),
    ]

class VIDMEMINFO(ctypes.Structure):
    _fields_ = [
        ("fpPrimary", ctypes.c_size_t),
        ("dwFlags", wintypes.DWORD),
        ("dwDisplayWidth", wintypes.DWORD),
        ("dwDisplayHeight", wintypes.DWORD),
        ("lDisplayPitch", ctypes.c_int),
        ("ddpfDisplay", DDPIXELFORMAT),
        ("dwOffscreenAlign", wintypes.DWORD),
        ("dwOverlayAlign", wintypes.DWORD),
        ("dwTextureAlign", wintypes.DWORD),
        ("dwZBufferAlign", wintypes.DWORD),
        ("dwAlphaAlign", wintypes.DWORD),
        ("dwNumHeaps", wintypes.DWORD),
        ("pvmList", ctypes.c_void_p),
    ]

class PROCESS_LIST(ctypes.Structure):
    _fields_ = [
        ("lpLink", ctypes.c_void_p),
        ("dwProcessId", wintypes.DWORD),
        ("dwRefCnt", wintypes.DWORD),
        ("dwAlphaDepth", wintypes.DWORD),
        ("dwZDepth", wintypes.DWORD),
    ]

class DBLNODE(ctypes.Structure):
    _fields_ = [
        ("next", ctypes.c_void_p),
        ("prev", ctypes.c_void_p),
        ("object", ctypes.c_void_p),
        ("object_int", ctypes.c_void_p),
    ]

class RECT(ctypes.Structure):
    _fields_ = [
        ("left", ctypes.c_int),
        ("top", ctypes.c_int),
        ("right", ctypes.c_int),
        ("bottom", ctypes.c_int),
    ]

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

class DDRAWI_DIRECTDRAW_GBL(ctypes.Structure):
    _fields_ = [
        ("dwRefCnt", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
        ("fpPrimaryOrig", ctypes.c_size_t),
        ("ddCaps", DDCORECAPS),
        ("dwInternal1", wintypes.DWORD),
        ("dwUnused1", wintypes.DWORD * 9),
        ("lpDDCBtmp", ctypes.c_void_p),
        ("dsList", ctypes.c_void_p),
        ("palList", ctypes.c_void_p),
        ("clipperList", ctypes.c_void_p),
        ("lp16DD", ctypes.c_void_p),
        ("dwMaxOverlays", wintypes.DWORD),
        ("dwCurrOverlays", wintypes.DWORD),
        ("dwMonitorFrequency", wintypes.DWORD),
        ("ddHELCaps", DDCORECAPS),
        ("dwUnused2", wintypes.DWORD * 50),
        ("ddckCKDestOverlay", DDCOLORKEY),
        ("ddckCKSrcOverlay", DDCOLORKEY),
        ("vmiData", VIDMEMINFO),
        ("lpDriverHandle", ctypes.c_void_p),
        ("lpExclusiveOwner", ctypes.c_void_p),
        ("dwModeIndex", wintypes.DWORD),
        ("dwModeIndexOrig", wintypes.DWORD),
        ("dwNumFourCC", wintypes.DWORD),
        ("lpdwFourCC", ctypes.c_void_p),
        ("dwNumModes", wintypes.DWORD),
        ("lpModeInfo", ctypes.c_void_p),
        ("plProcessList", PROCESS_LIST),
        ("dwSurfaceLockCount", wintypes.DWORD),
        ("dwAliasedLockCnt", wintypes.DWORD),
        ("dwReserved3", ctypes.c_size_t),
        ("hDD", ctypes.c_size_t),
        ("cObsolete", ctypes.c_byte * 12),
        ("dwReserved1", wintypes.DWORD),
        ("dwReserved2", wintypes.DWORD),
        ("dbnOverlayRoot", DBLNODE),
        ("lpwPDeviceFlags", ctypes.c_void_p),
        ("dwPDevice", wintypes.DWORD),
        ("dwWin16LockCnt", wintypes.DWORD),
        ("dwUnused3", wintypes.DWORD),
        ("hInstance", wintypes.DWORD),
        ("dwEvent16", wintypes.DWORD),
        ("dwSaveNumModes", wintypes.DWORD),
        ("lpD3DGlobalDriverData", ctypes.c_size_t),
        ("lpD3DHALCallbacks", ctypes.c_size_t),
        ("ddBothCaps", DDCORECAPS),
        ("lpDDVideoPortCaps", ctypes.c_void_p),
        ("dvpList", ctypes.c_void_p),
        ("lpD3DHALCallbacks2", ctypes.c_size_t),
        ("rectDevice", RECT),
        ("cMonitors", wintypes.DWORD),
        ("gpbmiSrc", ctypes.c_void_p),
        ("gpbmiDest", ctypes.c_void_p),
        ("phaiHeapAliases", ctypes.c_void_p),
        ("hKernelHandle", ctypes.c_size_t),
        ("pfnNotifyProc", ctypes.c_size_t),
        ("lpDDKernelCaps", ctypes.c_void_p),
        ("lpddNLVCaps", ctypes.c_void_p),
        ("lpddNLVHELCaps", ctypes.c_void_p),
        ("lpddNLVBothCaps", ctypes.c_void_p),
        ("lpD3DExtendedCaps", ctypes.c_size_t),
        ("dwDOSBoxEvent", wintypes.DWORD),
        ("rectDesktop", RECT),
        ("cDriverName", ctypes.c_byte * 32),
        ("lpD3DHALCallbacks3", ctypes.c_size_t),
        ("dwNumZPixelFormats", wintypes.DWORD),
        ("lpZPixelFormats", ctypes.c_void_p),
        ("mcList", ctypes.c_void_p),
        ("hDDVxd", wintypes.DWORD),
        ("ddsCapsMore", DDSCAPSEX),
    ]
#[repr(C)]
pub struct DDSCAPS {
    pub dwCaps: u32,
}

#[repr(C)]
pub struct DDCORECAPS {
    pub dwSize: u32,
    pub dwCaps: u32,
    pub dwCaps2: u32,
    pub dwCKeyCaps: u32,
    pub dwFXCaps: u32,
    pub dwFXAlphaCaps: u32,
    pub dwPalCaps: u32,
    pub dwSVCaps: u32,
    pub dwAlphaBltConstBitDepths: u32,
    pub dwAlphaBltPixelBitDepths: u32,
    pub dwAlphaBltSurfaceBitDepths: u32,
    pub dwAlphaOverlayConstBitDepths: u32,
    pub dwAlphaOverlayPixelBitDepths: u32,
    pub dwAlphaOverlaySurfaceBitDepths: u32,
    pub dwZBufferBitDepths: u32,
    pub dwVidMemTotal: u32,
    pub dwVidMemFree: u32,
    pub dwMaxVisibleOverlays: u32,
    pub dwCurrVisibleOverlays: u32,
    pub dwNumFourCCCodes: u32,
    pub dwAlignBoundarySrc: u32,
    pub dwAlignSizeSrc: u32,
    pub dwAlignBoundaryDest: u32,
    pub dwAlignSizeDest: u32,
    pub dwAlignStrideAlign: u32,
    pub dwRops: [u32; 8],
    pub ddsCaps: DDSCAPS,
    pub dwMinOverlayStretch: u32,
    pub dwMaxOverlayStretch: u32,
    pub dwMinLiveVideoStretch: u32,
    pub dwMaxLiveVideoStretch: u32,
    pub dwMinHwCodecStretch: u32,
    pub dwMaxHwCodecStretch: u32,
    pub dwReserved1: u32,
    pub dwReserved2: u32,
    pub dwReserved3: u32,
    pub dwSVBCaps: u32,
    pub dwSVBCKeyCaps: u32,
    pub dwSVBFXCaps: u32,
    pub dwSVBRops: [u32; 8],
    pub dwVSBCaps: u32,
    pub dwVSBCKeyCaps: u32,
    pub dwVSBFXCaps: u32,
    pub dwVSBRops: [u32; 8],
    pub dwSSBCaps: u32,
    pub dwSSBCKeyCaps: u32,
    pub dwSSBFXCaps: u32,
    pub dwSSBRops: [u32; 8],
    pub dwMaxVideoPorts: u32,
    pub dwCurrVideoPorts: u32,
    pub dwSVBCaps2: u32,
}

#[repr(C)]
pub struct DDCOLORKEY {
    pub dwColorSpaceLowValue: u32,
    pub dwColorSpaceHighValue: u32,
}

#[repr(C)]
pub struct DDPIXELFORMAT {
    pub dwSize: u32,
    pub dwFlags: u32,
    pub dwFourCC: u32,
    pub Anonymous1: _Anonymous1_e__Union,
    pub Anonymous2: _Anonymous2_e__Union,
    pub Anonymous3: _Anonymous3_e__Union,
    pub Anonymous4: _Anonymous4_e__Union,
    pub Anonymous5: _Anonymous5_e__Union,
}

#[repr(C)]
pub struct VIDMEMINFO {
    pub fpPrimary: usize,
    pub dwFlags: u32,
    pub dwDisplayWidth: u32,
    pub dwDisplayHeight: u32,
    pub lDisplayPitch: i32,
    pub ddpfDisplay: DDPIXELFORMAT,
    pub dwOffscreenAlign: u32,
    pub dwOverlayAlign: u32,
    pub dwTextureAlign: u32,
    pub dwZBufferAlign: u32,
    pub dwAlphaAlign: u32,
    pub dwNumHeaps: u32,
    pub pvmList: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct PROCESS_LIST {
    pub lpLink: *mut core::ffi::c_void,
    pub dwProcessId: u32,
    pub dwRefCnt: u32,
    pub dwAlphaDepth: u32,
    pub dwZDepth: u32,
}

#[repr(C)]
pub struct DBLNODE {
    pub next: *mut core::ffi::c_void,
    pub prev: *mut core::ffi::c_void,
    pub object: *mut core::ffi::c_void,
    pub object_int: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct RECT {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

#[repr(C)]
pub struct DDSCAPSEX {
    pub dwCaps2: u32,
    pub dwCaps3: u32,
    pub Anonymous: _Anonymous_e__Union,
}

#[repr(C)]
pub struct DDRAWI_DIRECTDRAW_GBL {
    pub dwRefCnt: u32,
    pub dwFlags: u32,
    pub fpPrimaryOrig: usize,
    pub ddCaps: DDCORECAPS,
    pub dwInternal1: u32,
    pub dwUnused1: [u32; 9],
    pub lpDDCBtmp: *mut core::ffi::c_void,
    pub dsList: *mut core::ffi::c_void,
    pub palList: *mut core::ffi::c_void,
    pub clipperList: *mut core::ffi::c_void,
    pub lp16DD: *mut core::ffi::c_void,
    pub dwMaxOverlays: u32,
    pub dwCurrOverlays: u32,
    pub dwMonitorFrequency: u32,
    pub ddHELCaps: DDCORECAPS,
    pub dwUnused2: [u32; 50],
    pub ddckCKDestOverlay: DDCOLORKEY,
    pub ddckCKSrcOverlay: DDCOLORKEY,
    pub vmiData: VIDMEMINFO,
    pub lpDriverHandle: *mut core::ffi::c_void,
    pub lpExclusiveOwner: *mut core::ffi::c_void,
    pub dwModeIndex: u32,
    pub dwModeIndexOrig: u32,
    pub dwNumFourCC: u32,
    pub lpdwFourCC: *mut core::ffi::c_void,
    pub dwNumModes: u32,
    pub lpModeInfo: *mut core::ffi::c_void,
    pub plProcessList: PROCESS_LIST,
    pub dwSurfaceLockCount: u32,
    pub dwAliasedLockCnt: u32,
    pub dwReserved3: usize,
    pub hDD: usize,
    pub cObsolete: [i8; 12],
    pub dwReserved1: u32,
    pub dwReserved2: u32,
    pub dbnOverlayRoot: DBLNODE,
    pub lpwPDeviceFlags: *mut core::ffi::c_void,
    pub dwPDevice: u32,
    pub dwWin16LockCnt: u32,
    pub dwUnused3: u32,
    pub hInstance: u32,
    pub dwEvent16: u32,
    pub dwSaveNumModes: u32,
    pub lpD3DGlobalDriverData: usize,
    pub lpD3DHALCallbacks: usize,
    pub ddBothCaps: DDCORECAPS,
    pub lpDDVideoPortCaps: *mut core::ffi::c_void,
    pub dvpList: *mut core::ffi::c_void,
    pub lpD3DHALCallbacks2: usize,
    pub rectDevice: RECT,
    pub cMonitors: u32,
    pub gpbmiSrc: *mut core::ffi::c_void,
    pub gpbmiDest: *mut core::ffi::c_void,
    pub phaiHeapAliases: *mut core::ffi::c_void,
    pub hKernelHandle: usize,
    pub pfnNotifyProc: usize,
    pub lpDDKernelCaps: *mut core::ffi::c_void,
    pub lpddNLVCaps: *mut core::ffi::c_void,
    pub lpddNLVHELCaps: *mut core::ffi::c_void,
    pub lpddNLVBothCaps: *mut core::ffi::c_void,
    pub lpD3DExtendedCaps: usize,
    pub dwDOSBoxEvent: u32,
    pub rectDesktop: RECT,
    pub cDriverName: [i8; 32],
    pub lpD3DHALCallbacks3: usize,
    pub dwNumZPixelFormats: u32,
    pub lpZPixelFormats: *mut core::ffi::c_void,
    pub mcList: *mut core::ffi::c_void,
    pub hDDVxd: u32,
    pub ddsCapsMore: DDSCAPSEX,
}
import "golang.org/x/sys/windows"

type DDSCAPS struct {
	dwCaps uint32
}

type DDCORECAPS struct {
	dwSize uint32
	dwCaps uint32
	dwCaps2 uint32
	dwCKeyCaps uint32
	dwFXCaps uint32
	dwFXAlphaCaps uint32
	dwPalCaps uint32
	dwSVCaps uint32
	dwAlphaBltConstBitDepths uint32
	dwAlphaBltPixelBitDepths uint32
	dwAlphaBltSurfaceBitDepths uint32
	dwAlphaOverlayConstBitDepths uint32
	dwAlphaOverlayPixelBitDepths uint32
	dwAlphaOverlaySurfaceBitDepths uint32
	dwZBufferBitDepths uint32
	dwVidMemTotal uint32
	dwVidMemFree uint32
	dwMaxVisibleOverlays uint32
	dwCurrVisibleOverlays uint32
	dwNumFourCCCodes uint32
	dwAlignBoundarySrc uint32
	dwAlignSizeSrc uint32
	dwAlignBoundaryDest uint32
	dwAlignSizeDest uint32
	dwAlignStrideAlign uint32
	dwRops [8]uint32
	ddsCaps DDSCAPS
	dwMinOverlayStretch uint32
	dwMaxOverlayStretch uint32
	dwMinLiveVideoStretch uint32
	dwMaxLiveVideoStretch uint32
	dwMinHwCodecStretch uint32
	dwMaxHwCodecStretch uint32
	dwReserved1 uint32
	dwReserved2 uint32
	dwReserved3 uint32
	dwSVBCaps uint32
	dwSVBCKeyCaps uint32
	dwSVBFXCaps uint32
	dwSVBRops [8]uint32
	dwVSBCaps uint32
	dwVSBCKeyCaps uint32
	dwVSBFXCaps uint32
	dwVSBRops [8]uint32
	dwSSBCaps uint32
	dwSSBCKeyCaps uint32
	dwSSBFXCaps uint32
	dwSSBRops [8]uint32
	dwMaxVideoPorts uint32
	dwCurrVideoPorts uint32
	dwSVBCaps2 uint32
}

type DDCOLORKEY struct {
	dwColorSpaceLowValue uint32
	dwColorSpaceHighValue uint32
}

type DDPIXELFORMAT struct {
	dwSize uint32
	dwFlags uint32
	dwFourCC uint32
	Anonymous1 _Anonymous1_e__Union
	Anonymous2 _Anonymous2_e__Union
	Anonymous3 _Anonymous3_e__Union
	Anonymous4 _Anonymous4_e__Union
	Anonymous5 _Anonymous5_e__Union
}

type VIDMEMINFO struct {
	fpPrimary uintptr
	dwFlags uint32
	dwDisplayWidth uint32
	dwDisplayHeight uint32
	lDisplayPitch int32
	ddpfDisplay DDPIXELFORMAT
	dwOffscreenAlign uint32
	dwOverlayAlign uint32
	dwTextureAlign uint32
	dwZBufferAlign uint32
	dwAlphaAlign uint32
	dwNumHeaps uint32
	pvmList uintptr
}

type PROCESS_LIST struct {
	lpLink uintptr
	dwProcessId uint32
	dwRefCnt uint32
	dwAlphaDepth uint32
	dwZDepth uint32
}

type DBLNODE struct {
	next uintptr
	prev uintptr
	object uintptr
	object_int uintptr
}

type RECT struct {
	left int32
	top int32
	right int32
	bottom int32
}

type DDSCAPSEX struct {
	dwCaps2 uint32
	dwCaps3 uint32
	Anonymous _Anonymous_e__Union
}

type DDRAWI_DIRECTDRAW_GBL struct {
	dwRefCnt uint32
	dwFlags uint32
	fpPrimaryOrig uintptr
	ddCaps DDCORECAPS
	dwInternal1 uint32
	dwUnused1 [9]uint32
	lpDDCBtmp uintptr
	dsList uintptr
	palList uintptr
	clipperList uintptr
	lp16DD uintptr
	dwMaxOverlays uint32
	dwCurrOverlays uint32
	dwMonitorFrequency uint32
	ddHELCaps DDCORECAPS
	dwUnused2 [50]uint32
	ddckCKDestOverlay DDCOLORKEY
	ddckCKSrcOverlay DDCOLORKEY
	vmiData VIDMEMINFO
	lpDriverHandle uintptr
	lpExclusiveOwner uintptr
	dwModeIndex uint32
	dwModeIndexOrig uint32
	dwNumFourCC uint32
	lpdwFourCC uintptr
	dwNumModes uint32
	lpModeInfo uintptr
	plProcessList PROCESS_LIST
	dwSurfaceLockCount uint32
	dwAliasedLockCnt uint32
	dwReserved3 uintptr
	hDD uintptr
	cObsolete [12]int8
	dwReserved1 uint32
	dwReserved2 uint32
	dbnOverlayRoot DBLNODE
	lpwPDeviceFlags uintptr
	dwPDevice uint32
	dwWin16LockCnt uint32
	dwUnused3 uint32
	hInstance uint32
	dwEvent16 uint32
	dwSaveNumModes uint32
	lpD3DGlobalDriverData uintptr
	lpD3DHALCallbacks uintptr
	ddBothCaps DDCORECAPS
	lpDDVideoPortCaps uintptr
	dvpList uintptr
	lpD3DHALCallbacks2 uintptr
	rectDevice RECT
	cMonitors uint32
	gpbmiSrc uintptr
	gpbmiDest uintptr
	phaiHeapAliases uintptr
	hKernelHandle uintptr
	pfnNotifyProc uintptr
	lpDDKernelCaps uintptr
	lpddNLVCaps uintptr
	lpddNLVHELCaps uintptr
	lpddNLVBothCaps uintptr
	lpD3DExtendedCaps uintptr
	dwDOSBoxEvent uint32
	rectDesktop RECT
	cDriverName [32]int8
	lpD3DHALCallbacks3 uintptr
	dwNumZPixelFormats uint32
	lpZPixelFormats uintptr
	mcList uintptr
	hDDVxd uint32
	ddsCapsMore DDSCAPSEX
}
type
  DDSCAPS = record
    dwCaps: DWORD;
  end;

  DDCORECAPS = record
    dwSize: DWORD;
    dwCaps: DWORD;
    dwCaps2: DWORD;
    dwCKeyCaps: DWORD;
    dwFXCaps: DWORD;
    dwFXAlphaCaps: DWORD;
    dwPalCaps: DWORD;
    dwSVCaps: DWORD;
    dwAlphaBltConstBitDepths: DWORD;
    dwAlphaBltPixelBitDepths: DWORD;
    dwAlphaBltSurfaceBitDepths: DWORD;
    dwAlphaOverlayConstBitDepths: DWORD;
    dwAlphaOverlayPixelBitDepths: DWORD;
    dwAlphaOverlaySurfaceBitDepths: DWORD;
    dwZBufferBitDepths: DWORD;
    dwVidMemTotal: DWORD;
    dwVidMemFree: DWORD;
    dwMaxVisibleOverlays: DWORD;
    dwCurrVisibleOverlays: DWORD;
    dwNumFourCCCodes: DWORD;
    dwAlignBoundarySrc: DWORD;
    dwAlignSizeSrc: DWORD;
    dwAlignBoundaryDest: DWORD;
    dwAlignSizeDest: DWORD;
    dwAlignStrideAlign: DWORD;
    dwRops: array[0..7] of DWORD;
    ddsCaps: DDSCAPS;
    dwMinOverlayStretch: DWORD;
    dwMaxOverlayStretch: DWORD;
    dwMinLiveVideoStretch: DWORD;
    dwMaxLiveVideoStretch: DWORD;
    dwMinHwCodecStretch: DWORD;
    dwMaxHwCodecStretch: DWORD;
    dwReserved1: DWORD;
    dwReserved2: DWORD;
    dwReserved3: DWORD;
    dwSVBCaps: DWORD;
    dwSVBCKeyCaps: DWORD;
    dwSVBFXCaps: DWORD;
    dwSVBRops: array[0..7] of DWORD;
    dwVSBCaps: DWORD;
    dwVSBCKeyCaps: DWORD;
    dwVSBFXCaps: DWORD;
    dwVSBRops: array[0..7] of DWORD;
    dwSSBCaps: DWORD;
    dwSSBCKeyCaps: DWORD;
    dwSSBFXCaps: DWORD;
    dwSSBRops: array[0..7] of DWORD;
    dwMaxVideoPorts: DWORD;
    dwCurrVideoPorts: DWORD;
    dwSVBCaps2: DWORD;
  end;

  DDCOLORKEY = record
    dwColorSpaceLowValue: DWORD;
    dwColorSpaceHighValue: DWORD;
  end;

  DDPIXELFORMAT = record
    dwSize: DWORD;
    dwFlags: DWORD;
    dwFourCC: DWORD;
    Anonymous1: _Anonymous1_e__Union;
    Anonymous2: _Anonymous2_e__Union;
    Anonymous3: _Anonymous3_e__Union;
    Anonymous4: _Anonymous4_e__Union;
    Anonymous5: _Anonymous5_e__Union;
  end;

  VIDMEMINFO = record
    fpPrimary: NativeUInt;
    dwFlags: DWORD;
    dwDisplayWidth: DWORD;
    dwDisplayHeight: DWORD;
    lDisplayPitch: Integer;
    ddpfDisplay: DDPIXELFORMAT;
    dwOffscreenAlign: DWORD;
    dwOverlayAlign: DWORD;
    dwTextureAlign: DWORD;
    dwZBufferAlign: DWORD;
    dwAlphaAlign: DWORD;
    dwNumHeaps: DWORD;
    pvmList: Pointer;
  end;

  PROCESS_LIST = record
    lpLink: Pointer;
    dwProcessId: DWORD;
    dwRefCnt: DWORD;
    dwAlphaDepth: DWORD;
    dwZDepth: DWORD;
  end;

  DBLNODE = record
    next: Pointer;
    prev: Pointer;
    object: Pointer;
    object_int: Pointer;
  end;

  RECT = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  DDSCAPSEX = record
    dwCaps2: DWORD;
    dwCaps3: DWORD;
    Anonymous: _Anonymous_e__Union;
  end;

  DDRAWI_DIRECTDRAW_GBL = record
    dwRefCnt: DWORD;
    dwFlags: DWORD;
    fpPrimaryOrig: NativeUInt;
    ddCaps: DDCORECAPS;
    dwInternal1: DWORD;
    dwUnused1: array[0..8] of DWORD;
    lpDDCBtmp: Pointer;
    dsList: Pointer;
    palList: Pointer;
    clipperList: Pointer;
    lp16DD: Pointer;
    dwMaxOverlays: DWORD;
    dwCurrOverlays: DWORD;
    dwMonitorFrequency: DWORD;
    ddHELCaps: DDCORECAPS;
    dwUnused2: array[0..49] of DWORD;
    ddckCKDestOverlay: DDCOLORKEY;
    ddckCKSrcOverlay: DDCOLORKEY;
    vmiData: VIDMEMINFO;
    lpDriverHandle: Pointer;
    lpExclusiveOwner: Pointer;
    dwModeIndex: DWORD;
    dwModeIndexOrig: DWORD;
    dwNumFourCC: DWORD;
    lpdwFourCC: Pointer;
    dwNumModes: DWORD;
    lpModeInfo: Pointer;
    plProcessList: PROCESS_LIST;
    dwSurfaceLockCount: DWORD;
    dwAliasedLockCnt: DWORD;
    dwReserved3: NativeUInt;
    hDD: NativeUInt;
    cObsolete: array[0..11] of Shortint;
    dwReserved1: DWORD;
    dwReserved2: DWORD;
    dbnOverlayRoot: DBLNODE;
    lpwPDeviceFlags: Pointer;
    dwPDevice: DWORD;
    dwWin16LockCnt: DWORD;
    dwUnused3: DWORD;
    hInstance: DWORD;
    dwEvent16: DWORD;
    dwSaveNumModes: DWORD;
    lpD3DGlobalDriverData: NativeUInt;
    lpD3DHALCallbacks: NativeUInt;
    ddBothCaps: DDCORECAPS;
    lpDDVideoPortCaps: Pointer;
    dvpList: Pointer;
    lpD3DHALCallbacks2: NativeUInt;
    rectDevice: RECT;
    cMonitors: DWORD;
    gpbmiSrc: Pointer;
    gpbmiDest: Pointer;
    phaiHeapAliases: Pointer;
    hKernelHandle: NativeUInt;
    pfnNotifyProc: NativeUInt;
    lpDDKernelCaps: Pointer;
    lpddNLVCaps: Pointer;
    lpddNLVHELCaps: Pointer;
    lpddNLVBothCaps: Pointer;
    lpD3DExtendedCaps: NativeUInt;
    dwDOSBoxEvent: DWORD;
    rectDesktop: RECT;
    cDriverName: array[0..31] of Shortint;
    lpD3DHALCallbacks3: NativeUInt;
    dwNumZPixelFormats: DWORD;
    lpZPixelFormats: Pointer;
    mcList: Pointer;
    hDDVxd: DWORD;
    ddsCapsMore: DDSCAPSEX;
  end;
const DDSCAPS = extern struct {
    dwCaps: u32,
};

const DDCORECAPS = extern struct {
    dwSize: u32,
    dwCaps: u32,
    dwCaps2: u32,
    dwCKeyCaps: u32,
    dwFXCaps: u32,
    dwFXAlphaCaps: u32,
    dwPalCaps: u32,
    dwSVCaps: u32,
    dwAlphaBltConstBitDepths: u32,
    dwAlphaBltPixelBitDepths: u32,
    dwAlphaBltSurfaceBitDepths: u32,
    dwAlphaOverlayConstBitDepths: u32,
    dwAlphaOverlayPixelBitDepths: u32,
    dwAlphaOverlaySurfaceBitDepths: u32,
    dwZBufferBitDepths: u32,
    dwVidMemTotal: u32,
    dwVidMemFree: u32,
    dwMaxVisibleOverlays: u32,
    dwCurrVisibleOverlays: u32,
    dwNumFourCCCodes: u32,
    dwAlignBoundarySrc: u32,
    dwAlignSizeSrc: u32,
    dwAlignBoundaryDest: u32,
    dwAlignSizeDest: u32,
    dwAlignStrideAlign: u32,
    dwRops: [8]u32,
    ddsCaps: DDSCAPS,
    dwMinOverlayStretch: u32,
    dwMaxOverlayStretch: u32,
    dwMinLiveVideoStretch: u32,
    dwMaxLiveVideoStretch: u32,
    dwMinHwCodecStretch: u32,
    dwMaxHwCodecStretch: u32,
    dwReserved1: u32,
    dwReserved2: u32,
    dwReserved3: u32,
    dwSVBCaps: u32,
    dwSVBCKeyCaps: u32,
    dwSVBFXCaps: u32,
    dwSVBRops: [8]u32,
    dwVSBCaps: u32,
    dwVSBCKeyCaps: u32,
    dwVSBFXCaps: u32,
    dwVSBRops: [8]u32,
    dwSSBCaps: u32,
    dwSSBCKeyCaps: u32,
    dwSSBFXCaps: u32,
    dwSSBRops: [8]u32,
    dwMaxVideoPorts: u32,
    dwCurrVideoPorts: u32,
    dwSVBCaps2: u32,
};

const DDCOLORKEY = extern struct {
    dwColorSpaceLowValue: u32,
    dwColorSpaceHighValue: u32,
};

const DDPIXELFORMAT = extern struct {
    dwSize: u32,
    dwFlags: u32,
    dwFourCC: u32,
    Anonymous1: _Anonymous1_e__Union,
    Anonymous2: _Anonymous2_e__Union,
    Anonymous3: _Anonymous3_e__Union,
    Anonymous4: _Anonymous4_e__Union,
    Anonymous5: _Anonymous5_e__Union,
};

const VIDMEMINFO = extern struct {
    fpPrimary: usize,
    dwFlags: u32,
    dwDisplayWidth: u32,
    dwDisplayHeight: u32,
    lDisplayPitch: i32,
    ddpfDisplay: DDPIXELFORMAT,
    dwOffscreenAlign: u32,
    dwOverlayAlign: u32,
    dwTextureAlign: u32,
    dwZBufferAlign: u32,
    dwAlphaAlign: u32,
    dwNumHeaps: u32,
    pvmList: ?*anyopaque,
};

const PROCESS_LIST = extern struct {
    lpLink: ?*anyopaque,
    dwProcessId: u32,
    dwRefCnt: u32,
    dwAlphaDepth: u32,
    dwZDepth: u32,
};

const DBLNODE = extern struct {
    next: ?*anyopaque,
    prev: ?*anyopaque,
    object: ?*anyopaque,
    object_int: ?*anyopaque,
};

const RECT = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const DDSCAPSEX = extern struct {
    dwCaps2: u32,
    dwCaps3: u32,
    Anonymous: _Anonymous_e__Union,
};

const DDRAWI_DIRECTDRAW_GBL = extern struct {
    dwRefCnt: u32,
    dwFlags: u32,
    fpPrimaryOrig: usize,
    ddCaps: DDCORECAPS,
    dwInternal1: u32,
    dwUnused1: [9]u32,
    lpDDCBtmp: ?*anyopaque,
    dsList: ?*anyopaque,
    palList: ?*anyopaque,
    clipperList: ?*anyopaque,
    lp16DD: ?*anyopaque,
    dwMaxOverlays: u32,
    dwCurrOverlays: u32,
    dwMonitorFrequency: u32,
    ddHELCaps: DDCORECAPS,
    dwUnused2: [50]u32,
    ddckCKDestOverlay: DDCOLORKEY,
    ddckCKSrcOverlay: DDCOLORKEY,
    vmiData: VIDMEMINFO,
    lpDriverHandle: ?*anyopaque,
    lpExclusiveOwner: ?*anyopaque,
    dwModeIndex: u32,
    dwModeIndexOrig: u32,
    dwNumFourCC: u32,
    lpdwFourCC: ?*anyopaque,
    dwNumModes: u32,
    lpModeInfo: ?*anyopaque,
    plProcessList: PROCESS_LIST,
    dwSurfaceLockCount: u32,
    dwAliasedLockCnt: u32,
    dwReserved3: usize,
    hDD: usize,
    cObsolete: [12]i8,
    dwReserved1: u32,
    dwReserved2: u32,
    dbnOverlayRoot: DBLNODE,
    lpwPDeviceFlags: ?*anyopaque,
    dwPDevice: u32,
    dwWin16LockCnt: u32,
    dwUnused3: u32,
    hInstance: u32,
    dwEvent16: u32,
    dwSaveNumModes: u32,
    lpD3DGlobalDriverData: usize,
    lpD3DHALCallbacks: usize,
    ddBothCaps: DDCORECAPS,
    lpDDVideoPortCaps: ?*anyopaque,
    dvpList: ?*anyopaque,
    lpD3DHALCallbacks2: usize,
    rectDevice: RECT,
    cMonitors: u32,
    gpbmiSrc: ?*anyopaque,
    gpbmiDest: ?*anyopaque,
    phaiHeapAliases: ?*anyopaque,
    hKernelHandle: usize,
    pfnNotifyProc: usize,
    lpDDKernelCaps: ?*anyopaque,
    lpddNLVCaps: ?*anyopaque,
    lpddNLVHELCaps: ?*anyopaque,
    lpddNLVBothCaps: ?*anyopaque,
    lpD3DExtendedCaps: usize,
    dwDOSBoxEvent: u32,
    rectDesktop: RECT,
    cDriverName: [32]i8,
    lpD3DHALCallbacks3: usize,
    dwNumZPixelFormats: u32,
    lpZPixelFormats: ?*anyopaque,
    mcList: ?*anyopaque,
    hDDVxd: u32,
    ddsCapsMore: DDSCAPSEX,
};
type
  DDSCAPS {.bycopy.} = object
    dwCaps: uint32

  DDCORECAPS {.bycopy.} = object
    dwSize: uint32
    dwCaps: uint32
    dwCaps2: uint32
    dwCKeyCaps: uint32
    dwFXCaps: uint32
    dwFXAlphaCaps: uint32
    dwPalCaps: uint32
    dwSVCaps: uint32
    dwAlphaBltConstBitDepths: uint32
    dwAlphaBltPixelBitDepths: uint32
    dwAlphaBltSurfaceBitDepths: uint32
    dwAlphaOverlayConstBitDepths: uint32
    dwAlphaOverlayPixelBitDepths: uint32
    dwAlphaOverlaySurfaceBitDepths: uint32
    dwZBufferBitDepths: uint32
    dwVidMemTotal: uint32
    dwVidMemFree: uint32
    dwMaxVisibleOverlays: uint32
    dwCurrVisibleOverlays: uint32
    dwNumFourCCCodes: uint32
    dwAlignBoundarySrc: uint32
    dwAlignSizeSrc: uint32
    dwAlignBoundaryDest: uint32
    dwAlignSizeDest: uint32
    dwAlignStrideAlign: uint32
    dwRops: array[8, uint32]
    ddsCaps: DDSCAPS
    dwMinOverlayStretch: uint32
    dwMaxOverlayStretch: uint32
    dwMinLiveVideoStretch: uint32
    dwMaxLiveVideoStretch: uint32
    dwMinHwCodecStretch: uint32
    dwMaxHwCodecStretch: uint32
    dwReserved1: uint32
    dwReserved2: uint32
    dwReserved3: uint32
    dwSVBCaps: uint32
    dwSVBCKeyCaps: uint32
    dwSVBFXCaps: uint32
    dwSVBRops: array[8, uint32]
    dwVSBCaps: uint32
    dwVSBCKeyCaps: uint32
    dwVSBFXCaps: uint32
    dwVSBRops: array[8, uint32]
    dwSSBCaps: uint32
    dwSSBCKeyCaps: uint32
    dwSSBFXCaps: uint32
    dwSSBRops: array[8, uint32]
    dwMaxVideoPorts: uint32
    dwCurrVideoPorts: uint32
    dwSVBCaps2: uint32

  DDCOLORKEY {.bycopy.} = object
    dwColorSpaceLowValue: uint32
    dwColorSpaceHighValue: uint32

  DDPIXELFORMAT {.bycopy.} = object
    dwSize: uint32
    dwFlags: uint32
    dwFourCC: uint32
    Anonymous1: _Anonymous1_e__Union
    Anonymous2: _Anonymous2_e__Union
    Anonymous3: _Anonymous3_e__Union
    Anonymous4: _Anonymous4_e__Union
    Anonymous5: _Anonymous5_e__Union

  VIDMEMINFO {.bycopy.} = object
    fpPrimary: uint
    dwFlags: uint32
    dwDisplayWidth: uint32
    dwDisplayHeight: uint32
    lDisplayPitch: int32
    ddpfDisplay: DDPIXELFORMAT
    dwOffscreenAlign: uint32
    dwOverlayAlign: uint32
    dwTextureAlign: uint32
    dwZBufferAlign: uint32
    dwAlphaAlign: uint32
    dwNumHeaps: uint32
    pvmList: pointer

  PROCESS_LIST {.bycopy.} = object
    lpLink: pointer
    dwProcessId: uint32
    dwRefCnt: uint32
    dwAlphaDepth: uint32
    dwZDepth: uint32

  DBLNODE {.bycopy.} = object
    next: pointer
    prev: pointer
    object: pointer
    object_int: pointer

  RECT {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  DDSCAPSEX {.bycopy.} = object
    dwCaps2: uint32
    dwCaps3: uint32
    Anonymous: _Anonymous_e__Union

  DDRAWI_DIRECTDRAW_GBL {.bycopy.} = object
    dwRefCnt: uint32
    dwFlags: uint32
    fpPrimaryOrig: uint
    ddCaps: DDCORECAPS
    dwInternal1: uint32
    dwUnused1: array[9, uint32]
    lpDDCBtmp: pointer
    dsList: pointer
    palList: pointer
    clipperList: pointer
    lp16DD: pointer
    dwMaxOverlays: uint32
    dwCurrOverlays: uint32
    dwMonitorFrequency: uint32
    ddHELCaps: DDCORECAPS
    dwUnused2: array[50, uint32]
    ddckCKDestOverlay: DDCOLORKEY
    ddckCKSrcOverlay: DDCOLORKEY
    vmiData: VIDMEMINFO
    lpDriverHandle: pointer
    lpExclusiveOwner: pointer
    dwModeIndex: uint32
    dwModeIndexOrig: uint32
    dwNumFourCC: uint32
    lpdwFourCC: pointer
    dwNumModes: uint32
    lpModeInfo: pointer
    plProcessList: PROCESS_LIST
    dwSurfaceLockCount: uint32
    dwAliasedLockCnt: uint32
    dwReserved3: uint
    hDD: uint
    cObsolete: array[12, int8]
    dwReserved1: uint32
    dwReserved2: uint32
    dbnOverlayRoot: DBLNODE
    lpwPDeviceFlags: pointer
    dwPDevice: uint32
    dwWin16LockCnt: uint32
    dwUnused3: uint32
    hInstance: uint32
    dwEvent16: uint32
    dwSaveNumModes: uint32
    lpD3DGlobalDriverData: uint
    lpD3DHALCallbacks: uint
    ddBothCaps: DDCORECAPS
    lpDDVideoPortCaps: pointer
    dvpList: pointer
    lpD3DHALCallbacks2: uint
    rectDevice: RECT
    cMonitors: uint32
    gpbmiSrc: pointer
    gpbmiDest: pointer
    phaiHeapAliases: pointer
    hKernelHandle: uint
    pfnNotifyProc: uint
    lpDDKernelCaps: pointer
    lpddNLVCaps: pointer
    lpddNLVHELCaps: pointer
    lpddNLVBothCaps: pointer
    lpD3DExtendedCaps: uint
    dwDOSBoxEvent: uint32
    rectDesktop: RECT
    cDriverName: array[32, int8]
    lpD3DHALCallbacks3: uint
    dwNumZPixelFormats: uint32
    lpZPixelFormats: pointer
    mcList: pointer
    hDDVxd: uint32
    ddsCapsMore: DDSCAPSEX
struct DDSCAPS
{
    uint dwCaps;
}

struct DDCORECAPS
{
    uint dwSize;
    uint dwCaps;
    uint dwCaps2;
    uint dwCKeyCaps;
    uint dwFXCaps;
    uint dwFXAlphaCaps;
    uint dwPalCaps;
    uint dwSVCaps;
    uint dwAlphaBltConstBitDepths;
    uint dwAlphaBltPixelBitDepths;
    uint dwAlphaBltSurfaceBitDepths;
    uint dwAlphaOverlayConstBitDepths;
    uint dwAlphaOverlayPixelBitDepths;
    uint dwAlphaOverlaySurfaceBitDepths;
    uint dwZBufferBitDepths;
    uint dwVidMemTotal;
    uint dwVidMemFree;
    uint dwMaxVisibleOverlays;
    uint dwCurrVisibleOverlays;
    uint dwNumFourCCCodes;
    uint dwAlignBoundarySrc;
    uint dwAlignSizeSrc;
    uint dwAlignBoundaryDest;
    uint dwAlignSizeDest;
    uint dwAlignStrideAlign;
    uint[8] dwRops;
    DDSCAPS ddsCaps;
    uint dwMinOverlayStretch;
    uint dwMaxOverlayStretch;
    uint dwMinLiveVideoStretch;
    uint dwMaxLiveVideoStretch;
    uint dwMinHwCodecStretch;
    uint dwMaxHwCodecStretch;
    uint dwReserved1;
    uint dwReserved2;
    uint dwReserved3;
    uint dwSVBCaps;
    uint dwSVBCKeyCaps;
    uint dwSVBFXCaps;
    uint[8] dwSVBRops;
    uint dwVSBCaps;
    uint dwVSBCKeyCaps;
    uint dwVSBFXCaps;
    uint[8] dwVSBRops;
    uint dwSSBCaps;
    uint dwSSBCKeyCaps;
    uint dwSSBFXCaps;
    uint[8] dwSSBRops;
    uint dwMaxVideoPorts;
    uint dwCurrVideoPorts;
    uint dwSVBCaps2;
}

struct DDCOLORKEY
{
    uint dwColorSpaceLowValue;
    uint dwColorSpaceHighValue;
}

struct DDPIXELFORMAT
{
    uint dwSize;
    uint dwFlags;
    uint dwFourCC;
    _Anonymous1_e__Union Anonymous1;
    _Anonymous2_e__Union Anonymous2;
    _Anonymous3_e__Union Anonymous3;
    _Anonymous4_e__Union Anonymous4;
    _Anonymous5_e__Union Anonymous5;
}

struct VIDMEMINFO
{
    size_t fpPrimary;
    uint dwFlags;
    uint dwDisplayWidth;
    uint dwDisplayHeight;
    int lDisplayPitch;
    DDPIXELFORMAT ddpfDisplay;
    uint dwOffscreenAlign;
    uint dwOverlayAlign;
    uint dwTextureAlign;
    uint dwZBufferAlign;
    uint dwAlphaAlign;
    uint dwNumHeaps;
    void* pvmList;
}

struct PROCESS_LIST
{
    void* lpLink;
    uint dwProcessId;
    uint dwRefCnt;
    uint dwAlphaDepth;
    uint dwZDepth;
}

struct DBLNODE
{
    void* next;
    void* prev;
    void* object;
    void* object_int;
}

struct RECT
{
    int left;
    int top;
    int right;
    int bottom;
}

struct DDSCAPSEX
{
    uint dwCaps2;
    uint dwCaps3;
    _Anonymous_e__Union Anonymous;
}

struct DDRAWI_DIRECTDRAW_GBL
{
    uint dwRefCnt;
    uint dwFlags;
    size_t fpPrimaryOrig;
    DDCORECAPS ddCaps;
    uint dwInternal1;
    uint[9] dwUnused1;
    void* lpDDCBtmp;
    void* dsList;
    void* palList;
    void* clipperList;
    void* lp16DD;
    uint dwMaxOverlays;
    uint dwCurrOverlays;
    uint dwMonitorFrequency;
    DDCORECAPS ddHELCaps;
    uint[50] dwUnused2;
    DDCOLORKEY ddckCKDestOverlay;
    DDCOLORKEY ddckCKSrcOverlay;
    VIDMEMINFO vmiData;
    void* lpDriverHandle;
    void* lpExclusiveOwner;
    uint dwModeIndex;
    uint dwModeIndexOrig;
    uint dwNumFourCC;
    void* lpdwFourCC;
    uint dwNumModes;
    void* lpModeInfo;
    PROCESS_LIST plProcessList;
    uint dwSurfaceLockCount;
    uint dwAliasedLockCnt;
    size_t dwReserved3;
    size_t hDD;
    byte[12] cObsolete;
    uint dwReserved1;
    uint dwReserved2;
    DBLNODE dbnOverlayRoot;
    void* lpwPDeviceFlags;
    uint dwPDevice;
    uint dwWin16LockCnt;
    uint dwUnused3;
    uint hInstance;
    uint dwEvent16;
    uint dwSaveNumModes;
    size_t lpD3DGlobalDriverData;
    size_t lpD3DHALCallbacks;
    DDCORECAPS ddBothCaps;
    void* lpDDVideoPortCaps;
    void* dvpList;
    size_t lpD3DHALCallbacks2;
    RECT rectDevice;
    uint cMonitors;
    void* gpbmiSrc;
    void* gpbmiDest;
    void* phaiHeapAliases;
    size_t hKernelHandle;
    size_t pfnNotifyProc;
    void* lpDDKernelCaps;
    void* lpddNLVCaps;
    void* lpddNLVHELCaps;
    void* lpddNLVBothCaps;
    size_t lpD3DExtendedCaps;
    uint dwDOSBoxEvent;
    RECT rectDesktop;
    byte[32] cDriverName;
    size_t lpD3DHALCallbacks3;
    uint dwNumZPixelFormats;
    void* lpZPixelFormats;
    void* mcList;
    uint hDDVxd;
    DDSCAPSEX ddsCapsMore;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DDRAWI_DIRECTDRAW_GBL サイズ: 1624 バイト(x86)
dim st, 406    ; 4byte整数×406(構造体サイズ 1624 / 4 切り上げ)
; dwRefCnt : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; fpPrimaryOrig : UINT_PTR (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; ddCaps : DDCORECAPS (+12, 316byte)  varptr(st)+12 を基点に操作(316byte:入れ子/配列)
; dwInternal1 : DWORD (+328, 4byte)  st.82 = 値  /  値 = st.82   (lpoke/lpeek も可)
; dwUnused1 : DWORD (+332, 36byte)  varptr(st)+332 を基点に操作(36byte:入れ子/配列)
; lpDDCBtmp : DDHAL_CALLBACKS* (+368, 4byte)  varptr(st)+368 を基点に操作(4byte:入れ子/配列)
; dsList : DDRAWI_DDRAWSURFACE_INT* (+372, 4byte)  varptr(st)+372 を基点に操作(4byte:入れ子/配列)
; palList : DDRAWI_DDRAWPALETTE_INT* (+376, 4byte)  varptr(st)+376 を基点に操作(4byte:入れ子/配列)
; clipperList : DDRAWI_DDRAWCLIPPER_INT* (+380, 4byte)  varptr(st)+380 を基点に操作(4byte:入れ子/配列)
; lp16DD : DDRAWI_DIRECTDRAW_GBL* (+384, 4byte)  varptr(st)+384 を基点に操作(4byte:入れ子/配列)
; dwMaxOverlays : DWORD (+388, 4byte)  st.97 = 値  /  値 = st.97   (lpoke/lpeek も可)
; dwCurrOverlays : DWORD (+392, 4byte)  st.98 = 値  /  値 = st.98   (lpoke/lpeek も可)
; dwMonitorFrequency : DWORD (+396, 4byte)  st.99 = 値  /  値 = st.99   (lpoke/lpeek も可)
; ddHELCaps : DDCORECAPS (+400, 316byte)  varptr(st)+400 を基点に操作(316byte:入れ子/配列)
; dwUnused2 : DWORD (+716, 200byte)  varptr(st)+716 を基点に操作(200byte:入れ子/配列)
; ddckCKDestOverlay : DDCOLORKEY (+916, 8byte)  varptr(st)+916 を基点に操作(8byte:入れ子/配列)
; ddckCKSrcOverlay : DDCOLORKEY (+924, 8byte)  varptr(st)+924 を基点に操作(8byte:入れ子/配列)
; vmiData : VIDMEMINFO (+932, 80byte)  varptr(st)+932 を基点に操作(80byte:入れ子/配列)
; lpDriverHandle : void* (+1012, 4byte)  st.253 = 値  /  値 = st.253   (lpoke/lpeek も可)
; lpExclusiveOwner : DDRAWI_DIRECTDRAW_LCL* (+1016, 4byte)  varptr(st)+1016 を基点に操作(4byte:入れ子/配列)
; dwModeIndex : DWORD (+1020, 4byte)  st.255 = 値  /  値 = st.255   (lpoke/lpeek も可)
; dwModeIndexOrig : DWORD (+1024, 4byte)  st.256 = 値  /  値 = st.256   (lpoke/lpeek も可)
; dwNumFourCC : DWORD (+1028, 4byte)  st.257 = 値  /  値 = st.257   (lpoke/lpeek も可)
; lpdwFourCC : DWORD* (+1032, 4byte)  st.258 = 値  /  値 = st.258   (lpoke/lpeek も可)
; dwNumModes : DWORD (+1036, 4byte)  st.259 = 値  /  値 = st.259   (lpoke/lpeek も可)
; lpModeInfo : DDHALMODEINFO* (+1040, 4byte)  varptr(st)+1040 を基点に操作(4byte:入れ子/配列)
; plProcessList : PROCESS_LIST (+1044, 20byte)  varptr(st)+1044 を基点に操作(20byte:入れ子/配列)
; dwSurfaceLockCount : DWORD (+1064, 4byte)  st.266 = 値  /  値 = st.266   (lpoke/lpeek も可)
; dwAliasedLockCnt : DWORD (+1068, 4byte)  st.267 = 値  /  値 = st.267   (lpoke/lpeek も可)
; dwReserved3 : UINT_PTR (+1072, 4byte)  st.268 = 値  /  値 = st.268   (lpoke/lpeek も可)
; hDD : UINT_PTR (+1076, 4byte)  st.269 = 値  /  値 = st.269   (lpoke/lpeek も可)
; cObsolete : CHAR (+1080, 12byte)  varptr(st)+1080 を基点に操作(12byte:入れ子/配列)
; dwReserved1 : DWORD (+1092, 4byte)  st.273 = 値  /  値 = st.273   (lpoke/lpeek も可)
; dwReserved2 : DWORD (+1096, 4byte)  st.274 = 値  /  値 = st.274   (lpoke/lpeek も可)
; dbnOverlayRoot : DBLNODE (+1100, 16byte)  varptr(st)+1100 を基点に操作(16byte:入れ子/配列)
; lpwPDeviceFlags : WORD* (+1116, 4byte)  st.279 = 値  /  値 = st.279   (lpoke/lpeek も可)
; dwPDevice : DWORD (+1120, 4byte)  st.280 = 値  /  値 = st.280   (lpoke/lpeek も可)
; dwWin16LockCnt : DWORD (+1124, 4byte)  st.281 = 値  /  値 = st.281   (lpoke/lpeek も可)
; dwUnused3 : DWORD (+1128, 4byte)  st.282 = 値  /  値 = st.282   (lpoke/lpeek も可)
; hInstance : DWORD (+1132, 4byte)  st.283 = 値  /  値 = st.283   (lpoke/lpeek も可)
; dwEvent16 : DWORD (+1136, 4byte)  st.284 = 値  /  値 = st.284   (lpoke/lpeek も可)
; dwSaveNumModes : DWORD (+1140, 4byte)  st.285 = 値  /  値 = st.285   (lpoke/lpeek も可)
; lpD3DGlobalDriverData : UINT_PTR (+1144, 4byte)  st.286 = 値  /  値 = st.286   (lpoke/lpeek も可)
; lpD3DHALCallbacks : UINT_PTR (+1148, 4byte)  st.287 = 値  /  値 = st.287   (lpoke/lpeek も可)
; ddBothCaps : DDCORECAPS (+1152, 316byte)  varptr(st)+1152 を基点に操作(316byte:入れ子/配列)
; lpDDVideoPortCaps : DDVIDEOPORTCAPS* (+1468, 4byte)  varptr(st)+1468 を基点に操作(4byte:入れ子/配列)
; dvpList : DDRAWI_DDVIDEOPORT_INT* (+1472, 4byte)  varptr(st)+1472 を基点に操作(4byte:入れ子/配列)
; lpD3DHALCallbacks2 : UINT_PTR (+1476, 4byte)  st.369 = 値  /  値 = st.369   (lpoke/lpeek も可)
; rectDevice : RECT (+1480, 16byte)  varptr(st)+1480 を基点に操作(16byte:入れ子/配列)
; cMonitors : DWORD (+1496, 4byte)  st.374 = 値  /  値 = st.374   (lpoke/lpeek も可)
; gpbmiSrc : void* (+1500, 4byte)  st.375 = 値  /  値 = st.375   (lpoke/lpeek も可)
; gpbmiDest : void* (+1504, 4byte)  st.376 = 値  /  値 = st.376   (lpoke/lpeek も可)
; phaiHeapAliases : HEAPALIASINFO* (+1508, 4byte)  varptr(st)+1508 を基点に操作(4byte:入れ子/配列)
; hKernelHandle : UINT_PTR (+1512, 4byte)  st.378 = 値  /  値 = st.378   (lpoke/lpeek も可)
; pfnNotifyProc : UINT_PTR (+1516, 4byte)  st.379 = 値  /  値 = st.379   (lpoke/lpeek も可)
; lpDDKernelCaps : DDKERNELCAPS* (+1520, 4byte)  varptr(st)+1520 を基点に操作(4byte:入れ子/配列)
; lpddNLVCaps : DDNONLOCALVIDMEMCAPS* (+1524, 4byte)  varptr(st)+1524 を基点に操作(4byte:入れ子/配列)
; lpddNLVHELCaps : DDNONLOCALVIDMEMCAPS* (+1528, 4byte)  varptr(st)+1528 を基点に操作(4byte:入れ子/配列)
; lpddNLVBothCaps : DDNONLOCALVIDMEMCAPS* (+1532, 4byte)  varptr(st)+1532 を基点に操作(4byte:入れ子/配列)
; lpD3DExtendedCaps : UINT_PTR (+1536, 4byte)  st.384 = 値  /  値 = st.384   (lpoke/lpeek も可)
; dwDOSBoxEvent : DWORD (+1540, 4byte)  st.385 = 値  /  値 = st.385   (lpoke/lpeek も可)
; rectDesktop : RECT (+1544, 16byte)  varptr(st)+1544 を基点に操作(16byte:入れ子/配列)
; cDriverName : CHAR (+1560, 32byte)  varptr(st)+1560 を基点に操作(32byte:入れ子/配列)
; lpD3DHALCallbacks3 : UINT_PTR (+1592, 4byte)  st.398 = 値  /  値 = st.398   (lpoke/lpeek も可)
; dwNumZPixelFormats : DWORD (+1596, 4byte)  st.399 = 値  /  値 = st.399   (lpoke/lpeek も可)
; lpZPixelFormats : DDPIXELFORMAT* (+1600, 4byte)  varptr(st)+1600 を基点に操作(4byte:入れ子/配列)
; mcList : DDRAWI_DDMOTIONCOMP_INT* (+1604, 4byte)  varptr(st)+1604 を基点に操作(4byte:入れ子/配列)
; hDDVxd : DWORD (+1608, 4byte)  st.402 = 値  /  値 = st.402   (lpoke/lpeek も可)
; ddsCapsMore : DDSCAPSEX (+1612, 12byte)  varptr(st)+1612 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DDRAWI_DIRECTDRAW_GBL サイズ: 1816 バイト(x64)
dim st, 454    ; 4byte整数×454(構造体サイズ 1816 / 4 切り上げ)
; dwRefCnt : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; fpPrimaryOrig : UINT_PTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; ddCaps : DDCORECAPS (+16, 316byte)  varptr(st)+16 を基点に操作(316byte:入れ子/配列)
; dwInternal1 : DWORD (+332, 4byte)  st.83 = 値  /  値 = st.83   (lpoke/lpeek も可)
; dwUnused1 : DWORD (+336, 36byte)  varptr(st)+336 を基点に操作(36byte:入れ子/配列)
; lpDDCBtmp : DDHAL_CALLBACKS* (+376, 8byte)  varptr(st)+376 を基点に操作(8byte:入れ子/配列)
; dsList : DDRAWI_DDRAWSURFACE_INT* (+384, 8byte)  varptr(st)+384 を基点に操作(8byte:入れ子/配列)
; palList : DDRAWI_DDRAWPALETTE_INT* (+392, 8byte)  varptr(st)+392 を基点に操作(8byte:入れ子/配列)
; clipperList : DDRAWI_DDRAWCLIPPER_INT* (+400, 8byte)  varptr(st)+400 を基点に操作(8byte:入れ子/配列)
; lp16DD : DDRAWI_DIRECTDRAW_GBL* (+408, 8byte)  varptr(st)+408 を基点に操作(8byte:入れ子/配列)
; dwMaxOverlays : DWORD (+416, 4byte)  st.104 = 値  /  値 = st.104   (lpoke/lpeek も可)
; dwCurrOverlays : DWORD (+420, 4byte)  st.105 = 値  /  値 = st.105   (lpoke/lpeek も可)
; dwMonitorFrequency : DWORD (+424, 4byte)  st.106 = 値  /  値 = st.106   (lpoke/lpeek も可)
; ddHELCaps : DDCORECAPS (+428, 316byte)  varptr(st)+428 を基点に操作(316byte:入れ子/配列)
; dwUnused2 : DWORD (+744, 200byte)  varptr(st)+744 を基点に操作(200byte:入れ子/配列)
; ddckCKDestOverlay : DDCOLORKEY (+944, 8byte)  varptr(st)+944 を基点に操作(8byte:入れ子/配列)
; ddckCKSrcOverlay : DDCOLORKEY (+952, 8byte)  varptr(st)+952 を基点に操作(8byte:入れ子/配列)
; vmiData : VIDMEMINFO (+960, 96byte)  varptr(st)+960 を基点に操作(96byte:入れ子/配列)
; lpDriverHandle : void* (+1056, 8byte)  qpoke st,1056,値 / qpeek(st,1056)  ※IronHSPのみ。3.7/3.8は lpoke st,1056,下位 : lpoke st,1060,上位
; lpExclusiveOwner : DDRAWI_DIRECTDRAW_LCL* (+1064, 8byte)  varptr(st)+1064 を基点に操作(8byte:入れ子/配列)
; dwModeIndex : DWORD (+1072, 4byte)  st.268 = 値  /  値 = st.268   (lpoke/lpeek も可)
; dwModeIndexOrig : DWORD (+1076, 4byte)  st.269 = 値  /  値 = st.269   (lpoke/lpeek も可)
; dwNumFourCC : DWORD (+1080, 4byte)  st.270 = 値  /  値 = st.270   (lpoke/lpeek も可)
; lpdwFourCC : DWORD* (+1088, 8byte)  qpoke st,1088,値 / qpeek(st,1088)  ※IronHSPのみ。3.7/3.8は lpoke st,1088,下位 : lpoke st,1092,上位
; dwNumModes : DWORD (+1096, 4byte)  st.274 = 値  /  値 = st.274   (lpoke/lpeek も可)
; lpModeInfo : DDHALMODEINFO* (+1104, 8byte)  varptr(st)+1104 を基点に操作(8byte:入れ子/配列)
; plProcessList : PROCESS_LIST (+1112, 24byte)  varptr(st)+1112 を基点に操作(24byte:入れ子/配列)
; dwSurfaceLockCount : DWORD (+1136, 4byte)  st.284 = 値  /  値 = st.284   (lpoke/lpeek も可)
; dwAliasedLockCnt : DWORD (+1140, 4byte)  st.285 = 値  /  値 = st.285   (lpoke/lpeek も可)
; dwReserved3 : UINT_PTR (+1144, 8byte)  qpoke st,1144,値 / qpeek(st,1144)  ※IronHSPのみ。3.7/3.8は lpoke st,1144,下位 : lpoke st,1148,上位
; hDD : UINT_PTR (+1152, 8byte)  qpoke st,1152,値 / qpeek(st,1152)  ※IronHSPのみ。3.7/3.8は lpoke st,1152,下位 : lpoke st,1156,上位
; cObsolete : CHAR (+1160, 12byte)  varptr(st)+1160 を基点に操作(12byte:入れ子/配列)
; dwReserved1 : DWORD (+1172, 4byte)  st.293 = 値  /  値 = st.293   (lpoke/lpeek も可)
; dwReserved2 : DWORD (+1176, 4byte)  st.294 = 値  /  値 = st.294   (lpoke/lpeek も可)
; dbnOverlayRoot : DBLNODE (+1184, 32byte)  varptr(st)+1184 を基点に操作(32byte:入れ子/配列)
; lpwPDeviceFlags : WORD* (+1216, 8byte)  qpoke st,1216,値 / qpeek(st,1216)  ※IronHSPのみ。3.7/3.8は lpoke st,1216,下位 : lpoke st,1220,上位
; dwPDevice : DWORD (+1224, 4byte)  st.306 = 値  /  値 = st.306   (lpoke/lpeek も可)
; dwWin16LockCnt : DWORD (+1228, 4byte)  st.307 = 値  /  値 = st.307   (lpoke/lpeek も可)
; dwUnused3 : DWORD (+1232, 4byte)  st.308 = 値  /  値 = st.308   (lpoke/lpeek も可)
; hInstance : DWORD (+1236, 4byte)  st.309 = 値  /  値 = st.309   (lpoke/lpeek も可)
; dwEvent16 : DWORD (+1240, 4byte)  st.310 = 値  /  値 = st.310   (lpoke/lpeek も可)
; dwSaveNumModes : DWORD (+1244, 4byte)  st.311 = 値  /  値 = st.311   (lpoke/lpeek も可)
; lpD3DGlobalDriverData : UINT_PTR (+1248, 8byte)  qpoke st,1248,値 / qpeek(st,1248)  ※IronHSPのみ。3.7/3.8は lpoke st,1248,下位 : lpoke st,1252,上位
; lpD3DHALCallbacks : UINT_PTR (+1256, 8byte)  qpoke st,1256,値 / qpeek(st,1256)  ※IronHSPのみ。3.7/3.8は lpoke st,1256,下位 : lpoke st,1260,上位
; ddBothCaps : DDCORECAPS (+1264, 316byte)  varptr(st)+1264 を基点に操作(316byte:入れ子/配列)
; lpDDVideoPortCaps : DDVIDEOPORTCAPS* (+1584, 8byte)  varptr(st)+1584 を基点に操作(8byte:入れ子/配列)
; dvpList : DDRAWI_DDVIDEOPORT_INT* (+1592, 8byte)  varptr(st)+1592 を基点に操作(8byte:入れ子/配列)
; lpD3DHALCallbacks2 : UINT_PTR (+1600, 8byte)  qpoke st,1600,値 / qpeek(st,1600)  ※IronHSPのみ。3.7/3.8は lpoke st,1600,下位 : lpoke st,1604,上位
; rectDevice : RECT (+1608, 16byte)  varptr(st)+1608 を基点に操作(16byte:入れ子/配列)
; cMonitors : DWORD (+1624, 4byte)  st.406 = 値  /  値 = st.406   (lpoke/lpeek も可)
; gpbmiSrc : void* (+1632, 8byte)  qpoke st,1632,値 / qpeek(st,1632)  ※IronHSPのみ。3.7/3.8は lpoke st,1632,下位 : lpoke st,1636,上位
; gpbmiDest : void* (+1640, 8byte)  qpoke st,1640,値 / qpeek(st,1640)  ※IronHSPのみ。3.7/3.8は lpoke st,1640,下位 : lpoke st,1644,上位
; phaiHeapAliases : HEAPALIASINFO* (+1648, 8byte)  varptr(st)+1648 を基点に操作(8byte:入れ子/配列)
; hKernelHandle : UINT_PTR (+1656, 8byte)  qpoke st,1656,値 / qpeek(st,1656)  ※IronHSPのみ。3.7/3.8は lpoke st,1656,下位 : lpoke st,1660,上位
; pfnNotifyProc : UINT_PTR (+1664, 8byte)  qpoke st,1664,値 / qpeek(st,1664)  ※IronHSPのみ。3.7/3.8は lpoke st,1664,下位 : lpoke st,1668,上位
; lpDDKernelCaps : DDKERNELCAPS* (+1672, 8byte)  varptr(st)+1672 を基点に操作(8byte:入れ子/配列)
; lpddNLVCaps : DDNONLOCALVIDMEMCAPS* (+1680, 8byte)  varptr(st)+1680 を基点に操作(8byte:入れ子/配列)
; lpddNLVHELCaps : DDNONLOCALVIDMEMCAPS* (+1688, 8byte)  varptr(st)+1688 を基点に操作(8byte:入れ子/配列)
; lpddNLVBothCaps : DDNONLOCALVIDMEMCAPS* (+1696, 8byte)  varptr(st)+1696 を基点に操作(8byte:入れ子/配列)
; lpD3DExtendedCaps : UINT_PTR (+1704, 8byte)  qpoke st,1704,値 / qpeek(st,1704)  ※IronHSPのみ。3.7/3.8は lpoke st,1704,下位 : lpoke st,1708,上位
; dwDOSBoxEvent : DWORD (+1712, 4byte)  st.428 = 値  /  値 = st.428   (lpoke/lpeek も可)
; rectDesktop : RECT (+1716, 16byte)  varptr(st)+1716 を基点に操作(16byte:入れ子/配列)
; cDriverName : CHAR (+1732, 32byte)  varptr(st)+1732 を基点に操作(32byte:入れ子/配列)
; lpD3DHALCallbacks3 : UINT_PTR (+1768, 8byte)  qpoke st,1768,値 / qpeek(st,1768)  ※IronHSPのみ。3.7/3.8は lpoke st,1768,下位 : lpoke st,1772,上位
; dwNumZPixelFormats : DWORD (+1776, 4byte)  st.444 = 値  /  値 = st.444   (lpoke/lpeek も可)
; lpZPixelFormats : DDPIXELFORMAT* (+1784, 8byte)  varptr(st)+1784 を基点に操作(8byte:入れ子/配列)
; mcList : DDRAWI_DDMOTIONCOMP_INT* (+1792, 8byte)  varptr(st)+1792 を基点に操作(8byte:入れ子/配列)
; hDDVxd : DWORD (+1800, 4byte)  st.450 = 値  /  値 = st.450   (lpoke/lpeek も可)
; ddsCapsMore : DDSCAPSEX (+1804, 12byte)  varptr(st)+1804 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DDSCAPS
    #field int dwCaps
#endstruct

#defstruct global DDCORECAPS
    #field int dwSize
    #field int dwCaps
    #field int dwCaps2
    #field int dwCKeyCaps
    #field int dwFXCaps
    #field int dwFXAlphaCaps
    #field int dwPalCaps
    #field int dwSVCaps
    #field int dwAlphaBltConstBitDepths
    #field int dwAlphaBltPixelBitDepths
    #field int dwAlphaBltSurfaceBitDepths
    #field int dwAlphaOverlayConstBitDepths
    #field int dwAlphaOverlayPixelBitDepths
    #field int dwAlphaOverlaySurfaceBitDepths
    #field int dwZBufferBitDepths
    #field int dwVidMemTotal
    #field int dwVidMemFree
    #field int dwMaxVisibleOverlays
    #field int dwCurrVisibleOverlays
    #field int dwNumFourCCCodes
    #field int dwAlignBoundarySrc
    #field int dwAlignSizeSrc
    #field int dwAlignBoundaryDest
    #field int dwAlignSizeDest
    #field int dwAlignStrideAlign
    #field int dwRops 8
    #field DDSCAPS ddsCaps
    #field int dwMinOverlayStretch
    #field int dwMaxOverlayStretch
    #field int dwMinLiveVideoStretch
    #field int dwMaxLiveVideoStretch
    #field int dwMinHwCodecStretch
    #field int dwMaxHwCodecStretch
    #field int dwReserved1
    #field int dwReserved2
    #field int dwReserved3
    #field int dwSVBCaps
    #field int dwSVBCKeyCaps
    #field int dwSVBFXCaps
    #field int dwSVBRops 8
    #field int dwVSBCaps
    #field int dwVSBCKeyCaps
    #field int dwVSBFXCaps
    #field int dwVSBRops 8
    #field int dwSSBCaps
    #field int dwSSBCKeyCaps
    #field int dwSSBFXCaps
    #field int dwSSBRops 8
    #field int dwMaxVideoPorts
    #field int dwCurrVideoPorts
    #field int dwSVBCaps2
#endstruct

#defstruct global DDCOLORKEY
    #field int dwColorSpaceLowValue
    #field int dwColorSpaceHighValue
#endstruct

#defstruct global DDPIXELFORMAT
    #field int dwSize
    #field int dwFlags
    #field int dwFourCC
    #field byte Anonymous1 4
    #field byte Anonymous2 4
    #field byte Anonymous3 8
    #field byte Anonymous4 4
    #field byte Anonymous5 4
#endstruct

#defstruct global VIDMEMINFO
    #field intptr fpPrimary
    #field int dwFlags
    #field int dwDisplayWidth
    #field int dwDisplayHeight
    #field int lDisplayPitch
    #field DDPIXELFORMAT ddpfDisplay
    #field int dwOffscreenAlign
    #field int dwOverlayAlign
    #field int dwTextureAlign
    #field int dwZBufferAlign
    #field int dwAlphaAlign
    #field int dwNumHeaps
    #field intptr pvmList
#endstruct

#defstruct global PROCESS_LIST
    #field intptr lpLink
    #field int dwProcessId
    #field int dwRefCnt
    #field int dwAlphaDepth
    #field int dwZDepth
#endstruct

#defstruct global DBLNODE
    #field intptr next
    #field intptr prev
    #field intptr object
    #field intptr object_int
#endstruct

#defstruct global RECT
    #field int left
    #field int top
    #field int right
    #field int bottom
#endstruct

#defstruct global DDSCAPSEX
    #field int dwCaps2
    #field int dwCaps3
    #field byte Anonymous 4
#endstruct

#defstruct global DDRAWI_DIRECTDRAW_GBL
    #field int dwRefCnt
    #field int dwFlags
    #field intptr fpPrimaryOrig
    #field DDCORECAPS ddCaps
    #field int dwInternal1
    #field int dwUnused1 9
    #field intptr lpDDCBtmp
    #field intptr dsList
    #field intptr palList
    #field intptr clipperList
    #field intptr lp16DD
    #field int dwMaxOverlays
    #field int dwCurrOverlays
    #field int dwMonitorFrequency
    #field DDCORECAPS ddHELCaps
    #field int dwUnused2 50
    #field DDCOLORKEY ddckCKDestOverlay
    #field DDCOLORKEY ddckCKSrcOverlay
    #field VIDMEMINFO vmiData
    #field intptr lpDriverHandle
    #field intptr lpExclusiveOwner
    #field int dwModeIndex
    #field int dwModeIndexOrig
    #field int dwNumFourCC
    #field intptr lpdwFourCC
    #field int dwNumModes
    #field intptr lpModeInfo
    #field PROCESS_LIST plProcessList
    #field int dwSurfaceLockCount
    #field int dwAliasedLockCnt
    #field intptr dwReserved3
    #field intptr hDD
    #field byte cObsolete 12
    #field int dwReserved1
    #field int dwReserved2
    #field DBLNODE dbnOverlayRoot
    #field intptr lpwPDeviceFlags
    #field int dwPDevice
    #field int dwWin16LockCnt
    #field int dwUnused3
    #field int hInstance
    #field int dwEvent16
    #field int dwSaveNumModes
    #field intptr lpD3DGlobalDriverData
    #field intptr lpD3DHALCallbacks
    #field DDCORECAPS ddBothCaps
    #field intptr lpDDVideoPortCaps
    #field intptr dvpList
    #field intptr lpD3DHALCallbacks2
    #field RECT rectDevice
    #field int cMonitors
    #field intptr gpbmiSrc
    #field intptr gpbmiDest
    #field intptr phaiHeapAliases
    #field intptr hKernelHandle
    #field intptr pfnNotifyProc
    #field intptr lpDDKernelCaps
    #field intptr lpddNLVCaps
    #field intptr lpddNLVHELCaps
    #field intptr lpddNLVBothCaps
    #field intptr lpD3DExtendedCaps
    #field int dwDOSBoxEvent
    #field RECT rectDesktop
    #field byte cDriverName 32
    #field intptr lpD3DHALCallbacks3
    #field int dwNumZPixelFormats
    #field intptr lpZPixelFormats
    #field intptr mcList
    #field int hDDVxd
    #field DDSCAPSEX ddsCapsMore
#endstruct

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