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

MrmCreateResourceIndexerFromPreviousPriFile

関数
既存PRIファイルからリソースインデクサを作成する。
DLLMrmSupport.dll呼出規約winapi

シグネチャ

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

HRESULT MrmCreateResourceIndexerFromPreviousPriFile(
    LPCWSTR projectRoot,
    MrmPlatformVersion platformVersion,
    LPCWSTR defaultQualifiers,   // optional
    LPCWSTR priFile,
    MrmResourceIndexerHandle* indexer
);

パラメーター

名前方向説明
projectRootLPCWSTRinリソースのルートとなるプロジェクトフォルダのパス。
platformVersionMrmPlatformVersionin対象とするMRMプラットフォームバージョン。
defaultQualifiersLPCWSTRinoptional既定のリソース修飾子文字列(例: language-en-US)。
priFileLPCWSTRin以前のスキーマを取り込む元となるPRIファイルのパス。
indexerMrmResourceIndexerHandle*inout作成されたリソースインデクサのハンドルを受け取るポインタ。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT MrmCreateResourceIndexerFromPreviousPriFile(
    LPCWSTR projectRoot,
    MrmPlatformVersion platformVersion,
    LPCWSTR defaultQualifiers,   // optional
    LPCWSTR priFile,
    MrmResourceIndexerHandle* indexer
);
[DllImport("MrmSupport.dll", ExactSpelling = true)]
static extern int MrmCreateResourceIndexerFromPreviousPriFile(
    [MarshalAs(UnmanagedType.LPWStr)] string projectRoot,   // LPCWSTR
    int platformVersion,   // MrmPlatformVersion
    [MarshalAs(UnmanagedType.LPWStr)] string defaultQualifiers,   // LPCWSTR optional
    [MarshalAs(UnmanagedType.LPWStr)] string priFile,   // LPCWSTR
    IntPtr indexer   // MrmResourceIndexerHandle* in/out
);
<DllImport("MrmSupport.dll", ExactSpelling:=True)>
Public Shared Function MrmCreateResourceIndexerFromPreviousPriFile(
    <MarshalAs(UnmanagedType.LPWStr)> projectRoot As String,   ' LPCWSTR
    platformVersion As Integer,   ' MrmPlatformVersion
    <MarshalAs(UnmanagedType.LPWStr)> defaultQualifiers As String,   ' LPCWSTR optional
    <MarshalAs(UnmanagedType.LPWStr)> priFile As String,   ' LPCWSTR
    indexer As IntPtr   ' MrmResourceIndexerHandle* in/out
) As Integer
End Function
' projectRoot : LPCWSTR
' platformVersion : MrmPlatformVersion
' defaultQualifiers : LPCWSTR optional
' priFile : LPCWSTR
' indexer : MrmResourceIndexerHandle* in/out
Declare PtrSafe Function MrmCreateResourceIndexerFromPreviousPriFile Lib "mrmsupport" ( _
    ByVal projectRoot As LongPtr, _
    ByVal platformVersion As Long, _
    ByVal defaultQualifiers As LongPtr, _
    ByVal priFile As LongPtr, _
    ByVal indexer As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MrmCreateResourceIndexerFromPreviousPriFile = ctypes.windll.mrmsupport.MrmCreateResourceIndexerFromPreviousPriFile
MrmCreateResourceIndexerFromPreviousPriFile.restype = ctypes.c_int
MrmCreateResourceIndexerFromPreviousPriFile.argtypes = [
    wintypes.LPCWSTR,  # projectRoot : LPCWSTR
    ctypes.c_int,  # platformVersion : MrmPlatformVersion
    wintypes.LPCWSTR,  # defaultQualifiers : LPCWSTR optional
    wintypes.LPCWSTR,  # priFile : LPCWSTR
    ctypes.c_void_p,  # indexer : MrmResourceIndexerHandle* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mrmsupport = windows.NewLazySystemDLL("MrmSupport.dll")
	procMrmCreateResourceIndexerFromPreviousPriFile = mrmsupport.NewProc("MrmCreateResourceIndexerFromPreviousPriFile")
)

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

extern "mrmsupport" fn MrmCreateResourceIndexerFromPreviousPriFile(
    projectRoot: [*c]const u16, // LPCWSTR
    platformVersion: i32, // MrmPlatformVersion
    defaultQualifiers: [*c]const u16, // LPCWSTR optional
    priFile: [*c]const u16, // LPCWSTR
    indexer: [*c]MrmResourceIndexerHandle // MrmResourceIndexerHandle* in/out
) callconv(std.os.windows.WINAPI) i32;
proc MrmCreateResourceIndexerFromPreviousPriFile(
    projectRoot: WideCString,  # LPCWSTR
    platformVersion: int32,  # MrmPlatformVersion
    defaultQualifiers: WideCString,  # LPCWSTR optional
    priFile: WideCString,  # LPCWSTR
    indexer: ptr MrmResourceIndexerHandle  # MrmResourceIndexerHandle* in/out
): int32 {.importc: "MrmCreateResourceIndexerFromPreviousPriFile", stdcall, dynlib: "MrmSupport.dll".}
pragma(lib, "mrmsupport");
extern(Windows)
int MrmCreateResourceIndexerFromPreviousPriFile(
    const(wchar)* projectRoot,   // LPCWSTR
    int platformVersion,   // MrmPlatformVersion
    const(wchar)* defaultQualifiers,   // LPCWSTR optional
    const(wchar)* priFile,   // LPCWSTR
    MrmResourceIndexerHandle* indexer   // MrmResourceIndexerHandle* in/out
);
ccall((:MrmCreateResourceIndexerFromPreviousPriFile, "MrmSupport.dll"), stdcall, Int32,
      (Cwstring, Int32, Cwstring, Cwstring, Ptr{MrmResourceIndexerHandle}),
      projectRoot, platformVersion, defaultQualifiers, priFile, indexer)
# projectRoot : LPCWSTR -> Cwstring
# platformVersion : MrmPlatformVersion -> Int32
# defaultQualifiers : LPCWSTR optional -> Cwstring
# priFile : LPCWSTR -> Cwstring
# indexer : MrmResourceIndexerHandle* in/out -> Ptr{MrmResourceIndexerHandle}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t MrmCreateResourceIndexerFromPreviousPriFile(
    const uint16_t* projectRoot,
    int32_t platformVersion,
    const uint16_t* defaultQualifiers,
    const uint16_t* priFile,
    void* indexer);
]]
local mrmsupport = ffi.load("mrmsupport")
-- mrmsupport.MrmCreateResourceIndexerFromPreviousPriFile(projectRoot, platformVersion, defaultQualifiers, priFile, indexer)
-- projectRoot : LPCWSTR
-- platformVersion : MrmPlatformVersion
-- defaultQualifiers : LPCWSTR optional
-- priFile : LPCWSTR
-- indexer : MrmResourceIndexerHandle* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('MrmSupport.dll');
const MrmCreateResourceIndexerFromPreviousPriFile = lib.func('__stdcall', 'MrmCreateResourceIndexerFromPreviousPriFile', 'int32_t', ['str16', 'int32_t', 'str16', 'str16', 'void *']);
// MrmCreateResourceIndexerFromPreviousPriFile(projectRoot, platformVersion, defaultQualifiers, priFile, indexer)
// projectRoot : LPCWSTR -> 'str16'
// platformVersion : MrmPlatformVersion -> 'int32_t'
// defaultQualifiers : LPCWSTR optional -> 'str16'
// priFile : LPCWSTR -> 'str16'
// indexer : MrmResourceIndexerHandle* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("MrmSupport.dll", {
  MrmCreateResourceIndexerFromPreviousPriFile: { parameters: ["buffer", "i32", "buffer", "buffer", "pointer"], result: "i32" },
});
// lib.symbols.MrmCreateResourceIndexerFromPreviousPriFile(projectRoot, platformVersion, defaultQualifiers, priFile, indexer)
// projectRoot : LPCWSTR -> "buffer"
// platformVersion : MrmPlatformVersion -> "i32"
// defaultQualifiers : LPCWSTR optional -> "buffer"
// priFile : LPCWSTR -> "buffer"
// indexer : MrmResourceIndexerHandle* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t MrmCreateResourceIndexerFromPreviousPriFile(
    const uint16_t* projectRoot,
    int32_t platformVersion,
    const uint16_t* defaultQualifiers,
    const uint16_t* priFile,
    void* indexer);
