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

ExtractPatchHeaderToFileA

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

シグネチャ

// mspatchc.dll  (ANSI / -A)
#include <windows.h>

BOOL ExtractPatchHeaderToFileA(
    LPCSTR PatchFileName,
    LPCSTR PatchHeaderFileName
);

パラメーター

名前方向
PatchFileNameLPCSTRin
PatchHeaderFileNameLPCSTRin

戻り値の型: BOOL

各言語での呼び出し定義

// mspatchc.dll  (ANSI / -A)
#include <windows.h>

BOOL ExtractPatchHeaderToFileA(
    LPCSTR PatchFileName,
    LPCSTR PatchHeaderFileName
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mspatchc.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern bool ExtractPatchHeaderToFileA(
    [MarshalAs(UnmanagedType.LPStr)] string PatchFileName,   // LPCSTR
    [MarshalAs(UnmanagedType.LPStr)] string PatchHeaderFileName   // LPCSTR
);
<DllImport("mspatchc.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function ExtractPatchHeaderToFileA(
    <MarshalAs(UnmanagedType.LPStr)> PatchFileName As String,   ' LPCSTR
    <MarshalAs(UnmanagedType.LPStr)> PatchHeaderFileName As String   ' LPCSTR
) As Boolean
End Function
' PatchFileName : LPCSTR
' PatchHeaderFileName : LPCSTR
Declare PtrSafe Function ExtractPatchHeaderToFileA Lib "mspatchc" ( _
    ByVal PatchFileName As String, _
    ByVal PatchHeaderFileName As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

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

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

var (
	mspatchc = windows.NewLazySystemDLL("mspatchc.dll")
	procExtractPatchHeaderToFileA = mspatchc.NewProc("ExtractPatchHeaderToFileA")
)

// PatchFileName (LPCSTR), PatchHeaderFileName (LPCSTR)
r1, _, err := procExtractPatchHeaderToFileA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(PatchFileName))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(PatchHeaderFileName))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function ExtractPatchHeaderToFileA(
  PatchFileName: PAnsiChar;   // LPCSTR
  PatchHeaderFileName: PAnsiChar   // LPCSTR
): BOOL; stdcall;
  external 'mspatchc.dll' name 'ExtractPatchHeaderToFileA';
result := DllCall("mspatchc\ExtractPatchHeaderToFileA"
    , "AStr", PatchFileName   ; LPCSTR
    , "AStr", PatchHeaderFileName   ; LPCSTR
    , "Int")   ; return: BOOL
●ExtractPatchHeaderToFileA(PatchFileName, PatchHeaderFileName) = DLL("mspatchc.dll", "bool ExtractPatchHeaderToFileA(char*, char*)")
# 呼び出し: ExtractPatchHeaderToFileA(PatchFileName, PatchHeaderFileName)
# PatchFileName : LPCSTR -> "char*"
# PatchHeaderFileName : LPCSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。