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

CreatePatchFileByHandles

関数
ハンドルで指定したファイルから差分パッチを作成する。
DLLmspatchc.dll呼出規約winapi

シグネチャ

// mspatchc.dll
#include <windows.h>

BOOL CreatePatchFileByHandles(
    HANDLE OldFileHandle,   // optional
    HANDLE NewFileHandle,
    HANDLE PatchFileHandle,
    DWORD OptionFlags,
    PATCH_OPTION_DATA* OptionData   // optional
);

パラメーター

名前方向
OldFileHandleHANDLEinoptional
NewFileHandleHANDLEin
PatchFileHandleHANDLEin
OptionFlagsDWORDin
OptionDataPATCH_OPTION_DATA*inoptional

戻り値の型: BOOL

各言語での呼び出し定義

// mspatchc.dll
#include <windows.h>

BOOL CreatePatchFileByHandles(
    HANDLE OldFileHandle,   // optional
    HANDLE NewFileHandle,
    HANDLE PatchFileHandle,
    DWORD OptionFlags,
    PATCH_OPTION_DATA* OptionData   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mspatchc.dll", ExactSpelling = true)]
static extern bool CreatePatchFileByHandles(
    IntPtr OldFileHandle,   // HANDLE optional
    IntPtr NewFileHandle,   // HANDLE
    IntPtr PatchFileHandle,   // HANDLE
    uint OptionFlags,   // DWORD
    IntPtr OptionData   // PATCH_OPTION_DATA* optional
);
<DllImport("mspatchc.dll", ExactSpelling:=True)>
Public Shared Function CreatePatchFileByHandles(
    OldFileHandle As IntPtr,   ' HANDLE optional
    NewFileHandle As IntPtr,   ' HANDLE
    PatchFileHandle As IntPtr,   ' HANDLE
    OptionFlags As UInteger,   ' DWORD
    OptionData As IntPtr   ' PATCH_OPTION_DATA* optional
) As Boolean
End Function
' OldFileHandle : HANDLE optional
' NewFileHandle : HANDLE
' PatchFileHandle : HANDLE
' OptionFlags : DWORD
' OptionData : PATCH_OPTION_DATA* optional
Declare PtrSafe Function CreatePatchFileByHandles Lib "mspatchc" ( _
    ByVal OldFileHandle As LongPtr, _
    ByVal NewFileHandle As LongPtr, _
    ByVal PatchFileHandle As LongPtr, _
    ByVal OptionFlags As Long, _
    ByVal OptionData As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CreatePatchFileByHandles = ctypes.windll.mspatchc.CreatePatchFileByHandles
CreatePatchFileByHandles.restype = wintypes.BOOL
CreatePatchFileByHandles.argtypes = [
    wintypes.HANDLE,  # OldFileHandle : HANDLE optional
    wintypes.HANDLE,  # NewFileHandle : HANDLE
    wintypes.HANDLE,  # PatchFileHandle : HANDLE
    wintypes.DWORD,  # OptionFlags : DWORD
    ctypes.c_void_p,  # OptionData : PATCH_OPTION_DATA* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('mspatchc.dll')
CreatePatchFileByHandles = Fiddle::Function.new(
  lib['CreatePatchFileByHandles'],
  [
    Fiddle::TYPE_VOIDP,  # OldFileHandle : HANDLE optional
    Fiddle::TYPE_VOIDP,  # NewFileHandle : HANDLE
    Fiddle::TYPE_VOIDP,  # PatchFileHandle : HANDLE
    -Fiddle::TYPE_INT,  # OptionFlags : DWORD
    Fiddle::TYPE_VOIDP,  # OptionData : PATCH_OPTION_DATA* optional
  ],
  Fiddle::TYPE_INT)
#[link(name = "mspatchc")]
extern "system" {
    fn CreatePatchFileByHandles(
        OldFileHandle: *mut core::ffi::c_void,  // HANDLE optional
        NewFileHandle: *mut core::ffi::c_void,  // HANDLE
        PatchFileHandle: *mut core::ffi::c_void,  // HANDLE
        OptionFlags: u32,  // DWORD
        OptionData: *mut PATCH_OPTION_DATA  // PATCH_OPTION_DATA* optional
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mspatchc.dll")]
public static extern bool CreatePatchFileByHandles(IntPtr OldFileHandle, IntPtr NewFileHandle, IntPtr PatchFileHandle, uint OptionFlags, IntPtr OptionData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mspatchc_CreatePatchFileByHandles' -Namespace Win32 -PassThru
# $api::CreatePatchFileByHandles(OldFileHandle, NewFileHandle, PatchFileHandle, OptionFlags, OptionData)
#uselib "mspatchc.dll"
#func global CreatePatchFileByHandles "CreatePatchFileByHandles" sptr, sptr, sptr, sptr, sptr
; CreatePatchFileByHandles OldFileHandle, NewFileHandle, PatchFileHandle, OptionFlags, varptr(OptionData)   ; 戻り値は stat
; OldFileHandle : HANDLE optional -> "sptr"
; NewFileHandle : HANDLE -> "sptr"
; PatchFileHandle : HANDLE -> "sptr"
; OptionFlags : DWORD -> "sptr"
; OptionData : PATCH_OPTION_DATA* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "mspatchc.dll"
#cfunc global CreatePatchFileByHandles "CreatePatchFileByHandles" sptr, sptr, sptr, int, var
; res = CreatePatchFileByHandles(OldFileHandle, NewFileHandle, PatchFileHandle, OptionFlags, OptionData)
; OldFileHandle : HANDLE optional -> "sptr"
; NewFileHandle : HANDLE -> "sptr"
; PatchFileHandle : HANDLE -> "sptr"
; OptionFlags : DWORD -> "int"
; OptionData : PATCH_OPTION_DATA* optional -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL CreatePatchFileByHandles(HANDLE OldFileHandle, HANDLE NewFileHandle, HANDLE PatchFileHandle, DWORD OptionFlags, PATCH_OPTION_DATA* OptionData)
#uselib "mspatchc.dll"
#cfunc global CreatePatchFileByHandles "CreatePatchFileByHandles" intptr, intptr, intptr, int, var
; res = CreatePatchFileByHandles(OldFileHandle, NewFileHandle, PatchFileHandle, OptionFlags, OptionData)
; OldFileHandle : HANDLE optional -> "intptr"
; NewFileHandle : HANDLE -> "intptr"
; PatchFileHandle : HANDLE -> "intptr"
; OptionFlags : DWORD -> "int"
; OptionData : PATCH_OPTION_DATA* optional -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mspatchc = windows.NewLazySystemDLL("mspatchc.dll")
	procCreatePatchFileByHandles = mspatchc.NewProc("CreatePatchFileByHandles")
)

// OldFileHandle (HANDLE optional), NewFileHandle (HANDLE), PatchFileHandle (HANDLE), OptionFlags (DWORD), OptionData (PATCH_OPTION_DATA* optional)
r1, _, err := procCreatePatchFileByHandles.Call(
	uintptr(OldFileHandle),
	uintptr(NewFileHandle),
	uintptr(PatchFileHandle),
	uintptr(OptionFlags),
	uintptr(OptionData),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function CreatePatchFileByHandles(
  OldFileHandle: THandle;   // HANDLE optional
  NewFileHandle: THandle;   // HANDLE
  PatchFileHandle: THandle;   // HANDLE
  OptionFlags: DWORD;   // DWORD
  OptionData: Pointer   // PATCH_OPTION_DATA* optional
): BOOL; stdcall;
  external 'mspatchc.dll' name 'CreatePatchFileByHandles';
result := DllCall("mspatchc\CreatePatchFileByHandles"
    , "Ptr", OldFileHandle   ; HANDLE optional
    , "Ptr", NewFileHandle   ; HANDLE
    , "Ptr", PatchFileHandle   ; HANDLE
    , "UInt", OptionFlags   ; DWORD
    , "Ptr", OptionData   ; PATCH_OPTION_DATA* optional
    , "Int")   ; return: BOOL
●CreatePatchFileByHandles(OldFileHandle, NewFileHandle, PatchFileHandle, OptionFlags, OptionData) = DLL("mspatchc.dll", "bool CreatePatchFileByHandles(void*, void*, void*, dword, void*)")
# 呼び出し: CreatePatchFileByHandles(OldFileHandle, NewFileHandle, PatchFileHandle, OptionFlags, OptionData)
# OldFileHandle : HANDLE optional -> "void*"
# NewFileHandle : HANDLE -> "void*"
# PatchFileHandle : HANDLE -> "void*"
# OptionFlags : DWORD -> "dword"
# OptionData : PATCH_OPTION_DATA* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。