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

MsiSourceListClearAllExW

関数
コンテキストやオプションを指定してソースリストを一括削除する。
DLLmsi.dll文字セットUnicode (-W)呼出規約winapi対応OSwindows8.0

シグネチャ

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

DWORD MsiSourceListClearAllExW(
    LPCWSTR szProductCodeOrPatchCode,
    LPCWSTR szUserSid,   // optional
    MSIINSTALLCONTEXT dwContext,
    DWORD dwOptions
);

パラメーター

名前方向説明
szProductCodeOrPatchCodeLPCWSTRin製品またはパッチの ProductCode またはパッチ GUID です。null 終端文字列を使用します。文字列が 39 文字より長い場合、関数は失敗し、ERROR_INVALID_PARAMETER を返します。このパラメーターを NULL にすることはできません。
szUserSidLPCWSTRinoptionalこのパラメーターには、製品またはパッチを保持するユーザーアカウントを指定する文字列形式の SID を指定できます。SID は検証も解決もされません。誤った SID を指定すると ERROR_UNKNOWN_PRODUCT または ERROR_UNKNOWN_PATCH が返ることがあります。マシンコンテキストを参照する場合、szUserSIDNULL である必要があり、dwContextMSIINSTALLCONTEXT_MACHINE である必要があります。マシン SID("S-1-5-18")を使用すると ERROR_INVALID PARAMETER が返されます。現在のユーザーアカウントを参照する場合、szUserSIDNULL にでき、dwContextMSIINSTALLCONTEXT_USERMANAGED または MSIINSTALLCONTEXT_USERUNMANAGED にできます。
dwContextMSIINSTALLCONTEXTin

このパラメーターは、製品またはパッチインスタンスのコンテキストを指定します。このパラメーターには、次のいずれかの値を指定できます。

コンテキストの種類 意味
MSIINSTALLCONTEXT_USERMANAGED
製品またはパッチインスタンスは、ユーザー単位の管理対象コンテキストに存在します。
MSIINSTALLCONTEXT_USERUNMANAGED
製品またはパッチインスタンスは、ユーザー単位の非管理対象コンテキストに存在します。
MSIINSTALLCONTEXT_MACHINE
製品またはパッチインスタンスは、マシン単位のコンテキストに存在します。
dwOptionsDWORDin

dwOptions の値は、szProductCodeOrPatchCode の値の解釈と、クリアするソースの種別を決定します。このパラメーターは、次の MSISOURCETYPE_* 定数のいずれかと、次の MSICODE_* 定数のいずれかを組み合わせたものである必要があります。

フラグ 意味
MSISOURCETYPE_MEDIA
ソースはメディアです。
MSISOURCETYPE_NETWORK
ソースはネットワーク種別です。
MSISOURCETYPE_URL
ソースは URL 種別です。
MSICODE_PATCH
szProductCodeOrPatchCode はパッチコードです。
MSICODE_PRODUCT
szProductCodeOrPatchCode は製品コードです。

戻り値の型: DWORD

公式ドキュメント

MsiSourceListClearAllEx 関数は、指定された製品またはパッチのインスタンスについて、指定したソース種別の既存ソースをすべて削除します。(Unicode)

戻り値

意味
ERROR_ACCESS_DENIED
ユーザーにソースを追加または移動する権限がありません。製品またはパッチが見つかったかどうかは示しません。
ERROR_BAD_CONFIGURATION
構成データが破損しています。
ERROR_INSTALL_SERVICE_FAILURE
Windows Installer サービスにアクセスできません。
ERROR_INVALID_PARAMETER
無効なパラメーターが関数に渡されました。
ERROR_SUCCESS
指定された種別のソースがすべて削除されました。
ERROR_UNKNOWN_PRODUCT
指定された製品は不明です。
ERROR_UNKNOWN_PATCH
指定されたパッチは不明です。
ERROR_FUNCTION_FAILED
予期しない内部エラーが発生しました。

解説(Remarks)

管理者は、マシンコンテキスト、または自身のユーザー単位のコンテキスト(管理対象・非管理対象を問わず)に存在する製品またはパッチインスタンスのインストールを変更できます。また、任意のユーザーのユーザー単位の管理対象コンテキストに存在する製品またはパッチインスタンスのインストールを変更できます。管理者は、他のユーザーのユーザー単位の非管理対象コンテキストに存在する、その他ユーザーによる製品またはパッチインスタンスのインストールを変更することはできません。

