ホーム › Storage.Packaging.Appx › PACKAGE_ID
PACKAGE_ID
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| reserved | DWORD | 4 | +0 | +0 | 将来の使用のために予約されており、0でなければならない32ビットフィールドである。 |
| processorArchitecture | DWORD | 4 | +4 | +4 | パッケージの対象プロセッサアーキテクチャ(x86/x64/ARM等)を示す32ビット値である。 |
| version | PACKAGE_VERSION | 8 | +8 | +8 | パッケージのバージョン(major.minor.build.revision)を表す共用体である。 |
| name | LPWSTR | 8/4 | +16 | +16 | パッケージ名を表すNull終端ワイド文字列である。 |
| publisher | LPWSTR | 8/4 | +24 | +20 | パッケージ発行元の識別名(Publisher DN)を表すNull終端ワイド文字列である。 |
| resourceId | LPWSTR | 8/4 | +32 | +24 | リソースパッケージのリソースID(言語/スケール等)を表すNull終端ワイド文字列で、NULL可である。 |
| publisherId | LPWSTR | 8/4 | +40 | +28 | 発行元のハッシュから生成されたパッケージファミリ識別子(Publisher ID)を表すワイド文字列である。 |
各言語での定義
#include <windows.h>
// PACKAGE_VERSION (x64 8 / x86 8 バイト)
typedef struct PACKAGE_VERSION {
_Anonymous_e__Union Anonymous;
} PACKAGE_VERSION;
// PACKAGE_ID (x64 48 / x86 32 バイト)
typedef struct PACKAGE_ID {
DWORD reserved;
DWORD processorArchitecture;
PACKAGE_VERSION version;
LPWSTR name;
LPWSTR publisher;
LPWSTR resourceId;
LPWSTR publisherId;
} PACKAGE_ID;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PACKAGE_VERSION
{
public _Anonymous_e__Union Anonymous;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PACKAGE_ID
{
public uint reserved;
public uint processorArchitecture;
public PACKAGE_VERSION version;
public IntPtr name;
public IntPtr publisher;
public IntPtr resourceId;
public IntPtr publisherId;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PACKAGE_VERSION
Public Anonymous As _Anonymous_e__Union
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PACKAGE_ID
Public reserved As UInteger
Public processorArchitecture As UInteger
Public version As PACKAGE_VERSION
Public name As IntPtr
Public publisher As IntPtr
Public resourceId As IntPtr
Public publisherId As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class PACKAGE_VERSION(ctypes.Structure):
_fields_ = [
("Anonymous", _Anonymous_e__Union),
]
class PACKAGE_ID(ctypes.Structure):
_fields_ = [
("reserved", wintypes.DWORD),
("processorArchitecture", wintypes.DWORD),
("version", PACKAGE_VERSION),
("name", ctypes.c_void_p),
("publisher", ctypes.c_void_p),
("resourceId", ctypes.c_void_p),
("publisherId", ctypes.c_void_p),
]#[repr(C)]
pub struct PACKAGE_VERSION {
pub Anonymous: _Anonymous_e__Union,
}
#[repr(C)]
pub struct PACKAGE_ID {
pub reserved: u32,
pub processorArchitecture: u32,
pub version: PACKAGE_VERSION,
pub name: *mut core::ffi::c_void,
pub publisher: *mut core::ffi::c_void,
pub resourceId: *mut core::ffi::c_void,
pub publisherId: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type PACKAGE_VERSION struct {
Anonymous _Anonymous_e__Union
}
type PACKAGE_ID struct {
reserved uint32
processorArchitecture uint32
version PACKAGE_VERSION
name uintptr
publisher uintptr
resourceId uintptr
publisherId uintptr
}type
PACKAGE_VERSION = record
Anonymous: _Anonymous_e__Union;
end;
PACKAGE_ID = record
reserved: DWORD;
processorArchitecture: DWORD;
version: PACKAGE_VERSION;
name: Pointer;
publisher: Pointer;
resourceId: Pointer;
publisherId: Pointer;
end;const PACKAGE_VERSION = extern struct {
Anonymous: _Anonymous_e__Union,
};
const PACKAGE_ID = extern struct {
reserved: u32,
processorArchitecture: u32,
version: PACKAGE_VERSION,
name: ?*anyopaque,
publisher: ?*anyopaque,
resourceId: ?*anyopaque,
publisherId: ?*anyopaque,
};type
PACKAGE_VERSION {.bycopy.} = object
Anonymous: _Anonymous_e__Union
PACKAGE_ID {.bycopy.} = object
reserved: uint32
processorArchitecture: uint32
version: PACKAGE_VERSION
name: pointer
publisher: pointer
resourceId: pointer
publisherId: pointerstruct PACKAGE_VERSION
{
_Anonymous_e__Union Anonymous;
}
struct PACKAGE_ID
{
uint reserved;
uint processorArchitecture;
PACKAGE_VERSION version;
void* name;
void* publisher;
void* resourceId;
void* publisherId;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; PACKAGE_ID サイズ: 32 バイト(x86)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; reserved : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; processorArchitecture : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; version : PACKAGE_VERSION (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; name : LPWSTR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; publisher : LPWSTR (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; resourceId : LPWSTR (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; publisherId : LPWSTR (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PACKAGE_ID サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; reserved : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; processorArchitecture : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; version : PACKAGE_VERSION (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; name : LPWSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; publisher : LPWSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; resourceId : LPWSTR (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; publisherId : LPWSTR (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global PACKAGE_VERSION
#field byte Anonymous 8
#endstruct
#defstruct global PACKAGE_ID
#field int reserved
#field int processorArchitecture
#field PACKAGE_VERSION version
#field intptr name
#field intptr publisher
#field intptr resourceId
#field intptr publisherId
#endstruct
stdim st, PACKAGE_ID ; NSTRUCT 変数を確保
st->reserved = 100
mes "reserved=" + st->reserved