Win32 API 日本語リファレンス
ホームSystem.ApplicationInstallationAndServicing › PATCH_OLD_FILE_INFO_W

PATCH_OLD_FILE_INFO_W

構造体
サイズx64: 48 バイト / x86: 24 バイト

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

フィールド

フィールドサイズx64x86説明
SizeOfThisStructDWORD4+0+0この構造体のバイトサイズ。
OldFileNameLPWSTR8/4+8+4差分の基準となる旧ファイル名(Unicode)。
IgnoreRangeCountDWORD4+16+8IgnoreRangeArrayの要素数。
IgnoreRangeArrayPATCH_IGNORE_RANGE*8/4+24+12差分計算で無視する範囲(PATCH_IGNORE_RANGE)配列へのポインタ。
RetainRangeCountDWORD4+32+16RetainRangeArrayの要素数。
RetainRangeArrayPATCH_RETAIN_RANGE*8/4+40+20そのまま保持する範囲(PATCH_RETAIN_RANGE)配列へのポインタ。

各言語での定義

#include <windows.h>

// PATCH_OLD_FILE_INFO_W  (x64 48 / x86 24 バイト)
typedef struct PATCH_OLD_FILE_INFO_W {
    DWORD SizeOfThisStruct;
    LPWSTR OldFileName;
    DWORD IgnoreRangeCount;
    PATCH_IGNORE_RANGE* IgnoreRangeArray;
    DWORD RetainRangeCount;
    PATCH_RETAIN_RANGE* RetainRangeArray;
} PATCH_OLD_FILE_INFO_W;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PATCH_OLD_FILE_INFO_W
{
    public uint SizeOfThisStruct;
    public IntPtr OldFileName;
    public uint IgnoreRangeCount;
    public IntPtr IgnoreRangeArray;
    public uint RetainRangeCount;
    public IntPtr RetainRangeArray;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PATCH_OLD_FILE_INFO_W
    Public SizeOfThisStruct As UInteger
    Public OldFileName As IntPtr
    Public IgnoreRangeCount As UInteger
    Public IgnoreRangeArray As IntPtr
    Public RetainRangeCount As UInteger
    Public RetainRangeArray As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class PATCH_OLD_FILE_INFO_W(ctypes.Structure):
    _fields_ = [
        ("SizeOfThisStruct", wintypes.DWORD),
        ("OldFileName", ctypes.c_void_p),
        ("IgnoreRangeCount", wintypes.DWORD),
        ("IgnoreRangeArray", ctypes.c_void_p),
        ("RetainRangeCount", wintypes.DWORD),
        ("RetainRangeArray", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct PATCH_OLD_FILE_INFO_W {
    pub SizeOfThisStruct: u32,
    pub OldFileName: *mut core::ffi::c_void,
    pub IgnoreRangeCount: u32,
    pub IgnoreRangeArray: *mut core::ffi::c_void,
    pub RetainRangeCount: u32,
    pub RetainRangeArray: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type PATCH_OLD_FILE_INFO_W struct {
	SizeOfThisStruct uint32
	OldFileName uintptr
	IgnoreRangeCount uint32
	IgnoreRangeArray uintptr
	RetainRangeCount uint32
	RetainRangeArray uintptr
}
type
  PATCH_OLD_FILE_INFO_W = record
    SizeOfThisStruct: DWORD;
    OldFileName: Pointer;
    IgnoreRangeCount: DWORD;
    IgnoreRangeArray: Pointer;
    RetainRangeCount: DWORD;
    RetainRangeArray: Pointer;
  end;
const PATCH_OLD_FILE_INFO_W = extern struct {
    SizeOfThisStruct: u32,
    OldFileName: ?*anyopaque,
    IgnoreRangeCount: u32,
    IgnoreRangeArray: ?*anyopaque,
    RetainRangeCount: u32,
    RetainRangeArray: ?*anyopaque,
};
type
  PATCH_OLD_FILE_INFO_W {.bycopy.} = object
    SizeOfThisStruct: uint32
    OldFileName: pointer
    IgnoreRangeCount: uint32
    IgnoreRangeArray: pointer
    RetainRangeCount: uint32
    RetainRangeArray: pointer
struct PATCH_OLD_FILE_INFO_W
{
    uint SizeOfThisStruct;
    void* OldFileName;
    uint IgnoreRangeCount;
    void* IgnoreRangeArray;
    uint RetainRangeCount;
    void* RetainRangeArray;
}

HSP用 定義

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

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

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