Win32 API 日本語リファレンス
ホームSystem.WindowsProgramming › RegSaveRestoreW

RegSaveRestoreW

関数
レジストリ値の保存または復元を行う(Unicode版)。
DLLADVPACK.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

// ADVPACK.dll  (Unicode / -W)
#include <windows.h>

HRESULT RegSaveRestoreW(
    HWND hWnd,
    LPCWSTR pszTitleString,
    HKEY hkBckupKey,
    LPCWSTR pcszRootKey,
    LPCWSTR pcszSubKey,
    LPCWSTR pcszValueName,
    DWORD dwFlags
);

パラメーター

名前方向説明
hWndHWNDinUIの親となるウィンドウのハンドル。NULL可。
pszTitleStringLPCWSTRin操作中に表示するタイトル文字列。
hkBckupKeyHKEYinバックアップ情報を格納するレジストリキーのハンドル。
pcszRootKeyLPCWSTRin対象レジストリのルートキー名を指す。
pcszSubKeyLPCWSTRin対象レジストリのサブキーパスを指す。
pcszValueNameLPCWSTRin保存または復元する値の名前を指す。
dwFlagsDWORDin保存か復元かなどの動作を制御するフラグ。

戻り値の型: HRESULT

各言語での呼び出し定義

// ADVPACK.dll  (Unicode / -W)
#include <windows.h>

