Win32 API 日本語リファレンス
ホームStorage.FileSystem › CreateHardLinkW

CreateHardLinkW

関数
既存ファイルへのハードリンクを作成する(Unicode版)。
DLLKERNEL32.dll文字セットUnicode (-W)呼出規約winapiSetLastErrorあり対応OSWindows XP 以降

シグネチャ

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

BOOL CreateHardLinkW(
    LPCWSTR lpFileName,
    LPCWSTR lpExistingFileName,
    SECURITY_ATTRIBUTES* lpSecurityAttributes   // optional
);

パラメーター

名前方向説明
lpFileNameLPCWSTRin

新しいファイルの名前。

このパラメーターにはパスを含めることができますが、ディレクトリ名を指定することはできません。

既定では、名前は MAX_PATH 文字に制限されます。この制限を 32,767 ワイド文字に拡張するには、パスの先頭に "\\?\" を付加します。詳細については、ファイル、パス、および名前空間の名前付けを参照してください。

ヒント

Windows 10 バージョン 1607 以降では、パスの先頭に "\\?\" を付加することなく MAX_PATH の制限を解除するオプトインが可能です。詳細については、ファイル、パス、および名前空間の名前付けの「Maximum Path Length Limitation」セクションを参照してください。

lpExistingFileNameLPCWSTRin

既存のファイルの名前。

このパラメーターにはパスを含めることができますが、ディレクトリ名を指定することはできません。

既定では、名前は MAX_PATH 文字に制限されます。この制限を 32,767 ワイド文字に拡張するには、パスの先頭に "\\?\" を付加します。詳細については、ファイル、パス、および名前空間の名前付けを参照してください。

ヒント

Windows 10 バージョン 1607 以降では、パスの先頭に "\\?\" を付加することなく MAX_PATH の制限を解除するオプトインが可能です。詳細については、ファイル、パス、および名前空間の名前付けの「Maximum Path Length Limitation」セクションを参照してください。

lpSecurityAttributesSECURITY_ATTRIBUTES*optional予約されています。NULL を指定する必要があります。

戻り値の型: BOOL

公式ドキュメント

既存のファイルと新しいファイルとの間にハードリンクを作成します。(Unicode)

戻り値

関数が成功した場合、戻り値は 0 以外の値になります。

関数が失敗した場合、戻り値は 0 になります。拡張エラー情報を取得するには、GetLastError を呼び出します。

この関数で作成できるハードリンクの最大数は、1 ファイルあたり 1023 個です。1 つのファイルに対して 1023 個を超えるリンクを作成しようとすると、エラーが発生します。

この関数の ANSI バージョンの lpFileName または lpExistingFileName パラメーターに MAX_PATH 文字を超える名前を渡した場合、または Unicode バージョンに対してパスの先頭に "\\?\" を付加せずに渡した場合、関数は ERROR_PATH_NOT_FOUND を返します。

解説(Remarks)

CreateFile または CreateHardLink で作成されたファイルのすべてのディレクトリエントリは、関連付けられたファイルへのハードリンクです。 CreateHardLink 関数で追加のハードリンクを作成すると、1 つのファイルに対して複数のディレクトリエントリ、すなわち同一ファイルへの複数のハードリンクを持つことができます。 これらは、同じディレクトリ内では異なる名前にできるほか、異なるディレクトリ内では同じ名前または異なる名前にできます。 ただし、1 つのファイルに対するすべてのハードリンクは、同一のボリューム上に存在する必要があります。

ハードリンクはファイルのディレクトリエントリにすぎないため、そのファイルに対する多くの変更は、それを参照するハードリンクを介してアクセスするアプリケーションに即座に反映されます。ただし、ディレクトリエントリのサイズおよび属性情報は、変更が行われたリンクについてのみ更新されます。

セキュリティ記述子は、ハードリンクが指すファイルに属します。リンク自体は単なるディレクトリエントリであり、セキュリティ記述子を持ちません。したがって、ハードリンクのセキュリティ記述子を変更すると、基になるファイルのセキュリティ記述子が変更され、そのファイルを指すすべてのハードリンクで新たに指定されたアクセスが許可されます。ハードリンクごとに個別のセキュリティ記述子をファイルに付与することはできません。

この関数は、lpSecurityAttributes パラメーターでセキュリティ記述子の情報が渡された場合でも、リンク先のファイルのセキュリティ記述子を変更しません。

ハードリンクを削除するには、DeleteFile を使用します。作成された順序に関係なく、任意の順序で削除できます。

CreateFile で指定されるフラグ、属性、アクセス、および共有は、ファイル単位で動作します。すなわち、共有を許可しないファイルを開いた場合、別のアプリケーションがそのファイルへの新しいハードリンクを作成して共有することはできません。

NTFS ファイルシステム上でハードリンクを作成した場合、ディレクトリエントリ内のファイル属性情報は、ファイルが開かれたとき、または特定のファイルのハンドルを指定して GetFileInformationByHandle が呼び出されたときにのみ更新されます。

シンボリックリンクの動作 — パスがシンボリックリンクを指している場合、この関数はそのシンボリックリンクへのハードリンクを作成します。

Windows 8 および Windows Server 2012 では、この関数は次のテクノロジでサポートされています。

テクノロジ サポート
Server Message Block (SMB) 3.0 プロトコル はい
SMB 3.0 Transparent Failover (TFO) いいえ
SMB 3.0 with Scale-out File Shares (SO) いいえ
Cluster Shared Volume File System (CsvFS) はい
Resilient File System (ReFS) いいえ

