ホーム › NetworkManagement.Ndis › NDIS_802_11_KEY
NDIS_802_11_KEY
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Length | DWORD | 4 | +0 | +0 | 本構造体の長さ(バイト)。 |
| KeyIndex | DWORD | 4 | +4 | +4 | キーインデックス。最上位ビットで送信キー指定やペアワイズキー指定を表す。 |
| KeyLength | DWORD | 4 | +8 | +8 | KeyMaterialのキー長(バイト)。 |
| BSSID | BYTE | 6 | +12 | +12 | ペアワイズキーの対象BSSID(MACアドレス、6バイト)。 |
| KeyRSC | ULONGLONG | 8 | +24 | +24 | キーの受信シーケンスカウンタ(リプレイ防止用)。 |
| KeyMaterial | BYTE | 1 | +32 | +32 | 実際のキーデータを格納する可変長配列の先頭バイト。 |
各言語での定義
#include <windows.h>
// NDIS_802_11_KEY (x64 40 / x86 40 バイト)
typedef struct NDIS_802_11_KEY {
DWORD Length;
DWORD KeyIndex;
DWORD KeyLength;
BYTE BSSID[6];
ULONGLONG KeyRSC;
BYTE KeyMaterial[1];
} NDIS_802_11_KEY;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDIS_802_11_KEY
{
public uint Length;
public uint KeyIndex;
public uint KeyLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] BSSID;
public ulong KeyRSC;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] KeyMaterial;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDIS_802_11_KEY
Public Length As UInteger
Public KeyIndex As UInteger
Public KeyLength As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public BSSID() As Byte
Public KeyRSC As ULong
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public KeyMaterial() As Byte
End Structureimport ctypes
from ctypes import wintypes
class NDIS_802_11_KEY(ctypes.Structure):
_fields_ = [
("Length", wintypes.DWORD),
("KeyIndex", wintypes.DWORD),
("KeyLength", wintypes.DWORD),
("BSSID", ctypes.c_ubyte * 6),
("KeyRSC", ctypes.c_ulonglong),
("KeyMaterial", ctypes.c_ubyte * 1),
]#[repr(C)]
pub struct NDIS_802_11_KEY {
pub Length: u32,
pub KeyIndex: u32,
pub KeyLength: u32,
pub BSSID: [u8; 6],
pub KeyRSC: u64,
pub KeyMaterial: [u8; 1],
}import "golang.org/x/sys/windows"
type NDIS_802_11_KEY struct {
Length uint32
KeyIndex uint32
KeyLength uint32
BSSID [6]byte
KeyRSC uint64
KeyMaterial [1]byte
}type
NDIS_802_11_KEY = record
Length: DWORD;
KeyIndex: DWORD;
KeyLength: DWORD;
BSSID: array[0..5] of Byte;
KeyRSC: UInt64;
KeyMaterial: array[0..0] of Byte;
end;const NDIS_802_11_KEY = extern struct {
Length: u32,
KeyIndex: u32,
KeyLength: u32,
BSSID: [6]u8,
KeyRSC: u64,
KeyMaterial: [1]u8,
};type
NDIS_802_11_KEY {.bycopy.} = object
Length: uint32
KeyIndex: uint32
KeyLength: uint32
BSSID: array[6, uint8]
KeyRSC: uint64
KeyMaterial: array[1, uint8]struct NDIS_802_11_KEY
{
uint Length;
uint KeyIndex;
uint KeyLength;
ubyte[6] BSSID;
ulong KeyRSC;
ubyte[1] KeyMaterial;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NDIS_802_11_KEY サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; Length : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; KeyIndex : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; KeyLength : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; BSSID : BYTE (+12, 6byte) varptr(st)+12 を基点に操作(6byte:入れ子/配列)
; KeyRSC : ULONGLONG (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; KeyMaterial : BYTE (+32, 1byte) varptr(st)+32 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NDIS_802_11_KEY
#field int Length
#field int KeyIndex
#field int KeyLength
#field byte BSSID 6
#field int64 KeyRSC
#field byte KeyMaterial 1
#endstruct
stdim st, NDIS_802_11_KEY ; NSTRUCT 変数を確保
st->Length = 100
mes "Length=" + st->Length