HRESULT RegSaveRestoreW(
    HWND hWnd,
    LPCWSTR pszTitleString,
    HKEY hkBckupKey,
    LPCWSTR pcszRootKey,
    LPCWSTR pcszSubKey,
    LPCWSTR pcszValueName,
    DWORD dwFlags
);
[DllImport("ADVPACK.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int RegSaveRestoreW(
    IntPtr hWnd,   // HWND
    [MarshalAs(UnmanagedType.LPWStr)] string pszTitleString,   // LPCWSTR
    IntPtr hkBckupKey,   // HKEY
    [MarshalAs(UnmanagedType.LPWStr)] string pcszRootKey,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string pcszSubKey,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string pcszValueName,   // LPCWSTR
    uint dwFlags   // DWORD
);
<DllImport("ADVPACK.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RegSaveRestoreW(
    hWnd As IntPtr,   ' HWND
    <MarshalAs(UnmanagedType.LPWStr)> pszTitleString As String,   ' LPCWSTR
    hkBckupKey As IntPtr,   ' HKEY
    <MarshalAs(UnmanagedType.LPWStr)> pcszRootKey As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> pcszSubKey As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> pcszValueName As String,   ' LPCWSTR
    dwFlags As UInteger   ' DWORD
) As Integer
End Function
' hWnd : HWND
' pszTitleString : LPCWSTR
' hkBckupKey : HKEY
' pcszRootKey : LPCWSTR
' pcszSubKey : LPCWSTR
' pcszValueName : LPCWSTR
' dwFlags : DWORD
Declare PtrSafe Function RegSaveRestoreW Lib "advpack" ( _
    ByVal hWnd As LongPtr, _
    ByVal pszTitleString As LongPtr, _
    ByVal hkBckupKey As LongPtr, _
    ByVal pcszRootKey As LongPtr, _
    ByVal pcszSubKey As LongPtr, _
    ByVal pcszValueName As LongPtr, _
    ByVal dwFlags As Long) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RegSaveRestoreW = ctypes.windll.advpack.RegSaveRestoreW
RegSaveRestoreW.restype = ctypes.c_int
RegSaveRestoreW.argtypes = [
    wintypes.HANDLE,  # hWnd : HWND
    wintypes.LPCWSTR,  # pszTitleString : LPCWSTR
    wintypes.HANDLE,  # hkBckupKey : HKEY
    wintypes.LPCWSTR,  # pcszRootKey : LPCWSTR
    wintypes.LPCWSTR,  # pcszSubKey : LPCWSTR
    wintypes.LPCWSTR,  # pcszValueName : LPCWSTR
    wintypes.DWORD,  # dwFlags : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ADVPACK.dll')
RegSaveRestoreW = Fiddle::Function.new(
  lib['RegSaveRestoreW'],
  [
    Fiddle::TYPE_VOIDP,  # hWnd : HWND
    Fiddle::TYPE_VOIDP,  # pszTitleString : LPCWSTR
    Fiddle::TYPE_VOIDP,  # hkBckupKey : HKEY
    Fiddle::TYPE_VOIDP,  # pcszRootKey : LPCWSTR
    Fiddle::TYPE_VOIDP,  # pcszSubKey : LPCWSTR
    Fiddle::TYPE_VOIDP,  # pcszValueName : LPCWSTR
    -Fiddle::TYPE_INT,  # dwFlags : DWORD
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "advpack")]
extern "system" {
    fn RegSaveRestoreW(
        hWnd: *mut core::ffi::c_void,  // HWND
        pszTitleString: *const u16,  // LPCWSTR
        hkBckupKey: *mut core::ffi::c_void,  // HKEY
        pcszRootKey: *const u16,  // LPCWSTR
        pcszSubKey: *const u16,  // LPCWSTR
        pcszValueName: *const u16,  // LPCWSTR
        dwFlags: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("ADVPACK.dll", CharSet = CharSet.Unicode)]
public static extern int RegSaveRestoreW(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)] string pszTitleString, IntPtr hkBckupKey, [MarshalAs(UnmanagedType.LPWStr)] string pcszRootKey, [MarshalAs(UnmanagedType.LPWStr)] string pcszSubKey, [MarshalAs(UnmanagedType.LPWStr)] string pcszValueName, uint dwFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVPACK_RegSaveRestoreW' -Namespace Win32 -PassThru
# $api::RegSaveRestoreW(hWnd, pszTitleString, hkBckupKey, pcszRootKey, pcszSubKey, pcszValueName, dwFlags)
#uselib "ADVPACK.dll"
#func global RegSaveRestoreW "RegSaveRestoreW" wptr, wptr, wptr, wptr, wptr, wptr, wptr
; RegSaveRestoreW hWnd, pszTitleString, hkBckupKey, pcszRootKey, pcszSubKey, pcszValueName, dwFlags   ; 戻り値は stat
; hWnd : HWND -> "wptr"
; pszTitleString : LPCWSTR -> "wptr"
; hkBckupKey : HKEY -> "wptr"
; pcszRootKey : LPCWSTR -> "wptr"
; pcszSubKey : LPCWSTR -> "wptr"
; pcszValueName : LPCWSTR -> "wptr"
; dwFlags : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "ADVPACK.dll"
#cfunc global RegSaveRestoreW "RegSaveRestoreW" sptr, wstr, sptr, wstr, wstr, wstr, int
; res = RegSaveRestoreW(hWnd, pszTitleString, hkBckupKey, pcszRootKey, pcszSubKey, pcszValueName, dwFlags)
; hWnd : HWND -> "sptr"
; pszTitleString : LPCWSTR -> "wstr"
; hkBckupKey : HKEY -> "sptr"
; pcszRootKey : LPCWSTR -> "wstr"
; pcszSubKey : LPCWSTR -> "wstr"
; pcszValueName : LPCWSTR -> "wstr"
; dwFlags : DWORD -> "int"
; HRESULT RegSaveRestoreW(HWND hWnd, LPCWSTR pszTitleString, HKEY hkBckupKey, LPCWSTR pcszRootKey, LPCWSTR pcszSubKey, LPCWSTR pcszValueName, DWORD dwFlags)
#uselib "ADVPACK.dll"
#cfunc global RegSaveRestoreW "RegSaveRestoreW" intptr, wstr, intptr, wstr, wstr, wstr, int
; res = RegSaveRestoreW(hWnd, pszTitleString, hkBckupKey, pcszRootKey, pcszSubKey, pcszValueName, dwFlags)
; hWnd : HWND -> "intptr"
; pszTitleString : LPCWSTR -> "wstr"
; hkBckupKey : HKEY -> "intptr"
; pcszRootKey : LPCWSTR -> "wstr"
; pcszSubKey : LPCWSTR -> "wstr"
; pcszValueName : LPCWSTR -> "wstr"
; dwFlags : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	advpack = windows.NewLazySystemDLL("ADVPACK.dll")
	procRegSaveRestoreW = advpack.NewProc("RegSaveRestoreW")
)

// hWnd (HWND), pszTitleString (LPCWSTR), hkBckupKey (HKEY), pcszRootKey (LPCWSTR), pcszSubKey (LPCWSTR), pcszValueName (LPCWSTR), dwFlags (DWORD)
r1, _, err := procRegSaveRestoreW.Call(
	uintptr(hWnd),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszTitleString))),
	uintptr(hkBckupKey),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pcszRootKey))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pcszSubKey))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pcszValueName))),
	uintptr(dwFlags),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function RegSaveRestoreW(
  hWnd: THandle;   // HWND
  pszTitleString: PWideChar;   // LPCWSTR
  hkBckupKey: THandle;   // HKEY
  pcszRootKey: PWideChar;   // LPCWSTR
  pcszSubKey: PWideChar;   // LPCWSTR
  pcszValueName: PWideChar;   // LPCWSTR
  dwFlags: DWORD   // DWORD
): Integer; stdcall;
  external 'ADVPACK.dll' name 'RegSaveRestoreW';
