Win32 API 日本語リファレンス
ホームNetworkManagement.IpHelper › IP_ADAPTER_INFO

IP_ADAPTER_INFO

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

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

フィールド

フィールドサイズx64x86説明
NextIP_ADAPTER_INFO*8/4+0+0アダプターのリスト内の次のアダプターへのポインターです。
ComboIndexDWORD4+8+4予約済みです。
AdapterNameCHAR260+12+8アダプターの名前を表す ANSI 文字列です。
DescriptionCHAR132+272+268アダプターの説明を格納する ANSI 文字列です。
AddressLengthDWORD4+404+400アダプターのハードウェア アドレスの長さ (バイト単位) です。
AddressBYTE8+408+404BYTE 配列として表される、アダプターのハードウェア アドレスです。
IndexDWORD4+416+412

アダプターのインデックスです。

アダプターのインデックスは、アダプターを無効にしてから再び有効にした場合など、状況によって変化することがあるため、永続的なものと見なさないでください。

TypeDWORD4+420+416

アダプターの種類です。アダプターの種類として指定できる値は、Ipifcons.h ヘッダー ファイルに列挙されています。

次の表はアダプターの種類の代表的な値を示しています。ただし、Windows Vista 以降ではこれら以外の値になることもあります。

意味
MIB_IF_TYPE_OTHER
1
その他の種類のネットワーク インターフェイスです。
MIB_IF_TYPE_ETHERNET
6
イーサネット ネットワーク インターフェイスです。
IF_TYPE_ISO88025_TOKENRING
9
MIB_IF_TYPE_TOKENRING
MIB_IF_TYPE_PPP
23
PPP ネットワーク インターフェイスです。
MIB_IF_TYPE_LOOPBACK
24
ソフトウェア ループバック ネットワーク インターフェイスです。
MIB_IF_TYPE_SLIP
28
ATM ネットワーク インターフェイスです。
IF_TYPE_IEEE80211
71
IEEE 802.11 ワイヤレス ネットワーク インターフェイスです。
メモ  このアダプターの種類は Windows Vista 以降で返されます。Windows Server 2003 および Windows XP では、IEEE 802.11 ワイヤレス ネットワーク インターフェイスはアダプターの種類として MIB_IF_TYPE_ETHERNET を返します。
 
DhcpEnabledDWORD4+424+420このアダプターで動的ホスト構成プロトコル (DHCP) が有効かどうかを指定するオプション値です。
CurrentIpAddressIP_ADDR_STRING*8/4+432+424予約済みです。
IpAddressListIP_ADDR_STRING48/40+440+428IP_ADDR_STRING 構造体のリンク リストとして表される、このアダプターに関連付けられた IPv4 アドレスの一覧です。1 つのアダプターには複数の IPv4 アドレスを割り当てることができます。
GatewayListIP_ADDR_STRING48/40+488+468IP_ADDR_STRING 構造体のリンク リストとして表される、このアダプターのゲートウェイの IPv4 アドレスです。1 つのアダプターには複数の IPv4 ゲートウェイ アドレスを割り当てることができます。通常、このリストにはこのアダプターの既定のゲートウェイの IPv4 アドレスを表すエントリが 1 つ含まれます。
DhcpServerIP_ADDR_STRING48/40+536+508

IP_ADDR_STRING 構造体のリンク リストとして表される、このアダプターの DHCP サーバーの IPv4 アドレスです。このリストには、このアダプターの DHCP サーバーの IPv4 アドレスを表すエントリが 1 つ含まれます。値が 255.255.255.255 の場合は、DHCP サーバーに到達できなかったか、到達を試みている最中であることを示します。

このメンバーは、DhcpEnabled メンバーが 0 以外の場合にのみ有効です。

HaveWinsBOOL4+584+548このアダプターが Windows インターネット ネーム サービス (WINS) を使用するかどうかを指定するオプション値です。
PrimaryWinsServerIP_ADDR_STRING48/40+592+552

IP_ADDR_STRING 構造体のリンク リストとして表される、プライマリ WINS サーバーの IPv4 アドレスです。このリストには、このアダプターのプライマリ WINS サーバーの IPv4 アドレスを表すエントリが 1 つ含まれます。

