Win32 API 日本語リファレンス
ホームStorage.FileSystem › KCRM_PROTOCOL_BLOB

KCRM_PROTOCOL_BLOB

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

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

フィールド

フィールドサイズx64x86説明
ProtocolIdGUID16+0+0リソースマネージャプロトコルを識別するGUID。
StaticInfoLengthDWORD4+16+16静的情報部分のバイト長。
TransactionIdInfoLengthDWORD4+20+20トランザクションID情報部分のバイト長。
Unused1DWORD4+24+24未使用フィールド。0を指定する。
Unused2DWORD4+28+28未使用フィールド。0を指定する。

各言語での定義

#include <windows.h>

// KCRM_PROTOCOL_BLOB  (x64 32 / x86 32 バイト)
typedef struct KCRM_PROTOCOL_BLOB {
    GUID ProtocolId;
    DWORD StaticInfoLength;
    DWORD TransactionIdInfoLength;
    DWORD Unused1;
    DWORD Unused2;
} KCRM_PROTOCOL_BLOB;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KCRM_PROTOCOL_BLOB
{
    public Guid ProtocolId;
    public uint StaticInfoLength;
    public uint TransactionIdInfoLength;
    public uint Unused1;
    public uint Unused2;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KCRM_PROTOCOL_BLOB
    Public ProtocolId As Guid
    Public StaticInfoLength As UInteger
    Public TransactionIdInfoLength As UInteger
    Public Unused1 As UInteger
    Public Unused2 As UInteger
End Structure
import ctypes
from ctypes import wintypes

class KCRM_PROTOCOL_BLOB(ctypes.Structure):
    _fields_ = [
        ("ProtocolId", GUID),
        ("StaticInfoLength", wintypes.DWORD),
        ("TransactionIdInfoLength", wintypes.DWORD),
        ("Unused1", wintypes.DWORD),
        ("Unused2", wintypes.DWORD),
    ]
#[repr(C)]
pub struct KCRM_PROTOCOL_BLOB {
    pub ProtocolId: GUID,
    pub StaticInfoLength: u32,
    pub TransactionIdInfoLength: u32,
    pub Unused1: u32,
    pub Unused2: u32,
}
import "golang.org/x/sys/windows"

type KCRM_PROTOCOL_BLOB struct {
	ProtocolId windows.GUID
	StaticInfoLength uint32
	TransactionIdInfoLength uint32
	Unused1 uint32
	Unused2 uint32
}
type
  KCRM_PROTOCOL_BLOB = record
    ProtocolId: TGUID;
    StaticInfoLength: DWORD;
    TransactionIdInfoLength: DWORD;
    Unused1: DWORD;
    Unused2: DWORD;
  end;
const KCRM_PROTOCOL_BLOB = extern struct {
    ProtocolId: GUID,
    StaticInfoLength: u32,
    TransactionIdInfoLength: u32,
    Unused1: u32,
    Unused2: u32,
};
type
  KCRM_PROTOCOL_BLOB {.bycopy.} = object
    ProtocolId: GUID
    StaticInfoLength: uint32
    TransactionIdInfoLength: uint32
    Unused1: uint32
    Unused2: uint32
struct KCRM_PROTOCOL_BLOB
{
    GUID ProtocolId;
    uint StaticInfoLength;
    uint TransactionIdInfoLength;
    uint Unused1;
    uint Unused2;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KCRM_PROTOCOL_BLOB サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; ProtocolId : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; StaticInfoLength : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; TransactionIdInfoLength : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; Unused1 : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; Unused2 : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ※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 KCRM_PROTOCOL_BLOB
    #field GUID ProtocolId
    #field int StaticInfoLength
    #field int TransactionIdInfoLength
    #field int Unused1
    #field int Unused2
#endstruct

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