result := DllCall("ADVPACK\RegSaveRestoreW"
    , "Ptr", hWnd   ; HWND
    , "WStr", pszTitleString   ; LPCWSTR
    , "Ptr", hkBckupKey   ; HKEY
    , "WStr", pcszRootKey   ; LPCWSTR
    , "WStr", pcszSubKey   ; LPCWSTR
    , "WStr", pcszValueName   ; LPCWSTR
    , "UInt", dwFlags   ; DWORD
    , "Int")   ; return: HRESULT
●RegSaveRestoreW(hWnd, pszTitleString, hkBckupKey, pcszRootKey, pcszSubKey, pcszValueName, dwFlags) = DLL("ADVPACK.dll", "int RegSaveRestoreW(void*, char*, void*, char*, char*, char*, dword)")
# 呼び出し: RegSaveRestoreW(hWnd, pszTitleString, hkBckupKey, pcszRootKey, pcszSubKey, pcszValueName, dwFlags)
# hWnd : HWND -> "void*"
# pszTitleString : LPCWSTR -> "char*"
# hkBckupKey : HKEY -> "void*"
# pcszRootKey : LPCWSTR -> "char*"
# pcszSubKey : LPCWSTR -> "char*"
# pcszValueName : LPCWSTR -> "char*"
# dwFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。
const std = @import("std");

