Win32 API 日本語リファレンス
ホームUI.Shell › PathCchCombineEx

PathCchCombineEx

関数
オプション指定で2つのパスを安全に連結し正規化する。
DLLapi-ms-win-core-path-l1-1-0.dll呼出規約winapi対応OSwindows8.0

シグネチャ

// api-ms-win-core-path-l1-1-0.dll
#include <windows.h>

HRESULT PathCchCombineEx(
    LPWSTR pszPathOut,
    UINT_PTR cchPathOut,
    LPCWSTR pszPathIn,   // optional
    LPCWSTR pszMore,   // optional
    PATHCCH_OPTIONS dwFlags
);

パラメーター

名前方向説明
pszPathOutLPWSTRoutこの関数が正常に終了したときに、結合されたパス文字列を受け取るバッファーへのポインターです。このパラメーターは、pszPathIn または pszMore と同じバッファーを指すこともできます。
cchPathOutUINT_PTRinpszPathOut が指すバッファーのサイズ(文字数単位)です。
pszPathInLPCWSTRinoptional1 つ目のパス文字列へのポインターです。この値は NULL でもかまいません。
pszMoreLPCWSTRinoptional2 つ目のパス文字列へのポインターです。このパスが単一のバックスラッシュで始まる場合は、pszPathIn が指すパスのルートのみと結合されます。このパスが完全修飾されている場合は、もう一方のパスと結合されずに、そのまま出力バッファーにコピーされます。この値は NULL でもかまいません。
dwFlagsPATHCCH_OPTIONSin

次のフラグの 1 つ以上を指定します。

意味
PATHCCH_NONE
0x0000000
MAX_PATH より長い \\?\ パス(つまりロングパス)の構築を許可しません。
PATHCCH_ALLOW_LONG_PATHS
0x00000001
MAX_PATH より長い \\?\ パスの構築を許可します。cchPathOutMAX_PATH より大きくなければならない点に注意してください。そうでない場合、このフラグは無視されます。
PATHCCH_FORCE_ENABLE_LONG_NAME_PROCESS
0x00000002
プロセスのロングネーム有効状態にかかわらず、呼び出し元をロングパス有効として扱うよう API に強制します。このオプションは PATHCCH_ALLOW_LONG_PATHS が指定されている場合にのみ使用でき、PATHCCH_FORCE_DISABLE_LONG_NAME_PROCESS と併用することはできません。

注意 この値は Windows 10 バージョン 1703 以降で使用できます。

PATHCCH_FORCE_DISABLE_LONG_NAME_PROCESS
0x00000004
プロセスのロングネーム有効状態にかかわらず、呼び出し元をロングパス無効として扱うよう API に強制します。このオプションは PATHCCH_ALLOW_LONG_PATHS が指定されている場合にのみ使用でき、PATHCCH_FORCE_ENABLE_LONG_NAME_PROCESS と併用することはできません。

注意 この値は Windows 10 バージョン 1703 以降で使用できます。

PATHCCH_DO_NOT_NORMALIZE_SEGMENTS
0x00000008
末尾のドットやスペースの削除を含む、パスセグメントの正規化を無効にします。これにより、win32 のパス正規化によってブロックされるパスへのアクセスが可能になります。

注意 この値は Windows 10 バージョン 1703 以降で使用できます。

PATHCCH_ENSURE_IS_EXTENDED_LENGTH_PATH
0x00000010
入力パスがまだ拡張長 DOS デバイスパス形式(\\?\ プレフィックス付き)になっていない場合に、その形式へ変換します。これにより、Win32 の正規化規則(末尾のドットやスペースを取り除くことがある)やパス長の制限のためにアクセスできないパスへのアクセスが可能になります。このオプションは PATHCCH_DO_NOT_NORMALIZE_SEGMENTS と同じ動作を含みます。

注意 この値は Windows 10 バージョン 1703 以降で使用できます。

戻り値の型: HRESULT

公式ドキュメント

2 つのパスフラグメントを 1 つのパスに結合します。(PathCchCombineEx)

戻り値

この関数は、次を含む HRESULT コードを返します。

戻り値 説明
S_OK
関数は成功しました。これには、ピリオドの後に文字が続かない場合など、拡張子が空のケースも含まれる点に注意してください。その場合、元の文字列は変更されずに返されます。
E_INVALIDARG
この値は、pszPathOut パラメーターが NULL に設定されている、または cchPathOut の値が 0 もしくは PATHCCH_MAX_CCH より大きい値に設定されているなど、いくつかの原因によって発生する可能性があります。
E_OUTOFMEMORY
関数は、操作を実行するのに十分なメモリを割り当てることができませんでした。
PATHCCH_E_FILENAME_TOO_LONG
元のパスの一方または両方のサイズが PATHCCH_MAX_CCH を超えました。

