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

MrmCreateResourceFileInMemory

関数
PRIリソースファイルをメモリ上に生成する。
DLLMrmSupport.dll呼出規約winapi

シグネチャ

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

HRESULT MrmCreateResourceFileInMemory(
    MrmResourceIndexerHandle indexer,
    MrmPackagingMode packagingMode,
    MrmPackagingOptions packagingOptions,
    BYTE** outputPriData,
    DWORD* outputPriSize
);

パラメーター

名前方向
indexerMrmResourceIndexerHandlein
packagingModeMrmPackagingModein
packagingOptionsMrmPackagingOptionsin
outputPriDataBYTE**out
outputPriSizeDWORD*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT MrmCreateResourceFileInMemory(
    MrmResourceIndexerHandle indexer,
    MrmPackagingMode packagingMode,
    MrmPackagingOptions packagingOptions,
    BYTE** outputPriData,
    DWORD* outputPriSize
);
[DllImport("MrmSupport.dll", ExactSpelling = true)]
static extern int MrmCreateResourceFileInMemory(
    MrmResourceIndexerHandle indexer,   // MrmResourceIndexerHandle
    int packagingMode,   // MrmPackagingMode
    int packagingOptions,   // MrmPackagingOptions
    IntPtr outputPriData,   // BYTE** out
    out uint outputPriSize   // DWORD* out
);
<DllImport("MrmSupport.dll", ExactSpelling:=True)>
Public Shared Function MrmCreateResourceFileInMemory(
    indexer As MrmResourceIndexerHandle,   ' MrmResourceIndexerHandle
    packagingMode As Integer,   ' MrmPackagingMode
    packagingOptions As Integer,   ' MrmPackagingOptions
    outputPriData As IntPtr,   ' BYTE** out
    <Out> ByRef outputPriSize As UInteger   ' DWORD* out
) As Integer
End Function
' indexer : MrmResourceIndexerHandle
' packagingMode : MrmPackagingMode
' packagingOptions : MrmPackagingOptions
' outputPriData : BYTE** out
' outputPriSize : DWORD* out
Declare PtrSafe Function MrmCreateResourceFileInMemory Lib "mrmsupport" ( _
    ByVal indexer As LongPtr, _
    ByVal packagingMode As Long, _
    ByVal packagingOptions As Long, _
    ByVal outputPriData As LongPtr, _
    ByRef outputPriSize As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MrmCreateResourceFileInMemory = ctypes.windll.mrmsupport.MrmCreateResourceFileInMemory
MrmCreateResourceFileInMemory.restype = ctypes.c_int
MrmCreateResourceFileInMemory.argtypes = [
    MrmResourceIndexerHandle,  # indexer : MrmResourceIndexerHandle
    ctypes.c_int,  # packagingMode : MrmPackagingMode
    ctypes.c_int,  # packagingOptions : MrmPackagingOptions
    ctypes.c_void_p,  # outputPriData : BYTE** out
    ctypes.POINTER(wintypes.DWORD),  # outputPriSize : DWORD* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MrmSupport.dll')
MrmCreateResourceFileInMemory = Fiddle::Function.new(
  lib['MrmCreateResourceFileInMemory'],
  [
    Fiddle::TYPE_VOIDP,  # indexer : MrmResourceIndexerHandle
    Fiddle::TYPE_INT,  # packagingMode : MrmPackagingMode
    Fiddle::TYPE_INT,  # packagingOptions : MrmPackagingOptions
    Fiddle::TYPE_VOIDP,  # outputPriData : BYTE** out
    Fiddle::TYPE_VOIDP,  # outputPriSize : DWORD* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mrmsupport")]
extern "system" {
    fn MrmCreateResourceFileInMemory(
        indexer: MrmResourceIndexerHandle,  // MrmResourceIndexerHandle
        packagingMode: i32,  // MrmPackagingMode
        packagingOptions: i32,  // MrmPackagingOptions
        outputPriData: *mut *mut u8,  // BYTE** out
        outputPriSize: *mut u32  // DWORD* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MrmSupport.dll")]
public static extern int MrmCreateResourceFileInMemory(MrmResourceIndexerHandle indexer, int packagingMode, int packagingOptions, IntPtr outputPriData, out uint outputPriSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MrmSupport_MrmCreateResourceFileInMemory' -Namespace Win32 -PassThru
# $api::MrmCreateResourceFileInMemory(indexer, packagingMode, packagingOptions, outputPriData, outputPriSize)
#uselib "MrmSupport.dll"
#func global MrmCreateResourceFileInMemory "MrmCreateResourceFileInMemory" sptr, sptr, sptr, sptr, sptr
; MrmCreateResourceFileInMemory indexer, packagingMode, packagingOptions, varptr(outputPriData), varptr(outputPriSize)   ; 戻り値は stat
; indexer : MrmResourceIndexerHandle -> "sptr"
; packagingMode : MrmPackagingMode -> "sptr"
; packagingOptions : MrmPackagingOptions -> "sptr"
; outputPriData : BYTE** out -> "sptr"
; outputPriSize : DWORD* out -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MrmSupport.dll"
#cfunc global MrmCreateResourceFileInMemory "MrmCreateResourceFileInMemory" int, int, int, var, var
; res = MrmCreateResourceFileInMemory(indexer, packagingMode, packagingOptions, outputPriData, outputPriSize)
; indexer : MrmResourceIndexerHandle -> "int"
; packagingMode : MrmPackagingMode -> "int"
; packagingOptions : MrmPackagingOptions -> "int"
; outputPriData : BYTE** out -> "var"
; outputPriSize : DWORD* out -> "var"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT MrmCreateResourceFileInMemory(MrmResourceIndexerHandle indexer, MrmPackagingMode packagingMode, MrmPackagingOptions packagingOptions, BYTE** outputPriData, DWORD* outputPriSize)
#uselib "MrmSupport.dll"
#cfunc global MrmCreateResourceFileInMemory "MrmCreateResourceFileInMemory" int, int, int, var, var
; res = MrmCreateResourceFileInMemory(indexer, packagingMode, packagingOptions, outputPriData, outputPriSize)
; indexer : MrmResourceIndexerHandle -> "int"
; packagingMode : MrmPackagingMode -> "int"
; packagingOptions : MrmPackagingOptions -> "int"
; outputPriData : BYTE** out -> "var"
; outputPriSize : DWORD* out -> "var"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mrmsupport = windows.NewLazySystemDLL("MrmSupport.dll")
	procMrmCreateResourceFileInMemory = mrmsupport.NewProc("MrmCreateResourceFileInMemory")
)

// indexer (MrmResourceIndexerHandle), packagingMode (MrmPackagingMode), packagingOptions (MrmPackagingOptions), outputPriData (BYTE** out), outputPriSize (DWORD* out)
r1, _, err := procMrmCreateResourceFileInMemory.Call(
	uintptr(indexer),
	uintptr(packagingMode),
	uintptr(packagingOptions),
	uintptr(outputPriData),
	uintptr(outputPriSize),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function MrmCreateResourceFileInMemory(
  indexer: MrmResourceIndexerHandle;   // MrmResourceIndexerHandle
  packagingMode: Integer;   // MrmPackagingMode
  packagingOptions: Integer;   // MrmPackagingOptions
  outputPriData: Pointer;   // BYTE** out
  outputPriSize: Pointer   // DWORD* out
): Integer; stdcall;
  external 'MrmSupport.dll' name 'MrmCreateResourceFileInMemory';
result := DllCall("MrmSupport\MrmCreateResourceFileInMemory"
    , "Ptr", indexer   ; MrmResourceIndexerHandle
    , "Int", packagingMode   ; MrmPackagingMode
    , "Int", packagingOptions   ; MrmPackagingOptions
    , "Ptr", outputPriData   ; BYTE** out
    , "Ptr", outputPriSize   ; DWORD* out
    , "Int")   ; return: HRESULT
●MrmCreateResourceFileInMemory(indexer, packagingMode, packagingOptions, outputPriData, outputPriSize) = DLL("MrmSupport.dll", "int MrmCreateResourceFileInMemory(void*, int, int, void*, void*)")
# 呼び出し: MrmCreateResourceFileInMemory(indexer, packagingMode, packagingOptions, outputPriData, outputPriSize)
# indexer : MrmResourceIndexerHandle -> "void*"
# packagingMode : MrmPackagingMode -> "int"
# packagingOptions : MrmPackagingOptions -> "int"
# outputPriData : BYTE** out -> "void*"
# outputPriSize : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。