ホーム › Networking.WinSock › WINDOWS_IRDA_DEVICE_INFO
WINDOWS_IRDA_DEVICE_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| irdaDeviceID | BYTE | 4 | +0 | +0 | IrDAデバイスのID(4バイト)である。 |
| irdaDeviceName | CHAR | 22 | +4 | +4 | IrDAデバイスの名前文字列(固定長)である。 |
| irdaDeviceHints1 | BYTE | 1 | +26 | +26 | デバイスのサービスヒントを示すバイト(その1)である。 |
| irdaDeviceHints2 | BYTE | 1 | +27 | +27 | デバイスのサービスヒントを示すバイト(その2)である。 |
| irdaCharSet | BYTE | 1 | +28 | +28 | デバイス名に使用される文字セットを示す値である。 |
各言語での定義
#include <windows.h>
// WINDOWS_IRDA_DEVICE_INFO (x64 29 / x86 29 バイト)
typedef struct WINDOWS_IRDA_DEVICE_INFO {
BYTE irdaDeviceID[4];
CHAR irdaDeviceName[22];
BYTE irdaDeviceHints1;
BYTE irdaDeviceHints2;
BYTE irdaCharSet;
} WINDOWS_IRDA_DEVICE_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WINDOWS_IRDA_DEVICE_INFO
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] irdaDeviceID;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)] public sbyte[] irdaDeviceName;
public byte irdaDeviceHints1;
public byte irdaDeviceHints2;
public byte irdaCharSet;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WINDOWS_IRDA_DEVICE_INFO
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public irdaDeviceID() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=22)> Public irdaDeviceName() As SByte
Public irdaDeviceHints1 As Byte
Public irdaDeviceHints2 As Byte
Public irdaCharSet As Byte
End Structureimport ctypes
from ctypes import wintypes
class WINDOWS_IRDA_DEVICE_INFO(ctypes.Structure):
_fields_ = [
("irdaDeviceID", ctypes.c_ubyte * 4),
("irdaDeviceName", ctypes.c_byte * 22),
("irdaDeviceHints1", ctypes.c_ubyte),
("irdaDeviceHints2", ctypes.c_ubyte),
("irdaCharSet", ctypes.c_ubyte),
]#[repr(C)]
pub struct WINDOWS_IRDA_DEVICE_INFO {
pub irdaDeviceID: [u8; 4],
pub irdaDeviceName: [i8; 22],
pub irdaDeviceHints1: u8,
pub irdaDeviceHints2: u8,
pub irdaCharSet: u8,
}import "golang.org/x/sys/windows"
type WINDOWS_IRDA_DEVICE_INFO struct {
irdaDeviceID [4]byte
irdaDeviceName [22]int8
irdaDeviceHints1 byte
irdaDeviceHints2 byte
irdaCharSet byte
}type
WINDOWS_IRDA_DEVICE_INFO = record
irdaDeviceID: array[0..3] of Byte;
irdaDeviceName: array[0..21] of Shortint;
irdaDeviceHints1: Byte;
irdaDeviceHints2: Byte;
irdaCharSet: Byte;
end;const WINDOWS_IRDA_DEVICE_INFO = extern struct {
irdaDeviceID: [4]u8,
irdaDeviceName: [22]i8,
irdaDeviceHints1: u8,
irdaDeviceHints2: u8,
irdaCharSet: u8,
};type
WINDOWS_IRDA_DEVICE_INFO {.bycopy.} = object
irdaDeviceID: array[4, uint8]
irdaDeviceName: array[22, int8]
irdaDeviceHints1: uint8
irdaDeviceHints2: uint8
irdaCharSet: uint8struct WINDOWS_IRDA_DEVICE_INFO
{
ubyte[4] irdaDeviceID;
byte[22] irdaDeviceName;
ubyte irdaDeviceHints1;
ubyte irdaDeviceHints2;
ubyte irdaCharSet;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WINDOWS_IRDA_DEVICE_INFO サイズ: 29 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 29 / 4 切り上げ)
; irdaDeviceID : BYTE (+0, 4byte) varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; irdaDeviceName : CHAR (+4, 22byte) varptr(st)+4 を基点に操作(22byte:入れ子/配列)
; irdaDeviceHints1 : BYTE (+26, 1byte) poke st,26,値 / 値 = peek(st,26)
; irdaDeviceHints2 : BYTE (+27, 1byte) poke st,27,値 / 値 = peek(st,27)
; irdaCharSet : BYTE (+28, 1byte) poke st,28,値 / 値 = peek(st,28)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WINDOWS_IRDA_DEVICE_INFO
#field byte irdaDeviceID 4
#field byte irdaDeviceName 22
#field byte irdaDeviceHints1
#field byte irdaDeviceHints2
#field byte irdaCharSet
#endstruct
stdim st, WINDOWS_IRDA_DEVICE_INFO ; NSTRUCT 変数を確保
st->irdaDeviceHints1 = 100
mes "irdaDeviceHints1=" + st->irdaDeviceHints1