ホーム › System.WindowsProgramming › CABINFOA
CABINFOA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| pszCab | LPSTR | 8/4 | +0 | +0 | CABファイルのパスを表す文字列(ANSI)。 |
| pszInf | LPSTR | 8/4 | +8 | +4 | INFファイル名を表す文字列(ANSI)。 |
| pszSection | LPSTR | 8/4 | +16 | +8 | INF内の処理対象セクション名(ANSI)。 |
| szSrcPath | CHAR | 260 | +24 | +12 | ソースパスを表すCHAR配列。 |
| dwFlags | DWORD | 4 | +284 | +272 | インストール動作を制御するフラグ。 |
各言語での定義
#include <windows.h>
// CABINFOA (x64 288 / x86 276 バイト)
typedef struct CABINFOA {
LPSTR pszCab;
LPSTR pszInf;
LPSTR pszSection;
CHAR szSrcPath[260];
DWORD dwFlags;
} CABINFOA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CABINFOA
{
public IntPtr pszCab;
public IntPtr pszInf;
public IntPtr pszSection;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 260)] public sbyte[] szSrcPath;
public uint dwFlags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CABINFOA
Public pszCab As IntPtr
Public pszInf As IntPtr
Public pszSection As IntPtr
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=260)> Public szSrcPath() As SByte
Public dwFlags As UInteger
End Structureimport ctypes
from ctypes import wintypes
class CABINFOA(ctypes.Structure):
_fields_ = [
("pszCab", ctypes.c_void_p),
("pszInf", ctypes.c_void_p),
("pszSection", ctypes.c_void_p),
("szSrcPath", ctypes.c_byte * 260),
("dwFlags", wintypes.DWORD),
]#[repr(C)]
pub struct CABINFOA {
pub pszCab: *mut core::ffi::c_void,
pub pszInf: *mut core::ffi::c_void,
pub pszSection: *mut core::ffi::c_void,
pub szSrcPath: [i8; 260],
pub dwFlags: u32,
}import "golang.org/x/sys/windows"
type CABINFOA struct {
pszCab uintptr
pszInf uintptr
pszSection uintptr
szSrcPath [260]int8
dwFlags uint32
}type
CABINFOA = record
pszCab: Pointer;
pszInf: Pointer;
pszSection: Pointer;
szSrcPath: array[0..259] of Shortint;
dwFlags: DWORD;
end;const CABINFOA = extern struct {
pszCab: ?*anyopaque,
pszInf: ?*anyopaque,
pszSection: ?*anyopaque,
szSrcPath: [260]i8,
dwFlags: u32,
};type
CABINFOA {.bycopy.} = object
pszCab: pointer
pszInf: pointer
pszSection: pointer
szSrcPath: array[260, int8]
dwFlags: uint32struct CABINFOA
{
void* pszCab;
void* pszInf;
void* pszSection;
byte[260] szSrcPath;
uint dwFlags;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; CABINFOA サイズ: 276 バイト(x86)
dim st, 69 ; 4byte整数×69(構造体サイズ 276 / 4 切り上げ)
; pszCab : LPSTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pszInf : LPSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; pszSection : LPSTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; szSrcPath : CHAR (+12, 260byte) varptr(st)+12 を基点に操作(260byte:入れ子/配列)
; dwFlags : DWORD (+272, 4byte) st.68 = 値 / 値 = st.68 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CABINFOA サイズ: 288 バイト(x64)
dim st, 72 ; 4byte整数×72(構造体サイズ 288 / 4 切り上げ)
; pszCab : LPSTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; pszInf : LPSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pszSection : LPSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; szSrcPath : CHAR (+24, 260byte) varptr(st)+24 を基点に操作(260byte:入れ子/配列)
; dwFlags : DWORD (+284, 4byte) st.71 = 値 / 値 = st.71 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global CABINFOA
#field intptr pszCab
#field intptr pszInf
#field intptr pszSection
#field byte szSrcPath 260
#field int dwFlags
#endstruct
stdim st, CABINFOA ; NSTRUCT 変数を確保
st->dwFlags = 100
mes "dwFlags=" + st->dwFlags