ホーム › NetworkManagement.Rras › MPR_DEVICE_1
MPR_DEVICE_1
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| szDeviceType | WCHAR | 34 | +0 | +0 | デバイスの種別を表すワイド文字列。 |
| szDeviceName | WCHAR | 258 | +34 | +34 | デバイスの名前を表すワイド文字列。 |
| szLocalPhoneNumber | WCHAR | 258 | +292 | +292 | このデバイスで発信するローカル電話番号(ワイド文字列)。 |
| szAlternates | LPWSTR | 8/4 | +552 | +552 | 代替電話番号のリストへのポインタ(複数文字列)。 |
各言語での定義
#include <windows.h>
// MPR_DEVICE_1 (x64 560 / x86 556 バイト)
typedef struct MPR_DEVICE_1 {
WCHAR szDeviceType[17];
WCHAR szDeviceName[129];
WCHAR szLocalPhoneNumber[129];
LPWSTR szAlternates;
} MPR_DEVICE_1;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MPR_DEVICE_1
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 17)] public string szDeviceType;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 129)] public string szDeviceName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 129)] public string szLocalPhoneNumber;
public IntPtr szAlternates;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MPR_DEVICE_1
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=17)> Public szDeviceType As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=129)> Public szDeviceName As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=129)> Public szLocalPhoneNumber As String
Public szAlternates As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class MPR_DEVICE_1(ctypes.Structure):
_fields_ = [
("szDeviceType", ctypes.c_wchar * 17),
("szDeviceName", ctypes.c_wchar * 129),
("szLocalPhoneNumber", ctypes.c_wchar * 129),
("szAlternates", ctypes.c_void_p),
]#[repr(C)]
pub struct MPR_DEVICE_1 {
pub szDeviceType: [u16; 17],
pub szDeviceName: [u16; 129],
pub szLocalPhoneNumber: [u16; 129],
pub szAlternates: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type MPR_DEVICE_1 struct {
szDeviceType [17]uint16
szDeviceName [129]uint16
szLocalPhoneNumber [129]uint16
szAlternates uintptr
}type
MPR_DEVICE_1 = record
szDeviceType: array[0..16] of WideChar;
szDeviceName: array[0..128] of WideChar;
szLocalPhoneNumber: array[0..128] of WideChar;
szAlternates: Pointer;
end;const MPR_DEVICE_1 = extern struct {
szDeviceType: [17]u16,
szDeviceName: [129]u16,
szLocalPhoneNumber: [129]u16,
szAlternates: ?*anyopaque,
};type
MPR_DEVICE_1 {.bycopy.} = object
szDeviceType: array[17, uint16]
szDeviceName: array[129, uint16]
szLocalPhoneNumber: array[129, uint16]
szAlternates: pointerstruct MPR_DEVICE_1
{
wchar[17] szDeviceType;
wchar[129] szDeviceName;
wchar[129] szLocalPhoneNumber;
void* szAlternates;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MPR_DEVICE_1 サイズ: 556 バイト(x86)
dim st, 139 ; 4byte整数×139(構造体サイズ 556 / 4 切り上げ)
; szDeviceType : WCHAR (+0, 34byte) varptr(st)+0 を基点に操作(34byte:入れ子/配列)
; szDeviceName : WCHAR (+34, 258byte) varptr(st)+34 を基点に操作(258byte:入れ子/配列)
; szLocalPhoneNumber : WCHAR (+292, 258byte) varptr(st)+292 を基点に操作(258byte:入れ子/配列)
; szAlternates : LPWSTR (+552, 4byte) st.138 = 値 / 値 = st.138 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MPR_DEVICE_1 サイズ: 560 バイト(x64)
dim st, 140 ; 4byte整数×140(構造体サイズ 560 / 4 切り上げ)
; szDeviceType : WCHAR (+0, 34byte) varptr(st)+0 を基点に操作(34byte:入れ子/配列)
; szDeviceName : WCHAR (+34, 258byte) varptr(st)+34 を基点に操作(258byte:入れ子/配列)
; szLocalPhoneNumber : WCHAR (+292, 258byte) varptr(st)+292 を基点に操作(258byte:入れ子/配列)
; szAlternates : LPWSTR (+552, 8byte) qpoke st,552,値 / qpeek(st,552) ※IronHSPのみ。3.7/3.8は lpoke st,552,下位 : lpoke st,556,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MPR_DEVICE_1
#field wchar szDeviceType 17
#field wchar szDeviceName 129
#field wchar szLocalPhoneNumber 129
#field intptr szAlternates
#endstruct
stdim st, MPR_DEVICE_1 ; NSTRUCT 変数を確保