解説(Remarks)

pszPathInpszMore の両方が NULL または空の文字列を指している場合、pszPathOut が指すバッファーには単一のバックスラッシュがコピーされます。

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

各言語での呼び出し定義

// api-ms-win-core-path-l1-1-0.dll
#include <windows.h>

HRESULT PathCchCombineEx(
    LPWSTR pszPathOut,
    UINT_PTR cchPathOut,
    LPCWSTR pszPathIn,   // optional
    LPCWSTR pszMore,   // optional
    PATHCCH_OPTIONS dwFlags
);
[DllImport("api-ms-win-core-path-l1-1-0.dll", ExactSpelling = true)]
static extern int PathCchCombineEx(
    [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pszPathOut,   // LPWSTR out
    UIntPtr cchPathOut,   // UINT_PTR
    [MarshalAs(UnmanagedType.LPWStr)] string pszPathIn,   // LPCWSTR optional
    [MarshalAs(UnmanagedType.LPWStr)] string pszMore,   // LPCWSTR optional
    uint dwFlags   // PATHCCH_OPTIONS
);
<DllImport("api-ms-win-core-path-l1-1-0.dll", ExactSpelling:=True)>
Public Shared Function PathCchCombineEx(
    <MarshalAs(UnmanagedType.LPWStr)> pszPathOut As System.Text.StringBuilder,   ' LPWSTR out
    cchPathOut As UIntPtr,   ' UINT_PTR
    <MarshalAs(UnmanagedType.LPWStr)> pszPathIn As String,   ' LPCWSTR optional
    <MarshalAs(UnmanagedType.LPWStr)> pszMore As String,   ' LPCWSTR optional
    dwFlags As UInteger   ' PATHCCH_OPTIONS
) As Integer
End Function
' pszPathOut : LPWSTR out
' cchPathOut : UINT_PTR
' pszPathIn : LPCWSTR optional
' pszMore : LPCWSTR optional
' dwFlags : PATHCCH_OPTIONS
Declare PtrSafe Function PathCchCombineEx Lib "api-ms-win-core-path-l1-1-0" ( _
    ByVal pszPathOut As LongPtr, _
    ByVal cchPathOut As LongPtr, _
    ByVal pszPathIn As LongPtr, _
    ByVal pszMore As LongPtr, _
    ByVal dwFlags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

PathCchCombineEx = ctypes.windll.LoadLibrary("api-ms-win-core-path-l1-1-0.dll").PathCchCombineEx
PathCchCombineEx.restype = ctypes.c_int
PathCchCombineEx.argtypes = [
    wintypes.LPWSTR,  # pszPathOut : LPWSTR out
    ctypes.c_size_t,  # cchPathOut : UINT_PTR
    wintypes.LPCWSTR,  # pszPathIn : LPCWSTR optional
    wintypes.LPCWSTR,  # pszMore : LPCWSTR optional
    wintypes.DWORD,  # dwFlags : PATHCCH_OPTIONS
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('api-ms-win-core-path-l1-1-0.dll')
PathCchCombineEx = Fiddle::Function.new(
  lib['PathCchCombineEx'],
  [
    Fiddle::TYPE_VOIDP,  # pszPathOut : LPWSTR out
    Fiddle::TYPE_UINTPTR_T,  # cchPathOut : UINT_PTR
    Fiddle::TYPE_VOIDP,  # pszPathIn : LPCWSTR optional
    Fiddle::TYPE_VOIDP,  # pszMore : LPCWSTR optional
    -Fiddle::TYPE_INT,  # dwFlags : PATHCCH_OPTIONS
  ],
  Fiddle::TYPE_INT)
#[link(name = "api-ms-win-core-path-l1-1-0")]
extern "system" {
    fn PathCchCombineEx(
        pszPathOut: *mut u16,  // LPWSTR out
        cchPathOut: usize,  // UINT_PTR
        pszPathIn: *const u16,  // LPCWSTR optional
        pszMore: *const u16,  // LPCWSTR optional
        dwFlags: u32  // PATHCCH_OPTIONS
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("api-ms-win-core-path-l1-1-0.dll")]
public static extern int PathCchCombineEx([MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pszPathOut, UIntPtr cchPathOut, [MarshalAs(UnmanagedType.LPWStr)] string pszPathIn, [MarshalAs(UnmanagedType.LPWStr)] string pszMore, uint dwFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-core-path-l1-1-0_PathCchCombineEx' -Namespace Win32 -PassThru
# $api::PathCchCombineEx(pszPathOut, cchPathOut, pszPathIn, pszMore, dwFlags)
#uselib "api-ms-win-core-path-l1-1-0.dll"
#func global PathCchCombineEx "PathCchCombineEx" sptr, sptr, sptr, sptr, sptr
; PathCchCombineEx varptr(pszPathOut), cchPathOut, pszPathIn, pszMore, dwFlags   ; 戻り値は stat
; pszPathOut : LPWSTR out -> "sptr"
; cchPathOut : UINT_PTR -> "sptr"
; pszPathIn : LPCWSTR optional -> "sptr"
; pszMore : LPCWSTR optional -> "sptr"
; dwFlags : PATHCCH_OPTIONS -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "api-ms-win-core-path-l1-1-0.dll"
#cfunc global PathCchCombineEx "PathCchCombineEx" var, sptr, wstr, wstr, int
; res = PathCchCombineEx(pszPathOut, cchPathOut, pszPathIn, pszMore, dwFlags)
; pszPathOut : LPWSTR out -> "var"
; cchPathOut : UINT_PTR -> "sptr"
; pszPathIn : LPCWSTR optional -> "wstr"
; pszMore : LPCWSTR optional -> "wstr"
; dwFlags : PATHCCH_OPTIONS -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT PathCchCombineEx(LPWSTR pszPathOut, UINT_PTR cchPathOut, LPCWSTR pszPathIn, LPCWSTR pszMore, PATHCCH_OPTIONS dwFlags)
#uselib "api-ms-win-core-path-l1-1-0.dll"
#cfunc global PathCchCombineEx "PathCchCombineEx" var, intptr, wstr, wstr, int
; res = PathCchCombineEx(pszPathOut, cchPathOut, pszPathIn, pszMore, dwFlags)
; pszPathOut : LPWSTR out -> "var"
; cchPathOut : UINT_PTR -> "intptr"
; pszPathIn : LPCWSTR optional -> "wstr"
; pszMore : LPCWSTR optional -> "wstr"
; dwFlags : PATHCCH_OPTIONS -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	api_ms_win_core_path_l1_1_0 = windows.NewLazySystemDLL("api-ms-win-core-path-l1-1-0.dll")
	procPathCchCombineEx = api_ms_win_core_path_l1_1_0.NewProc("PathCchCombineEx")
)

// pszPathOut (LPWSTR out), cchPathOut (UINT_PTR), pszPathIn (LPCWSTR optional), pszMore (LPCWSTR optional), dwFlags (PATHCCH_OPTIONS)
r1, _, err := procPathCchCombineEx.Call(
	uintptr(pszPathOut),
	uintptr(cchPathOut),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszPathIn))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszMore))),
	uintptr(dwFlags),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function PathCchCombineEx(
  pszPathOut: PWideChar;   // LPWSTR out
  cchPathOut: NativeUInt;   // UINT_PTR
  pszPathIn: PWideChar;   // LPCWSTR optional
  pszMore: PWideChar;   // LPCWSTR optional
  dwFlags: DWORD   // PATHCCH_OPTIONS
): Integer; stdcall;
  external 'api-ms-win-core-path-l1-1-0.dll' name 'PathCchCombineEx';
result := DllCall("api-ms-win-core-path-l1-1-0\PathCchCombineEx"
    , "Ptr", pszPathOut   ; LPWSTR out
    , "UPtr", cchPathOut   ; UINT_PTR
    , "WStr", pszPathIn   ; LPCWSTR optional
    , "WStr", pszMore   ; LPCWSTR optional
    , "UInt", dwFlags   ; PATHCCH_OPTIONS
    , "Int")   ; return: HRESULT
●PathCchCombineEx(pszPathOut, cchPathOut, pszPathIn, pszMore, dwFlags) = DLL("api-ms-win-core-path-l1-1-0.dll", "int PathCchCombineEx(char*, int, char*, char*, dword)")
# 呼び出し: PathCchCombineEx(pszPathOut, cchPathOut, pszPathIn, pszMore, dwFlags)
# pszPathOut : LPWSTR out -> "char*"
# cchPathOut : UINT_PTR -> "int"
# pszPathIn : LPCWSTR optional -> "char*"
# pszMore : LPCWSTR optional -> "char*"
# dwFlags : PATHCCH_OPTIONS -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "api-ms-win-core-path-l1-1-0" fn PathCchCombineEx(
    pszPathOut: [*c]u16, // LPWSTR out
    cchPathOut: usize, // UINT_PTR
    pszPathIn: [*c]const u16, // LPCWSTR optional
    pszMore: [*c]const u16, // LPCWSTR optional
    dwFlags: u32 // PATHCCH_OPTIONS
) callconv(std.os.windows.WINAPI) i32;
proc PathCchCombineEx(
    pszPathOut: ptr uint16,  # LPWSTR out
    cchPathOut: uint,  # UINT_PTR
    pszPathIn: WideCString,  # LPCWSTR optional
    pszMore: WideCString,  # LPCWSTR optional
    dwFlags: uint32  # PATHCCH_OPTIONS
): int32 {.importc: "PathCchCombineEx", stdcall, dynlib: "api-ms-win-core-path-l1-1-0.dll".}
pragma(lib, "api-ms-win-core-path-l1-1-0");
extern(Windows)
int PathCchCombineEx(
    wchar* pszPathOut,   // LPWSTR out
    size_t cchPathOut,   // UINT_PTR
    const(wchar)* pszPathIn,   // LPCWSTR optional
    const(wchar)* pszMore,   // LPCWSTR optional
    uint dwFlags   // PATHCCH_OPTIONS
);
ccall((:PathCchCombineEx, "api-ms-win-core-path-l1-1-0.dll"), stdcall, Int32,
      (Ptr{UInt16}, Csize_t, Cwstring, Cwstring, UInt32),
      pszPathOut, cchPathOut, pszPathIn, pszMore, dwFlags)
