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

PdhParseCounterPathW

関数
カウンターパス文字列を構成要素に分解して解析する。
DLLpdh.dll文字セットUnicode (-W)呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

DWORD PdhParseCounterPathW(
    LPCWSTR szFullPathBuffer,
    PDH_COUNTER_PATH_ELEMENTS_W* pCounterPathElements,   // optional
    DWORD* pdwBufferSize,
    DWORD dwFlags
);

パラメーター

名前方向説明
szFullPathBufferLPCWSTRin解析するカウンターパスを格納した Null 終端文字列です。カウンターパスの最大長は PDH_MAX_COUNTER_PATH です。
pCounterPathElementsPDH_COUNTER_PATH_ELEMENTS_W*outoptional呼び出し側が割り当てたバッファーで、 PDH_COUNTER_PATH_ELEMENTS 構造体を受け取ります。この構造体には、szFullPathBuffer パラメーターで参照されるパスの個々の文字列要素へのポインターが含まれます。関数はこれらの文字列を PDH_COUNTER_PATH_ELEMENTS 構造体の末尾に追加します。割り当てるバッファーは、構造体と文字列を格納できる十分な大きさである必要があります。pdwBufferSize がゼロの場合は NULL を設定します。
pdwBufferSizeDWORD*inoutpCounterPathElements バッファーのサイズ(バイト単位)です。入力時にゼロの場合、関数は PDH_MORE_DATA を返し、このパラメーターに必要なバッファーサイズを設定します。バッファーが必要なサイズより大きい場合、関数はこのパラメーターに実際に使用されたバッファーのサイズを設定します。入力時に指定したサイズがゼロより大きく、かつ必要なサイズより小さい場合、返されたサイズを基にバッファーを再割り当てしないでください。
dwFlagsDWORDin予約済みです。ゼロを指定する必要があります。

戻り値の型: DWORD

公式ドキュメント

カウンターパスの要素を解析し、その結果を PDH_COUNTER_PATH_ELEMENTS 構造体に格納します。(Unicode)

戻り値

関数が成功した場合、ERROR_SUCCESS を返します。

関数が失敗した場合、戻り値は システムエラーコードまたは PDH エラーコードです。設定される可能性のある値を次に示します。

戻り値 説明
PDH_INVALID_ARGUMENT
パラメーターが無効です。
PDH_MORE_DATA
pCounterPathElements バッファーが小さすぎて、パス要素を格納できません。この戻り値は、入力時に pdwBufferSize がゼロの場合に想定されるものです。入力時に指定したサイズがゼロより大きく、かつ必要なサイズより小さい場合、返されたサイズを基にバッファーを再割り当てしないでください。
PDH_INVALID_PATH
パスの形式が正しくないため、解析できません。たとえば、一部のリリースでは、入力時に指定したサイズがゼロより大きく、かつ必要なサイズより小さい場合に、このエラーが返されることがあります。
PDH_MEMORY_ALLOCATION_FAILURE
関数を完了するためのメモリを割り当てることができません。

解説(Remarks)

この関数は 2 回呼び出す必要があります。1 回目は必要なバッファーサイズを取得するため(pCounterPathElementsNULL に、pdwBufferSize を 0 に設定します)、2 回目はデータを取得するために呼び出します。

メモ

pdh.h ヘッダーは、UNICODE プリプロセッサ定数の定義に基づいて、この関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして PdhParseCounterPath を定義します。エンコーディング非依存のエイリアスを、エンコーディング非依存でないコードと混在させて使用すると、不一致が生じ、コンパイルエラーや実行時エラーを引き起こすことがあります。詳細については、「Conventions for Function Prototypes」を参照してください。

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

各言語での呼び出し定義

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