管理者以外のユーザーは、他のユーザーのユーザー単位のコンテキスト(管理対象・非管理対象を問わず)に存在する製品またはパッチインスタンスのインストールを変更できません。自身のユーザー単位の非管理対象コンテキストに存在する製品またはパッチインスタンスのインストールは変更できます。マシンコンテキストまたは自身のユーザー単位の管理対象コンテキストに存在する製品またはパッチインスタンスのインストールは、製品またはパッチソースの参照が許可されている場合に限り変更できます。ポリシーを設定することでソースの参照をユーザーに許可できます。詳細については、DisableBrowseAllowLockdownBrowseAlwaysInstallElevated の各ポリシーを参照してください。

メモ

msi.h ヘッダーは、UNICODE プリプロセッサ定数の定義に基づいて、この関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして MsiSourceListClearAllEx を定義します。エンコーディング中立のエイリアスの使用を、エンコーディング中立でないコードと混在させると、不一致が生じ、コンパイルエラーや実行時エラーを引き起こす可能性があります。詳細については、関数プロトタイプの規則を参照してください。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

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

DWORD MsiSourceListClearAllExW(
    LPCWSTR szProductCodeOrPatchCode,
    LPCWSTR szUserSid,   // optional
    MSIINSTALLCONTEXT dwContext,
    DWORD dwOptions
);
[DllImport("msi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint MsiSourceListClearAllExW(
    [MarshalAs(UnmanagedType.LPWStr)] string szProductCodeOrPatchCode,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string szUserSid,   // LPCWSTR optional
    int dwContext,   // MSIINSTALLCONTEXT
    uint dwOptions   // DWORD
);
<DllImport("msi.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function MsiSourceListClearAllExW(
    <MarshalAs(UnmanagedType.LPWStr)> szProductCodeOrPatchCode As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> szUserSid As String,   ' LPCWSTR optional
    dwContext As Integer,   ' MSIINSTALLCONTEXT
    dwOptions As UInteger   ' DWORD
) As UInteger
End Function
' szProductCodeOrPatchCode : LPCWSTR
' szUserSid : LPCWSTR optional
' dwContext : MSIINSTALLCONTEXT
' dwOptions : DWORD
Declare PtrSafe Function MsiSourceListClearAllExW Lib "msi" ( _
    ByVal szProductCodeOrPatchCode As LongPtr, _
    ByVal szUserSid As LongPtr, _
    ByVal dwContext As Long, _
    ByVal dwOptions 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

MsiSourceListClearAllExW = ctypes.windll.msi.MsiSourceListClearAllExW
MsiSourceListClearAllExW.restype = wintypes.DWORD
MsiSourceListClearAllExW.argtypes = [
    wintypes.LPCWSTR,  # szProductCodeOrPatchCode : LPCWSTR
    wintypes.LPCWSTR,  # szUserSid : LPCWSTR optional
    ctypes.c_int,  # dwContext : MSIINSTALLCONTEXT
    wintypes.DWORD,  # dwOptions : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('msi.dll')
MsiSourceListClearAllExW = Fiddle::Function.new(
  lib['MsiSourceListClearAllExW'],
  [
    Fiddle::TYPE_VOIDP,  # szProductCodeOrPatchCode : LPCWSTR
    Fiddle::TYPE_VOIDP,  # szUserSid : LPCWSTR optional
    Fiddle::TYPE_INT,  # dwContext : MSIINSTALLCONTEXT
    -Fiddle::TYPE_INT,  # dwOptions : DWORD
  ],
  -Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "msi")]
extern "system" {
    fn MsiSourceListClearAllExW(
        szProductCodeOrPatchCode: *const u16,  // LPCWSTR
        szUserSid: *const u16,  // LPCWSTR optional
        dwContext: i32,  // MSIINSTALLCONTEXT
        dwOptions: u32  // DWORD
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("msi.dll", CharSet = CharSet.Unicode)]
public static extern uint MsiSourceListClearAllExW([MarshalAs(UnmanagedType.LPWStr)] string szProductCodeOrPatchCode, [MarshalAs(UnmanagedType.LPWStr)] string szUserSid, int dwContext, uint dwOptions);
"@
$api = Add-Type -MemberDefinition $sig -Name 'msi_MsiSourceListClearAllExW' -Namespace Win32 -PassThru
# $api::MsiSourceListClearAllExW(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions)
#uselib "msi.dll"
#func global MsiSourceListClearAllExW "MsiSourceListClearAllExW" wptr, wptr, wptr, wptr
; MsiSourceListClearAllExW szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions   ; 戻り値は stat
; szProductCodeOrPatchCode : LPCWSTR -> "wptr"
; szUserSid : LPCWSTR optional -> "wptr"
; dwContext : MSIINSTALLCONTEXT -> "wptr"
; dwOptions : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "msi.dll"
#cfunc global MsiSourceListClearAllExW "MsiSourceListClearAllExW" wstr, wstr, int, int
; res = MsiSourceListClearAllExW(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions)
; szProductCodeOrPatchCode : LPCWSTR -> "wstr"
; szUserSid : LPCWSTR optional -> "wstr"
; dwContext : MSIINSTALLCONTEXT -> "int"
; dwOptions : DWORD -> "int"
; DWORD MsiSourceListClearAllExW(LPCWSTR szProductCodeOrPatchCode, LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, DWORD dwOptions)
#uselib "msi.dll"
#cfunc global MsiSourceListClearAllExW "MsiSourceListClearAllExW" wstr, wstr, int, int
; res = MsiSourceListClearAllExW(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions)
; szProductCodeOrPatchCode : LPCWSTR -> "wstr"
; szUserSid : LPCWSTR optional -> "wstr"
; dwContext : MSIINSTALLCONTEXT -> "int"
; dwOptions : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	msi = windows.NewLazySystemDLL("msi.dll")
	procMsiSourceListClearAllExW = msi.NewProc("MsiSourceListClearAllExW")
)

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

extern "msi" fn MsiSourceListClearAllExW(
    szProductCodeOrPatchCode: [*c]const u16, // LPCWSTR
    szUserSid: [*c]const u16, // LPCWSTR optional
    dwContext: i32, // MSIINSTALLCONTEXT
    dwOptions: u32 // DWORD
) callconv(std.os.windows.WINAPI) u32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。
proc MsiSourceListClearAllExW(
    szProductCodeOrPatchCode: WideCString,  # LPCWSTR
    szUserSid: WideCString,  # LPCWSTR optional
    dwContext: int32,  # MSIINSTALLCONTEXT
    dwOptions: uint32  # DWORD
): uint32 {.importc: "MsiSourceListClearAllExW", stdcall, dynlib: "msi.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。
pragma(lib, "msi");
extern(Windows)
uint MsiSourceListClearAllExW(
    const(wchar)* szProductCodeOrPatchCode,   // LPCWSTR
    const(wchar)* szUserSid,   // LPCWSTR optional
    int dwContext,   // MSIINSTALLCONTEXT
    uint dwOptions   // DWORD
);
ccall((:MsiSourceListClearAllExW, "msi.dll"), stdcall, UInt32,
      (Cwstring, Cwstring, Int32, UInt32),
      szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions)
# szProductCodeOrPatchCode : LPCWSTR -> Cwstring
# szUserSid : LPCWSTR optional -> Cwstring
# dwContext : MSIINSTALLCONTEXT -> Int32
# dwOptions : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。
local ffi = require("ffi")
ffi.cdef[[
uint32_t MsiSourceListClearAllExW(
    const uint16_t* szProductCodeOrPatchCode,
    const uint16_t* szUserSid,
    int32_t dwContext,
    uint32_t dwOptions);
]]
local msi = ffi.load("msi")
-- msi.MsiSourceListClearAllExW(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions)
-- szProductCodeOrPatchCode : LPCWSTR
-- szUserSid : LPCWSTR optional
-- dwContext : MSIINSTALLCONTEXT
-- dwOptions : 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('msi.dll');
const MsiSourceListClearAllExW = lib.func('__stdcall', 'MsiSourceListClearAllExW', 'uint32_t', ['str16', 'str16', 'int32_t', 'uint32_t']);
// MsiSourceListClearAllExW(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions)
// szProductCodeOrPatchCode : LPCWSTR -> 'str16'
// szUserSid : LPCWSTR optional -> 'str16'
// dwContext : MSIINSTALLCONTEXT -> 'int32_t'
// dwOptions : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("msi.dll", {
  MsiSourceListClearAllExW: { parameters: ["buffer", "buffer", "i32", "u32"], result: "u32" },
});
// lib.symbols.MsiSourceListClearAllExW(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions)
// szProductCodeOrPatchCode : LPCWSTR -> "buffer"
// szUserSid : LPCWSTR optional -> "buffer"
// dwContext : MSIINSTALLCONTEXT -> "i32"
// dwOptions : DWORD -> "u32"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t MsiSourceListClearAllExW(
    const uint16_t* szProductCodeOrPatchCode,
    const uint16_t* szUserSid,
    int32_t dwContext,
    uint32_t dwOptions);