このメンバーは、HaveWins メンバーが TRUE の場合にのみ有効です。

SecondaryWinsServerIP_ADDR_STRING48/40+640+592

IP_ADDR_STRING 構造体のリンク リストとして表される、セカンダリ WINS サーバーの IPv4 アドレスです。1 つのアダプターには複数のセカンダリ WINS サーバー アドレスを割り当てることができます。

このメンバーは、HaveWins メンバーが TRUE の場合にのみ有効です。

LeaseObtainedLONGLONG8+688+632

現在の DHCP リースを取得した時刻です。

このメンバーは、DhcpEnabled メンバーが 0 以外の場合にのみ有効です。

LeaseExpiresLONGLONG8+696+640

現在の DHCP リースが期限切れになる時刻です。

このメンバーは、DhcpEnabled メンバーが 0 以外の場合にのみ有効です。

公式ドキュメント

IP_ADAPTER_INFO 構造体は、ローカル コンピューター上の特定のネットワーク アダプターに関する情報を格納します。

解説(Remarks)

IP_ADAPTER_INFO 構造体が扱えるのは、ローカル コンピューター上の特定のネットワーク アダプターに関する IPv4 の情報のみです。 IP_ADAPTER_INFO 構造体は、GetAdaptersInfo 関数を呼び出して取得します。

Visual Studio 2005 以降を使用する場合、time_t データ型は既定で 8 バイトのデータ型になり、32 ビット プラットフォームで LeaseObtained メンバーおよび LeaseExpires メンバーに使用される 4 バイトのデータ型とは異なります。32 ビット プラットフォームで IP_ADAPTER_INFO 構造体を正しく使用するには、アプリケーションのコンパイル時に _USE_32BIT_TIME_T を定義し (たとえば -D _USE_32BIT_TIME_T をオプションとして指定します)、time_t データ型を 4 バイトのデータ型にしてください。

Windows XP 以降で使用する場合、IP_ADAPTER_ADDRESSES 構造体には IPv4 と IPv6 の両方の情報が含まれます。GetAdaptersAddresses 関数は、IPv4 および IPv6 のアダプター情報を取得します。

次の例では、アダプター情報を取得し、各アダプターのさまざまなプロパティを出力します。

#include <winsock2.h>
#include <iphlpapi.h>
#include <stdio.h>
#include <stdlib.h>
#pragma comment(lib, "IPHLPAPI.lib")

#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))

/* Note: could also use malloc() and free() */

