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

RASIPXW

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0この構造体のバイト単位のサイズ。
dwErrorDWORD4+4+4IPXCPプロトコル制御の結果エラーコード。0なら正常。
szIpxAddressWCHAR44+8+8接続に割り当てられたIPXアドレスを表すワイド文字列。

各言語での定義

#include <windows.h>

// RASIPXW  (x64 52 / x86 52 バイト)
typedef struct RASIPXW {
    DWORD dwSize;
    DWORD dwError;
    WCHAR szIpxAddress[22];
} RASIPXW;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RASIPXW
{
    public uint dwSize;
    public uint dwError;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 22)] public string szIpxAddress;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RASIPXW
    Public dwSize As UInteger
    Public dwError As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=22)> Public szIpxAddress As String
End Structure
import ctypes
from ctypes import wintypes

class RASIPXW(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwError", wintypes.DWORD),
        ("szIpxAddress", ctypes.c_wchar * 22),
    ]
#[repr(C)]
pub struct RASIPXW {
    pub dwSize: u32,
    pub dwError: u32,
    pub szIpxAddress: [u16; 22],
}
import "golang.org/x/sys/windows"

type RASIPXW struct {
	dwSize uint32
	dwError uint32
	szIpxAddress [22]uint16
}
type
  RASIPXW = record
    dwSize: DWORD;
    dwError: DWORD;
    szIpxAddress: array[0..21] of WideChar;
  end;
const RASIPXW = extern struct {
    dwSize: u32,
    dwError: u32,
    szIpxAddress: [22]u16,
};
type
  RASIPXW {.bycopy.} = object
    dwSize: uint32
    dwError: uint32
    szIpxAddress: array[22, uint16]
struct RASIPXW
{
    uint dwSize;
    uint dwError;
    wchar[22] szIpxAddress;
}

HSP用 定義

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

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

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