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

SecPkgInfoW

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

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

フィールド

フィールドサイズx64x86説明
fCapabilitiesDWORD4+0+0セキュリティパッケージの機能を示すSECPKG_FLAGビットフラグ。
wVersionWORD2+4+4パッケージが実装するSSPIのバージョン番号。
wRPCIDWORD2+6+6DCE RPCで用いるパッケージ識別子。未割当時はSECPKG_ID_NONE。
cbMaxTokenDWORD4+8+8パッケージが扱う認証トークンの最大バイト数。
NameWORD*8/4+16+12セキュリティパッケージ名を指すワイド文字列ポインタ。
CommentWORD*8/4+24+16パッケージの説明文を指すワイド文字列ポインタ。

各言語での定義

#include <windows.h>

// SecPkgInfoW  (x64 32 / x86 20 バイト)
typedef struct SecPkgInfoW {
    DWORD fCapabilities;
    WORD wVersion;
    WORD wRPCID;
    DWORD cbMaxToken;
    WORD* Name;
    WORD* Comment;
} SecPkgInfoW;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SecPkgInfoW
{
    public uint fCapabilities;
    public ushort wVersion;
    public ushort wRPCID;
    public uint cbMaxToken;
    public IntPtr Name;
    public IntPtr Comment;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SecPkgInfoW
    Public fCapabilities As UInteger
    Public wVersion As UShort
    Public wRPCID As UShort
    Public cbMaxToken As UInteger
    Public Name As IntPtr
    Public Comment As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class SecPkgInfoW(ctypes.Structure):
    _fields_ = [
        ("fCapabilities", wintypes.DWORD),
        ("wVersion", ctypes.c_ushort),
        ("wRPCID", ctypes.c_ushort),
        ("cbMaxToken", wintypes.DWORD),
        ("Name", ctypes.c_void_p),
        ("Comment", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct SecPkgInfoW {
    pub fCapabilities: u32,
    pub wVersion: u16,
    pub wRPCID: u16,
    pub cbMaxToken: u32,
    pub Name: *mut core::ffi::c_void,
    pub Comment: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type SecPkgInfoW struct {
	fCapabilities uint32
	wVersion uint16
	wRPCID uint16
	cbMaxToken uint32
	Name uintptr
	Comment uintptr
}
type
  SecPkgInfoW = record
    fCapabilities: DWORD;
    wVersion: Word;
    wRPCID: Word;
    cbMaxToken: DWORD;
    Name: Pointer;
    Comment: Pointer;
  end;
const SecPkgInfoW = extern struct {
    fCapabilities: u32,
    wVersion: u16,
    wRPCID: u16,
    cbMaxToken: u32,
    Name: ?*anyopaque,
    Comment: ?*anyopaque,
};
type
  SecPkgInfoW {.bycopy.} = object
    fCapabilities: uint32
    wVersion: uint16
    wRPCID: uint16
    cbMaxToken: uint32
    Name: pointer
    Comment: pointer
struct SecPkgInfoW
{
    uint fCapabilities;
    ushort wVersion;
    ushort wRPCID;
    uint cbMaxToken;
    void* Name;
    void* Comment;
}

HSP用 定義

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

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

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