C, "MrmSupport.dll");
// $ffi->MrmCreateResourceIndexerFromPreviousPriFile(projectRoot, platformVersion, defaultQualifiers, priFile, indexer);
// projectRoot : LPCWSTR
// platformVersion : MrmPlatformVersion
// defaultQualifiers : LPCWSTR optional
// priFile : LPCWSTR
// indexer : MrmResourceIndexerHandle* in/out
// 構造体/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 MrmCreateResourceIndexerFromPreviousPriFile(
        WString projectRoot,   // LPCWSTR
        int platformVersion,   // MrmPlatformVersion
        WString defaultQualifiers,   // LPCWSTR optional
        WString priFile,   // LPCWSTR
        Pointer indexer   // MrmResourceIndexerHandle* in/out
    );
}
@[Link("mrmsupport")]
lib LibMrmSupport
  fun MrmCreateResourceIndexerFromPreviousPriFile = MrmCreateResourceIndexerFromPreviousPriFile(
    projectRoot : UInt16*,   # LPCWSTR
    platformVersion : Int32,   # MrmPlatformVersion
    defaultQualifiers : UInt16*,   # LPCWSTR optional
    priFile : UInt16*,   # LPCWSTR
    indexer : MrmResourceIndexerHandle*   # MrmResourceIndexerHandle* in/out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef MrmCreateResourceIndexerFromPreviousPriFileNative = Int32 Function(Pointer<Utf16>, Int32, Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>);
typedef MrmCreateResourceIndexerFromPreviousPriFileDart = int Function(Pointer<Utf16>, int, Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>);
final MrmCreateResourceIndexerFromPreviousPriFile = DynamicLibrary.open('MrmSupport.dll')
    .lookupFunction<MrmCreateResourceIndexerFromPreviousPriFileNative, MrmCreateResourceIndexerFromPreviousPriFileDart>('MrmCreateResourceIndexerFromPreviousPriFile');
// projectRoot : LPCWSTR -> Pointer<Utf16>
// platformVersion : MrmPlatformVersion -> Int32
// defaultQualifiers : LPCWSTR optional -> Pointer<Utf16>
// priFile : LPCWSTR -> Pointer<Utf16>
// indexer : MrmResourceIndexerHandle* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function MrmCreateResourceIndexerFromPreviousPriFile(
  projectRoot: PWideChar;   // LPCWSTR
  platformVersion: Integer;   // MrmPlatformVersion
  defaultQualifiers: PWideChar;   // LPCWSTR optional
  priFile: PWideChar;   // LPCWSTR
  indexer: Pointer   // MrmResourceIndexerHandle* in/out
): Integer; stdcall;
  external 'MrmSupport.dll' name 'MrmCreateResourceIndexerFromPreviousPriFile';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "MrmCreateResourceIndexerFromPreviousPriFile"
  c_MrmCreateResourceIndexerFromPreviousPriFile :: CWString -> Int32 -> CWString -> CWString -> Ptr () -> IO Int32
