Win32 API 日本語リファレンス
ホームSystem.Ioctl › ENCRYPTED_DATA_INFO

ENCRYPTED_DATA_INFO

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

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

フィールド

フィールドサイズx64x86説明
StartingFileOffsetULONGLONG8+0+0返される暗号化データの開始ファイルオフセット(バイト)。
OutputBufferOffsetDWORD4+8+8出力バッファ内で実データが始まるオフセット(バイト)。
BytesWithinFileSizeDWORD4+12+12ファイルサイズ範囲内に含まれるバイト数。
BytesWithinValidDataLengthDWORD4+16+16有効データ長(VDL)範囲内に含まれるバイト数。
CompressionFormatWORD2+20+20適用されている圧縮形式を示す値。非圧縮はCOMPRESSION_FORMAT_NONE。
DataUnitShiftBYTE1+22+22データ単位サイズのlog2(シフト量)。実サイズは1<<DataUnitShift。
ChunkShiftBYTE1+23+23チャンクサイズのlog2(シフト量)。
ClusterShiftBYTE1+24+24クラスタサイズのlog2(シフト量)。
EncryptionFormatBYTE1+25+25使用されている暗号化形式を示す値。
NumberOfDataBlocksWORD2+26+26データブロックの個数。
DataBlockSizeDWORD4+28+28各データブロックのサイズ(バイト)。

各言語での定義

#include <windows.h>