DWORD PdhParseCounterPathW(
    LPCWSTR szFullPathBuffer,
    PDH_COUNTER_PATH_ELEMENTS_W* pCounterPathElements,   // optional
    DWORD* pdwBufferSize,
    DWORD dwFlags
);
[DllImport("pdh.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern uint PdhParseCounterPathW(
    [MarshalAs(UnmanagedType.LPWStr)] string szFullPathBuffer,   // LPCWSTR
    IntPtr pCounterPathElements,   // PDH_COUNTER_PATH_ELEMENTS_W* optional, out
    ref uint pdwBufferSize,   // DWORD* in/out
    uint dwFlags   // DWORD
);
<DllImport("pdh.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function PdhParseCounterPathW(
    <MarshalAs(UnmanagedType.LPWStr)> szFullPathBuffer As String,   ' LPCWSTR
    pCounterPathElements As IntPtr,   ' PDH_COUNTER_PATH_ELEMENTS_W* optional, out
    ByRef pdwBufferSize As UInteger,   ' DWORD* in/out
    dwFlags As UInteger   ' DWORD
) As UInteger
End Function
' szFullPathBuffer : LPCWSTR
' pCounterPathElements : PDH_COUNTER_PATH_ELEMENTS_W* optional, out
' pdwBufferSize : DWORD* in/out
' dwFlags : DWORD
Declare PtrSafe Function PdhParseCounterPathW Lib "pdh" ( _
    ByVal szFullPathBuffer As LongPtr, _
    ByVal pCounterPathElements As LongPtr, _
    ByRef pdwBufferSize As Long, _
    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

PdhParseCounterPathW = ctypes.windll.pdh.PdhParseCounterPathW
PdhParseCounterPathW.restype = wintypes.DWORD
PdhParseCounterPathW.argtypes = [
    wintypes.LPCWSTR,  # szFullPathBuffer : LPCWSTR
    ctypes.c_void_p,  # pCounterPathElements : PDH_COUNTER_PATH_ELEMENTS_W* optional, out
    ctypes.POINTER(wintypes.DWORD),  # pdwBufferSize : DWORD* in/out
    wintypes.DWORD,  # dwFlags : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('pdh.dll')
PdhParseCounterPathW = Fiddle::Function.new(
  lib['PdhParseCounterPathW'],
  [
    Fiddle::TYPE_VOIDP,  # szFullPathBuffer : LPCWSTR
    Fiddle::TYPE_VOIDP,  # pCounterPathElements : PDH_COUNTER_PATH_ELEMENTS_W* optional, out
    Fiddle::TYPE_VOIDP,  # pdwBufferSize : DWORD* in/out
    -Fiddle::TYPE_INT,  # dwFlags : DWORD
  ],
  -Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "pdh")]
extern "system" {
    fn PdhParseCounterPathW(
        szFullPathBuffer: *const u16,  // LPCWSTR
        pCounterPathElements: *mut PDH_COUNTER_PATH_ELEMENTS_W,  // PDH_COUNTER_PATH_ELEMENTS_W* optional, out
        pdwBufferSize: *mut u32,  // DWORD* in/out
        dwFlags: u32  // DWORD
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("pdh.dll", CharSet = CharSet.Unicode)]
public static extern uint PdhParseCounterPathW([MarshalAs(UnmanagedType.LPWStr)] string szFullPathBuffer, IntPtr pCounterPathElements, ref uint pdwBufferSize, uint dwFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'pdh_PdhParseCounterPathW' -Namespace Win32 -PassThru
# $api::PdhParseCounterPathW(szFullPathBuffer, pCounterPathElements, pdwBufferSize, dwFlags)
#uselib "pdh.dll"
#func global PdhParseCounterPathW "PdhParseCounterPathW" wptr, wptr, wptr, wptr
; PdhParseCounterPathW szFullPathBuffer, varptr(pCounterPathElements), varptr(pdwBufferSize), dwFlags   ; 戻り値は stat
; szFullPathBuffer : LPCWSTR -> "wptr"
; pCounterPathElements : PDH_COUNTER_PATH_ELEMENTS_W* optional, out -> "wptr"
; pdwBufferSize : DWORD* in/out -> "wptr"
; dwFlags : DWORD -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "pdh.dll"
#cfunc global PdhParseCounterPathW "PdhParseCounterPathW" wstr, var, var, int
; res = PdhParseCounterPathW(szFullPathBuffer, pCounterPathElements, pdwBufferSize, dwFlags)
; szFullPathBuffer : LPCWSTR -> "wstr"
; pCounterPathElements : PDH_COUNTER_PATH_ELEMENTS_W* optional, out -> "var"
; pdwBufferSize : DWORD* in/out -> "var"
; dwFlags : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD PdhParseCounterPathW(LPCWSTR szFullPathBuffer, PDH_COUNTER_PATH_ELEMENTS_W* pCounterPathElements, DWORD* pdwBufferSize, DWORD dwFlags)
#uselib "pdh.dll"
#cfunc global PdhParseCounterPathW "PdhParseCounterPathW" wstr, var, var, int
; res = PdhParseCounterPathW(szFullPathBuffer, pCounterPathElements, pdwBufferSize, dwFlags)
; szFullPathBuffer : LPCWSTR -> "wstr"
; pCounterPathElements : PDH_COUNTER_PATH_ELEMENTS_W* optional, out -> "var"
; pdwBufferSize : DWORD* in/out -> "var"
; dwFlags : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	pdh = windows.NewLazySystemDLL("pdh.dll")
	procPdhParseCounterPathW = pdh.NewProc("PdhParseCounterPathW")
)

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

extern "pdh" fn PdhParseCounterPathW(
    szFullPathBuffer: [*c]const u16, // LPCWSTR
    pCounterPathElements: [*c]PDH_COUNTER_PATH_ELEMENTS_W, // PDH_COUNTER_PATH_ELEMENTS_W* optional, out
    pdwBufferSize: [*c]u32, // DWORD* in/out
    dwFlags: u32 // DWORD
) callconv(std.os.windows.WINAPI) u32;
// Unicode(-W): UTF-16LE のヌル終端バッファ([*c]const u16)を渡す。
proc PdhParseCounterPathW(
    szFullPathBuffer: WideCString,  # LPCWSTR
    pCounterPathElements: ptr PDH_COUNTER_PATH_ELEMENTS_W,  # PDH_COUNTER_PATH_ELEMENTS_W* optional, out
    pdwBufferSize: ptr uint32,  # DWORD* in/out
    dwFlags: uint32  # DWORD
): uint32 {.importc: "PdhParseCounterPathW", stdcall, dynlib: "pdh.dll".}
# Unicode(-W): WideCString は newWideCString("...") で生成。
pragma(lib, "pdh");
extern(Windows)
uint PdhParseCounterPathW(
    const(wchar)* szFullPathBuffer,   // LPCWSTR
    PDH_COUNTER_PATH_ELEMENTS_W* pCounterPathElements,   // PDH_COUNTER_PATH_ELEMENTS_W* optional, out
    uint* pdwBufferSize,   // DWORD* in/out
    uint dwFlags   // DWORD
);
ccall((:PdhParseCounterPathW, "pdh.dll"), stdcall, UInt32,
      (Cwstring, Ptr{PDH_COUNTER_PATH_ELEMENTS_W}, Ptr{UInt32}, UInt32),
      szFullPathBuffer, pCounterPathElements, pdwBufferSize, dwFlags)
# szFullPathBuffer : LPCWSTR -> Cwstring
# pCounterPathElements : PDH_COUNTER_PATH_ELEMENTS_W* optional, out -> Ptr{PDH_COUNTER_PATH_ELEMENTS_W}
# pdwBufferSize : DWORD* in/out -> Ptr{UInt32}
# dwFlags : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
# Unicode(-W): Cwstring には transcode(UInt16, "...") 等で UTF-16 を渡す。
local ffi = require("ffi")
ffi.cdef[[
uint32_t PdhParseCounterPathW(
    const uint16_t* szFullPathBuffer,
    void* pCounterPathElements,
    uint32_t* pdwBufferSize,
    uint32_t dwFlags);
]]
local pdh = ffi.load("pdh")
-- pdh.PdhParseCounterPathW(szFullPathBuffer, pCounterPathElements, pdwBufferSize, dwFlags)
-- szFullPathBuffer : LPCWSTR
-- pCounterPathElements : PDH_COUNTER_PATH_ELEMENTS_W* optional, out
-- pdwBufferSize : DWORD* in/out
-- 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('pdh.dll');
const PdhParseCounterPathW = lib.func('__stdcall', 'PdhParseCounterPathW', 'uint32_t', ['str16', 'void *', 'uint32_t *', 'uint32_t']);
// PdhParseCounterPathW(szFullPathBuffer, pCounterPathElements, pdwBufferSize, dwFlags)
// szFullPathBuffer : LPCWSTR -> 'str16'
// pCounterPathElements : PDH_COUNTER_PATH_ELEMENTS_W* optional, out -> 'void *'
// pdwBufferSize : DWORD* in/out -> 'uint32_t *'
// dwFlags : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("pdh.dll", {
  PdhParseCounterPathW: { parameters: ["buffer", "pointer", "pointer", "u32"], result: "u32" },
});
// lib.symbols.PdhParseCounterPathW(szFullPathBuffer, pCounterPathElements, pdwBufferSize, dwFlags)
// szFullPathBuffer : LPCWSTR -> "buffer"
// pCounterPathElements : PDH_COUNTER_PATH_ELEMENTS_W* optional, out -> "pointer"
// pdwBufferSize : DWORD* in/out -> "pointer"
// dwFlags : DWORD -> "u32"
// 文字列は "buffer"。Unicode(-W) は new TextEncoder() ではなく UTF-16LE のバイト列(末尾に \x00\x00)を Uint8Array で渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t PdhParseCounterPathW(
    const uint16_t* szFullPathBuffer,
    void* pCounterPathElements,
    uint32_t* pdwBufferSize,
    uint32_t dwFlags);
