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

ExtractPatchHeaderToFileW

関数
パッチファイルからヘッダー情報を抽出してファイルに出力する(Unicode版)。
DLLmspatchc.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

// mspatchc.dll  (Unicode / -W)
#include <windows.h>

BOOL ExtractPatchHeaderToFileW(
    LPCWSTR PatchFileName,
    LPCWSTR PatchHeaderFileName
);

パラメーター

名前方向
PatchFileNameLPCWSTRin
PatchHeaderFileNameLPCWSTRin

戻り値の型: BOOL

各言語での呼び出し定義

// mspatchc.dll  (Unicode / -W)
#include <windows.h>

BOOL ExtractPatchHeaderToFileW(
    LPCWSTR PatchFileName,
    LPCWSTR PatchHeaderFileName
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mspatchc.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool ExtractPatchHeaderToFileW(
    [MarshalAs(UnmanagedType.LPWStr)] string PatchFileName,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string PatchHeaderFileName   // LPCWSTR
);
<DllImport("mspatchc.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function ExtractPatchHeaderToFileW(
    <MarshalAs(UnmanagedType.LPWStr)> PatchFileName As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> PatchHeaderFileName As String   ' LPCWSTR
) As Boolean
End Function
' PatchFileName : LPCWSTR
' PatchHeaderFileName : LPCWSTR
Declare PtrSafe Function ExtractPatchHeaderToFileW Lib "mspatchc" ( _
    ByVal PatchFileName As LongPtr, _
    ByVal PatchHeaderFileName 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

ExtractPatchHeaderToFileW = ctypes.windll.mspatchc.ExtractPatchHeaderToFileW
ExtractPatchHeaderToFileW.restype = wintypes.BOOL
ExtractPatchHeaderToFileW.argtypes = [
    wintypes.LPCWSTR,  # PatchFileName : LPCWSTR
    wintypes.LPCWSTR,  # PatchHeaderFileName : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('mspatchc.dll')
ExtractPatchHeaderToFileW = Fiddle::Function.new(
  lib['ExtractPatchHeaderToFileW'],
  [
    Fiddle::TYPE_VOIDP,  # PatchFileName : LPCWSTR
    Fiddle::TYPE_VOIDP,  # PatchHeaderFileName : LPCWSTR
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "mspatchc")]
extern "system" {
    fn ExtractPatchHeaderToFileW(
        PatchFileName: *const u16,  // LPCWSTR
        PatchHeaderFileName: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mspatchc.dll", CharSet = CharSet.Unicode)]
public static extern bool ExtractPatchHeaderToFileW([MarshalAs(UnmanagedType.LPWStr)] string PatchFileName, [MarshalAs(UnmanagedType.LPWStr)] string PatchHeaderFileName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mspatchc_ExtractPatchHeaderToFileW' -Namespace Win32 -PassThru
# $api::ExtractPatchHeaderToFileW(PatchFileName, PatchHeaderFileName)
#uselib "mspatchc.dll"
#func global ExtractPatchHeaderToFileW "ExtractPatchHeaderToFileW" wptr, wptr
; ExtractPatchHeaderToFileW PatchFileName, PatchHeaderFileName   ; 戻り値は stat
; PatchFileName : LPCWSTR -> "wptr"
; PatchHeaderFileName : LPCWSTR -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "mspatchc.dll"
#cfunc global ExtractPatchHeaderToFileW "ExtractPatchHeaderToFileW" wstr, wstr
; res = ExtractPatchHeaderToFileW(PatchFileName, PatchHeaderFileName)
; PatchFileName : LPCWSTR -> "wstr"
; PatchHeaderFileName : LPCWSTR -> "wstr"
; BOOL ExtractPatchHeaderToFileW(LPCWSTR PatchFileName, LPCWSTR PatchHeaderFileName)
#uselib "mspatchc.dll"
#cfunc global ExtractPatchHeaderToFileW "ExtractPatchHeaderToFileW" wstr, wstr
; res = ExtractPatchHeaderToFileW(PatchFileName, PatchHeaderFileName)
; PatchFileName : LPCWSTR -> "wstr"
; PatchHeaderFileName : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mspatchc = windows.NewLazySystemDLL("mspatchc.dll")
	procExtractPatchHeaderToFileW = mspatchc.NewProc("ExtractPatchHeaderToFileW")
)

// PatchFileName (LPCWSTR), PatchHeaderFileName (LPCWSTR)
r1, _, err := procExtractPatchHeaderToFileW.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(PatchFileName))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(PatchHeaderFileName))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function ExtractPatchHeaderToFileW(
  PatchFileName: PWideChar;   // LPCWSTR
  PatchHeaderFileName: PWideChar   // LPCWSTR
): BOOL; stdcall;
  external 'mspatchc.dll' name 'ExtractPatchHeaderToFileW';
result := DllCall("mspatchc\ExtractPatchHeaderToFileW"
    , "WStr", PatchFileName   ; LPCWSTR
    , "WStr", PatchHeaderFileName   ; LPCWSTR
    , "Int")   ; return: BOOL
●ExtractPatchHeaderToFileW(PatchFileName, PatchHeaderFileName) = DLL("mspatchc.dll", "bool ExtractPatchHeaderToFileW(char*, char*)")
# 呼び出し: ExtractPatchHeaderToFileW(PatchFileName, PatchHeaderFileName)
# PatchFileName : LPCWSTR -> "char*"
# PatchHeaderFileName : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。