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

ApplyDeltaProvidedB

関数
呼び出し側が用意したバッファにデルタを適用してターゲットを生成する。
DLLmsdelta.dll呼出規約winapi

シグネチャ

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

BOOL ApplyDeltaProvidedB(
    LONGLONG ApplyFlags,
    DELTA_INPUT Source,
    DELTA_INPUT Delta,
    void* lpTarget,
    UINT_PTR uTargetSize
);

パラメーター

名前方向
ApplyFlagsLONGLONGin
SourceDELTA_INPUTin
DeltaDELTA_INPUTin
lpTargetvoid*inout
uTargetSizeUINT_PTRin

戻り値の型: BOOL

各言語での呼び出し定義

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

BOOL ApplyDeltaProvidedB(
    LONGLONG ApplyFlags,
    DELTA_INPUT Source,
    DELTA_INPUT Delta,
    void* lpTarget,
    UINT_PTR uTargetSize
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("msdelta.dll", ExactSpelling = true)]
static extern bool ApplyDeltaProvidedB(
    long ApplyFlags,   // LONGLONG
    DELTA_INPUT Source,   // DELTA_INPUT
    DELTA_INPUT Delta,   // DELTA_INPUT
    IntPtr lpTarget,   // void* in/out
    UIntPtr uTargetSize   // UINT_PTR
);
<DllImport("msdelta.dll", ExactSpelling:=True)>
Public Shared Function ApplyDeltaProvidedB(
    ApplyFlags As Long,   ' LONGLONG
    Source As DELTA_INPUT,   ' DELTA_INPUT
    Delta As DELTA_INPUT,   ' DELTA_INPUT
    lpTarget As IntPtr,   ' void* in/out
    uTargetSize As UIntPtr   ' UINT_PTR
) As Boolean
End Function
' ApplyFlags : LONGLONG
' Source : DELTA_INPUT
' Delta : DELTA_INPUT
' lpTarget : void* in/out
' uTargetSize : UINT_PTR
Declare PtrSafe Function ApplyDeltaProvidedB Lib "msdelta" ( _
    ByVal ApplyFlags As LongLong, _
    ByVal Source As LongPtr, _
    ByVal Delta As LongPtr, _
    ByVal lpTarget As LongPtr, _
    ByVal uTargetSize As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ApplyDeltaProvidedB = ctypes.windll.msdelta.ApplyDeltaProvidedB
ApplyDeltaProvidedB.restype = wintypes.BOOL
ApplyDeltaProvidedB.argtypes = [
    ctypes.c_longlong,  # ApplyFlags : LONGLONG
    DELTA_INPUT,  # Source : DELTA_INPUT
    DELTA_INPUT,  # Delta : DELTA_INPUT
    ctypes.POINTER(None),  # lpTarget : void* in/out
    ctypes.c_size_t,  # uTargetSize : UINT_PTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msdelta.dll')
ApplyDeltaProvidedB = Fiddle::Function.new(
  lib['ApplyDeltaProvidedB'],
  [
    Fiddle::TYPE_LONG_LONG,  # ApplyFlags : LONGLONG
    Fiddle::TYPE_VOIDP,  # Source : DELTA_INPUT
    Fiddle::TYPE_VOIDP,  # Delta : DELTA_INPUT
    Fiddle::TYPE_VOIDP,  # lpTarget : void* in/out
    Fiddle::TYPE_UINTPTR_T,  # uTargetSize : UINT_PTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "msdelta")]
extern "system" {
    fn ApplyDeltaProvidedB(
        ApplyFlags: i64,  // LONGLONG
        Source: DELTA_INPUT,  // DELTA_INPUT
        Delta: DELTA_INPUT,  // DELTA_INPUT
        lpTarget: *mut (),  // void* in/out
        uTargetSize: usize  // UINT_PTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("msdelta.dll")]
public static extern bool ApplyDeltaProvidedB(long ApplyFlags, DELTA_INPUT Source, DELTA_INPUT Delta, IntPtr lpTarget, UIntPtr uTargetSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msdelta_ApplyDeltaProvidedB' -Namespace Win32 -PassThru
# $api::ApplyDeltaProvidedB(ApplyFlags, Source, Delta, lpTarget, uTargetSize)
#uselib "msdelta.dll"
#func global ApplyDeltaProvidedB "ApplyDeltaProvidedB" sptr, sptr, sptr, sptr, sptr
; ApplyDeltaProvidedB ApplyFlags, Source, Delta, lpTarget, uTargetSize   ; 戻り値は stat
; ApplyFlags : LONGLONG -> "sptr"
; Source : DELTA_INPUT -> "sptr"
; Delta : DELTA_INPUT -> "sptr"
; lpTarget : void* in/out -> "sptr"
; uTargetSize : UINT_PTR -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msdelta.dll"
#cfunc global ApplyDeltaProvidedB "ApplyDeltaProvidedB" int64, int, int, sptr, sptr
; res = ApplyDeltaProvidedB(ApplyFlags, Source, Delta, lpTarget, uTargetSize)
; ApplyFlags : LONGLONG -> "int64"
; Source : DELTA_INPUT -> "int"
; Delta : DELTA_INPUT -> "int"
; lpTarget : void* in/out -> "sptr"
; uTargetSize : UINT_PTR -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
; BOOL ApplyDeltaProvidedB(LONGLONG ApplyFlags, DELTA_INPUT Source, DELTA_INPUT Delta, void* lpTarget, UINT_PTR uTargetSize)
#uselib "msdelta.dll"
#cfunc global ApplyDeltaProvidedB "ApplyDeltaProvidedB" int64, int, int, intptr, intptr
; res = ApplyDeltaProvidedB(ApplyFlags, Source, Delta, lpTarget, uTargetSize)
; ApplyFlags : LONGLONG -> "int64"
; Source : DELTA_INPUT -> "int"
; Delta : DELTA_INPUT -> "int"
; lpTarget : void* in/out -> "intptr"
; uTargetSize : UINT_PTR -> "intptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msdelta = windows.NewLazySystemDLL("msdelta.dll")
	procApplyDeltaProvidedB = msdelta.NewProc("ApplyDeltaProvidedB")
)

// ApplyFlags (LONGLONG), Source (DELTA_INPUT), Delta (DELTA_INPUT), lpTarget (void* in/out), uTargetSize (UINT_PTR)
r1, _, err := procApplyDeltaProvidedB.Call(
	uintptr(ApplyFlags),
	uintptr(Source),
	uintptr(Delta),
	uintptr(lpTarget),
	uintptr(uTargetSize),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function ApplyDeltaProvidedB(
  ApplyFlags: Int64;   // LONGLONG
  Source: DELTA_INPUT;   // DELTA_INPUT
  Delta: DELTA_INPUT;   // DELTA_INPUT
  lpTarget: Pointer;   // void* in/out
  uTargetSize: NativeUInt   // UINT_PTR
): BOOL; stdcall;
  external 'msdelta.dll' name 'ApplyDeltaProvidedB';
result := DllCall("msdelta\ApplyDeltaProvidedB"
    , "Int64", ApplyFlags   ; LONGLONG
    , "Ptr", Source   ; DELTA_INPUT
    , "Ptr", Delta   ; DELTA_INPUT
    , "Ptr", lpTarget   ; void* in/out
    , "UPtr", uTargetSize   ; UINT_PTR
    , "Int")   ; return: BOOL
●ApplyDeltaProvidedB(ApplyFlags, Source, Delta, lpTarget, uTargetSize) = DLL("msdelta.dll", "bool ApplyDeltaProvidedB(int64, void*, void*, void*, int)")
# 呼び出し: ApplyDeltaProvidedB(ApplyFlags, Source, Delta, lpTarget, uTargetSize)
# ApplyFlags : LONGLONG -> "int64"
# Source : DELTA_INPUT -> "void*"
# Delta : DELTA_INPUT -> "void*"
# lpTarget : void* in/out -> "void*"
# uTargetSize : UINT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。