Win32 API 日本語リファレンス
ホームStorage.Packaging.Appx › APPX_ENCRYPTED_PACKAGE_SETTINGS2

APPX_ENCRYPTED_PACKAGE_SETTINGS2

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

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

フィールド

フィールドサイズx64x86説明
keyLengthDWORD4+0+0暗号化キーの長さ(Key Length)をビット単位で表す32ビット値である。
encryptionAlgorithmLPWSTR8/4+8+4使用する暗号化アルゴリズム名を表すNull終端ワイド文字列である。
blockMapHashAlgorithmIUri*8/4+16+8ブロックマップのハッシュアルゴリズムをURIで指定するIUriポインタである。
optionsDWORD4+24+12暗号化処理の追加オプション(APPX_ENCRYPTED_PACKAGE_OPTIONS)を示す32ビット値である。

各言語での定義

#include <windows.h>

// APPX_ENCRYPTED_PACKAGE_SETTINGS2  (x64 32 / x86 16 バイト)
typedef struct APPX_ENCRYPTED_PACKAGE_SETTINGS2 {
    DWORD keyLength;
    LPWSTR encryptionAlgorithm;
    IUri* blockMapHashAlgorithm;
    DWORD options;
} APPX_ENCRYPTED_PACKAGE_SETTINGS2;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct APPX_ENCRYPTED_PACKAGE_SETTINGS2
{
    public uint keyLength;
    public IntPtr encryptionAlgorithm;
    public IntPtr blockMapHashAlgorithm;
    public uint options;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure APPX_ENCRYPTED_PACKAGE_SETTINGS2
    Public keyLength As UInteger
    Public encryptionAlgorithm As IntPtr
    Public blockMapHashAlgorithm As IntPtr
    Public options As UInteger
End Structure
import ctypes
from ctypes import wintypes

class APPX_ENCRYPTED_PACKAGE_SETTINGS2(ctypes.Structure):
    _fields_ = [
        ("keyLength", wintypes.DWORD),
        ("encryptionAlgorithm", ctypes.c_void_p),
        ("blockMapHashAlgorithm", ctypes.c_void_p),
        ("options", wintypes.DWORD),
    ]
#[repr(C)]
pub struct APPX_ENCRYPTED_PACKAGE_SETTINGS2 {
    pub keyLength: u32,
    pub encryptionAlgorithm: *mut core::ffi::c_void,
    pub blockMapHashAlgorithm: *mut core::ffi::c_void,
    pub options: u32,
}
import "golang.org/x/sys/windows"

type APPX_ENCRYPTED_PACKAGE_SETTINGS2 struct {
	keyLength uint32
	encryptionAlgorithm uintptr
	blockMapHashAlgorithm uintptr
	options uint32
}
type
  APPX_ENCRYPTED_PACKAGE_SETTINGS2 = record
    keyLength: DWORD;
    encryptionAlgorithm: Pointer;
    blockMapHashAlgorithm: Pointer;
    options: DWORD;
  end;
const APPX_ENCRYPTED_PACKAGE_SETTINGS2 = extern struct {
    keyLength: u32,
    encryptionAlgorithm: ?*anyopaque,
    blockMapHashAlgorithm: ?*anyopaque,
    options: u32,
};
type
  APPX_ENCRYPTED_PACKAGE_SETTINGS2 {.bycopy.} = object
    keyLength: uint32
    encryptionAlgorithm: pointer
    blockMapHashAlgorithm: pointer
    options: uint32
struct APPX_ENCRYPTED_PACKAGE_SETTINGS2
{
    uint keyLength;
    void* encryptionAlgorithm;
    void* blockMapHashAlgorithm;
    uint options;
}

HSP用 定義

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

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

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