Win32 API 日本語リファレンス
ホームNetworkManagement.WiFi › DOT11_KEY_ALGO_TKIP_MIC

DOT11_KEY_ALGO_TKIP_MIC

構造体
サイズx64: 20 バイト / x86: 20 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
ucIV48CounterBYTE6+0+0TKIP の48ビット IV カウンタ初期値(6バイト)。
ulTKIPKeyLengthDWORD4+8+8TKIP 鍵のバイト長を表す。
ulMICKeyLengthDWORD4+12+12MIC 鍵のバイト長を表す。
ucTKIPMICKeysBYTE1+16+16TKIP 鍵と MIC 鍵を連結したバイト配列。可変長。

各言語での定義

#include <windows.h>

// DOT11_KEY_ALGO_TKIP_MIC  (x64 20 / x86 20 バイト)
typedef struct DOT11_KEY_ALGO_TKIP_MIC {
    BYTE ucIV48Counter[6];
    DWORD ulTKIPKeyLength;
    DWORD ulMICKeyLength;
    BYTE ucTKIPMICKeys[1];
} DOT11_KEY_ALGO_TKIP_MIC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_KEY_ALGO_TKIP_MIC
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] ucIV48Counter;
    public uint ulTKIPKeyLength;
    public uint ulMICKeyLength;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] ucTKIPMICKeys;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_KEY_ALGO_TKIP_MIC
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public ucIV48Counter() As Byte
    Public ulTKIPKeyLength As UInteger
    Public ulMICKeyLength As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public ucTKIPMICKeys() As Byte
End Structure
import ctypes
from ctypes import wintypes

class DOT11_KEY_ALGO_TKIP_MIC(ctypes.Structure):
    _fields_ = [
        ("ucIV48Counter", ctypes.c_ubyte * 6),
        ("ulTKIPKeyLength", wintypes.DWORD),
        ("ulMICKeyLength", wintypes.DWORD),
        ("ucTKIPMICKeys", ctypes.c_ubyte * 1),
    ]
#[repr(C)]
pub struct DOT11_KEY_ALGO_TKIP_MIC {
    pub ucIV48Counter: [u8; 6],
    pub ulTKIPKeyLength: u32,
    pub ulMICKeyLength: u32,
    pub ucTKIPMICKeys: [u8; 1],
}
import "golang.org/x/sys/windows"

type DOT11_KEY_ALGO_TKIP_MIC struct {
	ucIV48Counter [6]byte
	ulTKIPKeyLength uint32
	ulMICKeyLength uint32
	ucTKIPMICKeys [1]byte
}
type
  DOT11_KEY_ALGO_TKIP_MIC = record
    ucIV48Counter: array[0..5] of Byte;
    ulTKIPKeyLength: DWORD;
    ulMICKeyLength: DWORD;
    ucTKIPMICKeys: array[0..0] of Byte;
  end;
const DOT11_KEY_ALGO_TKIP_MIC = extern struct {
    ucIV48Counter: [6]u8,
    ulTKIPKeyLength: u32,
    ulMICKeyLength: u32,
    ucTKIPMICKeys: [1]u8,
};
type
  DOT11_KEY_ALGO_TKIP_MIC {.bycopy.} = object
    ucIV48Counter: array[6, uint8]
    ulTKIPKeyLength: uint32
    ulMICKeyLength: uint32
    ucTKIPMICKeys: array[1, uint8]
struct DOT11_KEY_ALGO_TKIP_MIC
{
    ubyte[6] ucIV48Counter;
    uint ulTKIPKeyLength;
    uint ulMICKeyLength;
    ubyte[1] ucTKIPMICKeys;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DOT11_KEY_ALGO_TKIP_MIC サイズ: 20 バイト(x64)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; ucIV48Counter : BYTE (+0, 6byte)  varptr(st)+0 を基点に操作(6byte:入れ子/配列)
; ulTKIPKeyLength : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; ulMICKeyLength : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ucTKIPMICKeys : BYTE (+16, 1byte)  varptr(st)+16 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DOT11_KEY_ALGO_TKIP_MIC
    #field byte ucIV48Counter 6
    #field int ulTKIPKeyLength
    #field int ulMICKeyLength
    #field byte ucTKIPMICKeys 1
#endstruct

stdim st, DOT11_KEY_ALGO_TKIP_MIC        ; NSTRUCT 変数を確保
st->ulTKIPKeyLength = 100
mes "ulTKIPKeyLength=" + st->ulTKIPKeyLength