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

MrmDumpPriFile

関数
PRIファイルの内容をXMLにダンプ出力する。
DLLMrmSupport.dll呼出規約winapi

シグネチャ

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

HRESULT MrmDumpPriFile(
    LPCWSTR indexFileName,
    LPCWSTR schemaPriFile,   // optional
    MrmDumpType dumpType,
    LPCWSTR outputXmlFile
);

パラメーター

名前方向説明
indexFileNameLPCWSTRinダンプ対象のインデックス(PRI)ファイルのパス。
schemaPriFileLPCWSTRinoptionalスキーマを含むPRIファイルのパス。NULL可。
dumpTypeMrmDumpTypeinダンプ出力の種別(MrmDumpType)。
outputXmlFileLPCWSTRinダンプ結果を書き出すXMLファイルのパス。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT MrmDumpPriFile(
    LPCWSTR indexFileName,
    LPCWSTR schemaPriFile,   // optional
    MrmDumpType dumpType,
    LPCWSTR outputXmlFile
);
[DllImport("MrmSupport.dll", ExactSpelling = true)]
static extern int MrmDumpPriFile(
    [MarshalAs(UnmanagedType.LPWStr)] string indexFileName,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string schemaPriFile,   // LPCWSTR optional
    int dumpType,   // MrmDumpType
    [MarshalAs(UnmanagedType.LPWStr)] string outputXmlFile   // LPCWSTR
);
<DllImport("MrmSupport.dll", ExactSpelling:=True)>
Public Shared Function MrmDumpPriFile(
    <MarshalAs(UnmanagedType.LPWStr)> indexFileName As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> schemaPriFile As String,   ' LPCWSTR optional
    dumpType As Integer,   ' MrmDumpType
    <MarshalAs(UnmanagedType.LPWStr)> outputXmlFile As String   ' LPCWSTR
) As Integer
End Function
' indexFileName : LPCWSTR
' schemaPriFile : LPCWSTR optional
' dumpType : MrmDumpType
' outputXmlFile : LPCWSTR
Declare PtrSafe Function MrmDumpPriFile Lib "mrmsupport" ( _
    ByVal indexFileName As LongPtr, _
    ByVal schemaPriFile As LongPtr, _
    ByVal dumpType As Long, _
    ByVal outputXmlFile As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MrmDumpPriFile = ctypes.windll.mrmsupport.MrmDumpPriFile
MrmDumpPriFile.restype = ctypes.c_int
MrmDumpPriFile.argtypes = [
    wintypes.LPCWSTR,  # indexFileName : LPCWSTR
    wintypes.LPCWSTR,  # schemaPriFile : LPCWSTR optional
    ctypes.c_int,  # dumpType : MrmDumpType
    wintypes.LPCWSTR,  # outputXmlFile : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MrmSupport.dll')
MrmDumpPriFile = Fiddle::Function.new(
  lib['MrmDumpPriFile'],
  [
    Fiddle::TYPE_VOIDP,  # indexFileName : LPCWSTR
    Fiddle::TYPE_VOIDP,  # schemaPriFile : LPCWSTR optional
    Fiddle::TYPE_INT,  # dumpType : MrmDumpType
    Fiddle::TYPE_VOIDP,  # outputXmlFile : LPCWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "mrmsupport")]
extern "system" {
    fn MrmDumpPriFile(
        indexFileName: *const u16,  // LPCWSTR
        schemaPriFile: *const u16,  // LPCWSTR optional
        dumpType: i32,  // MrmDumpType
        outputXmlFile: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MrmSupport.dll")]
public static extern int MrmDumpPriFile([MarshalAs(UnmanagedType.LPWStr)] string indexFileName, [MarshalAs(UnmanagedType.LPWStr)] string schemaPriFile, int dumpType, [MarshalAs(UnmanagedType.LPWStr)] string outputXmlFile);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MrmSupport_MrmDumpPriFile' -Namespace Win32 -PassThru
# $api::MrmDumpPriFile(indexFileName, schemaPriFile, dumpType, outputXmlFile)
#uselib "MrmSupport.dll"
#func global MrmDumpPriFile "MrmDumpPriFile" sptr, sptr, sptr, sptr
; MrmDumpPriFile indexFileName, schemaPriFile, dumpType, outputXmlFile   ; 戻り値は stat
; indexFileName : LPCWSTR -> "sptr"
; schemaPriFile : LPCWSTR optional -> "sptr"
; dumpType : MrmDumpType -> "sptr"
; outputXmlFile : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MrmSupport.dll"
#cfunc global MrmDumpPriFile "MrmDumpPriFile" wstr, wstr, int, wstr
; res = MrmDumpPriFile(indexFileName, schemaPriFile, dumpType, outputXmlFile)
; indexFileName : LPCWSTR -> "wstr"
; schemaPriFile : LPCWSTR optional -> "wstr"
; dumpType : MrmDumpType -> "int"
; outputXmlFile : LPCWSTR -> "wstr"
; HRESULT MrmDumpPriFile(LPCWSTR indexFileName, LPCWSTR schemaPriFile, MrmDumpType dumpType, LPCWSTR outputXmlFile)
#uselib "MrmSupport.dll"
#cfunc global MrmDumpPriFile "MrmDumpPriFile" wstr, wstr, int, wstr
; res = MrmDumpPriFile(indexFileName, schemaPriFile, dumpType, outputXmlFile)
; indexFileName : LPCWSTR -> "wstr"
; schemaPriFile : LPCWSTR optional -> "wstr"
; dumpType : MrmDumpType -> "int"
; outputXmlFile : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mrmsupport = windows.NewLazySystemDLL("MrmSupport.dll")
	procMrmDumpPriFile = mrmsupport.NewProc("MrmDumpPriFile")
)

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

extern "mrmsupport" fn MrmDumpPriFile(
    indexFileName: [*c]const u16, // LPCWSTR
    schemaPriFile: [*c]const u16, // LPCWSTR optional
    dumpType: i32, // MrmDumpType
    outputXmlFile: [*c]const u16 // LPCWSTR
) callconv(std.os.windows.WINAPI) i32;
proc MrmDumpPriFile(
    indexFileName: WideCString,  # LPCWSTR
    schemaPriFile: WideCString,  # LPCWSTR optional
    dumpType: int32,  # MrmDumpType
    outputXmlFile: WideCString  # LPCWSTR
): int32 {.importc: "MrmDumpPriFile", stdcall, dynlib: "MrmSupport.dll".}
pragma(lib, "mrmsupport");
extern(Windows)
int MrmDumpPriFile(
    const(wchar)* indexFileName,   // LPCWSTR
    const(wchar)* schemaPriFile,   // LPCWSTR optional
    int dumpType,   // MrmDumpType
    const(wchar)* outputXmlFile   // LPCWSTR
);
ccall((:MrmDumpPriFile, "MrmSupport.dll"), stdcall, Int32,
      (Cwstring, Cwstring, Int32, Cwstring),
      indexFileName, schemaPriFile, dumpType, outputXmlFile)
# indexFileName : LPCWSTR -> Cwstring
# schemaPriFile : LPCWSTR optional -> Cwstring
# dumpType : MrmDumpType -> Int32
# outputXmlFile : LPCWSTR -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t MrmDumpPriFile(
    const uint16_t* indexFileName,
    const uint16_t* schemaPriFile,
    int32_t dumpType,
    const uint16_t* outputXmlFile);
]]
local mrmsupport = ffi.load("mrmsupport")
-- mrmsupport.MrmDumpPriFile(indexFileName, schemaPriFile, dumpType, outputXmlFile)
-- indexFileName : LPCWSTR
-- schemaPriFile : LPCWSTR optional
-- dumpType : MrmDumpType
-- outputXmlFile : LPCWSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('MrmSupport.dll');
const MrmDumpPriFile = lib.func('__stdcall', 'MrmDumpPriFile', 'int32_t', ['str16', 'str16', 'int32_t', 'str16']);
// MrmDumpPriFile(indexFileName, schemaPriFile, dumpType, outputXmlFile)
// indexFileName : LPCWSTR -> 'str16'
// schemaPriFile : LPCWSTR optional -> 'str16'
// dumpType : MrmDumpType -> 'int32_t'
// outputXmlFile : LPCWSTR -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("MrmSupport.dll", {
  MrmDumpPriFile: { parameters: ["buffer", "buffer", "i32", "buffer"], result: "i32" },
});
// lib.symbols.MrmDumpPriFile(indexFileName, schemaPriFile, dumpType, outputXmlFile)
// indexFileName : LPCWSTR -> "buffer"
// schemaPriFile : LPCWSTR optional -> "buffer"
// dumpType : MrmDumpType -> "i32"
// outputXmlFile : LPCWSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t MrmDumpPriFile(
    const uint16_t* indexFileName,
    const uint16_t* schemaPriFile,
    int32_t dumpType,
    const uint16_t* outputXmlFile);