# pszPathOut : LPWSTR out -> Ptr{UInt16}
# cchPathOut : UINT_PTR -> Csize_t
# pszPathIn : LPCWSTR optional -> Cwstring
# pszMore : LPCWSTR optional -> Cwstring
# dwFlags : PATHCCH_OPTIONS -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t PathCchCombineEx(
    uint16_t* pszPathOut,
    uintptr_t cchPathOut,
    const uint16_t* pszPathIn,
    const uint16_t* pszMore,
    uint32_t dwFlags);
]]
local api-ms-win-core-path-l1-1-0 = ffi.load("api-ms-win-core-path-l1-1-0")
-- api-ms-win-core-path-l1-1-0.PathCchCombineEx(pszPathOut, cchPathOut, pszPathIn, pszMore, dwFlags)
-- pszPathOut : LPWSTR out
-- cchPathOut : UINT_PTR
-- pszPathIn : LPCWSTR optional
-- pszMore : LPCWSTR optional
-- dwFlags : PATHCCH_OPTIONS
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('api-ms-win-core-path-l1-1-0.dll');
const PathCchCombineEx = lib.func('__stdcall', 'PathCchCombineEx', 'int32_t', ['uint16_t *', 'uintptr_t', 'str16', 'str16', 'uint32_t']);
// PathCchCombineEx(pszPathOut, cchPathOut, pszPathIn, pszMore, dwFlags)
// pszPathOut : LPWSTR out -> 'uint16_t *'
// cchPathOut : UINT_PTR -> 'uintptr_t'
// pszPathIn : LPCWSTR optional -> 'str16'
// pszMore : LPCWSTR optional -> 'str16'
// dwFlags : PATHCCH_OPTIONS -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("api-ms-win-core-path-l1-1-0.dll", {
  PathCchCombineEx: { parameters: ["buffer", "usize", "buffer", "buffer", "u32"], result: "i32" },
});
// lib.symbols.PathCchCombineEx(pszPathOut, cchPathOut, pszPathIn, pszMore, dwFlags)
// pszPathOut : LPWSTR out -> "buffer"
// cchPathOut : UINT_PTR -> "usize"
// pszPathIn : LPCWSTR optional -> "buffer"
// pszMore : LPCWSTR optional -> "buffer"
// dwFlags : PATHCCH_OPTIONS -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t PathCchCombineEx(
    uint16_t* pszPathOut,
    size_t cchPathOut,
    const uint16_t* pszPathIn,
    const uint16_t* pszMore,
    uint32_t dwFlags);
