Win32 API 日本語リファレンス
ホームUI.WindowsAndMessaging › MrmGetPriFileContentChecksum

MrmGetPriFileContentChecksum

関数
PRIファイルの内容チェックサムを取得する。
DLLMrmSupport.dll呼出規約winapi

シグネチャ

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

HRESULT MrmGetPriFileContentChecksum(
    LPCWSTR priFile,
    DWORD* checksum
);

パラメーター

名前方向
priFileLPCWSTRin
checksumDWORD*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT MrmGetPriFileContentChecksum(
    LPCWSTR priFile,
    DWORD* checksum
);
[DllImport("MrmSupport.dll", ExactSpelling = true)]
static extern int MrmGetPriFileContentChecksum(
    [MarshalAs(UnmanagedType.LPWStr)] string priFile,   // LPCWSTR
    out uint checksum   // DWORD* out
);
<DllImport("MrmSupport.dll", ExactSpelling:=True)>
Public Shared Function MrmGetPriFileContentChecksum(
    <MarshalAs(UnmanagedType.LPWStr)> priFile As String,   ' LPCWSTR
    <Out> ByRef checksum As UInteger   ' DWORD* out
) As Integer
End Function
' priFile : LPCWSTR
' checksum : DWORD* out
Declare PtrSafe Function MrmGetPriFileContentChecksum Lib "mrmsupport" ( _
    ByVal priFile As LongPtr, _
    ByRef checksum As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MrmGetPriFileContentChecksum = ctypes.windll.mrmsupport.MrmGetPriFileContentChecksum
MrmGetPriFileContentChecksum.restype = ctypes.c_int
MrmGetPriFileContentChecksum.argtypes = [
    wintypes.LPCWSTR,  # priFile : LPCWSTR
    ctypes.POINTER(wintypes.DWORD),  # checksum : DWORD* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MrmSupport.dll')
MrmGetPriFileContentChecksum = Fiddle::Function.new(
  lib['MrmGetPriFileContentChecksum'],
  [
    Fiddle::TYPE_VOIDP,  # priFile : LPCWSTR
    Fiddle::TYPE_VOIDP,  # checksum : DWORD* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mrmsupport")]
extern "system" {
    fn MrmGetPriFileContentChecksum(
        priFile: *const u16,  // LPCWSTR
        checksum: *mut u32  // DWORD* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MrmSupport.dll")]
public static extern int MrmGetPriFileContentChecksum([MarshalAs(UnmanagedType.LPWStr)] string priFile, out uint checksum);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MrmSupport_MrmGetPriFileContentChecksum' -Namespace Win32 -PassThru
# $api::MrmGetPriFileContentChecksum(priFile, checksum)
#uselib "MrmSupport.dll"
#func global MrmGetPriFileContentChecksum "MrmGetPriFileContentChecksum" sptr, sptr
; MrmGetPriFileContentChecksum priFile, varptr(checksum)   ; 戻り値は stat
; priFile : LPCWSTR -> "sptr"
; checksum : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MrmSupport.dll"
#cfunc global MrmGetPriFileContentChecksum "MrmGetPriFileContentChecksum" wstr, var
; res = MrmGetPriFileContentChecksum(priFile, checksum)
; priFile : LPCWSTR -> "wstr"
; checksum : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT MrmGetPriFileContentChecksum(LPCWSTR priFile, DWORD* checksum)
#uselib "MrmSupport.dll"
#cfunc global MrmGetPriFileContentChecksum "MrmGetPriFileContentChecksum" wstr, var
; res = MrmGetPriFileContentChecksum(priFile, checksum)
; priFile : LPCWSTR -> "wstr"
; checksum : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mrmsupport = windows.NewLazySystemDLL("MrmSupport.dll")
	procMrmGetPriFileContentChecksum = mrmsupport.NewProc("MrmGetPriFileContentChecksum")
)

// priFile (LPCWSTR), checksum (DWORD* out)
r1, _, err := procMrmGetPriFileContentChecksum.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(priFile))),
	uintptr(checksum),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function MrmGetPriFileContentChecksum(
  priFile: PWideChar;   // LPCWSTR
  checksum: Pointer   // DWORD* out
): Integer; stdcall;
  external 'MrmSupport.dll' name 'MrmGetPriFileContentChecksum';
result := DllCall("MrmSupport\MrmGetPriFileContentChecksum"
    , "WStr", priFile   ; LPCWSTR
    , "Ptr", checksum   ; DWORD* out
    , "Int")   ; return: HRESULT
●MrmGetPriFileContentChecksum(priFile, checksum) = DLL("MrmSupport.dll", "int MrmGetPriFileContentChecksum(char*, void*)")
# 呼び出し: MrmGetPriFileContentChecksum(priFile, checksum)
# priFile : LPCWSTR -> "char*"
# checksum : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。