C, "MrmSupport.dll");
// $ffi->MrmDumpPriFile(indexFileName, schemaPriFile, dumpType, outputXmlFile);
// indexFileName : LPCWSTR
// schemaPriFile : LPCWSTR optional
// dumpType : MrmDumpType
// outputXmlFile : LPCWSTR
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Mrmsupport extends StdCallLibrary {
    Mrmsupport INSTANCE = Native.load("mrmsupport", Mrmsupport.class);
    int MrmDumpPriFile(
        WString indexFileName,   // LPCWSTR
        WString schemaPriFile,   // LPCWSTR optional
        int dumpType,   // MrmDumpType
        WString outputXmlFile   // LPCWSTR
    );
}
@[Link("mrmsupport")]
lib LibMrmSupport
  fun MrmDumpPriFile = MrmDumpPriFile(
    indexFileName : UInt16*,   # LPCWSTR
    schemaPriFile : UInt16*,   # LPCWSTR optional
    dumpType : Int32,   # MrmDumpType
    outputXmlFile : UInt16*   # LPCWSTR
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef MrmDumpPriFileNative = Int32 Function(Pointer<Utf16>, Pointer<Utf16>, Int32, Pointer<Utf16>);
typedef MrmDumpPriFileDart = int Function(Pointer<Utf16>, Pointer<Utf16>, int, Pointer<Utf16>);
final MrmDumpPriFile = DynamicLibrary.open('MrmSupport.dll')
    .lookupFunction<MrmDumpPriFileNative, MrmDumpPriFileDart>('MrmDumpPriFile');
// indexFileName : LPCWSTR -> Pointer<Utf16>
// schemaPriFile : LPCWSTR optional -> Pointer<Utf16>
// dumpType : MrmDumpType -> Int32
// outputXmlFile : LPCWSTR -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function MrmDumpPriFile(
  indexFileName: PWideChar;   // LPCWSTR
  schemaPriFile: PWideChar;   // LPCWSTR optional
  dumpType: Integer;   // MrmDumpType
  outputXmlFile: PWideChar   // LPCWSTR
): Integer; stdcall;
  external 'MrmSupport.dll' name 'MrmDumpPriFile';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "MrmDumpPriFile"
  c_MrmDumpPriFile :: CWString -> CWString -> Int32 -> CWString -> IO Int32