C, "msi.dll");
// $ffi->MsiSourceListClearAllExW(szProductCodeOrPatchCode, szUserSid, dwContext, dwOptions);
// szProductCodeOrPatchCode : LPCWSTR
// szUserSid : LPCWSTR optional
// dwContext : MSIINSTALLCONTEXT
// dwOptions : 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 Msi extends StdCallLibrary {
    Msi INSTANCE = Native.load("msi", Msi.class, W32APIOptions.UNICODE_OPTIONS);
    int MsiSourceListClearAllExW(
        WString szProductCodeOrPatchCode,   // LPCWSTR
        WString szUserSid,   // LPCWSTR optional
        int dwContext,   // MSIINSTALLCONTEXT
        int dwOptions   // DWORD
    );
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。
@[Link("msi")]
lib Libmsi
  fun MsiSourceListClearAllExW = MsiSourceListClearAllExW(
    szProductCodeOrPatchCode : UInt16*,   # LPCWSTR
    szUserSid : UInt16*,   # LPCWSTR optional
    dwContext : Int32,   # MSIINSTALLCONTEXT
    dwOptions : UInt32   # DWORD
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef MsiSourceListClearAllExWNative = Uint32 Function(Pointer<Utf16>, Pointer<Utf16>, Int32, Uint32);
typedef MsiSourceListClearAllExWDart = int Function(Pointer<Utf16>, Pointer<Utf16>, int, int);
final MsiSourceListClearAllExW = DynamicLibrary.open('msi.dll')
    .lookupFunction<MsiSourceListClearAllExWNative, MsiSourceListClearAllExWDart>('MsiSourceListClearAllExW');
// szProductCodeOrPatchCode : LPCWSTR -> Pointer<Utf16>
// szUserSid : LPCWSTR optional -> Pointer<Utf16>
// dwContext : MSIINSTALLCONTEXT -> Int32
// dwOptions : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function MsiSourceListClearAllExW(
  szProductCodeOrPatchCode: PWideChar;   // LPCWSTR
  szUserSid: PWideChar;   // LPCWSTR optional
  dwContext: Integer;   // MSIINSTALLCONTEXT
  dwOptions: DWORD   // DWORD
): DWORD; stdcall;
  external 'msi.dll' name 'MsiSourceListClearAllExW';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "MsiSourceListClearAllExW"
  c_MsiSourceListClearAllExW :: CWString -> CWString -> Int32 -> Word32 -> IO Word32
