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