int __cdecl main()
{

    /* Declare and initialize variables */

// It is possible for an adapter to have multiple
// IPv4 addresses, gateways, and secondary WINS servers
// assigned to the adapter. 
//
// Note that this sample code only prints out the 
// first entry for the IP address/mask, and gateway, and
// the primary and secondary WINS server for each adapter. 

    PIP_ADAPTER_INFO pAdapterInfo;
    PIP_ADAPTER_INFO pAdapter = NULL;
    DWORD dwRetVal = 0;
    UINT i;

/* variables used to print DHCP time info */
    struct tm newtime;
    char buffer[32];
    errno_t error;

    ULONG ulOutBufLen = sizeof (IP_ADAPTER_INFO);
    pAdapterInfo = (IP_ADAPTER_INFO *) MALLOC(sizeof (IP_ADAPTER_INFO));
    if (pAdapterInfo == NULL) {
        printf("Error allocating memory needed to call GetAdaptersinfo\n");
        return 1;
    }
// Make an initial call to GetAdaptersInfo to get
// the necessary size into the ulOutBufLen variable
    if (GetAdaptersInfo(pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW) {
        FREE(pAdapterInfo);
        pAdapterInfo = (IP_ADAPTER_INFO *) MALLOC(ulOutBufLen);
        if (pAdapterInfo == NULL) {
            printf("Error allocating memory needed to call GetAdaptersinfo\n");
            return 1;
        }
    }

    if ((dwRetVal = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen)) == NO_ERROR) {
        pAdapter = pAdapterInfo;
        while (pAdapter) {
            printf("\tComboIndex: \t%d\n", pAdapter->ComboIndex);
            printf("\tAdapter Name: \t%s\n", pAdapter->AdapterName);
            printf("\tAdapter Desc: \t%s\n", pAdapter->Description);
            printf("\tAdapter Addr: \t");
            for (i = 0; i < pAdapter->AddressLength; i++) {
                if (i == (pAdapter->AddressLength - 1))
                    printf("%.2X\n", (int) pAdapter->Address[i]);
                else
                    printf("%.2X-", (int) pAdapter->Address[i]);
            }
            printf("\tIndex: \t%d\n", pAdapter->Index);
            printf("\tType: \t");
            switch (pAdapter->Type) {
            case MIB_IF_TYPE_OTHER:
                printf("Other\n");
                break;
            case MIB_IF_TYPE_ETHERNET:
                printf("Ethernet\n");
                break;
            case MIB_IF_TYPE_TOKENRING:
                printf("Token Ring\n");
                break;
            case MIB_IF_TYPE_FDDI:
                printf("FDDI\n");
                break;
            case MIB_IF_TYPE_PPP:
                printf("PPP\n");
                break;
            case MIB_IF_TYPE_LOOPBACK:
                printf("Lookback\n");
                break;
            case MIB_IF_TYPE_SLIP:
                printf("Slip\n");
                break;
            default:
                printf("Unknown type %ld\n", pAdapter->Type);
                break;
            }

            printf("\tIP Address: \t%s\n",
                   pAdapter->IpAddressList.IpAddress.String);
            printf("\tIP Mask: \t%s\n", pAdapter->IpAddressList.IpMask.String);

            printf("\tGateway: \t%s\n", pAdapter->GatewayList.IpAddress.String);
            printf("\t***\n");

            if (pAdapter->DhcpEnabled) {
                printf("\tDHCP Enabled: Yes\n");
                printf("\t  DHCP Server: \t%s\n",
                       pAdapter->DhcpServer.IpAddress.String);

                printf("\t  Lease Obtained: ");
                /* Display local time */
                error = _localtime32_s(&newtime, (__time32_t*) &pAdapter->LeaseObtained);
                if (error)
                    printf("Invalid Argument to _localtime32_s\n");
                else {
                    // Convert to an ASCII representation 
                    error = asctime_s(buffer, 32, &newtime);
                    if (error)
                        printf("Invalid Argument to asctime_s\n");
                    else
                        /* asctime_s returns the string terminated by \n\0 */
                        printf("%s", buffer);
                }

                printf("\t  Lease Expires:  ");
                error = _localtime32_s(&newtime, (__time32_t*) &pAdapter->LeaseExpires);
                if (error)
                    printf("Invalid Argument to _localtime32_s\n");
                else {
                    // Convert to an ASCII representation 
                    error = asctime_s(buffer, 32, &newtime);
                    if (error)
                        printf("Invalid Argument to asctime_s\n");
                    else
                        /* asctime_s returns the string terminated by \n\0 */
                        printf("%s", buffer);
                }
            } else
                printf("\tDHCP Enabled: No\n");

            if (pAdapter->HaveWins) {
                printf("\tHave Wins: Yes\n");
                printf("\t  Primary Wins Server:    %s\n",
                       pAdapter->PrimaryWinsServer.IpAddress.String);
                printf("\t  Secondary Wins Server:  %s\n",
                       pAdapter->SecondaryWinsServer.IpAddress.String);
            } else
                printf("\tHave Wins: No\n");
            pAdapter = pAdapter->Next;
            printf("\n");
        }
    } else {
        printf("GetAdaptersInfo failed with error: %d\n", dwRetVal);

    }
    if (pAdapterInfo)
        FREE(pAdapterInfo);

    return 0;
}
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// IP_ADDRESS_STRING  (x64 16 / x86 16 バイト)
typedef struct IP_ADDRESS_STRING {
    CHAR String[16];
} IP_ADDRESS_STRING;

// IP_ADDR_STRING  (x64 48 / x86 40 バイト)
typedef struct IP_ADDR_STRING {
    IP_ADDR_STRING* Next;
    IP_ADDRESS_STRING IpAddress;
    IP_ADDRESS_STRING IpMask;
    DWORD Context;
} IP_ADDR_STRING;