-- szProductCodeOrPatchCode : LPCWSTR -> CWString
-- szUserSid : LPCWSTR optional -> CWString
-- dwContext : MSIINSTALLCONTEXT -> Int32
-- dwOptions : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let msisourcelistclearallexw =
  foreign "MsiSourceListClearAllExW"
    ((ptr uint16_t) @-> (ptr uint16_t) @-> int32_t @-> uint32_t @-> returning uint32_t)
(* szProductCodeOrPatchCode : LPCWSTR -> (ptr uint16_t) *)
(* szUserSid : LPCWSTR optional -> (ptr uint16_t) *)
(* dwContext : MSIINSTALLCONTEXT -> int32_t *)
(* dwOptions : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library msi (t "msi.dll"))
(cffi:use-foreign-library msi)

(cffi:defcfun ("MsiSourceListClearAllExW" msi-source-list-clear-all-ex-w :convention :stdcall) :uint32
  (sz-product-code-or-patch-code (:string :encoding :utf-16le))   ; LPCWSTR
  (sz-user-sid (:string :encoding :utf-16le))   ; LPCWSTR optional
  (dw-context :int32)   ; MSIINSTALLCONTEXT
  (dw-options :uint32))   ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $MsiSourceListClearAllExW = Win32::API::More->new('msi',
    'DWORD MsiSourceListClearAllExW(LPCWSTR szProductCodeOrPatchCode, LPCWSTR szUserSid, int dwContext, DWORD dwOptions)');
# my $ret = $MsiSourceListClearAllExW->Call($szProductCodeOrPatchCode, $szUserSid, $dwContext, $dwOptions);
# szProductCodeOrPatchCode : LPCWSTR -> LPCWSTR
# szUserSid : LPCWSTR optional -> LPCWSTR
# dwContext : MSIINSTALLCONTEXT -> int
# dwOptions : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。

関連項目

文字セット違い
類似 API
使用する型