ホーム › Devices.DeviceAndDriverInstallation › CONNECTION_RESOURCE
CONNECTION_RESOURCE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Connection_Header | CONNECTION_DES | 20 | +0 | +0 | 接続リソースの記述子ヘッダ(CONNECTION_DES)。 |
各言語での定義
#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)
// CONNECTION_RESOURCE (x64 20 / x86 20 バイト)
#pragma pack(push, 1)
typedef struct CONNECTION_RESOURCE {
CONNECTION_DES Connection_Header;
} CONNECTION_RESOURCE;
#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;
}
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct CONNECTION_RESOURCE
{
public CONNECTION_DES Connection_Header;
}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
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure CONNECTION_RESOURCE
Public Connection_Header As CONNECTION_DES
End Structureimport 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),
]
class CONNECTION_RESOURCE(ctypes.Structure):
_pack_ = 1
_fields_ = [
("Connection_Header", CONNECTION_DES),
]#[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,
}
#[repr(C, packed(1))]
pub struct CONNECTION_RESOURCE {
pub Connection_Header: CONNECTION_DES,
}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_RESOURCE struct {
Connection_Header CONNECTION_DES
}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;
CONNECTION_RESOURCE = packed record
Connection_Header: CONNECTION_DES;
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,
};
const CONNECTION_RESOURCE = extern struct {
Connection_Header: CONNECTION_DES,
};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
CONNECTION_RESOURCE {.packed.} = object
Connection_Header: CONNECTION_DESalign(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;
}
align(1)
struct CONNECTION_RESOURCE
{
CONNECTION_DES Connection_Header;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CONNECTION_RESOURCE サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; Connection_Header : CONNECTION_DES (+0, 20byte) varptr(st)+0 を基点に操作(20byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#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
#defstruct global CONNECTION_RESOURCE, pack=1
#field CONNECTION_DES Connection_Header
#endstruct
stdim st, CONNECTION_RESOURCE ; NSTRUCT 変数を確保