// IP_ADAPTER_INFO  (x64 704 / x86 648 バイト)
typedef struct IP_ADAPTER_INFO {
    IP_ADAPTER_INFO* Next;
    DWORD ComboIndex;
    CHAR AdapterName[260];
    CHAR Description[132];
    DWORD AddressLength;
    BYTE Address[8];
    DWORD Index;
    DWORD Type;
    DWORD DhcpEnabled;
    IP_ADDR_STRING* CurrentIpAddress;
    IP_ADDR_STRING IpAddressList;
    IP_ADDR_STRING GatewayList;
    IP_ADDR_STRING DhcpServer;
    BOOL HaveWins;
    IP_ADDR_STRING PrimaryWinsServer;
    IP_ADDR_STRING SecondaryWinsServer;
    LONGLONG LeaseObtained;
    LONGLONG LeaseExpires;
} IP_ADAPTER_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IP_ADDRESS_STRING
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public sbyte[] String;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IP_ADDR_STRING
{
    public IntPtr Next;
    public IP_ADDRESS_STRING IpAddress;
    public IP_ADDRESS_STRING IpMask;
    public uint Context;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IP_ADAPTER_INFO
{
    public IntPtr Next;
    public uint ComboIndex;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 260)] public sbyte[] AdapterName;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 132)] public sbyte[] Description;
    public uint AddressLength;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] Address;
    public uint Index;
    public uint Type;
    public uint DhcpEnabled;
    public IntPtr CurrentIpAddress;
    public IP_ADDR_STRING IpAddressList;
    public IP_ADDR_STRING GatewayList;
    public IP_ADDR_STRING DhcpServer;
    [MarshalAs(UnmanagedType.Bool)] public bool HaveWins;
    public IP_ADDR_STRING PrimaryWinsServer;
    public IP_ADDR_STRING SecondaryWinsServer;
    public long LeaseObtained;
    public long LeaseExpires;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IP_ADDRESS_STRING
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public String() As SByte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IP_ADDR_STRING
    Public Next As IntPtr
    Public IpAddress As IP_ADDRESS_STRING
    Public IpMask As IP_ADDRESS_STRING
    Public Context As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IP_ADAPTER_INFO
    Public Next As IntPtr
    Public ComboIndex As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=260)> Public AdapterName() As SByte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=132)> Public Description() As SByte
    Public AddressLength As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public Address() As Byte
    Public Index As UInteger
    Public Type As UInteger
    Public DhcpEnabled As UInteger
    Public CurrentIpAddress As IntPtr
    Public IpAddressList As IP_ADDR_STRING
    Public GatewayList As IP_ADDR_STRING
    Public DhcpServer As IP_ADDR_STRING
    <MarshalAs(UnmanagedType.Bool)> Public HaveWins As Boolean
    Public PrimaryWinsServer As IP_ADDR_STRING
    Public SecondaryWinsServer As IP_ADDR_STRING
    Public LeaseObtained As Long
    Public LeaseExpires As Long
End Structure
import ctypes
from ctypes import wintypes

class IP_ADDRESS_STRING(ctypes.Structure):
    _fields_ = [
        ("String", ctypes.c_byte * 16),
    ]

class IP_ADDR_STRING(ctypes.Structure):
    _fields_ = [
        ("Next", ctypes.c_void_p),
        ("IpAddress", IP_ADDRESS_STRING),
        ("IpMask", IP_ADDRESS_STRING),
        ("Context", wintypes.DWORD),
    ]

class IP_ADAPTER_INFO(ctypes.Structure):
    _fields_ = [
        ("Next", ctypes.c_void_p),
        ("ComboIndex", wintypes.DWORD),
        ("AdapterName", ctypes.c_byte * 260),
        ("Description", ctypes.c_byte * 132),
        ("AddressLength", wintypes.DWORD),
        ("Address", ctypes.c_ubyte * 8),
        ("Index", wintypes.DWORD),
        ("Type", wintypes.DWORD),
        ("DhcpEnabled", wintypes.DWORD),
        ("CurrentIpAddress", ctypes.c_void_p),
        ("IpAddressList", IP_ADDR_STRING),
        ("GatewayList", IP_ADDR_STRING),
        ("DhcpServer", IP_ADDR_STRING),
        ("HaveWins", wintypes.BOOL),
        ("PrimaryWinsServer", IP_ADDR_STRING),
        ("SecondaryWinsServer", IP_ADDR_STRING),
        ("LeaseObtained", ctypes.c_longlong),
        ("LeaseExpires", ctypes.c_longlong),
    ]
