ホーム › System.WindowsProgramming › RunSetupCommandW
RunSetupCommandW
関数INFセクションやコマンドを実行してセットアップを行う(Unicode版)。
シグネチャ
// ADVPACK.dll (Unicode / -W)
#include <windows.h>
HRESULT RunSetupCommandW(
HWND hWnd,
LPCWSTR szCmdName,
LPCWSTR szInfSection,
LPCWSTR szDir,
LPCWSTR lpszTitle,
HANDLE* phEXE,
DWORD dwFlags,
void* pvReserved
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hWnd | HWND | in | UIの親となるウィンドウのハンドル。NULL可。 |
| szCmdName | LPCWSTR | in | 実行するコマンドまたはINFファイル名を指す。 |
| szInfSection | LPCWSTR | in | INF実行時に処理するセクション名を指す。 |
| szDir | LPCWSTR | in | コマンドの作業ディレクトリを指す。 |
| lpszTitle | LPCWSTR | in | 進捗表示などに用いるタイトル文字列。 |
| phEXE | HANDLE* | inout | 起動したプロセスのハンドルを受け取る変数へのポインタ。 |
| dwFlags | DWORD | in | 実行動作を制御するフラグ(RSC_FLAG_INF等)。 |
| pvReserved | void* | inout | 予約済み。NULLを指定する。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// ADVPACK.dll (Unicode / -W)
#include <windows.h>
HRESULT RunSetupCommandW(
HWND hWnd,
LPCWSTR szCmdName,
LPCWSTR szInfSection,
LPCWSTR szDir,
LPCWSTR lpszTitle,
HANDLE* phEXE,
DWORD dwFlags,
void* pvReserved
);[DllImport("ADVPACK.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int RunSetupCommandW(
IntPtr hWnd, // HWND
[MarshalAs(UnmanagedType.LPWStr)] string szCmdName, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string szInfSection, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string szDir, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string lpszTitle, // LPCWSTR
IntPtr phEXE, // HANDLE* in/out
uint dwFlags, // DWORD
IntPtr pvReserved // void* in/out
);<DllImport("ADVPACK.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function RunSetupCommandW(
hWnd As IntPtr, ' HWND
<MarshalAs(UnmanagedType.LPWStr)> szCmdName As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> szInfSection As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> szDir As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> lpszTitle As String, ' LPCWSTR
phEXE As IntPtr, ' HANDLE* in/out
dwFlags As UInteger, ' DWORD
pvReserved As IntPtr ' void* in/out
) As Integer
End Function' hWnd : HWND
' szCmdName : LPCWSTR
' szInfSection : LPCWSTR
' szDir : LPCWSTR
' lpszTitle : LPCWSTR
' phEXE : HANDLE* in/out
' dwFlags : DWORD
' pvReserved : void* in/out
Declare PtrSafe Function RunSetupCommandW Lib "advpack" ( _
ByVal hWnd As LongPtr, _
ByVal szCmdName As LongPtr, _
ByVal szInfSection As LongPtr, _
ByVal szDir As LongPtr, _
ByVal lpszTitle As LongPtr, _
ByVal phEXE As LongPtr, _
ByVal dwFlags As Long, _
ByVal pvReserved As LongPtr) 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
RunSetupCommandW = ctypes.windll.advpack.RunSetupCommandW
RunSetupCommandW.restype = ctypes.c_int
RunSetupCommandW.argtypes = [
wintypes.HANDLE, # hWnd : HWND
wintypes.LPCWSTR, # szCmdName : LPCWSTR
wintypes.LPCWSTR, # szInfSection : LPCWSTR
wintypes.LPCWSTR, # szDir : LPCWSTR
wintypes.LPCWSTR, # lpszTitle : LPCWSTR
ctypes.c_void_p, # phEXE : HANDLE* in/out
wintypes.DWORD, # dwFlags : DWORD
ctypes.POINTER(None), # pvReserved : void* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ADVPACK.dll')
RunSetupCommandW = Fiddle::Function.new(
lib['RunSetupCommandW'],
[
Fiddle::TYPE_VOIDP, # hWnd : HWND
Fiddle::TYPE_VOIDP, # szCmdName : LPCWSTR
Fiddle::TYPE_VOIDP, # szInfSection : LPCWSTR
Fiddle::TYPE_VOIDP, # szDir : LPCWSTR
Fiddle::TYPE_VOIDP, # lpszTitle : LPCWSTR
Fiddle::TYPE_VOIDP, # phEXE : HANDLE* in/out
-Fiddle::TYPE_INT, # dwFlags : DWORD
Fiddle::TYPE_VOIDP, # pvReserved : void* in/out
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "advpack")]
extern "system" {
fn RunSetupCommandW(
hWnd: *mut core::ffi::c_void, // HWND
szCmdName: *const u16, // LPCWSTR
szInfSection: *const u16, // LPCWSTR
szDir: *const u16, // LPCWSTR
lpszTitle: *const u16, // LPCWSTR
phEXE: *mut *mut core::ffi::c_void, // HANDLE* in/out
dwFlags: u32, // DWORD
pvReserved: *mut () // void* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ADVPACK.dll", CharSet = CharSet.Unicode)]
public static extern int RunSetupCommandW(IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)] string szCmdName, [MarshalAs(UnmanagedType.LPWStr)] string szInfSection, [MarshalAs(UnmanagedType.LPWStr)] string szDir, [MarshalAs(UnmanagedType.LPWStr)] string lpszTitle, IntPtr phEXE, uint dwFlags, IntPtr pvReserved);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ADVPACK_RunSetupCommandW' -Namespace Win32 -PassThru
# $api::RunSetupCommandW(hWnd, szCmdName, szInfSection, szDir, lpszTitle, phEXE, dwFlags, pvReserved)#uselib "ADVPACK.dll"
#func global RunSetupCommandW "RunSetupCommandW" wptr, wptr, wptr, wptr, wptr, wptr, wptr, wptr
; RunSetupCommandW hWnd, szCmdName, szInfSection, szDir, lpszTitle, phEXE, dwFlags, pvReserved ; 戻り値は stat
; hWnd : HWND -> "wptr"
; szCmdName : LPCWSTR -> "wptr"
; szInfSection : LPCWSTR -> "wptr"
; szDir : LPCWSTR -> "wptr"
; lpszTitle : LPCWSTR -> "wptr"
; phEXE : HANDLE* in/out -> "wptr"
; dwFlags : DWORD -> "wptr"
; pvReserved : void* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "ADVPACK.dll"
#cfunc global RunSetupCommandW "RunSetupCommandW" sptr, wstr, wstr, wstr, wstr, sptr, int, sptr
; res = RunSetupCommandW(hWnd, szCmdName, szInfSection, szDir, lpszTitle, phEXE, dwFlags, pvReserved)
; hWnd : HWND -> "sptr"
; szCmdName : LPCWSTR -> "wstr"
; szInfSection : LPCWSTR -> "wstr"
; szDir : LPCWSTR -> "wstr"
; lpszTitle : LPCWSTR -> "wstr"
; phEXE : HANDLE* in/out -> "sptr"
; dwFlags : DWORD -> "int"
; pvReserved : void* in/out -> "sptr"; HRESULT RunSetupCommandW(HWND hWnd, LPCWSTR szCmdName, LPCWSTR szInfSection, LPCWSTR szDir, LPCWSTR lpszTitle, HANDLE* phEXE, DWORD dwFlags, void* pvReserved)
#uselib "ADVPACK.dll"
#cfunc global RunSetupCommandW "RunSetupCommandW" intptr, wstr, wstr, wstr, wstr, intptr, int, intptr
; res = RunSetupCommandW(hWnd, szCmdName, szInfSection, szDir, lpszTitle, phEXE, dwFlags, pvReserved)
; hWnd : HWND -> "intptr"
; szCmdName : LPCWSTR -> "wstr"
; szInfSection : LPCWSTR -> "wstr"
; szDir : LPCWSTR -> "wstr"
; lpszTitle : LPCWSTR -> "wstr"
; phEXE : HANDLE* in/out -> "intptr"
; dwFlags : DWORD -> "int"
; pvReserved : void* in/out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
advpack = windows.NewLazySystemDLL("ADVPACK.dll")
procRunSetupCommandW = advpack.NewProc("RunSetupCommandW")
)
// hWnd (HWND), szCmdName (LPCWSTR), szInfSection (LPCWSTR), szDir (LPCWSTR), lpszTitle (LPCWSTR), phEXE (HANDLE* in/out), dwFlags (DWORD), pvReserved (void* in/out)
r1, _, err := procRunSetupCommandW.Call(
uintptr(hWnd),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szCmdName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szInfSection))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(szDir))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszTitle))),
uintptr(phEXE),
uintptr(dwFlags),
uintptr(pvReserved),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction RunSetupCommandW(
hWnd: THandle; // HWND
szCmdName: PWideChar; // LPCWSTR
szInfSection: PWideChar; // LPCWSTR
szDir: PWideChar; // LPCWSTR
lpszTitle: PWideChar; // LPCWSTR
phEXE: Pointer; // HANDLE* in/out
dwFlags: DWORD; // DWORD
pvReserved: Pointer // void* in/out
): Integer; stdcall;
external 'ADVPACK.dll' name 'RunSetupCommandW';result := DllCall("ADVPACK\RunSetupCommandW"
, "Ptr", hWnd ; HWND
, "WStr", szCmdName ; LPCWSTR
, "WStr", szInfSection ; LPCWSTR
, "WStr", szDir ; LPCWSTR
, "WStr", lpszTitle ; LPCWSTR
, "Ptr", phEXE ; HANDLE* in/out
, "UInt", dwFlags ; DWORD
, "Ptr", pvReserved ; void* in/out
, "Int") ; return: HRESULT●RunSetupCommandW(hWnd, szCmdName, szInfSection, szDir, lpszTitle, phEXE, dwFlags, pvReserved) = DLL("ADVPACK.dll", "int RunSetupCommandW(void*, char*, char*, char*, char*, void*, dword, void*)")
# 呼び出し: RunSetupCommandW(hWnd, szCmdName, szInfSection, szDir, lpszTitle, phEXE, dwFlags, pvReserved)
# hWnd : HWND -> "void*"
# szCmdName : LPCWSTR -> "char*"
# szInfSection : LPCWSTR -> "char*"
# szDir : LPCWSTR -> "char*"
# lpszTitle : LPCWSTR -> "char*"
# phEXE : HANDLE* in/out -> "void*"
# dwFlags : DWORD -> "dword"
# pvReserved : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。const std = @import("std");
extern "advpack" fn RunSetupCommandW(
hWnd: ?*anyopaque, // HWND
szCmdName: [*c]const u16, // LPCWSTR
szInfSection: [*c]const u16, // LPCWSTR
szDir: [*c]const u16, // LPCWSTR
lpszTitle: [*c]const u16, // LPCWSTR
phEXE: ?*anyopaque, // HANDLE* in/out
dwFlags: u32, // DWORD
pvReserved: ?*anyopaque // void* in/out
) callconv(std.os.windows.WINAPI) i32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。proc RunSetupCommandW(
hWnd: pointer, # HWND
szCmdName: WideCString, # LPCWSTR
szInfSection: WideCString, # LPCWSTR
szDir: WideCString, # LPCWSTR
lpszTitle: WideCString, # LPCWSTR
phEXE: pointer, # HANDLE* in/out
dwFlags: uint32, # DWORD
pvReserved: pointer # void* in/out
): int32 {.importc: "RunSetupCommandW", stdcall, dynlib: "ADVPACK.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。pragma(lib, "advpack");
extern(Windows)
int RunSetupCommandW(
void* hWnd, // HWND
const(wchar)* szCmdName, // LPCWSTR
const(wchar)* szInfSection, // LPCWSTR
const(wchar)* szDir, // LPCWSTR
const(wchar)* lpszTitle, // LPCWSTR
void* phEXE, // HANDLE* in/out
uint dwFlags, // DWORD
void* pvReserved // void* in/out
);ccall((:RunSetupCommandW, "ADVPACK.dll"), stdcall, Int32,
(Ptr{Cvoid}, Cwstring, Cwstring, Cwstring, Cwstring, Ptr{Cvoid}, UInt32, Ptr{Cvoid}),
hWnd, szCmdName, szInfSection, szDir, lpszTitle, phEXE, dwFlags, pvReserved)
# hWnd : HWND -> Ptr{Cvoid}
# szCmdName : LPCWSTR -> Cwstring
# szInfSection : LPCWSTR -> Cwstring
# szDir : LPCWSTR -> Cwstring
# lpszTitle : LPCWSTR -> Cwstring
# phEXE : HANDLE* in/out -> Ptr{Cvoid}
# dwFlags : DWORD -> UInt32
# pvReserved : void* in/out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。local ffi = require("ffi")
ffi.cdef[[
int32_t RunSetupCommandW(
void* hWnd,
const uint16_t* szCmdName,
const uint16_t* szInfSection,
const uint16_t* szDir,
const uint16_t* lpszTitle,
void* phEXE,
uint32_t dwFlags,
void* pvReserved);
]]
local advpack = ffi.load("advpack")
-- advpack.RunSetupCommandW(hWnd, szCmdName, szInfSection, szDir, lpszTitle, phEXE, dwFlags, pvReserved)
-- hWnd : HWND
-- szCmdName : LPCWSTR
-- szInfSection : LPCWSTR
-- szDir : LPCWSTR
-- lpszTitle : LPCWSTR
-- phEXE : HANDLE* in/out
-- dwFlags : DWORD
-- pvReserved : void* in/out
-- 構造体/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 RunSetupCommandW = lib.func('__stdcall', 'RunSetupCommandW', 'int32_t', ['void *', 'str16', 'str16', 'str16', 'str16', 'void *', 'uint32_t', 'void *']);
// RunSetupCommandW(hWnd, szCmdName, szInfSection, szDir, lpszTitle, phEXE, dwFlags, pvReserved)
// hWnd : HWND -> 'void *'
// szCmdName : LPCWSTR -> 'str16'
// szInfSection : LPCWSTR -> 'str16'
// szDir : LPCWSTR -> 'str16'
// lpszTitle : LPCWSTR -> 'str16'
// phEXE : HANDLE* in/out -> 'void *'
// dwFlags : DWORD -> 'uint32_t'
// pvReserved : void* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("ADVPACK.dll", {
RunSetupCommandW: { parameters: ["pointer", "buffer", "buffer", "buffer", "buffer", "pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.RunSetupCommandW(hWnd, szCmdName, szInfSection, szDir, lpszTitle, phEXE, dwFlags, pvReserved)
// hWnd : HWND -> "pointer"
// szCmdName : LPCWSTR -> "buffer"
// szInfSection : LPCWSTR -> "buffer"
// szDir : LPCWSTR -> "buffer"
// lpszTitle : LPCWSTR -> "buffer"
// phEXE : HANDLE* in/out -> "pointer"
// dwFlags : DWORD -> "u32"
// pvReserved : void* in/out -> "pointer"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t RunSetupCommandW(
void* hWnd,
const uint16_t* szCmdName,
const uint16_t* szInfSection,
const uint16_t* szDir,
const uint16_t* lpszTitle,
void* phEXE,
uint32_t dwFlags,
void* pvReserved);
C, "ADVPACK.dll");
// $ffi->RunSetupCommandW(hWnd, szCmdName, szInfSection, szDir, lpszTitle, phEXE, dwFlags, pvReserved);
// hWnd : HWND
// szCmdName : LPCWSTR
// szInfSection : LPCWSTR
// szDir : LPCWSTR
// lpszTitle : LPCWSTR
// phEXE : HANDLE* in/out
// dwFlags : DWORD
// pvReserved : void* in/out
// 構造体/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 RunSetupCommandW(
Pointer hWnd, // HWND
WString szCmdName, // LPCWSTR
WString szInfSection, // LPCWSTR
WString szDir, // LPCWSTR
WString lpszTitle, // LPCWSTR
Pointer phEXE, // HANDLE* in/out
int dwFlags, // DWORD
Pointer pvReserved // void* in/out
);
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。@[Link("advpack")]
lib LibADVPACK
fun RunSetupCommandW = RunSetupCommandW(
hWnd : Void*, # HWND
szCmdName : UInt16*, # LPCWSTR
szInfSection : UInt16*, # LPCWSTR
szDir : UInt16*, # LPCWSTR
lpszTitle : UInt16*, # LPCWSTR
phEXE : Void*, # HANDLE* in/out
dwFlags : UInt32, # DWORD
pvReserved : Void* # void* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef RunSetupCommandWNative = Int32 Function(Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>, Uint32, Pointer<Void>);
typedef RunSetupCommandWDart = int Function(Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>, int, Pointer<Void>);
final RunSetupCommandW = DynamicLibrary.open('ADVPACK.dll')
.lookupFunction<RunSetupCommandWNative, RunSetupCommandWDart>('RunSetupCommandW');
// hWnd : HWND -> Pointer<Void>
// szCmdName : LPCWSTR -> Pointer<Utf16>
// szInfSection : LPCWSTR -> Pointer<Utf16>
// szDir : LPCWSTR -> Pointer<Utf16>
// lpszTitle : LPCWSTR -> Pointer<Utf16>
// phEXE : HANDLE* in/out -> Pointer<Void>
// dwFlags : DWORD -> Uint32
// pvReserved : void* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function RunSetupCommandW(
hWnd: THandle; // HWND
szCmdName: PWideChar; // LPCWSTR
szInfSection: PWideChar; // LPCWSTR
szDir: PWideChar; // LPCWSTR
lpszTitle: PWideChar; // LPCWSTR
phEXE: Pointer; // HANDLE* in/out
dwFlags: DWORD; // DWORD
pvReserved: Pointer // void* in/out
): Integer; stdcall;
external 'ADVPACK.dll' name 'RunSetupCommandW';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "RunSetupCommandW"
c_RunSetupCommandW :: Ptr () -> CWString -> CWString -> CWString -> CWString -> Ptr () -> Word32 -> Ptr () -> IO Int32
-- hWnd : HWND -> Ptr ()
-- szCmdName : LPCWSTR -> CWString
-- szInfSection : LPCWSTR -> CWString
-- szDir : LPCWSTR -> CWString
-- lpszTitle : LPCWSTR -> CWString
-- phEXE : HANDLE* in/out -> Ptr ()
-- dwFlags : DWORD -> Word32
-- pvReserved : void* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let runsetupcommandw =
foreign "RunSetupCommandW"
((ptr void) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> (ptr void) @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* hWnd : HWND -> (ptr void) *)
(* szCmdName : LPCWSTR -> (ptr uint16_t) *)
(* szInfSection : LPCWSTR -> (ptr uint16_t) *)
(* szDir : LPCWSTR -> (ptr uint16_t) *)
(* lpszTitle : LPCWSTR -> (ptr uint16_t) *)
(* phEXE : HANDLE* in/out -> (ptr void) *)
(* dwFlags : DWORD -> uint32_t *)
(* pvReserved : void* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library advpack (t "ADVPACK.dll"))
(cffi:use-foreign-library advpack)
(cffi:defcfun ("RunSetupCommandW" run-setup-command-w :convention :stdcall) :int32
(h-wnd :pointer) ; HWND
(sz-cmd-name (:string :encoding :utf-16le)) ; LPCWSTR
(sz-inf-section (:string :encoding :utf-16le)) ; LPCWSTR
(sz-dir (:string :encoding :utf-16le)) ; LPCWSTR
(lpsz-title (:string :encoding :utf-16le)) ; LPCWSTR
(ph-exe :pointer) ; HANDLE* in/out
(dw-flags :uint32) ; DWORD
(pv-reserved :pointer)) ; void* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $RunSetupCommandW = Win32::API::More->new('ADVPACK',
'int RunSetupCommandW(HANDLE hWnd, LPCWSTR szCmdName, LPCWSTR szInfSection, LPCWSTR szDir, LPCWSTR lpszTitle, HANDLE phEXE, DWORD dwFlags, LPVOID pvReserved)');
# my $ret = $RunSetupCommandW->Call($hWnd, $szCmdName, $szInfSection, $szDir, $lpszTitle, $phEXE, $dwFlags, $pvReserved);
# hWnd : HWND -> HANDLE
# szCmdName : LPCWSTR -> LPCWSTR
# szInfSection : LPCWSTR -> LPCWSTR
# szDir : LPCWSTR -> LPCWSTR
# lpszTitle : LPCWSTR -> LPCWSTR
# phEXE : HANDLE* in/out -> HANDLE
# dwFlags : DWORD -> DWORD
# pvReserved : void* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。関連項目
文字セット違い
- f RunSetupCommandA (ANSI版) — INFセクションやコマンドを実行してセットアップを行う(ANSI版)。