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

IndexFilePath

関数
指定ファイルパスをインデックス化し修飾子情報を返す。
DLLMrmSupport.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT IndexFilePath(
    void* resourceIndexer,
    LPCWSTR filePath,
    LPWSTR* ppResourceUri,
    DWORD* pQualifierCount,
    IndexedResourceQualifier** ppQualifiers
);

パラメーター

名前方向
resourceIndexervoid*in
filePathLPCWSTRin
ppResourceUriLPWSTR*out
pQualifierCountDWORD*out
ppQualifiersIndexedResourceQualifier**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

IndexFilePath = ctypes.windll.mrmsupport.IndexFilePath
IndexFilePath.restype = ctypes.c_int
IndexFilePath.argtypes = [
    ctypes.POINTER(None),  # resourceIndexer : void*
    wintypes.LPCWSTR,  # filePath : LPCWSTR
    ctypes.c_void_p,  # ppResourceUri : LPWSTR* out
    ctypes.POINTER(wintypes.DWORD),  # pQualifierCount : DWORD* out
    ctypes.c_void_p,  # ppQualifiers : IndexedResourceQualifier** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mrmsupport = windows.NewLazySystemDLL("MrmSupport.dll")
	procIndexFilePath = mrmsupport.NewProc("IndexFilePath")
)

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