#[repr(C)]
pub struct IP_ADDRESS_STRING {
    pub String: [i8; 16],
}

#[repr(C)]
pub struct IP_ADDR_STRING {
    pub Next: *mut core::ffi::c_void,
    pub IpAddress: IP_ADDRESS_STRING,
    pub IpMask: IP_ADDRESS_STRING,
    pub Context: u32,
}

#[repr(C)]
pub struct IP_ADAPTER_INFO {
    pub Next: *mut core::ffi::c_void,
    pub ComboIndex: u32,
    pub AdapterName: [i8; 260],
    pub Description: [i8; 132],
    pub AddressLength: u32,
    pub Address: [u8; 8],
    pub Index: u32,
    pub Type: u32,
    pub DhcpEnabled: u32,
    pub CurrentIpAddress: *mut core::ffi::c_void,
    pub IpAddressList: IP_ADDR_STRING,
    pub GatewayList: IP_ADDR_STRING,
    pub DhcpServer: IP_ADDR_STRING,
    pub HaveWins: i32,
    pub PrimaryWinsServer: IP_ADDR_STRING,
    pub SecondaryWinsServer: IP_ADDR_STRING,
    pub LeaseObtained: i64,
    pub LeaseExpires: i64,
}
import "golang.org/x/sys/windows"

type IP_ADDRESS_STRING struct {
	String [16]int8
}

type IP_ADDR_STRING struct {
	Next uintptr
	IpAddress IP_ADDRESS_STRING
	IpMask IP_ADDRESS_STRING
	Context uint32
}

type IP_ADAPTER_INFO struct {
	Next uintptr
	ComboIndex uint32
	AdapterName [260]int8
	Description [132]int8
	AddressLength uint32
	Address [8]byte
	Index uint32
	Type uint32
	DhcpEnabled uint32
	CurrentIpAddress uintptr
	IpAddressList IP_ADDR_STRING
	GatewayList IP_ADDR_STRING
	DhcpServer IP_ADDR_STRING
	HaveWins int32
	PrimaryWinsServer IP_ADDR_STRING
	SecondaryWinsServer IP_ADDR_STRING
	LeaseObtained int64
	LeaseExpires int64
}
type
  IP_ADDRESS_STRING = record
    String: array[0..15] of Shortint;
  end;

  IP_ADDR_STRING = record
    Next: Pointer;
    IpAddress: IP_ADDRESS_STRING;
    IpMask: IP_ADDRESS_STRING;
    Context: DWORD;
  end;

  IP_ADAPTER_INFO = record
    Next: Pointer;
    ComboIndex: DWORD;
    AdapterName: array[0..259] of Shortint;
    Description: array[0..131] of Shortint;
    AddressLength: DWORD;
    Address: array[0..7] of Byte;
    Index: DWORD;
    Type: DWORD;
    DhcpEnabled: DWORD;
    CurrentIpAddress: Pointer;
    IpAddressList: IP_ADDR_STRING;
    GatewayList: IP_ADDR_STRING;
    DhcpServer: IP_ADDR_STRING;
    HaveWins: BOOL;
    PrimaryWinsServer: IP_ADDR_STRING;
    SecondaryWinsServer: IP_ADDR_STRING;
    LeaseObtained: Int64;
    LeaseExpires: Int64;
  end;
const IP_ADDRESS_STRING = extern struct {
    String: [16]i8,
};

const IP_ADDR_STRING = extern struct {
    Next: ?*anyopaque,
    IpAddress: IP_ADDRESS_STRING,
    IpMask: IP_ADDRESS_STRING,
    Context: u32,
};

