ホーム › NetworkManagement.Ndis › NDIS_PCI_DEVICE_CUSTOM_PROPERTIES
NDIS_PCI_DEVICE_CUSTOM_PROPERTIES
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Header | NDIS_OBJECT_HEADER | 4 | +0 | +0 | 構造体の型・リビジョン・サイズを示すNDISオブジェクトヘッダー。 |
| DeviceType | DWORD | 4 | +4 | +4 | PCIまたはPCI Expressデバイスの種別を示す。 |
| CurrentSpeedAndMode | DWORD | 4 | +8 | +8 | 現在のバス速度と動作モードを示す。 |
| CurrentPayloadSize | DWORD | 4 | +12 | +12 | 現在のPCI Expressペイロードサイズ(バイト)。 |
| MaxPayloadSize | DWORD | 4 | +16 | +16 | サポートする最大ペイロードサイズ(バイト)。 |
| MaxReadRequestSize | DWORD | 4 | +20 | +20 | 最大リード要求サイズ(バイト)。 |
| CurrentLinkSpeed | DWORD | 4 | +24 | +24 | 現在のリンク速度を示す。 |
| CurrentLinkWidth | DWORD | 4 | +28 | +28 | 現在のリンク幅(レーン数)を示す。 |
| MaxLinkSpeed | DWORD | 4 | +32 | +32 | サポートする最大リンク速度を示す。 |
| MaxLinkWidth | DWORD | 4 | +36 | +36 | サポートする最大リンク幅(レーン数)を示す。 |
| PciExpressVersion | DWORD | 4 | +40 | +40 | PCI Expressの仕様バージョンを示す。 |
| InterruptType | DWORD | 4 | +44 | +44 | 割り込み種別(ライン/MSI/MSI-Xなど)を示す。 |
| MaxInterruptMessages | DWORD | 4 | +48 | +48 | サポートする最大割り込みメッセージ数を示す。 |
各言語での定義
#include <windows.h>
// NDIS_OBJECT_HEADER (x64 4 / x86 4 バイト)
typedef struct NDIS_OBJECT_HEADER {
BYTE Type;
BYTE Revision;
WORD Size;
} NDIS_OBJECT_HEADER;
// NDIS_PCI_DEVICE_CUSTOM_PROPERTIES (x64 52 / x86 52 バイト)
typedef struct NDIS_PCI_DEVICE_CUSTOM_PROPERTIES {
NDIS_OBJECT_HEADER Header;
DWORD DeviceType;
DWORD CurrentSpeedAndMode;
DWORD CurrentPayloadSize;
DWORD MaxPayloadSize;
DWORD MaxReadRequestSize;
DWORD CurrentLinkSpeed;
DWORD CurrentLinkWidth;
DWORD MaxLinkSpeed;
DWORD MaxLinkWidth;
DWORD PciExpressVersion;
DWORD InterruptType;
DWORD MaxInterruptMessages;
} NDIS_PCI_DEVICE_CUSTOM_PROPERTIES;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDIS_OBJECT_HEADER
{
public byte Type;
public byte Revision;
public ushort Size;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDIS_PCI_DEVICE_CUSTOM_PROPERTIES
{
public NDIS_OBJECT_HEADER Header;
public uint DeviceType;
public uint CurrentSpeedAndMode;
public uint CurrentPayloadSize;
public uint MaxPayloadSize;
public uint MaxReadRequestSize;
public uint CurrentLinkSpeed;
public uint CurrentLinkWidth;
public uint MaxLinkSpeed;
public uint MaxLinkWidth;
public uint PciExpressVersion;
public uint InterruptType;
public uint MaxInterruptMessages;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDIS_OBJECT_HEADER
Public Type As Byte
Public Revision As Byte
Public Size As UShort
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDIS_PCI_DEVICE_CUSTOM_PROPERTIES
Public Header As NDIS_OBJECT_HEADER
Public DeviceType As UInteger
Public CurrentSpeedAndMode As UInteger
Public CurrentPayloadSize As UInteger
Public MaxPayloadSize As UInteger
Public MaxReadRequestSize As UInteger
Public CurrentLinkSpeed As UInteger
Public CurrentLinkWidth As UInteger
Public MaxLinkSpeed As UInteger
Public MaxLinkWidth As UInteger
Public PciExpressVersion As UInteger
Public InterruptType As UInteger
Public MaxInterruptMessages As UInteger
End Structureimport ctypes
from ctypes import wintypes
class NDIS_OBJECT_HEADER(ctypes.Structure):
_fields_ = [
("Type", ctypes.c_ubyte),
("Revision", ctypes.c_ubyte),
("Size", ctypes.c_ushort),
]
class NDIS_PCI_DEVICE_CUSTOM_PROPERTIES(ctypes.Structure):
_fields_ = [
("Header", NDIS_OBJECT_HEADER),
("DeviceType", wintypes.DWORD),
("CurrentSpeedAndMode", wintypes.DWORD),
("CurrentPayloadSize", wintypes.DWORD),
("MaxPayloadSize", wintypes.DWORD),
("MaxReadRequestSize", wintypes.DWORD),
("CurrentLinkSpeed", wintypes.DWORD),
("CurrentLinkWidth", wintypes.DWORD),
("MaxLinkSpeed", wintypes.DWORD),
("MaxLinkWidth", wintypes.DWORD),
("PciExpressVersion", wintypes.DWORD),
("InterruptType", wintypes.DWORD),
("MaxInterruptMessages", wintypes.DWORD),
]#[repr(C)]
pub struct NDIS_OBJECT_HEADER {
pub Type: u8,
pub Revision: u8,
pub Size: u16,
}
#[repr(C)]
pub struct NDIS_PCI_DEVICE_CUSTOM_PROPERTIES {
pub Header: NDIS_OBJECT_HEADER,
pub DeviceType: u32,
pub CurrentSpeedAndMode: u32,
pub CurrentPayloadSize: u32,
pub MaxPayloadSize: u32,
pub MaxReadRequestSize: u32,
pub CurrentLinkSpeed: u32,
pub CurrentLinkWidth: u32,
pub MaxLinkSpeed: u32,
pub MaxLinkWidth: u32,
pub PciExpressVersion: u32,
pub InterruptType: u32,
pub MaxInterruptMessages: u32,
}import "golang.org/x/sys/windows"
type NDIS_OBJECT_HEADER struct {
Type byte
Revision byte
Size uint16
}
type NDIS_PCI_DEVICE_CUSTOM_PROPERTIES struct {
Header NDIS_OBJECT_HEADER
DeviceType uint32
CurrentSpeedAndMode uint32
CurrentPayloadSize uint32
MaxPayloadSize uint32
MaxReadRequestSize uint32
CurrentLinkSpeed uint32
CurrentLinkWidth uint32
MaxLinkSpeed uint32
MaxLinkWidth uint32
PciExpressVersion uint32
InterruptType uint32
MaxInterruptMessages uint32
}type
NDIS_OBJECT_HEADER = record
Type: Byte;
Revision: Byte;
Size: Word;
end;
NDIS_PCI_DEVICE_CUSTOM_PROPERTIES = record
Header: NDIS_OBJECT_HEADER;
DeviceType: DWORD;
CurrentSpeedAndMode: DWORD;
CurrentPayloadSize: DWORD;
MaxPayloadSize: DWORD;
MaxReadRequestSize: DWORD;
CurrentLinkSpeed: DWORD;
CurrentLinkWidth: DWORD;
MaxLinkSpeed: DWORD;
MaxLinkWidth: DWORD;
PciExpressVersion: DWORD;
InterruptType: DWORD;
MaxInterruptMessages: DWORD;
end;const NDIS_OBJECT_HEADER = extern struct {
Type: u8,
Revision: u8,
Size: u16,
};
const NDIS_PCI_DEVICE_CUSTOM_PROPERTIES = extern struct {
Header: NDIS_OBJECT_HEADER,
DeviceType: u32,
CurrentSpeedAndMode: u32,
CurrentPayloadSize: u32,
MaxPayloadSize: u32,
MaxReadRequestSize: u32,
CurrentLinkSpeed: u32,
CurrentLinkWidth: u32,
MaxLinkSpeed: u32,
MaxLinkWidth: u32,
PciExpressVersion: u32,
InterruptType: u32,
MaxInterruptMessages: u32,
};type
NDIS_OBJECT_HEADER {.bycopy.} = object
Type: uint8
Revision: uint8
Size: uint16
NDIS_PCI_DEVICE_CUSTOM_PROPERTIES {.bycopy.} = object
Header: NDIS_OBJECT_HEADER
DeviceType: uint32
CurrentSpeedAndMode: uint32
CurrentPayloadSize: uint32
MaxPayloadSize: uint32
MaxReadRequestSize: uint32
CurrentLinkSpeed: uint32
CurrentLinkWidth: uint32
MaxLinkSpeed: uint32
MaxLinkWidth: uint32
PciExpressVersion: uint32
InterruptType: uint32
MaxInterruptMessages: uint32struct NDIS_OBJECT_HEADER
{
ubyte Type;
ubyte Revision;
ushort Size;
}
struct NDIS_PCI_DEVICE_CUSTOM_PROPERTIES
{
NDIS_OBJECT_HEADER Header;
uint DeviceType;
uint CurrentSpeedAndMode;
uint CurrentPayloadSize;
uint MaxPayloadSize;
uint MaxReadRequestSize;
uint CurrentLinkSpeed;
uint CurrentLinkWidth;
uint MaxLinkSpeed;
uint MaxLinkWidth;
uint PciExpressVersion;
uint InterruptType;
uint MaxInterruptMessages;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NDIS_PCI_DEVICE_CUSTOM_PROPERTIES サイズ: 52 バイト(x64)
dim st, 13 ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; Header : NDIS_OBJECT_HEADER (+0, 4byte) varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; DeviceType : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; CurrentSpeedAndMode : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; CurrentPayloadSize : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; MaxPayloadSize : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; MaxReadRequestSize : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; CurrentLinkSpeed : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; CurrentLinkWidth : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; MaxLinkSpeed : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; MaxLinkWidth : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; PciExpressVersion : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; InterruptType : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; MaxInterruptMessages : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global NDIS_OBJECT_HEADER
#field byte Type
#field byte Revision
#field short Size
#endstruct
#defstruct global NDIS_PCI_DEVICE_CUSTOM_PROPERTIES
#field NDIS_OBJECT_HEADER Header
#field int DeviceType
#field int CurrentSpeedAndMode
#field int CurrentPayloadSize
#field int MaxPayloadSize
#field int MaxReadRequestSize
#field int CurrentLinkSpeed
#field int CurrentLinkWidth
#field int MaxLinkSpeed
#field int MaxLinkWidth
#field int PciExpressVersion
#field int InterruptType
#field int MaxInterruptMessages
#endstruct
stdim st, NDIS_PCI_DEVICE_CUSTOM_PROPERTIES ; NSTRUCT 変数を確保
st->DeviceType = 100
mes "DeviceType=" + st->DeviceType