extern "advpack" fn RegSaveRestoreW(
    hWnd: ?*anyopaque, // HWND
    pszTitleString: [*c]const u16, // LPCWSTR
    hkBckupKey: ?*anyopaque, // HKEY
    pcszRootKey: [*c]const u16, // LPCWSTR
    pcszSubKey: [*c]const u16, // LPCWSTR
    pcszValueName: [*c]const u16, // LPCWSTR
    dwFlags: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。
proc RegSaveRestoreW(
    hWnd: pointer,  # HWND
    pszTitleString: WideCString,  # LPCWSTR
    hkBckupKey: pointer,  # HKEY
    pcszRootKey: WideCString,  # LPCWSTR
    pcszSubKey: WideCString,  # LPCWSTR
    pcszValueName: WideCString,  # LPCWSTR
    dwFlags: uint32  # DWORD
): int32 {.importc: "RegSaveRestoreW", stdcall, dynlib: "ADVPACK.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。
pragma(lib, "advpack");
extern(Windows)
int RegSaveRestoreW(
    void* hWnd,   // HWND
    const(wchar)* pszTitleString,   // LPCWSTR
    void* hkBckupKey,   // HKEY
    const(wchar)* pcszRootKey,   // LPCWSTR
    const(wchar)* pcszSubKey,   // LPCWSTR
    const(wchar)* pcszValueName,   // LPCWSTR
    uint dwFlags   // DWORD
);
ccall((:RegSaveRestoreW, "ADVPACK.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Cwstring, Ptr{Cvoid}, Cwstring, Cwstring, Cwstring, UInt32),
      hWnd, pszTitleString, hkBckupKey, pcszRootKey, pcszSubKey, pcszValueName, dwFlags)
# hWnd : HWND -> Ptr{Cvoid}
# pszTitleString : LPCWSTR -> Cwstring
# hkBckupKey : HKEY -> Ptr{Cvoid}
# pcszRootKey : LPCWSTR -> Cwstring
# pcszSubKey : LPCWSTR -> Cwstring
# pcszValueName : LPCWSTR -> Cwstring
# dwFlags : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。
local ffi = require("ffi")
ffi.cdef[[
int32_t RegSaveRestoreW(
    void* hWnd,
    const uint16_t* pszTitleString,
    void* hkBckupKey,
    const uint16_t* pcszRootKey,
    const uint16_t* pcszSubKey,
    const uint16_t* pcszValueName,
    uint32_t dwFlags);
]]
local advpack = ffi.load("advpack")
-- advpack.RegSaveRestoreW(hWnd, pszTitleString, hkBckupKey, pcszRootKey, pcszSubKey, pcszValueName, dwFlags)
-- hWnd : HWND
-- pszTitleString : LPCWSTR
-- hkBckupKey : HKEY
-- pcszRootKey : LPCWSTR
-- pcszSubKey : LPCWSTR
-- pcszValueName : LPCWSTR
-- dwFlags : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
-- Unicode(-W): uint16_t* には UTF-16LE のバッファ(ffi.new("uint16_t[?]", ...))を渡す。
const koffi = require('koffi');
const lib = koffi.load('ADVPACK.dll');
const RegSaveRestoreW = lib.func('__stdcall', 'RegSaveRestoreW', 'int32_t', ['void *', 'str16', 'void *', 'str16', 'str16', 'str16', 'uint32_t']);
// RegSaveRestoreW(hWnd, pszTitleString, hkBckupKey, pcszRootKey, pcszSubKey, pcszValueName, dwFlags)
// hWnd : HWND -> 'void *'
// pszTitleString : LPCWSTR -> 'str16'
// hkBckupKey : HKEY -> 'void *'
// pcszRootKey : LPCWSTR -> 'str16'
// pcszSubKey : LPCWSTR -> 'str16'
// pcszValueName : LPCWSTR -> 'str16'
// dwFlags : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("ADVPACK.dll", {
  RegSaveRestoreW: { parameters: ["pointer", "buffer", "pointer", "buffer", "buffer", "buffer", "u32"], result: "i32" },
});
// lib.symbols.RegSaveRestoreW(hWnd, pszTitleString, hkBckupKey, pcszRootKey, pcszSubKey, pcszValueName, dwFlags)
// hWnd : HWND -> "pointer"
// pszTitleString : LPCWSTR -> "buffer"
// hkBckupKey : HKEY -> "pointer"
// pcszRootKey : LPCWSTR -> "buffer"
// pcszSubKey : LPCWSTR -> "buffer"
// pcszValueName : LPCWSTR -> "buffer"
// dwFlags : DWORD -> "u32"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t RegSaveRestoreW(
    void* hWnd,
    const uint16_t* pszTitleString,
    void* hkBckupKey,
    const uint16_t* pcszRootKey,
    const uint16_t* pcszSubKey,
    const uint16_t* pcszValueName,
    uint32_t dwFlags);
