ホーム › NetworkManagement.WiFi › DOT11_CIPHER_DEFAULT_KEY_VALUE
DOT11_CIPHER_DEFAULT_KEY_VALUE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Header | NDIS_OBJECT_HEADER | 4 | +0 | +0 | NDIS オブジェクトのバージョン情報を含むヘッダー。 |
| uKeyIndex | DWORD | 4 | +4 | +4 | 既定鍵テーブル内の鍵インデックスを表す。 |
| AlgorithmId | DOT11_CIPHER_ALGORITHM | 4 | +8 | +8 | 鍵に対応する暗号アルゴリズム識別子。 |
| MacAddr | BYTE | 6 | +12 | +12 | 鍵を関連付ける MAC アドレス。 |
| bDelete | BOOLEAN | 1 | +18 | +18 | この鍵を削除するか示すフラグ。 |
| bStatic | BOOLEAN | 1 | +19 | +19 | 静的鍵か(再起動後も保持)を示すフラグ。 |
| usKeyLength | WORD | 2 | +20 | +20 | ucKey が保持する鍵のバイト長を表す。 |
| ucKey | BYTE | 1 | +22 | +22 | 暗号鍵データを格納するバイト配列。可変長。 |
各言語での定義
#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_CIPHER_DEFAULT_KEY_VALUE (x64 24 / x86 24 バイト)
typedef struct DOT11_CIPHER_DEFAULT_KEY_VALUE {
NDIS_OBJECT_HEADER Header;
DWORD uKeyIndex;
DOT11_CIPHER_ALGORITHM AlgorithmId;
BYTE MacAddr[6];
BOOLEAN bDelete;
BOOLEAN bStatic;
WORD usKeyLength;
BYTE ucKey[1];
} DOT11_CIPHER_DEFAULT_KEY_VALUE;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_CIPHER_DEFAULT_KEY_VALUE
{
public NDIS_OBJECT_HEADER Header;
public uint uKeyIndex;
public int AlgorithmId;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] MacAddr;
[MarshalAs(UnmanagedType.U1)] public bool bDelete;
[MarshalAs(UnmanagedType.U1)] public bool bStatic;
public ushort usKeyLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] ucKey;
}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_CIPHER_DEFAULT_KEY_VALUE
Public Header As NDIS_OBJECT_HEADER
Public uKeyIndex As UInteger
Public AlgorithmId As Integer
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public MacAddr() As Byte
<MarshalAs(UnmanagedType.U1)> Public bDelete As Boolean
<MarshalAs(UnmanagedType.U1)> Public bStatic As Boolean
Public usKeyLength As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public ucKey() 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_CIPHER_DEFAULT_KEY_VALUE(ctypes.Structure):
_fields_ = [
("Header", NDIS_OBJECT_HEADER),
("uKeyIndex", wintypes.DWORD),
("AlgorithmId", ctypes.c_int),
("MacAddr", ctypes.c_ubyte * 6),
("bDelete", ctypes.c_byte),
("bStatic", ctypes.c_byte),
("usKeyLength", ctypes.c_ushort),
("ucKey", 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_CIPHER_DEFAULT_KEY_VALUE {
pub Header: NDIS_OBJECT_HEADER,
pub uKeyIndex: u32,
pub AlgorithmId: i32,
pub MacAddr: [u8; 6],
pub bDelete: u8,
pub bStatic: u8,
pub usKeyLength: u16,
pub ucKey: [u8; 1],
}import "golang.org/x/sys/windows"
type NDIS_OBJECT_HEADER struct {
Type byte
Revision byte
Size uint16
}
type DOT11_CIPHER_DEFAULT_KEY_VALUE struct {
Header NDIS_OBJECT_HEADER
uKeyIndex uint32
AlgorithmId int32
MacAddr [6]byte
bDelete byte
bStatic byte
usKeyLength uint16
ucKey [1]byte
}type
NDIS_OBJECT_HEADER = record
Type: Byte;
Revision: Byte;
Size: Word;
end;
DOT11_CIPHER_DEFAULT_KEY_VALUE = record
Header: NDIS_OBJECT_HEADER;
uKeyIndex: DWORD;
AlgorithmId: Integer;
MacAddr: array[0..5] of Byte;
bDelete: ByteBool;
bStatic: ByteBool;
usKeyLength: Word;
ucKey: array[0..0] of Byte;
end;const NDIS_OBJECT_HEADER = extern struct {
Type: u8,
Revision: u8,
Size: u16,
};
const DOT11_CIPHER_DEFAULT_KEY_VALUE = extern struct {
Header: NDIS_OBJECT_HEADER,
uKeyIndex: u32,
AlgorithmId: i32,
MacAddr: [6]u8,
bDelete: u8,
bStatic: u8,
usKeyLength: u16,
ucKey: [1]u8,
};type
NDIS_OBJECT_HEADER {.bycopy.} = object
Type: uint8
Revision: uint8
Size: uint16
DOT11_CIPHER_DEFAULT_KEY_VALUE {.bycopy.} = object
Header: NDIS_OBJECT_HEADER
uKeyIndex: uint32
AlgorithmId: int32
MacAddr: array[6, uint8]
bDelete: uint8
bStatic: uint8
usKeyLength: uint16
ucKey: array[1, uint8]struct NDIS_OBJECT_HEADER
{
ubyte Type;
ubyte Revision;
ushort Size;
}
struct DOT11_CIPHER_DEFAULT_KEY_VALUE
{
NDIS_OBJECT_HEADER Header;
uint uKeyIndex;
int AlgorithmId;
ubyte[6] MacAddr;
ubyte bDelete;
ubyte bStatic;
ushort usKeyLength;
ubyte[1] ucKey;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DOT11_CIPHER_DEFAULT_KEY_VALUE サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Header : NDIS_OBJECT_HEADER (+0, 4byte) varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; uKeyIndex : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; AlgorithmId : DOT11_CIPHER_ALGORITHM (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; MacAddr : BYTE (+12, 6byte) varptr(st)+12 を基点に操作(6byte:入れ子/配列)
; bDelete : BOOLEAN (+18, 1byte) poke st,18,値 / 値 = peek(st,18)
; bStatic : BOOLEAN (+19, 1byte) poke st,19,値 / 値 = peek(st,19)
; usKeyLength : WORD (+20, 2byte) wpoke st,20,値 / 値 = wpeek(st,20)
; ucKey : BYTE (+22, 1byte) varptr(st)+22 を基点に操作(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_CIPHER_DEFAULT_KEY_VALUE
#field NDIS_OBJECT_HEADER Header
#field int uKeyIndex
#field int AlgorithmId
#field byte MacAddr 6
#field bool1 bDelete
#field bool1 bStatic
#field short usKeyLength
#field byte ucKey 1
#endstruct
stdim st, DOT11_CIPHER_DEFAULT_KEY_VALUE ; NSTRUCT 変数を確保
st->uKeyIndex = 100
mes "uKeyIndex=" + st->uKeyIndex