ホーム › System.ApplicationInstallationAndServicing › ApplyDeltaW
ApplyDeltaW
関数ソースファイルにデルタを適用してターゲットファイルを生成する(Unicode版)。
シグネチャ
// msdelta.dll (Unicode / -W)
#include <windows.h>
BOOL ApplyDeltaW(
LONGLONG ApplyFlags,
LPCWSTR lpSourceName,
LPCWSTR lpDeltaName,
LPCWSTR lpTargetName
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ApplyFlags | LONGLONG | in |
| lpSourceName | LPCWSTR | in |
| lpDeltaName | LPCWSTR | in |
| lpTargetName | LPCWSTR | in |
戻り値の型: BOOL
各言語での呼び出し定義
// msdelta.dll (Unicode / -W)
#include <windows.h>
BOOL ApplyDeltaW(
LONGLONG ApplyFlags,
LPCWSTR lpSourceName,
LPCWSTR lpDeltaName,
LPCWSTR lpTargetName
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("msdelta.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool ApplyDeltaW(
long ApplyFlags, // LONGLONG
[MarshalAs(UnmanagedType.LPWStr)] string lpSourceName, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string lpDeltaName, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string lpTargetName // LPCWSTR
);<DllImport("msdelta.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function ApplyDeltaW(
ApplyFlags As Long, ' LONGLONG
<MarshalAs(UnmanagedType.LPWStr)> lpSourceName As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> lpDeltaName As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> lpTargetName As String ' LPCWSTR
) As Boolean
End Function' ApplyFlags : LONGLONG
' lpSourceName : LPCWSTR
' lpDeltaName : LPCWSTR
' lpTargetName : LPCWSTR
Declare PtrSafe Function ApplyDeltaW Lib "msdelta" ( _
ByVal ApplyFlags As LongLong, _
ByVal lpSourceName As LongPtr, _
ByVal lpDeltaName As LongPtr, _
ByVal lpTargetName As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ApplyDeltaW = ctypes.windll.msdelta.ApplyDeltaW
ApplyDeltaW.restype = wintypes.BOOL
ApplyDeltaW.argtypes = [
ctypes.c_longlong, # ApplyFlags : LONGLONG
wintypes.LPCWSTR, # lpSourceName : LPCWSTR
wintypes.LPCWSTR, # lpDeltaName : LPCWSTR
wintypes.LPCWSTR, # lpTargetName : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('msdelta.dll')
ApplyDeltaW = Fiddle::Function.new(
lib['ApplyDeltaW'],
[
Fiddle::TYPE_LONG_LONG, # ApplyFlags : LONGLONG
Fiddle::TYPE_VOIDP, # lpSourceName : LPCWSTR
Fiddle::TYPE_VOIDP, # lpDeltaName : LPCWSTR
Fiddle::TYPE_VOIDP, # lpTargetName : LPCWSTR
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "msdelta")]
extern "system" {
fn ApplyDeltaW(
ApplyFlags: i64, // LONGLONG
lpSourceName: *const u16, // LPCWSTR
lpDeltaName: *const u16, // LPCWSTR
lpTargetName: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("msdelta.dll", CharSet = CharSet.Unicode)]
public static extern bool ApplyDeltaW(long ApplyFlags, [MarshalAs(UnmanagedType.LPWStr)] string lpSourceName, [MarshalAs(UnmanagedType.LPWStr)] string lpDeltaName, [MarshalAs(UnmanagedType.LPWStr)] string lpTargetName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msdelta_ApplyDeltaW' -Namespace Win32 -PassThru
# $api::ApplyDeltaW(ApplyFlags, lpSourceName, lpDeltaName, lpTargetName)#uselib "msdelta.dll"
#func global ApplyDeltaW "ApplyDeltaW" wptr, wptr, wptr, wptr
; ApplyDeltaW ApplyFlags, lpSourceName, lpDeltaName, lpTargetName ; 戻り値は stat
; ApplyFlags : LONGLONG -> "wptr"
; lpSourceName : LPCWSTR -> "wptr"
; lpDeltaName : LPCWSTR -> "wptr"
; lpTargetName : LPCWSTR -> "wptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "msdelta.dll"
#cfunc global ApplyDeltaW "ApplyDeltaW" int64, wstr, wstr, wstr
; res = ApplyDeltaW(ApplyFlags, lpSourceName, lpDeltaName, lpTargetName)
; ApplyFlags : LONGLONG -> "int64"
; lpSourceName : LPCWSTR -> "wstr"
; lpDeltaName : LPCWSTR -> "wstr"
; lpTargetName : LPCWSTR -> "wstr"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。; BOOL ApplyDeltaW(LONGLONG ApplyFlags, LPCWSTR lpSourceName, LPCWSTR lpDeltaName, LPCWSTR lpTargetName)
#uselib "msdelta.dll"
#cfunc global ApplyDeltaW "ApplyDeltaW" int64, wstr, wstr, wstr
; res = ApplyDeltaW(ApplyFlags, lpSourceName, lpDeltaName, lpTargetName)
; ApplyFlags : LONGLONG -> "int64"
; lpSourceName : LPCWSTR -> "wstr"
; lpDeltaName : LPCWSTR -> "wstr"
; lpTargetName : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msdelta = windows.NewLazySystemDLL("msdelta.dll")
procApplyDeltaW = msdelta.NewProc("ApplyDeltaW")
)
// ApplyFlags (LONGLONG), lpSourceName (LPCWSTR), lpDeltaName (LPCWSTR), lpTargetName (LPCWSTR)
r1, _, err := procApplyDeltaW.Call(
uintptr(ApplyFlags),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpSourceName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpDeltaName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpTargetName))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction ApplyDeltaW(
ApplyFlags: Int64; // LONGLONG
lpSourceName: PWideChar; // LPCWSTR
lpDeltaName: PWideChar; // LPCWSTR
lpTargetName: PWideChar // LPCWSTR
): BOOL; stdcall;
external 'msdelta.dll' name 'ApplyDeltaW';result := DllCall("msdelta\ApplyDeltaW"
, "Int64", ApplyFlags ; LONGLONG
, "WStr", lpSourceName ; LPCWSTR
, "WStr", lpDeltaName ; LPCWSTR
, "WStr", lpTargetName ; LPCWSTR
, "Int") ; return: BOOL●ApplyDeltaW(ApplyFlags, lpSourceName, lpDeltaName, lpTargetName) = DLL("msdelta.dll", "bool ApplyDeltaW(int64, char*, char*, char*)")
# 呼び出し: ApplyDeltaW(ApplyFlags, lpSourceName, lpDeltaName, lpTargetName)
# ApplyFlags : LONGLONG -> "int64"
# lpSourceName : LPCWSTR -> "char*"
# lpDeltaName : LPCWSTR -> "char*"
# lpTargetName : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。