ホーム › System.Diagnostics.Debug.Extensions › READCONTROLSPACE64
READCONTROLSPACE64
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Processor | WORD | 2 | +0 | +0 | 対象とするプロセッサ番号。 |
| Address | ULONGLONG | 8 | +8 | +8 | コントロール空間の読み出し開始アドレス(64ビット)。 |
| BufLen | DWORD | 4 | +16 | +16 | Bufが受け取るデータのバイト長。 |
| Buf | BYTE | 1 | +20 | +20 | 読み出したデータを格納する可変長バッファの先頭。 |
各言語での定義
#include <windows.h>
// READCONTROLSPACE64 (x64 24 / x86 24 バイト)
typedef struct READCONTROLSPACE64 {
WORD Processor;
ULONGLONG Address;
DWORD BufLen;
BYTE Buf[1];
} READCONTROLSPACE64;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct READCONTROLSPACE64
{
public ushort Processor;
public ulong Address;
public uint BufLen;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] Buf;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure READCONTROLSPACE64
Public Processor As UShort
Public Address As ULong
Public BufLen As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Buf() As Byte
End Structureimport ctypes
from ctypes import wintypes
class READCONTROLSPACE64(ctypes.Structure):
_fields_ = [
("Processor", ctypes.c_ushort),
("Address", ctypes.c_ulonglong),
("BufLen", wintypes.DWORD),
("Buf", ctypes.c_ubyte * 1),
]#[repr(C)]
pub struct READCONTROLSPACE64 {
pub Processor: u16,
pub Address: u64,
pub BufLen: u32,
pub Buf: [u8; 1],
}import "golang.org/x/sys/windows"
type READCONTROLSPACE64 struct {
Processor uint16
Address uint64
BufLen uint32
Buf [1]byte
}type
READCONTROLSPACE64 = record
Processor: Word;
Address: UInt64;
BufLen: DWORD;
Buf: array[0..0] of Byte;
end;const READCONTROLSPACE64 = extern struct {
Processor: u16,
Address: u64,
BufLen: u32,
Buf: [1]u8,
};type
READCONTROLSPACE64 {.bycopy.} = object
Processor: uint16
Address: uint64
BufLen: uint32
Buf: array[1, uint8]struct READCONTROLSPACE64
{
ushort Processor;
ulong Address;
uint BufLen;
ubyte[1] Buf;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; READCONTROLSPACE64 サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Processor : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; Address : ULONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; BufLen : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; Buf : BYTE (+20, 1byte) varptr(st)+20 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global READCONTROLSPACE64
#field short Processor
#field int64 Address
#field int BufLen
#field byte Buf 1
#endstruct
stdim st, READCONTROLSPACE64 ; NSTRUCT 変数を確保
st->Processor = 100
mes "Processor=" + st->Processor