Win32 API 日本語リファレンス
ホームNetworking.WinSock › WINDOWS_IAS_QUERY

WINDOWS_IAS_QUERY

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

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

フィールド

フィールドサイズx64x86説明
irdaDeviceIDBYTE4+0+0問い合わせ対象のIrDAデバイスID(4バイト)である。
irdaClassNameCHAR64+4+4問い合わせるIASのクラス名文字列である。
irdaAttribNameCHAR256+68+68問い合わせるIAS属性の名前文字列である。
irdaAttribTypeDWORD4+324+324返される属性のデータ型を示す値である。
irdaAttribute_irdaAttribute_e__Union8/4+328+328問い合わせ結果の属性値を保持する無名共用体である。

共用体: _irdaAttribute_e__Union x64 8B / x86 4B

フィールドサイズx64x86
irdaAttribIntINT4+0+0
irdaAttribOctetSeq_irdaAttribOctetSeq_e__Struct8/4+0+0
irdaAttribUsrStr_irdaAttribUsrStr_e__Struct8/4+0+0

各言語での定義

#include <windows.h>

// WINDOWS_IAS_QUERY  (x64 336 / x86 332 バイト)
typedef struct WINDOWS_IAS_QUERY {
    BYTE irdaDeviceID[4];
    CHAR irdaClassName[64];
    CHAR irdaAttribName[256];
    DWORD irdaAttribType;
    _irdaAttribute_e__Union irdaAttribute;
} WINDOWS_IAS_QUERY;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WINDOWS_IAS_QUERY
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] irdaDeviceID;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public sbyte[] irdaClassName;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public sbyte[] irdaAttribName;
    public uint irdaAttribType;
    public _irdaAttribute_e__Union irdaAttribute;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WINDOWS_IAS_QUERY
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public irdaDeviceID() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=64)> Public irdaClassName() As SByte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=256)> Public irdaAttribName() As SByte
    Public irdaAttribType As UInteger
    Public irdaAttribute As _irdaAttribute_e__Union
End Structure
import ctypes
from ctypes import wintypes

class WINDOWS_IAS_QUERY(ctypes.Structure):
    _fields_ = [
        ("irdaDeviceID", ctypes.c_ubyte * 4),
        ("irdaClassName", ctypes.c_byte * 64),
        ("irdaAttribName", ctypes.c_byte * 256),
        ("irdaAttribType", wintypes.DWORD),
        ("irdaAttribute", _irdaAttribute_e__Union),
    ]
#[repr(C)]
pub struct WINDOWS_IAS_QUERY {
    pub irdaDeviceID: [u8; 4],
    pub irdaClassName: [i8; 64],
    pub irdaAttribName: [i8; 256],
    pub irdaAttribType: u32,
    pub irdaAttribute: _irdaAttribute_e__Union,
}
import "golang.org/x/sys/windows"

type WINDOWS_IAS_QUERY struct {
	irdaDeviceID [4]byte
	irdaClassName [64]int8
	irdaAttribName [256]int8
	irdaAttribType uint32
	irdaAttribute _irdaAttribute_e__Union
}
type
  WINDOWS_IAS_QUERY = record
    irdaDeviceID: array[0..3] of Byte;
    irdaClassName: array[0..63] of Shortint;
    irdaAttribName: array[0..255] of Shortint;
    irdaAttribType: DWORD;
    irdaAttribute: _irdaAttribute_e__Union;
  end;
const WINDOWS_IAS_QUERY = extern struct {
    irdaDeviceID: [4]u8,
    irdaClassName: [64]i8,
    irdaAttribName: [256]i8,
    irdaAttribType: u32,
    irdaAttribute: _irdaAttribute_e__Union,
};
type
  WINDOWS_IAS_QUERY {.bycopy.} = object
    irdaDeviceID: array[4, uint8]
    irdaClassName: array[64, int8]
    irdaAttribName: array[256, int8]
    irdaAttribType: uint32
    irdaAttribute: _irdaAttribute_e__Union
struct WINDOWS_IAS_QUERY
{
    ubyte[4] irdaDeviceID;
    byte[64] irdaClassName;
    byte[256] irdaAttribName;
    uint irdaAttribType;
    _irdaAttribute_e__Union irdaAttribute;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; WINDOWS_IAS_QUERY サイズ: 332 バイト(x86)
dim st, 83    ; 4byte整数×83(構造体サイズ 332 / 4 切り上げ)
; irdaDeviceID : BYTE (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; irdaClassName : CHAR (+4, 64byte)  varptr(st)+4 を基点に操作(64byte:入れ子/配列)
; irdaAttribName : CHAR (+68, 256byte)  varptr(st)+68 を基点に操作(256byte:入れ子/配列)
; irdaAttribType : DWORD (+324, 4byte)  st.81 = 値  /  値 = st.81   (lpoke/lpeek も可)
; irdaAttribute : _irdaAttribute_e__Union (+328, 4byte)  varptr(st)+328 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WINDOWS_IAS_QUERY サイズ: 336 バイト(x64)
dim st, 84    ; 4byte整数×84(構造体サイズ 336 / 4 切り上げ)
; irdaDeviceID : BYTE (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; irdaClassName : CHAR (+4, 64byte)  varptr(st)+4 を基点に操作(64byte:入れ子/配列)
; irdaAttribName : CHAR (+68, 256byte)  varptr(st)+68 を基点に操作(256byte:入れ子/配列)
; irdaAttribType : DWORD (+324, 4byte)  st.81 = 値  /  値 = st.81   (lpoke/lpeek も可)
; irdaAttribute : _irdaAttribute_e__Union (+328, 8byte)  varptr(st)+328 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WINDOWS_IAS_QUERY
    #field byte irdaDeviceID 4
    #field byte irdaClassName 64
    #field byte irdaAttribName 256
    #field int irdaAttribType
    #field byte irdaAttribute 8
#endstruct

stdim st, WINDOWS_IAS_QUERY        ; NSTRUCT 変数を確保
st->irdaAttribType = 100
mes "irdaAttribType=" + st->irdaAttribType
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。