Win32 API 日本語リファレンス
ホームDevices.Tapi › ADDRALIAS

ADDRALIAS

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

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

フィールド

フィールドサイズx64x86説明
rgchNameCHAR41+0+0表示名を示すANSI文字配列。
rgchENameCHAR11+41+41電子メールアドレス等のアドレス名を示すANSI文字配列。
rgchSrvrCHAR12+52+52サーバー名を示すANSI文字配列。
dibDetailDWORD4+64+64詳細情報へのバイトオフセットを示す。
typeWORD2+68+68アドレスの種別を示す値。

各言語での定義

#include <windows.h>

// ADDRALIAS  (x64 72 / x86 72 バイト)
typedef struct ADDRALIAS {
    CHAR rgchName[41];
    CHAR rgchEName[11];
    CHAR rgchSrvr[12];
    DWORD dibDetail;
    WORD type;
} ADDRALIAS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ADDRALIAS
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 41)] public sbyte[] rgchName;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public sbyte[] rgchEName;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public sbyte[] rgchSrvr;
    public uint dibDetail;
    public ushort type;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ADDRALIAS
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=41)> Public rgchName() As SByte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=11)> Public rgchEName() As SByte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=12)> Public rgchSrvr() As SByte
    Public dibDetail As UInteger
    Public type As UShort
End Structure
import ctypes
from ctypes import wintypes

class ADDRALIAS(ctypes.Structure):
    _fields_ = [
        ("rgchName", ctypes.c_byte * 41),
        ("rgchEName", ctypes.c_byte * 11),
        ("rgchSrvr", ctypes.c_byte * 12),
        ("dibDetail", wintypes.DWORD),
        ("type", ctypes.c_ushort),
    ]
#[repr(C)]
pub struct ADDRALIAS {
    pub rgchName: [i8; 41],
    pub rgchEName: [i8; 11],
    pub rgchSrvr: [i8; 12],
    pub dibDetail: u32,
    pub type: u16,
}
import "golang.org/x/sys/windows"

type ADDRALIAS struct {
	rgchName [41]int8
	rgchEName [11]int8
	rgchSrvr [12]int8
	dibDetail uint32
	type uint16
}
type
  ADDRALIAS = record
    rgchName: array[0..40] of Shortint;
    rgchEName: array[0..10] of Shortint;
    rgchSrvr: array[0..11] of Shortint;
    dibDetail: DWORD;
    type: Word;
  end;
const ADDRALIAS = extern struct {
    rgchName: [41]i8,
    rgchEName: [11]i8,
    rgchSrvr: [12]i8,
    dibDetail: u32,
    type: u16,
};
type
  ADDRALIAS {.bycopy.} = object
    rgchName: array[41, int8]
    rgchEName: array[11, int8]
    rgchSrvr: array[12, int8]
    dibDetail: uint32
    type: uint16
struct ADDRALIAS
{
    byte[41] rgchName;
    byte[11] rgchEName;
    byte[12] rgchSrvr;
    uint dibDetail;
    ushort type;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ADDRALIAS サイズ: 72 バイト(x64)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; rgchName : CHAR (+0, 41byte)  varptr(st)+0 を基点に操作(41byte:入れ子/配列)
; rgchEName : CHAR (+41, 11byte)  varptr(st)+41 を基点に操作(11byte:入れ子/配列)
; rgchSrvr : CHAR (+52, 12byte)  varptr(st)+52 を基点に操作(12byte:入れ子/配列)
; dibDetail : DWORD (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; type : WORD (+68, 2byte)  wpoke st,68,値  /  値 = wpeek(st,68)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global ADDRALIAS
    #field byte rgchName 41
    #field byte rgchEName 11
    #field byte rgchSrvr 12
    #field int dibDetail
    #field short type
#endstruct

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