Win32 API 日本語リファレンス
ホームSystem.Diagnostics.Debug › APC_CALLBACK_DATA

APC_CALLBACK_DATA

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

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

フィールド

フィールドサイズx64x86説明
ParameterUINT_PTR8/4+0+0APCコールバックに渡されるパラメータ値。
ContextRecordCONTEXT*8/4+8+4スレッドのレジスタ状態を保持するCONTEXTへのポインタ。
Reserved0UINT_PTR8/4+16+8予約フィールド。0が入る。
Reserved1UINT_PTR8/4+24+12予約フィールド。0が入る。

各言語での定義

#include <windows.h>

// APC_CALLBACK_DATA  (x64 32 / x86 16 バイト)
typedef struct APC_CALLBACK_DATA {
    UINT_PTR Parameter;
    CONTEXT* ContextRecord;
    UINT_PTR Reserved0;
    UINT_PTR Reserved1;
} APC_CALLBACK_DATA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct APC_CALLBACK_DATA
{
    public UIntPtr Parameter;
    public IntPtr ContextRecord;
    public UIntPtr Reserved0;
    public UIntPtr Reserved1;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure APC_CALLBACK_DATA
    Public Parameter As UIntPtr
    Public ContextRecord As IntPtr
    Public Reserved0 As UIntPtr
    Public Reserved1 As UIntPtr
End Structure
import ctypes
from ctypes import wintypes

class APC_CALLBACK_DATA(ctypes.Structure):
    _fields_ = [
        ("Parameter", ctypes.c_size_t),
        ("ContextRecord", ctypes.c_void_p),
        ("Reserved0", ctypes.c_size_t),
        ("Reserved1", ctypes.c_size_t),
    ]
#[repr(C)]
pub struct APC_CALLBACK_DATA {
    pub Parameter: usize,
    pub ContextRecord: *mut core::ffi::c_void,
    pub Reserved0: usize,
    pub Reserved1: usize,
}
import "golang.org/x/sys/windows"

type APC_CALLBACK_DATA struct {
	Parameter uintptr
	ContextRecord uintptr
	Reserved0 uintptr
	Reserved1 uintptr
}
type
  APC_CALLBACK_DATA = record
    Parameter: NativeUInt;
    ContextRecord: Pointer;
    Reserved0: NativeUInt;
    Reserved1: NativeUInt;
  end;
const APC_CALLBACK_DATA = extern struct {
    Parameter: usize,
    ContextRecord: ?*anyopaque,
    Reserved0: usize,
    Reserved1: usize,
};
type
  APC_CALLBACK_DATA {.bycopy.} = object
    Parameter: uint
    ContextRecord: pointer
    Reserved0: uint
    Reserved1: uint
struct APC_CALLBACK_DATA
{
    size_t Parameter;
    void* ContextRecord;
    size_t Reserved0;
    size_t Reserved1;
}

HSP用 定義

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

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

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