-- projectRoot : LPCWSTR -> CWString
-- platformVersion : MrmPlatformVersion -> Int32
-- defaultQualifiers : LPCWSTR optional -> CWString
-- priFile : LPCWSTR -> CWString
-- indexer : MrmResourceIndexerHandle* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let mrmcreateresourceindexerfrompreviousprifile =
  foreign "MrmCreateResourceIndexerFromPreviousPriFile"
    ((ptr uint16_t) @-> int32_t @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr void) @-> returning int32_t)
(* projectRoot : LPCWSTR -> (ptr uint16_t) *)
(* platformVersion : MrmPlatformVersion -> int32_t *)
(* defaultQualifiers : LPCWSTR optional -> (ptr uint16_t) *)
(* priFile : LPCWSTR -> (ptr uint16_t) *)
(* indexer : MrmResourceIndexerHandle* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library mrmsupport (t "MrmSupport.dll"))
(cffi:use-foreign-library mrmsupport)

(cffi:defcfun ("MrmCreateResourceIndexerFromPreviousPriFile" mrm-create-resource-indexer-from-previous-pri-file :convention :stdcall) :int32
  (project-root (:string :encoding :utf-16le))   ; LPCWSTR
  (platform-version :int32)   ; MrmPlatformVersion
  (default-qualifiers (:string :encoding :utf-16le))   ; LPCWSTR optional
  (pri-file (:string :encoding :utf-16le))   ; LPCWSTR
  (indexer :pointer))   ; MrmResourceIndexerHandle* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $MrmCreateResourceIndexerFromPreviousPriFile = Win32::API::More->new('MrmSupport',
    'int MrmCreateResourceIndexerFromPreviousPriFile(LPCWSTR projectRoot, int platformVersion, LPCWSTR defaultQualifiers, LPCWSTR priFile, LPVOID indexer)');
# my $ret = $MrmCreateResourceIndexerFromPreviousPriFile->Call($projectRoot, $platformVersion, $defaultQualifiers, $priFile, $indexer);
# projectRoot : LPCWSTR -> LPCWSTR
# platformVersion : MrmPlatformVersion -> int
# defaultQualifiers : LPCWSTR optional -> LPCWSTR
# priFile : LPCWSTR -> LPCWSTR
# indexer : MrmResourceIndexerHandle* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型