const IP_ADAPTER_INFO = extern struct {
    Next: ?*anyopaque,
    ComboIndex: u32,
    AdapterName: [260]i8,
    Description: [132]i8,
    AddressLength: u32,
    Address: [8]u8,
    Index: u32,
    Type: u32,
    DhcpEnabled: u32,
    CurrentIpAddress: ?*anyopaque,
    IpAddressList: IP_ADDR_STRING,
    GatewayList: IP_ADDR_STRING,
    DhcpServer: IP_ADDR_STRING,
    HaveWins: i32,
    PrimaryWinsServer: IP_ADDR_STRING,
    SecondaryWinsServer: IP_ADDR_STRING,
    LeaseObtained: i64,
    LeaseExpires: i64,
};
type
  IP_ADDRESS_STRING {.bycopy.} = object
    String: array[16, int8]

  IP_ADDR_STRING {.bycopy.} = object
    Next: pointer
    IpAddress: IP_ADDRESS_STRING
    IpMask: IP_ADDRESS_STRING
    Context: uint32

  IP_ADAPTER_INFO {.bycopy.} = object
    Next: pointer
    ComboIndex: uint32
    AdapterName: array[260, int8]
    Description: array[132, int8]
    AddressLength: uint32
    Address: array[8, uint8]
    Index: uint32
    Type: uint32
    DhcpEnabled: uint32
    CurrentIpAddress: pointer
    IpAddressList: IP_ADDR_STRING
    GatewayList: IP_ADDR_STRING
    DhcpServer: IP_ADDR_STRING
    HaveWins: int32
    PrimaryWinsServer: IP_ADDR_STRING
    SecondaryWinsServer: IP_ADDR_STRING
    LeaseObtained: int64
    LeaseExpires: int64
struct IP_ADDRESS_STRING
{
    byte[16] String;
}

struct IP_ADDR_STRING
{
    void* Next;
    IP_ADDRESS_STRING IpAddress;
    IP_ADDRESS_STRING IpMask;
    uint Context;
}

