Win32 API 日本語リファレンス
ホームUI.WindowsAndMessaging › DEBUGHOOKINFO

DEBUGHOOKINFO

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

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

フィールド

フィールドサイズx64x86説明
idThreadDWORD4+0+0デバッグ対象スレッドの識別子である。
idThreadInstallerDWORD4+4+4デバッグフックをインストールしたスレッドの識別子である。
lParamLPARAM8/4+8+8監視対象フックに渡される lParam の値である。
wParamWPARAM8/4+16+12監視対象フックに渡される wParam の値である。
codeINT4+24+16監視対象フックに渡されるフックコードである。

各言語での定義

#include <windows.h>

// DEBUGHOOKINFO  (x64 32 / x86 20 バイト)
typedef struct DEBUGHOOKINFO {
    DWORD idThread;
    DWORD idThreadInstaller;
    LPARAM lParam;
    WPARAM wParam;
    INT code;
} DEBUGHOOKINFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEBUGHOOKINFO
{
    public uint idThread;
    public uint idThreadInstaller;
    public IntPtr lParam;
    public UIntPtr wParam;
    public int code;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEBUGHOOKINFO
    Public idThread As UInteger
    Public idThreadInstaller As UInteger
    Public lParam As IntPtr
    Public wParam As UIntPtr
    Public code As Integer
End Structure
import ctypes
from ctypes import wintypes

class DEBUGHOOKINFO(ctypes.Structure):
    _fields_ = [
        ("idThread", wintypes.DWORD),
        ("idThreadInstaller", wintypes.DWORD),
        ("lParam", ctypes.c_ssize_t),
        ("wParam", ctypes.c_size_t),
        ("code", ctypes.c_int),
    ]
#[repr(C)]
pub struct DEBUGHOOKINFO {
    pub idThread: u32,
    pub idThreadInstaller: u32,
    pub lParam: isize,
    pub wParam: usize,
    pub code: i32,
}
import "golang.org/x/sys/windows"

type DEBUGHOOKINFO struct {
	idThread uint32
	idThreadInstaller uint32
	lParam uintptr
	wParam uintptr
	code int32
}
type
  DEBUGHOOKINFO = record
    idThread: DWORD;
    idThreadInstaller: DWORD;
    lParam: NativeInt;
    wParam: NativeUInt;
    code: Integer;
  end;
const DEBUGHOOKINFO = extern struct {
    idThread: u32,
    idThreadInstaller: u32,
    lParam: isize,
    wParam: usize,
    code: i32,
};
type
  DEBUGHOOKINFO {.bycopy.} = object
    idThread: uint32
    idThreadInstaller: uint32
    lParam: int
    wParam: uint
    code: int32
struct DEBUGHOOKINFO
{
    uint idThread;
    uint idThreadInstaller;
    ptrdiff_t lParam;
    size_t wParam;
    int code;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DEBUGHOOKINFO サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; idThread : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; idThreadInstaller : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; lParam : LPARAM (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; wParam : WPARAM (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; code : INT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DEBUGHOOKINFO サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; idThread : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; idThreadInstaller : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; lParam : LPARAM (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; wParam : WPARAM (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; code : INT (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DEBUGHOOKINFO
    #field int idThread
    #field int idThreadInstaller
    #field intptr lParam
    #field intptr wParam
    #field int code
#endstruct

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