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

LINEFORWARDLIST

構造体
サイズx64: 32 バイト / x86: 32 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
dwTotalSizeDWORD4+0+0この構造体に割り当てられた総サイズをバイトで表す。
dwNumEntriesDWORD4+4+4ForwardList内の転送エントリの個数を表す。
ForwardListLINEFORWARD24+8+8LINEFORWARD構造体の可変長配列の先頭要素。

各言語での定義

#include <windows.h>

// LINEFORWARD  (x64 24 / x86 24 バイト)
#pragma pack(push, 1)
typedef struct LINEFORWARD {
    DWORD dwForwardMode;
    DWORD dwCallerAddressSize;
    DWORD dwCallerAddressOffset;
    DWORD dwDestCountryCode;
    DWORD dwDestAddressSize;
    DWORD dwDestAddressOffset;
} LINEFORWARD;
#pragma pack(pop)

// LINEFORWARDLIST  (x64 32 / x86 32 バイト)
#pragma pack(push, 1)
typedef struct LINEFORWARDLIST {
    DWORD dwTotalSize;
    DWORD dwNumEntries;
    LINEFORWARD ForwardList[1];
} LINEFORWARDLIST;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct LINEFORWARD
{
    public uint dwForwardMode;
    public uint dwCallerAddressSize;
    public uint dwCallerAddressOffset;
    public uint dwDestCountryCode;
    public uint dwDestAddressSize;
    public uint dwDestAddressOffset;
}

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct LINEFORWARDLIST
{
    public uint dwTotalSize;
    public uint dwNumEntries;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public LINEFORWARD[] ForwardList;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure LINEFORWARD
    Public dwForwardMode As UInteger
    Public dwCallerAddressSize As UInteger
    Public dwCallerAddressOffset As UInteger
    Public dwDestCountryCode As UInteger
    Public dwDestAddressSize As UInteger
    Public dwDestAddressOffset As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure LINEFORWARDLIST
    Public dwTotalSize As UInteger
    Public dwNumEntries As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public ForwardList() As LINEFORWARD
End Structure
import ctypes
from ctypes import wintypes

class LINEFORWARD(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("dwForwardMode", wintypes.DWORD),
        ("dwCallerAddressSize", wintypes.DWORD),
        ("dwCallerAddressOffset", wintypes.DWORD),
        ("dwDestCountryCode", wintypes.DWORD),
        ("dwDestAddressSize", wintypes.DWORD),
        ("dwDestAddressOffset", wintypes.DWORD),
    ]

class LINEFORWARDLIST(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("dwTotalSize", wintypes.DWORD),
        ("dwNumEntries", wintypes.DWORD),
        ("ForwardList", LINEFORWARD * 1),
    ]
#[repr(C, packed(1))]
pub struct LINEFORWARD {
    pub dwForwardMode: u32,
    pub dwCallerAddressSize: u32,
    pub dwCallerAddressOffset: u32,
    pub dwDestCountryCode: u32,
    pub dwDestAddressSize: u32,
    pub dwDestAddressOffset: u32,
}

#[repr(C, packed(1))]
pub struct LINEFORWARDLIST {
    pub dwTotalSize: u32,
    pub dwNumEntries: u32,
    pub ForwardList: [LINEFORWARD; 1],
}
import "golang.org/x/sys/windows"

type LINEFORWARD struct {
	dwForwardMode uint32
	dwCallerAddressSize uint32
	dwCallerAddressOffset uint32
	dwDestCountryCode uint32
	dwDestAddressSize uint32
	dwDestAddressOffset uint32
}

type LINEFORWARDLIST struct {
	dwTotalSize uint32
	dwNumEntries uint32
	ForwardList [1]LINEFORWARD
}
type
  LINEFORWARD = packed record
    dwForwardMode: DWORD;
    dwCallerAddressSize: DWORD;
    dwCallerAddressOffset: DWORD;
    dwDestCountryCode: DWORD;
    dwDestAddressSize: DWORD;
    dwDestAddressOffset: DWORD;
  end;

  LINEFORWARDLIST = packed record
    dwTotalSize: DWORD;
    dwNumEntries: DWORD;
    ForwardList: array[0..0] of LINEFORWARD;
  end;
const LINEFORWARD = extern struct {
    dwForwardMode: u32,
    dwCallerAddressSize: u32,
    dwCallerAddressOffset: u32,
    dwDestCountryCode: u32,
    dwDestAddressSize: u32,
    dwDestAddressOffset: u32,
};

const LINEFORWARDLIST = extern struct {
    dwTotalSize: u32,
    dwNumEntries: u32,
    ForwardList: [1]LINEFORWARD,
};
type
  LINEFORWARD {.packed.} = object
    dwForwardMode: uint32
    dwCallerAddressSize: uint32
    dwCallerAddressOffset: uint32
    dwDestCountryCode: uint32
    dwDestAddressSize: uint32
    dwDestAddressOffset: uint32

  LINEFORWARDLIST {.packed.} = object
    dwTotalSize: uint32
    dwNumEntries: uint32
    ForwardList: array[1, LINEFORWARD]
align(1)
struct LINEFORWARD
{
    uint dwForwardMode;
    uint dwCallerAddressSize;
    uint dwCallerAddressOffset;
    uint dwDestCountryCode;
    uint dwDestAddressSize;
    uint dwDestAddressOffset;
}

align(1)
struct LINEFORWARDLIST
{
    uint dwTotalSize;
    uint dwNumEntries;
    LINEFORWARD[1] ForwardList;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; LINEFORWARDLIST サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; dwTotalSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwNumEntries : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ForwardList : LINEFORWARD (+8, 24byte)  varptr(st)+8 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global LINEFORWARD, pack=1
    #field int dwForwardMode
    #field int dwCallerAddressSize
    #field int dwCallerAddressOffset
    #field int dwDestCountryCode
    #field int dwDestAddressSize
    #field int dwDestAddressOffset
#endstruct

#defstruct global LINEFORWARDLIST, pack=1
    #field int dwTotalSize
    #field int dwNumEntries
    #field LINEFORWARD ForwardList 1
#endstruct

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