ホーム › Networking.WinSock › ATM_CAUSE_IE
ATM_CAUSE_IE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Location | BYTE | 1 | +0 | +0 | 原因が発生した場所を示すロケーションコード。 |
| Cause | BYTE | 1 | +1 | +1 | 切断や障害の原因を示す原因コード。 |
| DiagnosticsLength | BYTE | 1 | +2 | +2 | Diagnostics内の有効バイト数を示す。 |
| Diagnostics | BYTE | 4 | +3 | +3 | 診断情報のバイト列の先頭。原因の詳細を保持する。 |
各言語での定義
#include <windows.h>
// ATM_CAUSE_IE (x64 7 / x86 7 バイト)
typedef struct ATM_CAUSE_IE {
BYTE Location;
BYTE Cause;
BYTE DiagnosticsLength;
BYTE Diagnostics[4];
} ATM_CAUSE_IE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ATM_CAUSE_IE
{
public byte Location;
public byte Cause;
public byte DiagnosticsLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] Diagnostics;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ATM_CAUSE_IE
Public Location As Byte
Public Cause As Byte
Public DiagnosticsLength As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public Diagnostics() As Byte
End Structureimport ctypes
from ctypes import wintypes
class ATM_CAUSE_IE(ctypes.Structure):
_fields_ = [
("Location", ctypes.c_ubyte),
("Cause", ctypes.c_ubyte),
("DiagnosticsLength", ctypes.c_ubyte),
("Diagnostics", ctypes.c_ubyte * 4),
]#[repr(C)]
pub struct ATM_CAUSE_IE {
pub Location: u8,
pub Cause: u8,
pub DiagnosticsLength: u8,
pub Diagnostics: [u8; 4],
}import "golang.org/x/sys/windows"
type ATM_CAUSE_IE struct {
Location byte
Cause byte
DiagnosticsLength byte
Diagnostics [4]byte
}type
ATM_CAUSE_IE = record
Location: Byte;
Cause: Byte;
DiagnosticsLength: Byte;
Diagnostics: array[0..3] of Byte;
end;const ATM_CAUSE_IE = extern struct {
Location: u8,
Cause: u8,
DiagnosticsLength: u8,
Diagnostics: [4]u8,
};type
ATM_CAUSE_IE {.bycopy.} = object
Location: uint8
Cause: uint8
DiagnosticsLength: uint8
Diagnostics: array[4, uint8]struct ATM_CAUSE_IE
{
ubyte Location;
ubyte Cause;
ubyte DiagnosticsLength;
ubyte[4] Diagnostics;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ATM_CAUSE_IE サイズ: 7 バイト(x64)
dim st, 2 ; 4byte整数×2(構造体サイズ 7 / 4 切り上げ)
; Location : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; Cause : BYTE (+1, 1byte) poke st,1,値 / 値 = peek(st,1)
; DiagnosticsLength : BYTE (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; Diagnostics : BYTE (+3, 4byte) varptr(st)+3 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global ATM_CAUSE_IE
#field byte Location
#field byte Cause
#field byte DiagnosticsLength
#field byte Diagnostics 4
#endstruct
stdim st, ATM_CAUSE_IE ; NSTRUCT 変数を確保
st->Location = 100
mes "Location=" + st->Location