Win32 API 日本語リファレンス
ホームNetworking.WinSock › ATM_ADDRESS

ATM_ADDRESS

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

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

フィールド

フィールドサイズx64x86説明
AddressTypeDWORD4+0+0ATMアドレスの種別(NSAPやE.164等)を示す。
NumofDigitsDWORD4+4+4Addr内の有効アドレス桁数を示す。
AddrBYTE20+8+8ATMアドレスのバイト列の先頭。種別に応じた形式を持つ。

各言語での定義

#include <windows.h>

// ATM_ADDRESS  (x64 28 / x86 28 バイト)
typedef struct ATM_ADDRESS {
    DWORD AddressType;
    DWORD NumofDigits;
    BYTE Addr[20];
} ATM_ADDRESS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ATM_ADDRESS
{
    public uint AddressType;
    public uint NumofDigits;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] Addr;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ATM_ADDRESS
    Public AddressType As UInteger
    Public NumofDigits As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=20)> Public Addr() As Byte
End Structure
import ctypes
from ctypes import wintypes

class ATM_ADDRESS(ctypes.Structure):
    _fields_ = [
        ("AddressType", wintypes.DWORD),
        ("NumofDigits", wintypes.DWORD),
        ("Addr", ctypes.c_ubyte * 20),
    ]
#[repr(C)]
pub struct ATM_ADDRESS {
    pub AddressType: u32,
    pub NumofDigits: u32,
    pub Addr: [u8; 20],
}
import "golang.org/x/sys/windows"

type ATM_ADDRESS struct {
	AddressType uint32
	NumofDigits uint32
	Addr [20]byte
}
type
  ATM_ADDRESS = record
    AddressType: DWORD;
    NumofDigits: DWORD;
    Addr: array[0..19] of Byte;
  end;
const ATM_ADDRESS = extern struct {
    AddressType: u32,
    NumofDigits: u32,
    Addr: [20]u8,
};
type
  ATM_ADDRESS {.bycopy.} = object
    AddressType: uint32
    NumofDigits: uint32
    Addr: array[20, uint8]
struct ATM_ADDRESS
{
    uint AddressType;
    uint NumofDigits;
    ubyte[20] Addr;
}

HSP用 定義

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

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

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