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

DDMDL

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

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

フィールド

フィールドサイズx64x86説明
MdlNextDDMDL*8/4+0+0連鎖する次のMDLへのポインタ。終端でNULL。
MdlSizeSHORT2+8+4このMDL構造体のサイズをバイト単位で示す。
MdlFlagsSHORT2+10+6MDLの状態や属性を示すフラグ。
ProcessINT_PTR8/4+16+8このバッファを所有するプロセスを示す値。
lpMappedSystemVaDWORD*8/4+24+12システム仮想アドレス空間にマップされた先頭アドレス。
lpStartVaDWORD*8/4+32+16記述対象バッファが属するページの先頭仮想アドレス。
ByteCountDWORD4+40+20記述対象バッファのバイト数。
ByteOffsetDWORD4+44+24先頭ページ内でのバッファ開始オフセットをバイト単位で示す。

各言語での定義

#include <windows.h>

// DDMDL  (x64 48 / x86 28 バイト)
typedef struct DDMDL {
    DDMDL* MdlNext;
    SHORT MdlSize;
    SHORT MdlFlags;
    INT_PTR Process;
    DWORD* lpMappedSystemVa;
    DWORD* lpStartVa;
    DWORD ByteCount;
    DWORD ByteOffset;
} DDMDL;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DDMDL
{
    public IntPtr MdlNext;
    public short MdlSize;
    public short MdlFlags;
    public IntPtr Process;
    public IntPtr lpMappedSystemVa;
    public IntPtr lpStartVa;
    public uint ByteCount;
    public uint ByteOffset;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DDMDL
    Public MdlNext As IntPtr
    Public MdlSize As Short
    Public MdlFlags As Short
    Public Process As IntPtr
    Public lpMappedSystemVa As IntPtr
    Public lpStartVa As IntPtr
    Public ByteCount As UInteger
    Public ByteOffset As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DDMDL(ctypes.Structure):
    _fields_ = [
        ("MdlNext", ctypes.c_void_p),
        ("MdlSize", ctypes.c_short),
        ("MdlFlags", ctypes.c_short),
        ("Process", ctypes.c_ssize_t),
        ("lpMappedSystemVa", ctypes.c_void_p),
        ("lpStartVa", ctypes.c_void_p),
        ("ByteCount", wintypes.DWORD),
        ("ByteOffset", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DDMDL {
    pub MdlNext: *mut core::ffi::c_void,
    pub MdlSize: i16,
    pub MdlFlags: i16,
    pub Process: isize,
    pub lpMappedSystemVa: *mut core::ffi::c_void,
    pub lpStartVa: *mut core::ffi::c_void,
    pub ByteCount: u32,
    pub ByteOffset: u32,
}
import "golang.org/x/sys/windows"

type DDMDL struct {
	MdlNext uintptr
	MdlSize int16
	MdlFlags int16
	Process uintptr
	lpMappedSystemVa uintptr
	lpStartVa uintptr
	ByteCount uint32
	ByteOffset uint32
}
type
  DDMDL = record
    MdlNext: Pointer;
    MdlSize: Smallint;
    MdlFlags: Smallint;
    Process: NativeInt;
    lpMappedSystemVa: Pointer;
    lpStartVa: Pointer;
    ByteCount: DWORD;
    ByteOffset: DWORD;
  end;
const DDMDL = extern struct {
    MdlNext: ?*anyopaque,
    MdlSize: i16,
    MdlFlags: i16,
    Process: isize,
    lpMappedSystemVa: ?*anyopaque,
    lpStartVa: ?*anyopaque,
    ByteCount: u32,
    ByteOffset: u32,
};
type
  DDMDL {.bycopy.} = object
    MdlNext: pointer
    MdlSize: int16
    MdlFlags: int16
    Process: int
    lpMappedSystemVa: pointer
    lpStartVa: pointer
    ByteCount: uint32
    ByteOffset: uint32
struct DDMDL
{
    void* MdlNext;
    short MdlSize;
    short MdlFlags;
    ptrdiff_t Process;
    void* lpMappedSystemVa;
    void* lpStartVa;
    uint ByteCount;
    uint ByteOffset;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DDMDL サイズ: 28 バイト(x86)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; MdlNext : DDMDL* (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; MdlSize : SHORT (+4, 2byte)  wpoke st,4,値  /  値 = wpeek(st,4)
; MdlFlags : SHORT (+6, 2byte)  wpoke st,6,値  /  値 = wpeek(st,6)
; Process : INT_PTR (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; lpMappedSystemVa : DWORD* (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; lpStartVa : DWORD* (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ByteCount : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ByteOffset : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DDMDL サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; MdlNext : DDMDL* (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; MdlSize : SHORT (+8, 2byte)  wpoke st,8,値  /  値 = wpeek(st,8)
; MdlFlags : SHORT (+10, 2byte)  wpoke st,10,値  /  値 = wpeek(st,10)
; Process : INT_PTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; lpMappedSystemVa : DWORD* (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; lpStartVa : DWORD* (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ByteCount : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ByteOffset : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DDMDL
    #field intptr MdlNext
    #field short MdlSize
    #field short MdlFlags
    #field intptr Process
    #field intptr lpMappedSystemVa
    #field intptr lpStartVa
    #field int ByteCount
    #field int ByteOffset
#endstruct

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