ホーム › NetworkManagement.WiFi › DOT11_BYTE_ARRAY
DOT11_BYTE_ARRAY
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Header | NDIS_OBJECT_HEADER | 4 | +0 | +0 | NDIS オブジェクトのバージョン情報を含むヘッダー。 |
| uNumOfBytes | DWORD | 4 | +4 | +4 | ucBuffer に有効なバイト数を表す。 |
| uTotalNumOfBytes | DWORD | 4 | +8 | +8 | ucBuffer が格納可能な最大バイト数を表す。 |
| ucBuffer | BYTE | 1 | +12 | +12 | 任意のバイトデータを格納する可変長バッファ。 |
各言語での定義
#include <windows.h>
// NDIS_OBJECT_HEADER (x64 4 / x86 4 バイト)
typedef struct NDIS_OBJECT_HEADER {
BYTE Type;
BYTE Revision;
WORD Size;
} NDIS_OBJECT_HEADER;
// DOT11_BYTE_ARRAY (x64 16 / x86 16 バイト)
typedef struct DOT11_BYTE_ARRAY {
NDIS_OBJECT_HEADER Header;
DWORD uNumOfBytes;
DWORD uTotalNumOfBytes;
BYTE ucBuffer[1];
} DOT11_BYTE_ARRAY;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 DOT11_BYTE_ARRAY
{
public NDIS_OBJECT_HEADER Header;
public uint uNumOfBytes;
public uint uTotalNumOfBytes;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] ucBuffer;
}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 DOT11_BYTE_ARRAY
Public Header As NDIS_OBJECT_HEADER
Public uNumOfBytes As UInteger
Public uTotalNumOfBytes As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public ucBuffer() As Byte
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 DOT11_BYTE_ARRAY(ctypes.Structure):
_fields_ = [
("Header", NDIS_OBJECT_HEADER),
("uNumOfBytes", wintypes.DWORD),
("uTotalNumOfBytes", wintypes.DWORD),
("ucBuffer", ctypes.c_ubyte * 1),
]#[repr(C)]
pub struct NDIS_OBJECT_HEADER {
pub Type: u8,
pub Revision: u8,
pub Size: u16,
}
#[repr(C)]
pub struct DOT11_BYTE_ARRAY {
pub Header: NDIS_OBJECT_HEADER,
pub uNumOfBytes: u32,
pub uTotalNumOfBytes: u32,
pub ucBuffer: [u8; 1],
}import "golang.org/x/sys/windows"
type NDIS_OBJECT_HEADER struct {
Type byte
Revision byte
Size uint16
}
type DOT11_BYTE_ARRAY struct {
Header NDIS_OBJECT_HEADER
uNumOfBytes uint32
uTotalNumOfBytes uint32
ucBuffer [1]byte
}type
NDIS_OBJECT_HEADER = record
Type: Byte;
Revision: Byte;
Size: Word;
end;
DOT11_BYTE_ARRAY = record
Header: NDIS_OBJECT_HEADER;
uNumOfBytes: DWORD;
uTotalNumOfBytes: DWORD;
ucBuffer: array[0..0] of Byte;
end;const NDIS_OBJECT_HEADER = extern struct {
Type: u8,
Revision: u8,
Size: u16,
};
const DOT11_BYTE_ARRAY = extern struct {
Header: NDIS_OBJECT_HEADER,
uNumOfBytes: u32,
uTotalNumOfBytes: u32,
ucBuffer: [1]u8,
};type
NDIS_OBJECT_HEADER {.bycopy.} = object
Type: uint8
Revision: uint8
Size: uint16
DOT11_BYTE_ARRAY {.bycopy.} = object
Header: NDIS_OBJECT_HEADER
uNumOfBytes: uint32
uTotalNumOfBytes: uint32
ucBuffer: array[1, uint8]struct NDIS_OBJECT_HEADER
{
ubyte Type;
ubyte Revision;
ushort Size;
}
struct DOT11_BYTE_ARRAY
{
NDIS_OBJECT_HEADER Header;
uint uNumOfBytes;
uint uTotalNumOfBytes;
ubyte[1] ucBuffer;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DOT11_BYTE_ARRAY サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Header : NDIS_OBJECT_HEADER (+0, 4byte) varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; uNumOfBytes : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; uTotalNumOfBytes : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ucBuffer : BYTE (+12, 1byte) varptr(st)+12 を基点に操作(1byte:入れ子/配列)
; ※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 DOT11_BYTE_ARRAY
#field NDIS_OBJECT_HEADER Header
#field int uNumOfBytes
#field int uTotalNumOfBytes
#field byte ucBuffer 1
#endstruct
stdim st, DOT11_BYTE_ARRAY ; NSTRUCT 変数を確保
st->uNumOfBytes = 100
mes "uNumOfBytes=" + st->uNumOfBytes