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

SIPAEVENT_VSM_IDK_RSA_INFO

構造体
サイズx64: 13 バイト / x86: 13 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
KeyBitLengthDWORD4+0+0RSA鍵のビット長。
PublicExpLengthBytesDWORD4+4+4公開指数のバイト長。
ModulusSizeBytesDWORD4+8+8モジュラスのバイト長。
PublicKeyDataBYTE1+12+12公開鍵データ(指数とモジュラス)の先頭バイト。可変長配列の起点となる。

各言語での定義

#include <windows.h>

// SIPAEVENT_VSM_IDK_RSA_INFO  (x64 13 / x86 13 バイト)
#pragma pack(push, 1)
typedef struct SIPAEVENT_VSM_IDK_RSA_INFO {
    DWORD KeyBitLength;
    DWORD PublicExpLengthBytes;
    DWORD ModulusSizeBytes;
    BYTE PublicKeyData[1];
} SIPAEVENT_VSM_IDK_RSA_INFO;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct SIPAEVENT_VSM_IDK_RSA_INFO
{
    public uint KeyBitLength;
    public uint PublicExpLengthBytes;
    public uint ModulusSizeBytes;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] PublicKeyData;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure SIPAEVENT_VSM_IDK_RSA_INFO
    Public KeyBitLength As UInteger
    Public PublicExpLengthBytes As UInteger
    Public ModulusSizeBytes As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public PublicKeyData() As Byte
End Structure
import ctypes
from ctypes import wintypes

class SIPAEVENT_VSM_IDK_RSA_INFO(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("KeyBitLength", wintypes.DWORD),
        ("PublicExpLengthBytes", wintypes.DWORD),
        ("ModulusSizeBytes", wintypes.DWORD),
        ("PublicKeyData", ctypes.c_ubyte * 1),
    ]
#[repr(C, packed(1))]
pub struct SIPAEVENT_VSM_IDK_RSA_INFO {
    pub KeyBitLength: u32,
    pub PublicExpLengthBytes: u32,
    pub ModulusSizeBytes: u32,
    pub PublicKeyData: [u8; 1],
}
import "golang.org/x/sys/windows"

type SIPAEVENT_VSM_IDK_RSA_INFO struct {
	KeyBitLength uint32
	PublicExpLengthBytes uint32
	ModulusSizeBytes uint32
	PublicKeyData [1]byte
}
type
  SIPAEVENT_VSM_IDK_RSA_INFO = packed record
    KeyBitLength: DWORD;
    PublicExpLengthBytes: DWORD;
    ModulusSizeBytes: DWORD;
    PublicKeyData: array[0..0] of Byte;
  end;
const SIPAEVENT_VSM_IDK_RSA_INFO = extern struct {
    KeyBitLength: u32,
    PublicExpLengthBytes: u32,
    ModulusSizeBytes: u32,
    PublicKeyData: [1]u8,
};
type
  SIPAEVENT_VSM_IDK_RSA_INFO {.packed.} = object
    KeyBitLength: uint32
    PublicExpLengthBytes: uint32
    ModulusSizeBytes: uint32
    PublicKeyData: array[1, uint8]
align(1)
struct SIPAEVENT_VSM_IDK_RSA_INFO
{
    uint KeyBitLength;
    uint PublicExpLengthBytes;
    uint ModulusSizeBytes;
    ubyte[1] PublicKeyData;
}

HSP用 定義

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

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

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