Win32 API 日本語リファレンス
ホームSecurity.Authentication.Identity › SecPkgContext_KeyingMaterialInfo

SecPkgContext_KeyingMaterialInfo

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

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

フィールド

フィールドサイズx64x86説明
cbLabelWORD2+0+0鍵素材導出に使うラベルのバイト数を示す。
pszLabelLPSTR8/4+8+4鍵素材エクスポータのラベル文字列へのポインタ。
cbContextValueWORD2+16+8コンテキスト値のバイト数を示す。
pbContextValueBYTE*8/4+24+12鍵導出に用いるコンテキスト値へのポインタ。
cbKeyingMaterialDWORD4+32+16要求する鍵素材のバイト数を示す。

各言語での定義

#include <windows.h>

// SecPkgContext_KeyingMaterialInfo  (x64 40 / x86 20 バイト)
typedef struct SecPkgContext_KeyingMaterialInfo {
    WORD cbLabel;
    LPSTR pszLabel;
    WORD cbContextValue;
    BYTE* pbContextValue;
    DWORD cbKeyingMaterial;
} SecPkgContext_KeyingMaterialInfo;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SecPkgContext_KeyingMaterialInfo
{
    public ushort cbLabel;
    public IntPtr pszLabel;
    public ushort cbContextValue;
    public IntPtr pbContextValue;
    public uint cbKeyingMaterial;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SecPkgContext_KeyingMaterialInfo
    Public cbLabel As UShort
    Public pszLabel As IntPtr
    Public cbContextValue As UShort
    Public pbContextValue As IntPtr
    Public cbKeyingMaterial As UInteger
End Structure
import ctypes
from ctypes import wintypes

class SecPkgContext_KeyingMaterialInfo(ctypes.Structure):
    _fields_ = [
        ("cbLabel", ctypes.c_ushort),
        ("pszLabel", ctypes.c_void_p),
        ("cbContextValue", ctypes.c_ushort),
        ("pbContextValue", ctypes.c_void_p),
        ("cbKeyingMaterial", wintypes.DWORD),
    ]
#[repr(C)]
pub struct SecPkgContext_KeyingMaterialInfo {
    pub cbLabel: u16,
    pub pszLabel: *mut core::ffi::c_void,
    pub cbContextValue: u16,
    pub pbContextValue: *mut core::ffi::c_void,
    pub cbKeyingMaterial: u32,
}
import "golang.org/x/sys/windows"

type SecPkgContext_KeyingMaterialInfo struct {
	cbLabel uint16
	pszLabel uintptr
	cbContextValue uint16
	pbContextValue uintptr
	cbKeyingMaterial uint32
}
type
  SecPkgContext_KeyingMaterialInfo = record
    cbLabel: Word;
    pszLabel: Pointer;
    cbContextValue: Word;
    pbContextValue: Pointer;
    cbKeyingMaterial: DWORD;
  end;
const SecPkgContext_KeyingMaterialInfo = extern struct {
    cbLabel: u16,
    pszLabel: ?*anyopaque,
    cbContextValue: u16,
    pbContextValue: ?*anyopaque,
    cbKeyingMaterial: u32,
};
type
  SecPkgContext_KeyingMaterialInfo {.bycopy.} = object
    cbLabel: uint16
    pszLabel: pointer
    cbContextValue: uint16
    pbContextValue: pointer
    cbKeyingMaterial: uint32
struct SecPkgContext_KeyingMaterialInfo
{
    ushort cbLabel;
    void* pszLabel;
    ushort cbContextValue;
    void* pbContextValue;
    uint cbKeyingMaterial;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SecPkgContext_KeyingMaterialInfo サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; cbLabel : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; pszLabel : LPSTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; cbContextValue : WORD (+8, 2byte)  wpoke st,8,値  /  値 = wpeek(st,8)
; pbContextValue : BYTE* (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; cbKeyingMaterial : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SecPkgContext_KeyingMaterialInfo サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; cbLabel : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; pszLabel : LPSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; cbContextValue : WORD (+16, 2byte)  wpoke st,16,値  /  値 = wpeek(st,16)
; pbContextValue : BYTE* (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; cbKeyingMaterial : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SecPkgContext_KeyingMaterialInfo
    #field short cbLabel
    #field intptr pszLabel
    #field short cbContextValue
    #field intptr pbContextValue
    #field int cbKeyingMaterial
#endstruct

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