Win32 API 日本語リファレンス
ホームDevices.DeviceAndDriverInstallation › CONNECTION_DES

CONNECTION_DES

構造体
サイズx64: 20 バイト / x86: 20 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
COND_TypeDWORD4+0+0接続記述子の種別を示す値。
COND_FlagsDWORD4+4+4接続記述子のフラグ群。
COND_ClassBYTE1+8+8接続のクラスを示すバイト値。
COND_ClassTypeBYTE1+9+9接続のクラス種別を示すバイト値。
COND_Reserved1BYTE1+10+10システム内部利用の予約バイト1。
COND_Reserved2BYTE1+11+11システム内部利用の予約バイト2。
COND_IdLONGLONG8+12+12接続を識別する64ビットID値。

各言語での定義

#include <windows.h>

// CONNECTION_DES  (x64 20 / x86 20 バイト)
#pragma pack(push, 1)
typedef struct CONNECTION_DES {
    DWORD COND_Type;
    DWORD COND_Flags;
    BYTE COND_Class;
    BYTE COND_ClassType;
    BYTE COND_Reserved1;
    BYTE COND_Reserved2;
    LONGLONG COND_Id;
} CONNECTION_DES;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct CONNECTION_DES
{
    public uint COND_Type;
    public uint COND_Flags;
    public byte COND_Class;
    public byte COND_ClassType;
    public byte COND_Reserved1;
    public byte COND_Reserved2;
    public long COND_Id;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure CONNECTION_DES
    Public COND_Type As UInteger
    Public COND_Flags As UInteger
    Public COND_Class As Byte
    Public COND_ClassType As Byte
    Public COND_Reserved1 As Byte
    Public COND_Reserved2 As Byte
    Public COND_Id As Long
End Structure
import ctypes
from ctypes import wintypes

class CONNECTION_DES(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("COND_Type", wintypes.DWORD),
        ("COND_Flags", wintypes.DWORD),
        ("COND_Class", ctypes.c_ubyte),
        ("COND_ClassType", ctypes.c_ubyte),
        ("COND_Reserved1", ctypes.c_ubyte),
        ("COND_Reserved2", ctypes.c_ubyte),
        ("COND_Id", ctypes.c_longlong),
    ]
#[repr(C, packed(1))]
pub struct CONNECTION_DES {
    pub COND_Type: u32,
    pub COND_Flags: u32,
    pub COND_Class: u8,
    pub COND_ClassType: u8,
    pub COND_Reserved1: u8,
    pub COND_Reserved2: u8,
    pub COND_Id: i64,
}
import "golang.org/x/sys/windows"

type CONNECTION_DES struct {
	COND_Type uint32
	COND_Flags uint32
	COND_Class byte
	COND_ClassType byte
	COND_Reserved1 byte
	COND_Reserved2 byte
	COND_Id int64
}
type
  CONNECTION_DES = packed record
    COND_Type: DWORD;
    COND_Flags: DWORD;
    COND_Class: Byte;
    COND_ClassType: Byte;
    COND_Reserved1: Byte;
    COND_Reserved2: Byte;
    COND_Id: Int64;
  end;
const CONNECTION_DES = extern struct {
    COND_Type: u32,
    COND_Flags: u32,
    COND_Class: u8,
    COND_ClassType: u8,
    COND_Reserved1: u8,
    COND_Reserved2: u8,
    COND_Id: i64,
};
type
  CONNECTION_DES {.packed.} = object
    COND_Type: uint32
    COND_Flags: uint32
    COND_Class: uint8
    COND_ClassType: uint8
    COND_Reserved1: uint8
    COND_Reserved2: uint8
    COND_Id: int64
align(1)
struct CONNECTION_DES
{
    uint COND_Type;
    uint COND_Flags;
    ubyte COND_Class;
    ubyte COND_ClassType;
    ubyte COND_Reserved1;
    ubyte COND_Reserved2;
    long COND_Id;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CONNECTION_DES サイズ: 20 バイト(x64)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; COND_Type : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; COND_Flags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; COND_Class : BYTE (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; COND_ClassType : BYTE (+9, 1byte)  poke st,9,値  /  値 = peek(st,9)
; COND_Reserved1 : BYTE (+10, 1byte)  poke st,10,値  /  値 = peek(st,10)
; COND_Reserved2 : BYTE (+11, 1byte)  poke st,11,値  /  値 = peek(st,11)
; COND_Id : LONGLONG (+12, 8byte)  qpoke st,12,値 / qpeek(st,12)  ※IronHSPのみ。3.7/3.8は lpoke st,12,下位 : lpoke st,16,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CONNECTION_DES, pack=1
    #field int COND_Type
    #field int COND_Flags
    #field byte COND_Class
    #field byte COND_ClassType
    #field byte COND_Reserved1
    #field byte COND_Reserved2
    #field int64 COND_Id
#endstruct

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