// ENCRYPTED_DATA_INFO  (x64 32 / x86 32 バイト)
typedef struct ENCRYPTED_DATA_INFO {
    ULONGLONG StartingFileOffset;
    DWORD OutputBufferOffset;
    DWORD BytesWithinFileSize;
    DWORD BytesWithinValidDataLength;
    WORD CompressionFormat;
    BYTE DataUnitShift;
    BYTE ChunkShift;
    BYTE ClusterShift;
    BYTE EncryptionFormat;
    WORD NumberOfDataBlocks;
    DWORD DataBlockSize[1];
} ENCRYPTED_DATA_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ENCRYPTED_DATA_INFO
{
    public ulong StartingFileOffset;
    public uint OutputBufferOffset;
    public uint BytesWithinFileSize;
    public uint BytesWithinValidDataLength;
    public ushort CompressionFormat;
    public byte DataUnitShift;
    public byte ChunkShift;
    public byte ClusterShift;
    public byte EncryptionFormat;
    public ushort NumberOfDataBlocks;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public uint[] DataBlockSize;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ENCRYPTED_DATA_INFO
    Public StartingFileOffset As ULong
    Public OutputBufferOffset As UInteger
    Public BytesWithinFileSize As UInteger
    Public BytesWithinValidDataLength As UInteger
    Public CompressionFormat As UShort
    Public DataUnitShift As Byte
    Public ChunkShift As Byte
    Public ClusterShift As Byte
    Public EncryptionFormat As Byte
    Public NumberOfDataBlocks As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public DataBlockSize() As UInteger
End Structure
import ctypes
from ctypes import wintypes

class ENCRYPTED_DATA_INFO(ctypes.Structure):
    _fields_ = [
        ("StartingFileOffset", ctypes.c_ulonglong),
        ("OutputBufferOffset", wintypes.DWORD),
        ("BytesWithinFileSize", wintypes.DWORD),
        ("BytesWithinValidDataLength", wintypes.DWORD),
        ("CompressionFormat", ctypes.c_ushort),
        ("DataUnitShift", ctypes.c_ubyte),
        ("ChunkShift", ctypes.c_ubyte),
        ("ClusterShift", ctypes.c_ubyte),
        ("EncryptionFormat", ctypes.c_ubyte),
        ("NumberOfDataBlocks", ctypes.c_ushort),
        ("DataBlockSize", wintypes.DWORD * 1),
    ]
#[repr(C)]
pub struct ENCRYPTED_DATA_INFO {
    pub StartingFileOffset: u64,
    pub OutputBufferOffset: u32,
    pub BytesWithinFileSize: u32,
    pub BytesWithinValidDataLength: u32,
    pub CompressionFormat: u16,
    pub DataUnitShift: u8,
    pub ChunkShift: u8,
    pub ClusterShift: u8,
    pub EncryptionFormat: u8,
    pub NumberOfDataBlocks: u16,
    pub DataBlockSize: [u32; 1],
}
import "golang.org/x/sys/windows"

type ENCRYPTED_DATA_INFO struct {
	StartingFileOffset uint64
	OutputBufferOffset uint32
	BytesWithinFileSize uint32
	BytesWithinValidDataLength uint32
	CompressionFormat uint16
	DataUnitShift byte
	ChunkShift byte
	ClusterShift byte
	EncryptionFormat byte
	NumberOfDataBlocks uint16
	DataBlockSize [1]uint32
}
type
  ENCRYPTED_DATA_INFO = record
    StartingFileOffset: UInt64;
    OutputBufferOffset: DWORD;
    BytesWithinFileSize: DWORD;
    BytesWithinValidDataLength: DWORD;
    CompressionFormat: Word;
    DataUnitShift: Byte;
    ChunkShift: Byte;
    ClusterShift: Byte;
    EncryptionFormat: Byte;
    NumberOfDataBlocks: Word;
    DataBlockSize: array[0..0] of DWORD;
  end;
const ENCRYPTED_DATA_INFO = extern struct {
    StartingFileOffset: u64,
    OutputBufferOffset: u32,
    BytesWithinFileSize: u32,
    BytesWithinValidDataLength: u32,
    CompressionFormat: u16,
    DataUnitShift: u8,
    ChunkShift: u8,
    ClusterShift: u8,
    EncryptionFormat: u8,
    NumberOfDataBlocks: u16,
    DataBlockSize: [1]u32,
};
type
  ENCRYPTED_DATA_INFO {.bycopy.} = object
    StartingFileOffset: uint64
    OutputBufferOffset: uint32
    BytesWithinFileSize: uint32
    BytesWithinValidDataLength: uint32
    CompressionFormat: uint16
    DataUnitShift: uint8
    ChunkShift: uint8
    ClusterShift: uint8
    EncryptionFormat: uint8
    NumberOfDataBlocks: uint16
    DataBlockSize: array[1, uint32]
struct ENCRYPTED_DATA_INFO
{
    ulong StartingFileOffset;
    uint OutputBufferOffset;
    uint BytesWithinFileSize;
    uint BytesWithinValidDataLength;
    ushort CompressionFormat;
    ubyte DataUnitShift;
    ubyte ChunkShift;
    ubyte ClusterShift;
    ubyte EncryptionFormat;
    ushort NumberOfDataBlocks;
    uint[1] DataBlockSize;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ENCRYPTED_DATA_INFO サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; StartingFileOffset : ULONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; OutputBufferOffset : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; BytesWithinFileSize : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; BytesWithinValidDataLength : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; CompressionFormat : WORD (+20, 2byte)  wpoke st,20,値  /  値 = wpeek(st,20)
; DataUnitShift : BYTE (+22, 1byte)  poke st,22,値  /  値 = peek(st,22)
; ChunkShift : BYTE (+23, 1byte)  poke st,23,値  /  値 = peek(st,23)
; ClusterShift : BYTE (+24, 1byte)  poke st,24,値  /  値 = peek(st,24)
; EncryptionFormat : BYTE (+25, 1byte)  poke st,25,値  /  値 = peek(st,25)
; NumberOfDataBlocks : WORD (+26, 2byte)  wpoke st,26,値  /  値 = wpeek(st,26)
; DataBlockSize : DWORD (+28, 4byte)  varptr(st)+28 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global ENCRYPTED_DATA_INFO
    #field int64 StartingFileOffset
    #field int OutputBufferOffset
    #field int BytesWithinFileSize
    #field int BytesWithinValidDataLength
    #field short CompressionFormat
    #field byte DataUnitShift
    #field byte ChunkShift
    #field byte ClusterShift
    #field byte EncryptionFormat
    #field short NumberOfDataBlocks
    #field int DataBlockSize 1
#endstruct

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