ホーム › Devices.Tapi › NSID
NSID
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwSize | DWORD | 4 | +0 | +0 | この構造体のサイズをバイト単位で示す。 |
| uchType | BYTE | 16 | +4 | +4 | 名前空間サービス識別子の種別を示すバイト値。 |
| xtype | DWORD | 4 | +20 | +20 | 拡張種別を示す値。 |
| lTime | INT | 4 | +24 | +24 | タイムスタンプを示す値。 |
| address | _address_e__Union | 72 | +28 | +28 | 識別子に対応するアドレス情報を格納する無名共用体。 |
共用体: _address_e__Union x64 72B / x86 72B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| alias | ADDRALIAS | 72 | +0 | +0 |
| rgchInterNet | CHAR | 1 | +0 | +0 |
各言語での定義
#include <windows.h>
// NSID (x64 100 / x86 100 バイト)
typedef struct NSID {
DWORD dwSize;
BYTE uchType[16];
DWORD xtype;
INT lTime;
_address_e__Union address;
} NSID;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NSID
{
public uint dwSize;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] uchType;
public uint xtype;
public int lTime;
public _address_e__Union address;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NSID
Public dwSize As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public uchType() As Byte
Public xtype As UInteger
Public lTime As Integer
Public address As _address_e__Union
End Structureimport ctypes
from ctypes import wintypes
class NSID(ctypes.Structure):
_fields_ = [
("dwSize", wintypes.DWORD),
("uchType", ctypes.c_ubyte * 16),
("xtype", wintypes.DWORD),
("lTime", ctypes.c_int),
("address", _address_e__Union),
]#[repr(C)]
pub struct NSID {
pub dwSize: u32,
pub uchType: [u8; 16],
pub xtype: u32,
pub lTime: i32,
pub address: _address_e__Union,
}import "golang.org/x/sys/windows"
type NSID struct {
dwSize uint32
uchType [16]byte
xtype uint32
lTime int32
address _address_e__Union
}type
NSID = record
dwSize: DWORD;
uchType: array[0..15] of Byte;
xtype: DWORD;
lTime: Integer;
address: _address_e__Union;
end;const NSID = extern struct {
dwSize: u32,
uchType: [16]u8,
xtype: u32,
lTime: i32,
address: _address_e__Union,
};type
NSID {.bycopy.} = object
dwSize: uint32
uchType: array[16, uint8]
xtype: uint32
lTime: int32
address: _address_e__Unionstruct NSID
{
uint dwSize;
ubyte[16] uchType;
uint xtype;
int lTime;
_address_e__Union address;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NSID サイズ: 100 バイト(x64)
dim st, 25 ; 4byte整数×25(構造体サイズ 100 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; uchType : BYTE (+4, 16byte) varptr(st)+4 を基点に操作(16byte:入れ子/配列)
; xtype : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; lTime : INT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; address : _address_e__Union (+28, 72byte) varptr(st)+28 を基点に操作(72byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NSID
#field int dwSize
#field byte uchType 16
#field int xtype
#field int lTime
#field byte address 72
#endstruct
stdim st, NSID ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。