SMB 3.0 は、継続的な可用性機能を持つ共有上でのハードリンクの作成をサポートしていないことに注意してください。

次のコードスニペットは、ファイルのセキュリティ記述子を変更しないように CreateHardLink を呼び出す方法を示しています。pszExistingFileName パラメーターには、元のファイル名、 またはファイルへの既存のリンクを指定できます。このコードを実行すると、pszNewLinkName がそのファイルを参照するようになります。

  BOOL fCreatedLink = CreateHardLink( pszNewLinkName, 
                                      pszExistingFileName, 
                                      NULL ); // reserved, must be NULL

  if ( fCreatedLink == FALSE )
   {
    ;// handle error condition
   }
メモ

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

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

各言語での呼び出し定義

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

BOOL CreateHardLinkW(
    LPCWSTR lpFileName,
    LPCWSTR lpExistingFileName,
    SECURITY_ATTRIBUTES* lpSecurityAttributes   // optional
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool CreateHardLinkW(
    [MarshalAs(UnmanagedType.LPWStr)] string lpFileName,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string lpExistingFileName,   // LPCWSTR
    IntPtr lpSecurityAttributes   // SECURITY_ATTRIBUTES* optional
);
<DllImport("KERNEL32.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CreateHardLinkW(
    <MarshalAs(UnmanagedType.LPWStr)> lpFileName As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> lpExistingFileName As String,   ' LPCWSTR
    lpSecurityAttributes As IntPtr   ' SECURITY_ATTRIBUTES* optional
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
' lpFileName : LPCWSTR
' lpExistingFileName : LPCWSTR
' lpSecurityAttributes : SECURITY_ATTRIBUTES* optional
Declare PtrSafe Function CreateHardLinkW Lib "kernel32" ( _
    ByVal lpFileName As LongPtr, _
    ByVal lpExistingFileName As LongPtr, _
    ByVal lpSecurityAttributes 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

CreateHardLinkW = ctypes.windll.kernel32.CreateHardLinkW
CreateHardLinkW.restype = wintypes.BOOL
CreateHardLinkW.argtypes = [
    wintypes.LPCWSTR,  # lpFileName : LPCWSTR
    wintypes.LPCWSTR,  # lpExistingFileName : LPCWSTR
    ctypes.c_void_p,  # lpSecurityAttributes : SECURITY_ATTRIBUTES* optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

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

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procCreateHardLinkW = kernel32.NewProc("CreateHardLinkW")
)

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

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

typedef CreateHardLinkWNative = Int32 Function(Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>);
typedef CreateHardLinkWDart = int Function(Pointer<Utf16>, Pointer<Utf16>, Pointer<Void>);
final CreateHardLinkW = DynamicLibrary.open('KERNEL32.dll')
    .lookupFunction<CreateHardLinkWNative, CreateHardLinkWDart>('CreateHardLinkW');
// lpFileName : LPCWSTR -> Pointer<Utf16>
// lpExistingFileName : LPCWSTR -> Pointer<Utf16>
// lpSecurityAttributes : SECURITY_ATTRIBUTES* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function CreateHardLinkW(
  lpFileName: PWideChar;   // LPCWSTR
  lpExistingFileName: PWideChar;   // LPCWSTR
  lpSecurityAttributes: Pointer   // SECURITY_ATTRIBUTES* optional
): BOOL; stdcall;
  external 'KERNEL32.dll' name 'CreateHardLinkW';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "CreateHardLinkW"
  c_CreateHardLinkW :: CWString -> CWString -> Ptr () -> IO CInt
-- lpFileName : LPCWSTR -> CWString
-- lpExistingFileName : LPCWSTR -> CWString
-- lpSecurityAttributes : SECURITY_ATTRIBUTES* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let createhardlinkw =
  foreign "CreateHardLinkW"
    ((ptr uint16_t) @-> (ptr uint16_t) @-> (ptr void) @-> returning int32_t)
(* lpFileName : LPCWSTR -> (ptr uint16_t) *)
(* lpExistingFileName : LPCWSTR -> (ptr uint16_t) *)
(* lpSecurityAttributes : SECURITY_ATTRIBUTES* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library kernel32 (t "KERNEL32.dll"))
(cffi:use-foreign-library kernel32)

(cffi:defcfun ("CreateHardLinkW" create-hard-link-w :convention :stdcall) :int32
  (lp-file-name (:string :encoding :utf-16le))   ; LPCWSTR
  (lp-existing-file-name (:string :encoding :utf-16le))   ; LPCWSTR
  (lp-security-attributes :pointer))   ; SECURITY_ATTRIBUTES* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $CreateHardLinkW = Win32::API::More->new('KERNEL32',
    'BOOL CreateHardLinkW(LPCWSTR lpFileName, LPCWSTR lpExistingFileName, LPVOID lpSecurityAttributes)');
# my $ret = $CreateHardLinkW->Call($lpFileName, $lpExistingFileName, $lpSecurityAttributes);
# lpFileName : LPCWSTR -> LPCWSTR
# lpExistingFileName : LPCWSTR -> LPCWSTR
# lpSecurityAttributes : SECURITY_ATTRIBUTES* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# Unicode(-W): LPCWSTR/LPWSTR は Win32::API が UTF-16 変換を行う。

関連項目

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