-- indexFileName : LPCWSTR -> CWString
-- schemaPriFile : LPCWSTR optional -> CWString
-- dumpType : MrmDumpType -> Int32
-- outputXmlFile : LPCWSTR -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let mrmdumpprifile =
  foreign "MrmDumpPriFile"
    ((ptr uint16_t) @-> (ptr uint16_t) @-> int32_t @-> (ptr uint16_t) @-> returning int32_t)
(* indexFileName : LPCWSTR -> (ptr uint16_t) *)
(* schemaPriFile : LPCWSTR optional -> (ptr uint16_t) *)
(* dumpType : MrmDumpType -> int32_t *)
(* outputXmlFile : LPCWSTR -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library mrmsupport (t "MrmSupport.dll"))
(cffi:use-foreign-library mrmsupport)

(cffi:defcfun ("MrmDumpPriFile" mrm-dump-pri-file :convention :stdcall) :int32
  (index-file-name (:string :encoding :utf-16le))   ; LPCWSTR
  (schema-pri-file (:string :encoding :utf-16le))   ; LPCWSTR optional
  (dump-type :int32)   ; MrmDumpType
  (output-xml-file (:string :encoding :utf-16le)))   ; LPCWSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $MrmDumpPriFile = Win32::API::More->new('MrmSupport',
    'int MrmDumpPriFile(LPCWSTR indexFileName, LPCWSTR schemaPriFile, int dumpType, LPCWSTR outputXmlFile)');
# my $ret = $MrmDumpPriFile->Call($indexFileName, $schemaPriFile, $dumpType, $outputXmlFile);
# indexFileName : LPCWSTR -> LPCWSTR
# schemaPriFile : LPCWSTR optional -> LPCWSTR
# dumpType : MrmDumpType -> int
# outputXmlFile : LPCWSTR -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型