C, "ADVPACK.dll");
// $ffi->RegSaveRestoreW(hWnd, pszTitleString, hkBckupKey, pcszRootKey, pcszSubKey, pcszValueName, dwFlags);
// hWnd : HWND
// pszTitleString : LPCWSTR
// hkBckupKey : HKEY
// pcszRootKey : LPCWSTR
// pcszSubKey : LPCWSTR
// pcszValueName : LPCWSTR
// dwFlags : DWORD
// 構造体/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 Advpack extends StdCallLibrary {
    Advpack INSTANCE = Native.load("advpack", Advpack.class, W32APIOptions.UNICODE_OPTIONS);
    int RegSaveRestoreW(
        Pointer hWnd,   // HWND
        WString pszTitleString,   // LPCWSTR
        Pointer hkBckupKey,   // HKEY
        WString pcszRootKey,   // LPCWSTR
        WString pcszSubKey,   // LPCWSTR
        WString pcszValueName,   // LPCWSTR
        int dwFlags   // DWORD
    );
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。
@[Link("advpack")]
lib LibADVPACK
  fun RegSaveRestoreW = RegSaveRestoreW(
    hWnd : Void*,   # HWND
    pszTitleString : UInt16*,   # LPCWSTR
    hkBckupKey : Void*,   # HKEY
    pcszRootKey : UInt16*,   # LPCWSTR
    pcszSubKey : UInt16*,   # LPCWSTR
    pcszValueName : UInt16*,   # LPCWSTR
    dwFlags : UInt32   # DWORD
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef RegSaveRestoreWNative = Int32 Function(Pointer<Void>, Pointer<Utf16>, Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Uint32);
typedef RegSaveRestoreWDart = int Function(Pointer<Void>, Pointer<Utf16>, Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, int);
final RegSaveRestoreW = DynamicLibrary.open('ADVPACK.dll')
    .lookupFunction<RegSaveRestoreWNative, RegSaveRestoreWDart>('RegSaveRestoreW');
// hWnd : HWND -> Pointer<Void>
// pszTitleString : LPCWSTR -> Pointer<Utf16>
// hkBckupKey : HKEY -> Pointer<Void>
// pcszRootKey : LPCWSTR -> Pointer<Utf16>
// pcszSubKey : LPCWSTR -> Pointer<Utf16>
// pcszValueName : LPCWSTR -> Pointer<Utf16>
// dwFlags : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function RegSaveRestoreW(
  hWnd: THandle;   // HWND
  pszTitleString: PWideChar;   // LPCWSTR
  hkBckupKey: THandle;   // HKEY
  pcszRootKey: PWideChar;   // LPCWSTR
  pcszSubKey: PWideChar;   // LPCWSTR
  pcszValueName: PWideChar;   // LPCWSTR
  dwFlags: DWORD   // DWORD
): Integer; stdcall;
  external 'ADVPACK.dll' name 'RegSaveRestoreW';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "RegSaveRestoreW"
  c_RegSaveRestoreW :: Ptr () -> CWString -> Ptr () -> CWString -> CWString -> CWString -> Word32 -> IO Int32
-- hWnd : HWND -> Ptr ()
-- pszTitleString : LPCWSTR -> CWString
-- hkBckupKey : HKEY -> Ptr ()
-- pcszRootKey : LPCWSTR -> CWString
-- pcszSubKey : LPCWSTR -> CWString
-- pcszValueName : LPCWSTR -> CWString
-- dwFlags : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let regsaverestorew =
  foreign "RegSaveRestoreW"
    ((ptr void) @-> (ptr uint16_t) @-> (ptr void) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> uint32_t @-> returning int32_t)
(* hWnd : HWND -> (ptr void) *)
(* pszTitleString : LPCWSTR -> (ptr uint16_t) *)
(* hkBckupKey : HKEY -> (ptr void) *)
(* pcszRootKey : LPCWSTR -> (ptr uint16_t) *)
(* pcszSubKey : LPCWSTR -> (ptr uint16_t) *)
(* pcszValueName : LPCWSTR -> (ptr uint16_t) *)
(* dwFlags : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library advpack (t "ADVPACK.dll"))
(cffi:use-foreign-library advpack)

(cffi:defcfun ("RegSaveRestoreW" reg-save-restore-w :convention :stdcall) :int32
  (h-wnd :pointer)   ; HWND
  (psz-title-string (:string :encoding :utf-16le))   ; LPCWSTR
  (hk-bckup-key :pointer)   ; HKEY
  (pcsz-root-key (:string :encoding :utf-16le))   ; LPCWSTR
  (pcsz-sub-key (:string :encoding :utf-16le))   ; LPCWSTR
  (pcsz-value-name (:string :encoding :utf-16le))   ; LPCWSTR
  (dw-flags :uint32))   ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $RegSaveRestoreW = Win32::API::More->new('ADVPACK',
    'int RegSaveRestoreW(HANDLE hWnd, LPCWSTR pszTitleString, HANDLE hkBckupKey, LPCWSTR pcszRootKey, LPCWSTR pcszSubKey, LPCWSTR pcszValueName, DWORD dwFlags)');
# my $ret = $RegSaveRestoreW->Call($hWnd, $pszTitleString, $hkBckupKey, $pcszRootKey, $pcszSubKey, $pcszValueName, $dwFlags);
# hWnd : HWND -> HANDLE
# pszTitleString : LPCWSTR -> LPCWSTR
# hkBckupKey : HKEY -> HANDLE
# pcszRootKey : LPCWSTR -> LPCWSTR
# pcszSubKey : LPCWSTR -> LPCWSTR
# pcszValueName : LPCWSTR -> LPCWSTR
# dwFlags : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。

関連項目

文字セット違い