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

NDIS_RECEIVE_HASH_PARAMETERS

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

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

フィールド

フィールドサイズx64x86説明
HeaderNDIS_OBJECT_HEADER4+0+0構造体の型・リビジョン・サイズを示すNDISオブジェクトヘッダー。
FlagsDWORD4+4+4受信ハッシュパラメータの有効項目や有効化を示すフラグ。
HashInformationDWORD4+8+8使用するハッシュ関数と種別を示す情報。
HashSecretKeySizeWORD2+12+12ハッシュ秘密鍵のサイズ(バイト)。
HashSecretKeyOffsetDWORD4+16+16本構造体先頭からハッシュ秘密鍵までのオフセット(バイト)。

各言語での定義

#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_RECEIVE_HASH_PARAMETERS  (x64 20 / x86 20 バイト)
typedef struct NDIS_RECEIVE_HASH_PARAMETERS {
    NDIS_OBJECT_HEADER Header;
    DWORD Flags;
    DWORD HashInformation;
    WORD HashSecretKeySize;
    DWORD HashSecretKeyOffset;
} NDIS_RECEIVE_HASH_PARAMETERS;
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_RECEIVE_HASH_PARAMETERS
{
    public NDIS_OBJECT_HEADER Header;
    public uint Flags;
    public uint HashInformation;
    public ushort HashSecretKeySize;
    public uint HashSecretKeyOffset;
}
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_RECEIVE_HASH_PARAMETERS
    Public Header As NDIS_OBJECT_HEADER
    Public Flags As UInteger
    Public HashInformation As UInteger
    Public HashSecretKeySize As UShort
    Public HashSecretKeyOffset As UInteger
End Structure
import 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_RECEIVE_HASH_PARAMETERS(ctypes.Structure):
    _fields_ = [
        ("Header", NDIS_OBJECT_HEADER),
        ("Flags", wintypes.DWORD),
        ("HashInformation", wintypes.DWORD),
        ("HashSecretKeySize", ctypes.c_ushort),
        ("HashSecretKeyOffset", wintypes.DWORD),
    ]
#[repr(C)]
pub struct NDIS_OBJECT_HEADER {
    pub Type: u8,
    pub Revision: u8,
    pub Size: u16,
}

#[repr(C)]
pub struct NDIS_RECEIVE_HASH_PARAMETERS {
    pub Header: NDIS_OBJECT_HEADER,
    pub Flags: u32,
    pub HashInformation: u32,
    pub HashSecretKeySize: u16,
    pub HashSecretKeyOffset: u32,
}
import "golang.org/x/sys/windows"

type NDIS_OBJECT_HEADER struct {
	Type byte
	Revision byte
	Size uint16
}

type NDIS_RECEIVE_HASH_PARAMETERS struct {
	Header NDIS_OBJECT_HEADER
	Flags uint32
	HashInformation uint32
	HashSecretKeySize uint16
	HashSecretKeyOffset uint32
}
type
  NDIS_OBJECT_HEADER = record
    Type: Byte;
    Revision: Byte;
    Size: Word;
  end;

  NDIS_RECEIVE_HASH_PARAMETERS = record
    Header: NDIS_OBJECT_HEADER;
    Flags: DWORD;
    HashInformation: DWORD;
    HashSecretKeySize: Word;
    HashSecretKeyOffset: DWORD;
  end;
const NDIS_OBJECT_HEADER = extern struct {
    Type: u8,
    Revision: u8,
    Size: u16,
};

const NDIS_RECEIVE_HASH_PARAMETERS = extern struct {
    Header: NDIS_OBJECT_HEADER,
    Flags: u32,
    HashInformation: u32,
    HashSecretKeySize: u16,
    HashSecretKeyOffset: u32,
};
type
  NDIS_OBJECT_HEADER {.bycopy.} = object
    Type: uint8
    Revision: uint8
    Size: uint16

  NDIS_RECEIVE_HASH_PARAMETERS {.bycopy.} = object
    Header: NDIS_OBJECT_HEADER
    Flags: uint32
    HashInformation: uint32
    HashSecretKeySize: uint16
    HashSecretKeyOffset: uint32
struct NDIS_OBJECT_HEADER
{
    ubyte Type;
    ubyte Revision;
    ushort Size;
}

struct NDIS_RECEIVE_HASH_PARAMETERS
{
    NDIS_OBJECT_HEADER Header;
    uint Flags;
    uint HashInformation;
    ushort HashSecretKeySize;
    uint HashSecretKeyOffset;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NDIS_RECEIVE_HASH_PARAMETERS サイズ: 20 バイト(x64)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; Header : NDIS_OBJECT_HEADER (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; Flags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; HashInformation : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; HashSecretKeySize : WORD (+12, 2byte)  wpoke st,12,値  /  値 = wpeek(st,12)
; HashSecretKeyOffset : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (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_RECEIVE_HASH_PARAMETERS
    #field NDIS_OBJECT_HEADER Header
    #field int Flags
    #field int HashInformation
    #field short HashSecretKeySize
    #field int HashSecretKeyOffset
#endstruct

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