struct IP_ADAPTER_INFO
{
    void* Next;
    uint ComboIndex;
    byte[260] AdapterName;
    byte[132] Description;
    uint AddressLength;
    ubyte[8] Address;
    uint Index;
    uint Type;
    uint DhcpEnabled;
    void* CurrentIpAddress;
    IP_ADDR_STRING IpAddressList;
    IP_ADDR_STRING GatewayList;
    IP_ADDR_STRING DhcpServer;
    int HaveWins;
    IP_ADDR_STRING PrimaryWinsServer;
    IP_ADDR_STRING SecondaryWinsServer;
    long LeaseObtained;
    long LeaseExpires;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; IP_ADAPTER_INFO サイズ: 648 バイト(x86)
dim st, 162    ; 4byte整数×162(構造体サイズ 648 / 4 切り上げ)
; Next : IP_ADAPTER_INFO* (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; ComboIndex : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; AdapterName : CHAR (+8, 260byte)  varptr(st)+8 を基点に操作(260byte:入れ子/配列)
; Description : CHAR (+268, 132byte)  varptr(st)+268 を基点に操作(132byte:入れ子/配列)
; AddressLength : DWORD (+400, 4byte)  st.100 = 値  /  値 = st.100   (lpoke/lpeek も可)
; Address : BYTE (+404, 8byte)  varptr(st)+404 を基点に操作(8byte:入れ子/配列)
; Index : DWORD (+412, 4byte)  st.103 = 値  /  値 = st.103   (lpoke/lpeek も可)
; Type : DWORD (+416, 4byte)  st.104 = 値  /  値 = st.104   (lpoke/lpeek も可)
; DhcpEnabled : DWORD (+420, 4byte)  st.105 = 値  /  値 = st.105   (lpoke/lpeek も可)
; CurrentIpAddress : IP_ADDR_STRING* (+424, 4byte)  varptr(st)+424 を基点に操作(4byte:入れ子/配列)
; IpAddressList : IP_ADDR_STRING (+428, 40byte)  varptr(st)+428 を基点に操作(40byte:入れ子/配列)
; GatewayList : IP_ADDR_STRING (+468, 40byte)  varptr(st)+468 を基点に操作(40byte:入れ子/配列)
; DhcpServer : IP_ADDR_STRING (+508, 40byte)  varptr(st)+508 を基点に操作(40byte:入れ子/配列)
; HaveWins : BOOL (+548, 4byte)  st.137 = 値  /  値 = st.137   (lpoke/lpeek も可)
; PrimaryWinsServer : IP_ADDR_STRING (+552, 40byte)  varptr(st)+552 を基点に操作(40byte:入れ子/配列)
; SecondaryWinsServer : IP_ADDR_STRING (+592, 40byte)  varptr(st)+592 を基点に操作(40byte:入れ子/配列)
; LeaseObtained : LONGLONG (+632, 8byte)  qpoke st,632,値 / qpeek(st,632)  ※IronHSPのみ。3.7/3.8は lpoke st,632,下位 : lpoke st,636,上位
; LeaseExpires : LONGLONG (+640, 8byte)  qpoke st,640,値 / qpeek(st,640)  ※IronHSPのみ。3.7/3.8は lpoke st,640,下位 : lpoke st,644,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IP_ADAPTER_INFO サイズ: 704 バイト(x64)
dim st, 176    ; 4byte整数×176(構造体サイズ 704 / 4 切り上げ)
; Next : IP_ADAPTER_INFO* (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; ComboIndex : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; AdapterName : CHAR (+12, 260byte)  varptr(st)+12 を基点に操作(260byte:入れ子/配列)
; Description : CHAR (+272, 132byte)  varptr(st)+272 を基点に操作(132byte:入れ子/配列)
; AddressLength : DWORD (+404, 4byte)  st.101 = 値  /  値 = st.101   (lpoke/lpeek も可)
; Address : BYTE (+408, 8byte)  varptr(st)+408 を基点に操作(8byte:入れ子/配列)
; Index : DWORD (+416, 4byte)  st.104 = 値  /  値 = st.104   (lpoke/lpeek も可)
; Type : DWORD (+420, 4byte)  st.105 = 値  /  値 = st.105   (lpoke/lpeek も可)
; DhcpEnabled : DWORD (+424, 4byte)  st.106 = 値  /  値 = st.106   (lpoke/lpeek も可)
; CurrentIpAddress : IP_ADDR_STRING* (+432, 8byte)  varptr(st)+432 を基点に操作(8byte:入れ子/配列)
; IpAddressList : IP_ADDR_STRING (+440, 48byte)  varptr(st)+440 を基点に操作(48byte:入れ子/配列)
; GatewayList : IP_ADDR_STRING (+488, 48byte)  varptr(st)+488 を基点に操作(48byte:入れ子/配列)
; DhcpServer : IP_ADDR_STRING (+536, 48byte)  varptr(st)+536 を基点に操作(48byte:入れ子/配列)
; HaveWins : BOOL (+584, 4byte)  st.146 = 値  /  値 = st.146   (lpoke/lpeek も可)
; PrimaryWinsServer : IP_ADDR_STRING (+592, 48byte)  varptr(st)+592 を基点に操作(48byte:入れ子/配列)
; SecondaryWinsServer : IP_ADDR_STRING (+640, 48byte)  varptr(st)+640 を基点に操作(48byte:入れ子/配列)
; LeaseObtained : LONGLONG (+688, 8byte)  qpoke st,688,値 / qpeek(st,688)  ※IronHSPのみ。3.7/3.8は lpoke st,688,下位 : lpoke st,692,上位
; LeaseExpires : LONGLONG (+696, 8byte)  qpoke st,696,値 / qpeek(st,696)  ※IronHSPのみ。3.7/3.8は lpoke st,696,下位 : lpoke st,700,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global IP_ADDRESS_STRING
    #field byte String 16
#endstruct

#defstruct global IP_ADDR_STRING
    #field intptr Next
    #field IP_ADDRESS_STRING IpAddress
    #field IP_ADDRESS_STRING IpMask
    #field int Context
#endstruct

#defstruct global IP_ADAPTER_INFO
    #field intptr Next
    #field int ComboIndex
    #field byte AdapterName 260
    #field byte Description 132
    #field int AddressLength
    #field byte Address 8
    #field int Index
    #field int Type
    #field int DhcpEnabled
    #field intptr CurrentIpAddress
    #field IP_ADDR_STRING IpAddressList
    #field IP_ADDR_STRING GatewayList
    #field IP_ADDR_STRING DhcpServer
    #field bool HaveWins
    #field IP_ADDR_STRING PrimaryWinsServer
    #field IP_ADDR_STRING SecondaryWinsServer
    #field int64 LeaseObtained
    #field int64 LeaseExpires
#endstruct

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