C, "pdh.dll");
// $ffi->PdhParseCounterPathW(szFullPathBuffer, pCounterPathElements, pdwBufferSize, dwFlags);
// szFullPathBuffer : LPCWSTR
// pCounterPathElements : PDH_COUNTER_PATH_ELEMENTS_W* optional, out
// pdwBufferSize : DWORD* in/out
// 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 Pdh extends StdCallLibrary {
    Pdh INSTANCE = Native.load("pdh", Pdh.class, W32APIOptions.UNICODE_OPTIONS);
    int PdhParseCounterPathW(
        WString szFullPathBuffer,   // LPCWSTR
        Pointer pCounterPathElements,   // PDH_COUNTER_PATH_ELEMENTS_W* optional, out
        IntByReference pdwBufferSize,   // DWORD* in/out
        int dwFlags   // DWORD
    );
}
// Unicode(-W): WString(入力)/char[](出力)で UTF-16 をマーシャリング。
@[Link("pdh")]
lib Libpdh
  fun PdhParseCounterPathW = PdhParseCounterPathW(
    szFullPathBuffer : UInt16*,   # LPCWSTR
    pCounterPathElements : PDH_COUNTER_PATH_ELEMENTS_W*,   # PDH_COUNTER_PATH_ELEMENTS_W* optional, out
    pdwBufferSize : UInt32*,   # DWORD* in/out
    dwFlags : 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 PdhParseCounterPathWNative = Uint32 Function(Pointer<Utf16>, Pointer<Void>, Pointer<Uint32>, Uint32);
typedef PdhParseCounterPathWDart = int Function(Pointer<Utf16>, Pointer<Void>, Pointer<Uint32>, int);
final PdhParseCounterPathW = DynamicLibrary.open('pdh.dll')
    .lookupFunction<PdhParseCounterPathWNative, PdhParseCounterPathWDart>('PdhParseCounterPathW');
// szFullPathBuffer : LPCWSTR -> Pointer<Utf16>
// pCounterPathElements : PDH_COUNTER_PATH_ELEMENTS_W* optional, out -> Pointer<Void>
// pdwBufferSize : DWORD* in/out -> Pointer<Uint32>
// dwFlags : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function PdhParseCounterPathW(
  szFullPathBuffer: PWideChar;   // LPCWSTR
  pCounterPathElements: Pointer;   // PDH_COUNTER_PATH_ELEMENTS_W* optional, out
  pdwBufferSize: Pointer;   // DWORD* in/out
  dwFlags: DWORD   // DWORD
): DWORD; stdcall;
  external 'pdh.dll' name 'PdhParseCounterPathW';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "PdhParseCounterPathW"
  c_PdhParseCounterPathW :: CWString -> Ptr () -> Ptr Word32 -> Word32 -> IO Word32
