Win32 API 日本語リファレンス
ホームMedia.KernelStreaming › SECURE_BUFFER_INFO

SECURE_BUFFER_INFO

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

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

フィールド

フィールドサイズx64x86説明
guidBufferIdentifierGUID16+0+0セキュアバッファを一意に識別するGUID。
cbBufferSizeDWORD4+16+16セキュアバッファ全体のサイズをバイト単位で示す。
cbCapturedDWORD4+20+20実際にキャプチャされたデータのバイト数を示す。
ullReservedULONGLONG128+24+24予約フィールド。将来の拡張用で通常は0を設定する。

各言語での定義

#include <windows.h>

// SECURE_BUFFER_INFO  (x64 152 / x86 152 バイト)
typedef struct SECURE_BUFFER_INFO {
    GUID guidBufferIdentifier;
    DWORD cbBufferSize;
    DWORD cbCaptured;
    ULONGLONG ullReserved[16];
} SECURE_BUFFER_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SECURE_BUFFER_INFO
{
    public Guid guidBufferIdentifier;
    public uint cbBufferSize;
    public uint cbCaptured;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public ulong[] ullReserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SECURE_BUFFER_INFO
    Public guidBufferIdentifier As Guid
    Public cbBufferSize As UInteger
    Public cbCaptured As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public ullReserved() As ULong
End Structure
import ctypes
from ctypes import wintypes

class SECURE_BUFFER_INFO(ctypes.Structure):
    _fields_ = [
        ("guidBufferIdentifier", GUID),
        ("cbBufferSize", wintypes.DWORD),
        ("cbCaptured", wintypes.DWORD),
        ("ullReserved", ctypes.c_ulonglong * 16),
    ]
#[repr(C)]
pub struct SECURE_BUFFER_INFO {
    pub guidBufferIdentifier: GUID,
    pub cbBufferSize: u32,
    pub cbCaptured: u32,
    pub ullReserved: [u64; 16],
}
import "golang.org/x/sys/windows"

type SECURE_BUFFER_INFO struct {
	guidBufferIdentifier windows.GUID
	cbBufferSize uint32
	cbCaptured uint32
	ullReserved [16]uint64
}
type
  SECURE_BUFFER_INFO = record
    guidBufferIdentifier: TGUID;
    cbBufferSize: DWORD;
    cbCaptured: DWORD;
    ullReserved: array[0..15] of UInt64;
  end;
const SECURE_BUFFER_INFO = extern struct {
    guidBufferIdentifier: GUID,
    cbBufferSize: u32,
    cbCaptured: u32,
    ullReserved: [16]u64,
};
type
  SECURE_BUFFER_INFO {.bycopy.} = object
    guidBufferIdentifier: GUID
    cbBufferSize: uint32
    cbCaptured: uint32
    ullReserved: array[16, uint64]
struct SECURE_BUFFER_INFO
{
    GUID guidBufferIdentifier;
    uint cbBufferSize;
    uint cbCaptured;
    ulong[16] ullReserved;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SECURE_BUFFER_INFO サイズ: 152 バイト(x64)
dim st, 38    ; 4byte整数×38(構造体サイズ 152 / 4 切り上げ)
; guidBufferIdentifier : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; cbBufferSize : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; cbCaptured : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ullReserved : ULONGLONG (+24, 128byte)  varptr(st)+24 を基点に操作(128byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global SECURE_BUFFER_INFO
    #field GUID guidBufferIdentifier
    #field int cbBufferSize
    #field int cbCaptured
    #field int64 ullReserved 16
#endstruct

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