ホーム › Graphics.DirectDraw › DD_LOCKDATA
DD_LOCKDATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| lpDD | DD_DIRECTDRAW_GLOBAL* | 8/4 | +0 | +0 | 対象のDirectDrawグローバルオブジェクトへのポインタ。 |
| lpDDSurface | DD_SURFACE_LOCAL* | 8/4 | +8 | +4 | ロック対象サーフェスのローカルオブジェクトへのポインタ。 |
| bHasRect | DWORD | 4 | +16 | +8 | rArea矩形が有効かを示すブール値。 |
| rArea | RECTL | 16 | +20 | +12 | ロックする領域の矩形を示すRECTL。 |
| lpSurfData | void* | 8/4 | +40 | +28 | ロックされたサーフェスメモリへのポインタを返す。 |
| ddRVal | HRESULT | 4 | +48 | +32 | 操作の結果を示すHRESULT。成功時はDD_OK。 |
| Lock | void* | 8/4 | +56 | +36 | ロック処理を行うコールバック関数へのポインタ。 |
| dwFlags | DWORD | 4 | +64 | +40 | ロック動作を制御するDDLOCK_系フラグ。 |
| fpProcess | UINT_PTR | 8/4 | +72 | +44 | 呼び出し元プロセスのアドレス空間情報を示すフラットアドレス。 |
各言語での定義
#include <windows.h>
// RECTL (x64 16 / x86 16 バイト)
typedef struct RECTL {
INT left;
INT top;
INT right;
INT bottom;
} RECTL;
// DD_LOCKDATA (x64 80 / x86 48 バイト)
typedef struct DD_LOCKDATA {
DD_DIRECTDRAW_GLOBAL* lpDD;
DD_SURFACE_LOCAL* lpDDSurface;
DWORD bHasRect;
RECTL rArea;
void* lpSurfData;
HRESULT ddRVal;
void* Lock;
DWORD dwFlags;
UINT_PTR fpProcess;
} DD_LOCKDATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RECTL
{
public int left;
public int top;
public int right;
public int bottom;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DD_LOCKDATA
{
public IntPtr lpDD;
public IntPtr lpDDSurface;
public uint bHasRect;
public RECTL rArea;
public IntPtr lpSurfData;
public int ddRVal;
public IntPtr Lock;
public uint dwFlags;
public UIntPtr fpProcess;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECTL
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 DD_LOCKDATA
Public lpDD As IntPtr
Public lpDDSurface As IntPtr
Public bHasRect As UInteger
Public rArea As RECTL
Public lpSurfData As IntPtr
Public ddRVal As Integer
Public Lock As IntPtr
Public dwFlags As UInteger
Public fpProcess As UIntPtr
End Structureimport ctypes
from ctypes import wintypes
class RECTL(ctypes.Structure):
_fields_ = [
("left", ctypes.c_int),
("top", ctypes.c_int),
("right", ctypes.c_int),
("bottom", ctypes.c_int),
]
class DD_LOCKDATA(ctypes.Structure):
_fields_ = [
("lpDD", ctypes.c_void_p),
("lpDDSurface", ctypes.c_void_p),
("bHasRect", wintypes.DWORD),
("rArea", RECTL),
("lpSurfData", ctypes.c_void_p),
("ddRVal", ctypes.c_int),
("Lock", ctypes.c_void_p),
("dwFlags", wintypes.DWORD),
("fpProcess", ctypes.c_size_t),
]#[repr(C)]
pub struct RECTL {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}
#[repr(C)]
pub struct DD_LOCKDATA {
pub lpDD: *mut core::ffi::c_void,
pub lpDDSurface: *mut core::ffi::c_void,
pub bHasRect: u32,
pub rArea: RECTL,
pub lpSurfData: *mut core::ffi::c_void,
pub ddRVal: i32,
pub Lock: *mut core::ffi::c_void,
pub dwFlags: u32,
pub fpProcess: usize,
}import "golang.org/x/sys/windows"
type RECTL struct {
left int32
top int32
right int32
bottom int32
}
type DD_LOCKDATA struct {
lpDD uintptr
lpDDSurface uintptr
bHasRect uint32
rArea RECTL
lpSurfData uintptr
ddRVal int32
Lock uintptr
dwFlags uint32
fpProcess uintptr
}type
RECTL = record
left: Integer;
top: Integer;
right: Integer;
bottom: Integer;
end;
DD_LOCKDATA = record
lpDD: Pointer;
lpDDSurface: Pointer;
bHasRect: DWORD;
rArea: RECTL;
lpSurfData: Pointer;
ddRVal: Integer;
Lock: Pointer;
dwFlags: DWORD;
fpProcess: NativeUInt;
end;const RECTL = extern struct {
left: i32,
top: i32,
right: i32,
bottom: i32,
};
const DD_LOCKDATA = extern struct {
lpDD: ?*anyopaque,
lpDDSurface: ?*anyopaque,
bHasRect: u32,
rArea: RECTL,
lpSurfData: ?*anyopaque,
ddRVal: i32,
Lock: ?*anyopaque,
dwFlags: u32,
fpProcess: usize,
};type
RECTL {.bycopy.} = object
left: int32
top: int32
right: int32
bottom: int32
DD_LOCKDATA {.bycopy.} = object
lpDD: pointer
lpDDSurface: pointer
bHasRect: uint32
rArea: RECTL
lpSurfData: pointer
ddRVal: int32
Lock: pointer
dwFlags: uint32
fpProcess: uintstruct RECTL
{
int left;
int top;
int right;
int bottom;
}
struct DD_LOCKDATA
{
void* lpDD;
void* lpDDSurface;
uint bHasRect;
RECTL rArea;
void* lpSurfData;
int ddRVal;
void* Lock;
uint dwFlags;
size_t fpProcess;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DD_LOCKDATA サイズ: 48 バイト(x86)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; lpDD : DD_DIRECTDRAW_GLOBAL* (+0, 4byte) varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; lpDDSurface : DD_SURFACE_LOCAL* (+4, 4byte) varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; bHasRect : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; rArea : RECTL (+12, 16byte) varptr(st)+12 を基点に操作(16byte:入れ子/配列)
; lpSurfData : void* (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ddRVal : HRESULT (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; Lock : void* (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; dwFlags : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; fpProcess : UINT_PTR (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DD_LOCKDATA サイズ: 80 バイト(x64)
dim st, 20 ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; lpDD : DD_DIRECTDRAW_GLOBAL* (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; lpDDSurface : DD_SURFACE_LOCAL* (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; bHasRect : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; rArea : RECTL (+20, 16byte) varptr(st)+20 を基点に操作(16byte:入れ子/配列)
; lpSurfData : void* (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ddRVal : HRESULT (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; Lock : void* (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; dwFlags : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; fpProcess : UINT_PTR (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global RECTL
#field int left
#field int top
#field int right
#field int bottom
#endstruct
#defstruct global DD_LOCKDATA
#field intptr lpDD
#field intptr lpDDSurface
#field int bHasRect
#field RECTL rArea
#field intptr lpSurfData
#field int ddRVal
#field intptr Lock
#field int dwFlags
#field intptr fpProcess
#endstruct
stdim st, DD_LOCKDATA ; NSTRUCT 変数を確保
st->bHasRect = 100
mes "bHasRect=" + st->bHasRect