-- szFullPathBuffer : LPCWSTR -> CWString
-- pCounterPathElements : PDH_COUNTER_PATH_ELEMENTS_W* optional, out -> Ptr ()
-- pdwBufferSize : DWORD* in/out -> Ptr Word32
-- dwFlags : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let pdhparsecounterpathw =
  foreign "PdhParseCounterPathW"
    ((ptr uint16_t) @-> (ptr void) @-> (ptr uint32_t) @-> uint32_t @-> returning uint32_t)
(* szFullPathBuffer : LPCWSTR -> (ptr uint16_t) *)
(* pCounterPathElements : PDH_COUNTER_PATH_ELEMENTS_W* optional, out -> (ptr void) *)
(* pdwBufferSize : DWORD* in/out -> (ptr uint32_t) *)
(* dwFlags : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library pdh (t "pdh.dll"))
(cffi:use-foreign-library pdh)

(cffi:defcfun ("PdhParseCounterPathW" pdh-parse-counter-path-w :convention :stdcall) :uint32
  (sz-full-path-buffer (:string :encoding :utf-16le))   ; LPCWSTR
  (p-counter-path-elements :pointer)   ; PDH_COUNTER_PATH_ELEMENTS_W* optional, out
  (pdw-buffer-size :pointer)   ; DWORD* in/out
  (dw-flags :uint32))   ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $PdhParseCounterPathW = Win32::API::More->new('pdh',
    'DWORD PdhParseCounterPathW(LPCWSTR szFullPathBuffer, LPVOID pCounterPathElements, LPVOID pdwBufferSize, DWORD dwFlags)');
# my $ret = $PdhParseCounterPathW->Call($szFullPathBuffer, $pCounterPathElements, $pdwBufferSize, $dwFlags);
# szFullPathBuffer : LPCWSTR -> LPCWSTR
# pCounterPathElements : PDH_COUNTER_PATH_ELEMENTS_W* optional, out -> LPVOID
# pdwBufferSize : DWORD* in/out -> LPVOID
# dwFlags : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。

関連項目

文字セット違い
公式の関連項目
使用する型