C, "api-ms-win-core-path-l1-1-0.dll");
// $ffi->PathCchCombineEx(pszPathOut, cchPathOut, pszPathIn, pszMore, dwFlags);
// pszPathOut : LPWSTR out
// cchPathOut : UINT_PTR
// pszPathIn : LPCWSTR optional
// pszMore : LPCWSTR optional
// dwFlags : PATHCCH_OPTIONS
// 構造体/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 Api-ms-win-core-path-l1-1-0 extends StdCallLibrary {
    Api-ms-win-core-path-l1-1-0 INSTANCE = Native.load("api-ms-win-core-path-l1-1-0", Api-ms-win-core-path-l1-1-0.class);
    int PathCchCombineEx(
        char[] pszPathOut,   // LPWSTR out
        long cchPathOut,   // UINT_PTR
        WString pszPathIn,   // LPCWSTR optional
        WString pszMore,   // LPCWSTR optional
        int dwFlags   // PATHCCH_OPTIONS
    );
}
@[Link("api-ms-win-core-path-l1-1-0")]
lib Libapi-ms-win-core-path-l1-1-0
  fun PathCchCombineEx = PathCchCombineEx(
    pszPathOut : UInt16*,   # LPWSTR out
    cchPathOut : LibC::SizeT,   # UINT_PTR
    pszPathIn : UInt16*,   # LPCWSTR optional
    pszMore : UInt16*,   # LPCWSTR optional
    dwFlags : UInt32   # PATHCCH_OPTIONS
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef PathCchCombineExNative = Int32 Function(Pointer<Utf16>, UintPtr, Pointer<Utf16>, Pointer<Utf16>, Uint32);
typedef PathCchCombineExDart = int Function(Pointer<Utf16>, int, Pointer<Utf16>, Pointer<Utf16>, int);
final PathCchCombineEx = DynamicLibrary.open('api-ms-win-core-path-l1-1-0.dll')
    .lookupFunction<PathCchCombineExNative, PathCchCombineExDart>('PathCchCombineEx');
// pszPathOut : LPWSTR out -> Pointer<Utf16>
// cchPathOut : UINT_PTR -> UintPtr
// pszPathIn : LPCWSTR optional -> Pointer<Utf16>
// pszMore : LPCWSTR optional -> Pointer<Utf16>
// dwFlags : PATHCCH_OPTIONS -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function PathCchCombineEx(
  pszPathOut: PWideChar;   // LPWSTR out
  cchPathOut: NativeUInt;   // UINT_PTR
  pszPathIn: PWideChar;   // LPCWSTR optional
  pszMore: PWideChar;   // LPCWSTR optional
  dwFlags: DWORD   // PATHCCH_OPTIONS
): Integer; stdcall;
  external 'api-ms-win-core-path-l1-1-0.dll' name 'PathCchCombineEx';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "PathCchCombineEx"
  c_PathCchCombineEx :: CWString -> CUIntPtr -> CWString -> CWString -> Word32 -> IO Int32
