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

DDRAWI_DDRAWPALETTE_GBL

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

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

フィールド

フィールドサイズx64x86説明
dwRefCntDWORD4+0+0グローバルパレットオブジェクトの参照カウントを示す。
dwFlagsDWORD4+4+4パレットの属性を示すDDRAWIPAL_系フラグを示す。
lpDD_lclDDRAWI_DIRECTDRAW_LCL*8/4+8+8所属するローカルDirectDrawオブジェクトへのポインタ。
dwProcessIdDWORD4+16+12このパレットを所有するプロセスの識別子を示す。
lpColorTablePALETTEENTRY*8/4+24+16パレットの色テーブル(PALETTEENTRY配列)へのポインタ。
Anonymous_Anonymous_e__Union8/4+32+20ドライバ予約値またはハンドルを保持する共用体。
dwDriverReservedDWORD4+40+24ドライバが利用する予約値を示す。
dwContentsStampDWORD4+44+28パレット内容の更新を追跡するスタンプ値を示す。
dwSaveStampDWORD4+48+32保存時点のスタンプ値を示す。
dwHandleDWORD4+52+36ドライバが用いるパレットハンドルを示す。

共用体: _Anonymous_e__Union x64 8B / x86 4B

フィールドサイズx64x86
dwReserved1UINT_PTR8/4+0+0
hHELGDIPaletteHPALETTE8/4+0+0

各言語での定義

#include <windows.h>

// DDRAWI_DDRAWPALETTE_GBL  (x64 56 / x86 40 バイト)
typedef struct DDRAWI_DDRAWPALETTE_GBL {
    DWORD dwRefCnt;
    DWORD dwFlags;
    DDRAWI_DIRECTDRAW_LCL* lpDD_lcl;
    DWORD dwProcessId;
    PALETTEENTRY* lpColorTable;
    _Anonymous_e__Union Anonymous;
    DWORD dwDriverReserved;
    DWORD dwContentsStamp;
    DWORD dwSaveStamp;
    DWORD dwHandle;
} DDRAWI_DDRAWPALETTE_GBL;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DDRAWI_DDRAWPALETTE_GBL
{
    public uint dwRefCnt;
    public uint dwFlags;
    public IntPtr lpDD_lcl;
    public uint dwProcessId;
    public IntPtr lpColorTable;
    public _Anonymous_e__Union Anonymous;
    public uint dwDriverReserved;
    public uint dwContentsStamp;
    public uint dwSaveStamp;
    public uint dwHandle;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DDRAWI_DDRAWPALETTE_GBL
    Public dwRefCnt As UInteger
    Public dwFlags As UInteger
    Public lpDD_lcl As IntPtr
    Public dwProcessId As UInteger
    Public lpColorTable As IntPtr
    Public Anonymous As _Anonymous_e__Union
    Public dwDriverReserved As UInteger
    Public dwContentsStamp As UInteger
    Public dwSaveStamp As UInteger
    Public dwHandle As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DDRAWI_DDRAWPALETTE_GBL(ctypes.Structure):
    _fields_ = [
        ("dwRefCnt", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
        ("lpDD_lcl", ctypes.c_void_p),
        ("dwProcessId", wintypes.DWORD),
        ("lpColorTable", ctypes.c_void_p),
        ("Anonymous", _Anonymous_e__Union),
        ("dwDriverReserved", wintypes.DWORD),
        ("dwContentsStamp", wintypes.DWORD),
        ("dwSaveStamp", wintypes.DWORD),
        ("dwHandle", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DDRAWI_DDRAWPALETTE_GBL {
    pub dwRefCnt: u32,
    pub dwFlags: u32,
    pub lpDD_lcl: *mut core::ffi::c_void,
    pub dwProcessId: u32,
    pub lpColorTable: *mut core::ffi::c_void,
    pub Anonymous: _Anonymous_e__Union,
    pub dwDriverReserved: u32,
    pub dwContentsStamp: u32,
    pub dwSaveStamp: u32,
    pub dwHandle: u32,
}
import "golang.org/x/sys/windows"

type DDRAWI_DDRAWPALETTE_GBL struct {
	dwRefCnt uint32
	dwFlags uint32
	lpDD_lcl uintptr
	dwProcessId uint32
	lpColorTable uintptr
	Anonymous _Anonymous_e__Union
	dwDriverReserved uint32
	dwContentsStamp uint32
	dwSaveStamp uint32
	dwHandle uint32
}
type
  DDRAWI_DDRAWPALETTE_GBL = record
    dwRefCnt: DWORD;
    dwFlags: DWORD;
    lpDD_lcl: Pointer;
    dwProcessId: DWORD;
    lpColorTable: Pointer;
    Anonymous: _Anonymous_e__Union;
    dwDriverReserved: DWORD;
    dwContentsStamp: DWORD;
    dwSaveStamp: DWORD;
    dwHandle: DWORD;
  end;
const DDRAWI_DDRAWPALETTE_GBL = extern struct {
    dwRefCnt: u32,
    dwFlags: u32,
    lpDD_lcl: ?*anyopaque,
    dwProcessId: u32,
    lpColorTable: ?*anyopaque,
    Anonymous: _Anonymous_e__Union,
    dwDriverReserved: u32,
    dwContentsStamp: u32,
    dwSaveStamp: u32,
    dwHandle: u32,
};
type
  DDRAWI_DDRAWPALETTE_GBL {.bycopy.} = object
    dwRefCnt: uint32
    dwFlags: uint32
    lpDD_lcl: pointer
    dwProcessId: uint32
    lpColorTable: pointer
    Anonymous: _Anonymous_e__Union
    dwDriverReserved: uint32
    dwContentsStamp: uint32
    dwSaveStamp: uint32
    dwHandle: uint32
struct DDRAWI_DDRAWPALETTE_GBL
{
    uint dwRefCnt;
    uint dwFlags;
    void* lpDD_lcl;
    uint dwProcessId;
    void* lpColorTable;
    _Anonymous_e__Union Anonymous;
    uint dwDriverReserved;
    uint dwContentsStamp;
    uint dwSaveStamp;
    uint dwHandle;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DDRAWI_DDRAWPALETTE_GBL サイズ: 40 バイト(x86)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; dwRefCnt : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; lpDD_lcl : DDRAWI_DIRECTDRAW_LCL* (+8, 4byte)  varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; dwProcessId : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; lpColorTable : PALETTEENTRY* (+16, 4byte)  varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; Anonymous : _Anonymous_e__Union (+20, 4byte)  varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; dwDriverReserved : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwContentsStamp : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; dwSaveStamp : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; dwHandle : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DDRAWI_DDRAWPALETTE_GBL サイズ: 56 バイト(x64)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; dwRefCnt : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; lpDD_lcl : DDRAWI_DIRECTDRAW_LCL* (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; dwProcessId : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; lpColorTable : PALETTEENTRY* (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; Anonymous : _Anonymous_e__Union (+32, 8byte)  varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; dwDriverReserved : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; dwContentsStamp : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; dwSaveStamp : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; dwHandle : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DDRAWI_DDRAWPALETTE_GBL
    #field int dwRefCnt
    #field int dwFlags
    #field intptr lpDD_lcl
    #field int dwProcessId
    #field intptr lpColorTable
    #field byte Anonymous 8
    #field int dwDriverReserved
    #field int dwContentsStamp
    #field int dwSaveStamp
    #field int dwHandle
#endstruct

stdim st, DDRAWI_DDRAWPALETTE_GBL        ; NSTRUCT 変数を確保
st->dwRefCnt = 100
mes "dwRefCnt=" + st->dwRefCnt
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。