ホーム › Globalization › GetFileMUIInfo
GetFileMUIInfo
関数指定ファイルのMUIリソース構成情報を取得する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
BOOL GetFileMUIInfo(
DWORD dwFlags,
LPCWSTR pcwszFilePath,
FILEMUIINFO* pFileMUIInfo, // optional
DWORD* pcbFileMUIInfo
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| dwFlags | DWORD | in |
| pcwszFilePath | LPCWSTR | in |
| pFileMUIInfo | FILEMUIINFO* | inoutoptional |
| pcbFileMUIInfo | DWORD* | inout |
戻り値の型: BOOL
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
BOOL GetFileMUIInfo(
DWORD dwFlags,
LPCWSTR pcwszFilePath,
FILEMUIINFO* pFileMUIInfo, // optional
DWORD* pcbFileMUIInfo
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool GetFileMUIInfo(
uint dwFlags, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string pcwszFilePath, // LPCWSTR
IntPtr pFileMUIInfo, // FILEMUIINFO* optional, in/out
ref uint pcbFileMUIInfo // DWORD* in/out
);<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GetFileMUIInfo(
dwFlags As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> pcwszFilePath As String, ' LPCWSTR
pFileMUIInfo As IntPtr, ' FILEMUIINFO* optional, in/out
ByRef pcbFileMUIInfo As UInteger ' DWORD* in/out
) As Boolean
End Function' dwFlags : DWORD
' pcwszFilePath : LPCWSTR
' pFileMUIInfo : FILEMUIINFO* optional, in/out
' pcbFileMUIInfo : DWORD* in/out
Declare PtrSafe Function GetFileMUIInfo Lib "kernel32" ( _
ByVal dwFlags As Long, _
ByVal pcwszFilePath As LongPtr, _
ByVal pFileMUIInfo As LongPtr, _
ByRef pcbFileMUIInfo As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetFileMUIInfo = ctypes.windll.kernel32.GetFileMUIInfo
GetFileMUIInfo.restype = wintypes.BOOL
GetFileMUIInfo.argtypes = [
wintypes.DWORD, # dwFlags : DWORD
wintypes.LPCWSTR, # pcwszFilePath : LPCWSTR
ctypes.c_void_p, # pFileMUIInfo : FILEMUIINFO* optional, in/out
ctypes.POINTER(wintypes.DWORD), # pcbFileMUIInfo : DWORD* in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
GetFileMUIInfo = Fiddle::Function.new(
lib['GetFileMUIInfo'],
[
-Fiddle::TYPE_INT, # dwFlags : DWORD
Fiddle::TYPE_VOIDP, # pcwszFilePath : LPCWSTR
Fiddle::TYPE_VOIDP, # pFileMUIInfo : FILEMUIINFO* optional, in/out
Fiddle::TYPE_VOIDP, # pcbFileMUIInfo : DWORD* in/out
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn GetFileMUIInfo(
dwFlags: u32, // DWORD
pcwszFilePath: *const u16, // LPCWSTR
pFileMUIInfo: *mut FILEMUIINFO, // FILEMUIINFO* optional, in/out
pcbFileMUIInfo: *mut u32 // DWORD* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true)]
public static extern bool GetFileMUIInfo(uint dwFlags, [MarshalAs(UnmanagedType.LPWStr)] string pcwszFilePath, IntPtr pFileMUIInfo, ref uint pcbFileMUIInfo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_GetFileMUIInfo' -Namespace Win32 -PassThru
# $api::GetFileMUIInfo(dwFlags, pcwszFilePath, pFileMUIInfo, pcbFileMUIInfo)#uselib "KERNEL32.dll"
#func global GetFileMUIInfo "GetFileMUIInfo" sptr, sptr, sptr, sptr
; GetFileMUIInfo dwFlags, pcwszFilePath, varptr(pFileMUIInfo), varptr(pcbFileMUIInfo) ; 戻り値は stat
; dwFlags : DWORD -> "sptr"
; pcwszFilePath : LPCWSTR -> "sptr"
; pFileMUIInfo : FILEMUIINFO* optional, in/out -> "sptr"
; pcbFileMUIInfo : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "KERNEL32.dll" #cfunc global GetFileMUIInfo "GetFileMUIInfo" int, wstr, var, var ; res = GetFileMUIInfo(dwFlags, pcwszFilePath, pFileMUIInfo, pcbFileMUIInfo) ; dwFlags : DWORD -> "int" ; pcwszFilePath : LPCWSTR -> "wstr" ; pFileMUIInfo : FILEMUIINFO* optional, in/out -> "var" ; pcbFileMUIInfo : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "KERNEL32.dll" #cfunc global GetFileMUIInfo "GetFileMUIInfo" int, wstr, sptr, sptr ; res = GetFileMUIInfo(dwFlags, pcwszFilePath, varptr(pFileMUIInfo), varptr(pcbFileMUIInfo)) ; dwFlags : DWORD -> "int" ; pcwszFilePath : LPCWSTR -> "wstr" ; pFileMUIInfo : FILEMUIINFO* optional, in/out -> "sptr" ; pcbFileMUIInfo : DWORD* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL GetFileMUIInfo(DWORD dwFlags, LPCWSTR pcwszFilePath, FILEMUIINFO* pFileMUIInfo, DWORD* pcbFileMUIInfo) #uselib "KERNEL32.dll" #cfunc global GetFileMUIInfo "GetFileMUIInfo" int, wstr, var, var ; res = GetFileMUIInfo(dwFlags, pcwszFilePath, pFileMUIInfo, pcbFileMUIInfo) ; dwFlags : DWORD -> "int" ; pcwszFilePath : LPCWSTR -> "wstr" ; pFileMUIInfo : FILEMUIINFO* optional, in/out -> "var" ; pcbFileMUIInfo : DWORD* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL GetFileMUIInfo(DWORD dwFlags, LPCWSTR pcwszFilePath, FILEMUIINFO* pFileMUIInfo, DWORD* pcbFileMUIInfo) #uselib "KERNEL32.dll" #cfunc global GetFileMUIInfo "GetFileMUIInfo" int, wstr, intptr, intptr ; res = GetFileMUIInfo(dwFlags, pcwszFilePath, varptr(pFileMUIInfo), varptr(pcbFileMUIInfo)) ; dwFlags : DWORD -> "int" ; pcwszFilePath : LPCWSTR -> "wstr" ; pFileMUIInfo : FILEMUIINFO* optional, in/out -> "intptr" ; pcbFileMUIInfo : DWORD* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procGetFileMUIInfo = kernel32.NewProc("GetFileMUIInfo")
)
// dwFlags (DWORD), pcwszFilePath (LPCWSTR), pFileMUIInfo (FILEMUIINFO* optional, in/out), pcbFileMUIInfo (DWORD* in/out)
r1, _, err := procGetFileMUIInfo.Call(
uintptr(dwFlags),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pcwszFilePath))),
uintptr(pFileMUIInfo),
uintptr(pcbFileMUIInfo),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GetFileMUIInfo(
dwFlags: DWORD; // DWORD
pcwszFilePath: PWideChar; // LPCWSTR
pFileMUIInfo: Pointer; // FILEMUIINFO* optional, in/out
pcbFileMUIInfo: Pointer // DWORD* in/out
): BOOL; stdcall;
external 'KERNEL32.dll' name 'GetFileMUIInfo';result := DllCall("KERNEL32\GetFileMUIInfo"
, "UInt", dwFlags ; DWORD
, "WStr", pcwszFilePath ; LPCWSTR
, "Ptr", pFileMUIInfo ; FILEMUIINFO* optional, in/out
, "Ptr", pcbFileMUIInfo ; DWORD* in/out
, "Int") ; return: BOOL●GetFileMUIInfo(dwFlags, pcwszFilePath, pFileMUIInfo, pcbFileMUIInfo) = DLL("KERNEL32.dll", "bool GetFileMUIInfo(dword, char*, void*, void*)")
# 呼び出し: GetFileMUIInfo(dwFlags, pcwszFilePath, pFileMUIInfo, pcbFileMUIInfo)
# dwFlags : DWORD -> "dword"
# pcwszFilePath : LPCWSTR -> "char*"
# pFileMUIInfo : FILEMUIINFO* optional, in/out -> "void*"
# pcbFileMUIInfo : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。