ホーム › System.Registry › RegLoadMUIStringA
RegLoadMUIStringA
関数レジストリ値からローカライズされた文字列を読み込む。
シグネチャ
// ADVAPI32.dll (ANSI / -A)
#include <windows.h>
WIN32_ERROR RegLoadMUIStringA(
HKEY hKey,
LPCSTR pszValue, // optional
LPSTR pszOutBuf, // optional
DWORD cbOutBuf,
DWORD* pcbData, // optional
DWORD Flags,
LPCSTR pszDirectory // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hKey | HKEY | in |
| pszValue | LPCSTR | inoptional |
| pszOutBuf | LPSTR | outoptional |
| cbOutBuf | DWORD | in |
| pcbData | DWORD* | outoptional |
| Flags | DWORD | in |
| pszDirectory | LPCSTR | inoptional |
戻り値の型: WIN32_ERROR
各言語での呼び出し定義
// ADVAPI32.dll (ANSI / -A)
#include <windows.h>
WIN32_ERROR RegLoadMUIStringA(
HKEY hKey,
LPCSTR pszValue, // optional
LPSTR pszOutBuf, // optional
DWORD cbOutBuf,
DWORD* pcbData, // optional
DWORD Flags,
LPCSTR pszDirectory // optional
);[DllImport("ADVAPI32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint RegLoadMUIStringA(
IntPtr hKey, // HKEY
[MarshalAs(UnmanagedType.LPStr)] string pszValue, // LPCSTR optional
[MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder pszOutBuf, // LPSTR optional, out
uint cbOutBuf, // DWORD
IntPtr pcbData, // DWORD* optional, out
uint Flags, // DWORD
[MarshalAs(UnmanagedType.LPStr)] string pszDirectory // LPCSTR optional
);<DllImport("ADVAPI32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function RegLoadMUIStringA(
hKey As IntPtr, ' HKEY
<MarshalAs(UnmanagedType.LPStr)> pszValue As String, ' LPCSTR optional
<MarshalAs(UnmanagedType.LPStr)> pszOutBuf As System.Text.StringBuilder, ' LPSTR optional, out
cbOutBuf As UInteger, ' DWORD
pcbData As IntPtr, ' DWORD* optional, out
Flags As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPStr)> pszDirectory As String ' LPCSTR optional
) As UInteger
End Function' hKey : HKEY
' pszValue : LPCSTR optional
' pszOutBuf : LPSTR optional, out
' cbOutBuf : DWORD
' pcbData : DWORD* optional, out
' Flags : DWORD
' pszDirectory : LPCSTR optional
Declare PtrSafe Function RegLoadMUIStringA Lib "advapi32" ( _
ByVal hKey As LongPtr, _
ByVal pszValue As String, _
ByVal pszOutBuf As String, _
ByVal cbOutBuf As Long, _
ByVal pcbData As LongPtr, _
ByVal Flags As Long, _
ByVal pszDirectory As String) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RegLoadMUIStringA = ctypes.windll.advapi32.RegLoadMUIStringA
RegLoadMUIStringA.restype = wintypes.DWORD
RegLoadMUIStringA.argtypes = [
wintypes.HANDLE, # hKey : HKEY
wintypes.LPCSTR, # pszValue : LPCSTR optional
wintypes.LPSTR, # pszOutBuf : LPSTR optional, out
wintypes.DWORD, # cbOutBuf : DWORD
ctypes.POINTER(wintypes.DWORD), # pcbData : DWORD* optional, out
wintypes.DWORD, # Flags : DWORD
wintypes.LPCSTR, # pszDirectory : LPCSTR optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ADVAPI32.dll')
RegLoadMUIStringA = Fiddle::Function.new(
lib['RegLoadMUIStringA'],
[
Fiddle::TYPE_VOIDP, # hKey : HKEY
Fiddle::TYPE_VOIDP, # pszValue : LPCSTR optional
Fiddle::TYPE_VOIDP, # pszOutBuf : LPSTR optional, out
-Fiddle::TYPE_INT, # cbOutBuf : DWORD
Fiddle::TYPE_VOIDP, # pcbData : DWORD* optional, out
-Fiddle::TYPE_INT, # Flags : DWORD
Fiddle::TYPE_VOIDP, # pszDirectory : LPCSTR optional
],
-Fiddle::TYPE_INT)#[link(name = "advapi32")]
extern "system" {
fn RegLoadMUIStringA(
hKey: *mut core::ffi::c_void, // HKEY
pszValue: *const u8, // LPCSTR optional
pszOutBuf: *mut u8, // LPSTR optional, out
cbOutBuf: u32, // DWORD
pcbData: *mut u32, // DWORD* optional, out
Flags: u32, // DWORD
pszDirectory: *const u8 // LPCSTR optional
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ADVAPI32.dll", CharSet = CharSet.Ansi)]
public static extern uint RegLoadMUIStringA(IntPtr hKey, [MarshalAs(UnmanagedType.LPStr)] string pszValue, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder pszOutBuf, uint cbOutBuf, IntPtr pcbData, uint Flags, [MarshalAs(UnmanagedType.LPStr)] string pszDirectory);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVAPI32_RegLoadMUIStringA' -Namespace Win32 -PassThru
# $api::RegLoadMUIStringA(hKey, pszValue, pszOutBuf, cbOutBuf, pcbData, Flags, pszDirectory)#uselib "ADVAPI32.dll"
#func global RegLoadMUIStringA "RegLoadMUIStringA" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; RegLoadMUIStringA hKey, pszValue, varptr(pszOutBuf), cbOutBuf, varptr(pcbData), Flags, pszDirectory ; 戻り値は stat
; hKey : HKEY -> "sptr"
; pszValue : LPCSTR optional -> "sptr"
; pszOutBuf : LPSTR optional, out -> "sptr"
; cbOutBuf : DWORD -> "sptr"
; pcbData : DWORD* optional, out -> "sptr"
; Flags : DWORD -> "sptr"
; pszDirectory : LPCSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ADVAPI32.dll" #cfunc global RegLoadMUIStringA "RegLoadMUIStringA" sptr, str, var, int, var, int, str ; res = RegLoadMUIStringA(hKey, pszValue, pszOutBuf, cbOutBuf, pcbData, Flags, pszDirectory) ; hKey : HKEY -> "sptr" ; pszValue : LPCSTR optional -> "str" ; pszOutBuf : LPSTR optional, out -> "var" ; cbOutBuf : DWORD -> "int" ; pcbData : DWORD* optional, out -> "var" ; Flags : DWORD -> "int" ; pszDirectory : LPCSTR optional -> "str" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ADVAPI32.dll" #cfunc global RegLoadMUIStringA "RegLoadMUIStringA" sptr, str, sptr, int, sptr, int, str ; res = RegLoadMUIStringA(hKey, pszValue, varptr(pszOutBuf), cbOutBuf, varptr(pcbData), Flags, pszDirectory) ; hKey : HKEY -> "sptr" ; pszValue : LPCSTR optional -> "str" ; pszOutBuf : LPSTR optional, out -> "sptr" ; cbOutBuf : DWORD -> "int" ; pcbData : DWORD* optional, out -> "sptr" ; Flags : DWORD -> "int" ; pszDirectory : LPCSTR optional -> "str" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; WIN32_ERROR RegLoadMUIStringA(HKEY hKey, LPCSTR pszValue, LPSTR pszOutBuf, DWORD cbOutBuf, DWORD* pcbData, DWORD Flags, LPCSTR pszDirectory) #uselib "ADVAPI32.dll" #cfunc global RegLoadMUIStringA "RegLoadMUIStringA" intptr, str, var, int, var, int, str ; res = RegLoadMUIStringA(hKey, pszValue, pszOutBuf, cbOutBuf, pcbData, Flags, pszDirectory) ; hKey : HKEY -> "intptr" ; pszValue : LPCSTR optional -> "str" ; pszOutBuf : LPSTR optional, out -> "var" ; cbOutBuf : DWORD -> "int" ; pcbData : DWORD* optional, out -> "var" ; Flags : DWORD -> "int" ; pszDirectory : LPCSTR optional -> "str" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; WIN32_ERROR RegLoadMUIStringA(HKEY hKey, LPCSTR pszValue, LPSTR pszOutBuf, DWORD cbOutBuf, DWORD* pcbData, DWORD Flags, LPCSTR pszDirectory) #uselib "ADVAPI32.dll" #cfunc global RegLoadMUIStringA "RegLoadMUIStringA" intptr, str, intptr, int, intptr, int, str ; res = RegLoadMUIStringA(hKey, pszValue, varptr(pszOutBuf), cbOutBuf, varptr(pcbData), Flags, pszDirectory) ; hKey : HKEY -> "intptr" ; pszValue : LPCSTR optional -> "str" ; pszOutBuf : LPSTR optional, out -> "intptr" ; cbOutBuf : DWORD -> "int" ; pcbData : DWORD* optional, out -> "intptr" ; Flags : DWORD -> "int" ; pszDirectory : LPCSTR optional -> "str" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
advapi32 = windows.NewLazySystemDLL("ADVAPI32.dll")
procRegLoadMUIStringA = advapi32.NewProc("RegLoadMUIStringA")
)
// hKey (HKEY), pszValue (LPCSTR optional), pszOutBuf (LPSTR optional, out), cbOutBuf (DWORD), pcbData (DWORD* optional, out), Flags (DWORD), pszDirectory (LPCSTR optional)
r1, _, err := procRegLoadMUIStringA.Call(
uintptr(hKey),
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszValue))),
uintptr(pszOutBuf),
uintptr(cbOutBuf),
uintptr(pcbData),
uintptr(Flags),
uintptr(unsafe.Pointer(windows.BytePtrFromString(pszDirectory))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // WIN32_ERRORfunction RegLoadMUIStringA(
hKey: THandle; // HKEY
pszValue: PAnsiChar; // LPCSTR optional
pszOutBuf: PAnsiChar; // LPSTR optional, out
cbOutBuf: DWORD; // DWORD
pcbData: Pointer; // DWORD* optional, out
Flags: DWORD; // DWORD
pszDirectory: PAnsiChar // LPCSTR optional
): DWORD; stdcall;
external 'ADVAPI32.dll' name 'RegLoadMUIStringA';result := DllCall("ADVAPI32\RegLoadMUIStringA"
, "Ptr", hKey ; HKEY
, "AStr", pszValue ; LPCSTR optional
, "Ptr", pszOutBuf ; LPSTR optional, out
, "UInt", cbOutBuf ; DWORD
, "Ptr", pcbData ; DWORD* optional, out
, "UInt", Flags ; DWORD
, "AStr", pszDirectory ; LPCSTR optional
, "UInt") ; return: WIN32_ERROR●RegLoadMUIStringA(hKey, pszValue, pszOutBuf, cbOutBuf, pcbData, Flags, pszDirectory) = DLL("ADVAPI32.dll", "dword RegLoadMUIStringA(void*, char*, char*, dword, void*, dword, char*)")
# 呼び出し: RegLoadMUIStringA(hKey, pszValue, pszOutBuf, cbOutBuf, pcbData, Flags, pszDirectory)
# hKey : HKEY -> "void*"
# pszValue : LPCSTR optional -> "char*"
# pszOutBuf : LPSTR optional, out -> "char*"
# cbOutBuf : DWORD -> "dword"
# pcbData : DWORD* optional, out -> "void*"
# Flags : DWORD -> "dword"
# pszDirectory : LPCSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。