ホーム › System.ApplicationInstallationAndServicing › DELTA_HEADER_INFO
DELTA_HEADER_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| FileTypeSet | LONGLONG | 8 | +0 | +0 | デルタ生成時に使用されたファイル種別セットの識別子。 |
| FileType | LONGLONG | 8 | +8 | +8 | 対象ファイルの種別を示す識別子。 |
| Flags | LONGLONG | 8 | +16 | +16 | デルタヘッダに関するフラグ。 |
| TargetSize | UINT_PTR | 8/4 | +24 | +24 | デルタ適用後のターゲットファイルのバイトサイズ。 |
| TargetFileTime | FILETIME | 8 | +32 | +28 | ターゲットファイルのタイムスタンプ(FILETIME)。 |
| TargetHashAlgId | ALG_ID | 4 | +40 | +36 | ターゲットハッシュの計算に用いたアルゴリズムID。 |
| TargetHash | DELTA_HASH | 36 | +44 | +40 | ターゲットファイルのハッシュ値(DELTA_HASH)。 |
各言語での定義
#include <windows.h>
// FILETIME (x64 8 / x86 8 バイト)
typedef struct FILETIME {
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME;
// DELTA_HASH (x64 36 / x86 36 バイト)
typedef struct DELTA_HASH {
DWORD HashSize;
BYTE HashValue[32];
} DELTA_HASH;
// DELTA_HEADER_INFO (x64 80 / x86 80 バイト)
typedef struct DELTA_HEADER_INFO {
LONGLONG FileTypeSet;
LONGLONG FileType;
LONGLONG Flags;
UINT_PTR TargetSize;
FILETIME TargetFileTime;
ALG_ID TargetHashAlgId;
DELTA_HASH TargetHash;
} DELTA_HEADER_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILETIME
{
public uint dwLowDateTime;
public uint dwHighDateTime;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DELTA_HASH
{
public uint HashSize;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] HashValue;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DELTA_HEADER_INFO
{
public long FileTypeSet;
public long FileType;
public long Flags;
public UIntPtr TargetSize;
public FILETIME TargetFileTime;
public uint TargetHashAlgId;
public DELTA_HASH TargetHash;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILETIME
Public dwLowDateTime As UInteger
Public dwHighDateTime As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DELTA_HASH
Public HashSize As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public HashValue() As Byte
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DELTA_HEADER_INFO
Public FileTypeSet As Long
Public FileType As Long
Public Flags As Long
Public TargetSize As UIntPtr
Public TargetFileTime As FILETIME
Public TargetHashAlgId As UInteger
Public TargetHash As DELTA_HASH
End Structureimport ctypes
from ctypes import wintypes
class FILETIME(ctypes.Structure):
_fields_ = [
("dwLowDateTime", wintypes.DWORD),
("dwHighDateTime", wintypes.DWORD),
]
class DELTA_HASH(ctypes.Structure):
_fields_ = [
("HashSize", wintypes.DWORD),
("HashValue", ctypes.c_ubyte * 32),
]
class DELTA_HEADER_INFO(ctypes.Structure):
_fields_ = [
("FileTypeSet", ctypes.c_longlong),
("FileType", ctypes.c_longlong),
("Flags", ctypes.c_longlong),
("TargetSize", ctypes.c_size_t),
("TargetFileTime", FILETIME),
("TargetHashAlgId", wintypes.DWORD),
("TargetHash", DELTA_HASH),
]#[repr(C)]
pub struct FILETIME {
pub dwLowDateTime: u32,
pub dwHighDateTime: u32,
}
#[repr(C)]
pub struct DELTA_HASH {
pub HashSize: u32,
pub HashValue: [u8; 32],
}
#[repr(C)]
pub struct DELTA_HEADER_INFO {
pub FileTypeSet: i64,
pub FileType: i64,
pub Flags: i64,
pub TargetSize: usize,
pub TargetFileTime: FILETIME,
pub TargetHashAlgId: u32,
pub TargetHash: DELTA_HASH,
}import "golang.org/x/sys/windows"
type FILETIME struct {
dwLowDateTime uint32
dwHighDateTime uint32
}
type DELTA_HASH struct {
HashSize uint32
HashValue [32]byte
}
type DELTA_HEADER_INFO struct {
FileTypeSet int64
FileType int64
Flags int64
TargetSize uintptr
TargetFileTime FILETIME
TargetHashAlgId uint32
TargetHash DELTA_HASH
}type
FILETIME = record
dwLowDateTime: DWORD;
dwHighDateTime: DWORD;
end;
DELTA_HASH = record
HashSize: DWORD;
HashValue: array[0..31] of Byte;
end;
DELTA_HEADER_INFO = record
FileTypeSet: Int64;
FileType: Int64;
Flags: Int64;
TargetSize: NativeUInt;
TargetFileTime: FILETIME;
TargetHashAlgId: DWORD;
TargetHash: DELTA_HASH;
end;const FILETIME = extern struct {
dwLowDateTime: u32,
dwHighDateTime: u32,
};
const DELTA_HASH = extern struct {
HashSize: u32,
HashValue: [32]u8,
};
const DELTA_HEADER_INFO = extern struct {
FileTypeSet: i64,
FileType: i64,
Flags: i64,
TargetSize: usize,
TargetFileTime: FILETIME,
TargetHashAlgId: u32,
TargetHash: DELTA_HASH,
};type
FILETIME {.bycopy.} = object
dwLowDateTime: uint32
dwHighDateTime: uint32
DELTA_HASH {.bycopy.} = object
HashSize: uint32
HashValue: array[32, uint8]
DELTA_HEADER_INFO {.bycopy.} = object
FileTypeSet: int64
FileType: int64
Flags: int64
TargetSize: uint
TargetFileTime: FILETIME
TargetHashAlgId: uint32
TargetHash: DELTA_HASHstruct FILETIME
{
uint dwLowDateTime;
uint dwHighDateTime;
}
struct DELTA_HASH
{
uint HashSize;
ubyte[32] HashValue;
}
struct DELTA_HEADER_INFO
{
long FileTypeSet;
long FileType;
long Flags;
size_t TargetSize;
FILETIME TargetFileTime;
uint TargetHashAlgId;
DELTA_HASH TargetHash;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DELTA_HEADER_INFO サイズ: 80 バイト(x86)
dim st, 20 ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; FileTypeSet : LONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; FileType : LONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Flags : LONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; TargetSize : UINT_PTR (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; TargetFileTime : FILETIME (+28, 8byte) varptr(st)+28 を基点に操作(8byte:入れ子/配列)
; TargetHashAlgId : ALG_ID (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; TargetHash : DELTA_HASH (+40, 36byte) varptr(st)+40 を基点に操作(36byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DELTA_HEADER_INFO サイズ: 80 バイト(x64)
dim st, 20 ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; FileTypeSet : LONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; FileType : LONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Flags : LONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; TargetSize : UINT_PTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; TargetFileTime : FILETIME (+32, 8byte) varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; TargetHashAlgId : ALG_ID (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; TargetHash : DELTA_HASH (+44, 36byte) varptr(st)+44 を基点に操作(36byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global FILETIME
#field int dwLowDateTime
#field int dwHighDateTime
#endstruct
#defstruct global DELTA_HASH
#field int HashSize
#field byte HashValue 32
#endstruct
#defstruct global DELTA_HEADER_INFO
#field int64 FileTypeSet
#field int64 FileType
#field int64 Flags
#field intptr TargetSize
#field FILETIME TargetFileTime
#field int TargetHashAlgId
#field DELTA_HASH TargetHash
#endstruct
stdim st, DELTA_HEADER_INFO ; NSTRUCT 変数を確保
st->FileTypeSet = 100
mes "FileTypeSet=" + st->FileTypeSet