-- pszPathOut : LPWSTR out -> CWString
-- cchPathOut : UINT_PTR -> CUIntPtr
-- pszPathIn : LPCWSTR optional -> CWString
-- pszMore : LPCWSTR optional -> CWString
-- dwFlags : PATHCCH_OPTIONS -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let pathcchcombineex =
  foreign "PathCchCombineEx"
    ((ptr uint16_t) @-> size_t @-> (ptr uint16_t) @-> (ptr uint16_t) @-> uint32_t @-> returning int32_t)
(* pszPathOut : LPWSTR out -> (ptr uint16_t) *)
(* cchPathOut : UINT_PTR -> size_t *)
(* pszPathIn : LPCWSTR optional -> (ptr uint16_t) *)
(* pszMore : LPCWSTR optional -> (ptr uint16_t) *)
(* dwFlags : PATHCCH_OPTIONS -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library api-ms-win-core-path-l1-1-0 (t "api-ms-win-core-path-l1-1-0.dll"))
(cffi:use-foreign-library api-ms-win-core-path-l1-1-0)

(cffi:defcfun ("PathCchCombineEx" path-cch-combine-ex :convention :stdcall) :int32
  (psz-path-out :pointer)   ; LPWSTR out
  (cch-path-out :uint64)   ; UINT_PTR
  (psz-path-in (:string :encoding :utf-16le))   ; LPCWSTR optional
  (psz-more (:string :encoding :utf-16le))   ; LPCWSTR optional
  (dw-flags :uint32))   ; PATHCCH_OPTIONS
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $PathCchCombineEx = Win32::API::More->new('api-ms-win-core-path-l1-1-0',
    'int PathCchCombineEx(LPWSTR pszPathOut, WPARAM cchPathOut, LPCWSTR pszPathIn, LPCWSTR pszMore, DWORD dwFlags)');
# my $ret = $PathCchCombineEx->Call($pszPathOut, $cchPathOut, $pszPathIn, $pszMore, $dwFlags);
# pszPathOut : LPWSTR out -> LPWSTR
# cchPathOut : UINT_PTR -> WPARAM
# pszPathIn : LPCWSTR optional -> LPCWSTR
# pszMore : LPCWSTR optional -> LPCWSTR
# dwFlags : PATHCCH_OPTIONS -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

類似 API
公式の関連項目
使用する型