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

CreateDirectoryTransactedA

関数
トランザクション内でディレクトリを作成する(ANSI版)。
DLLKERNEL32.dll文字セットANSI (-A)呼出規約winapiSetLastErrorあり対応OSWindows Vista 以降

シグネチャ

// KERNEL32.dll  (ANSI / -A)
#include <windows.h>

BOOL CreateDirectoryTransactedA(
    LPCSTR lpTemplateDirectory,   // optional
    LPCSTR lpNewDirectory,
    SECURITY_ATTRIBUTES* lpSecurityAttributes,   // optional
    HANDLE hTransaction
);

パラメーター

名前方向説明
lpTemplateDirectoryLPCSTRinoptional

新しいディレクトリを作成する際にテンプレートとして使用するディレクトリのパス。このパラメーターには NULL を指定できます。

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

ヒント

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

ディレクトリはローカルコンピューター上に存在する必要があります。そうでない場合、関数は失敗し、最終エラーコードは ERROR_TRANSACTIONS_UNSUPPORTED_REMOTE に設定されます。

lpNewDirectoryLPCSTRin

作成するディレクトリのパス。

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

ヒント

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

lpSecurityAttributesSECURITY_ATTRIBUTES*inoptional

SECURITY_ATTRIBUTES 構造体へのポインター。構造体の lpSecurityDescriptor メンバーは、新しいディレクトリのセキュリティ 記述子を指定します。

lpSecurityAttributesNULL の場合、ディレクトリには 既定のセキュリティ記述子が割り当てられます。ディレクトリの既定のセキュリティ記述子内のアクセス制御リスト (ACL) は その親ディレクトリから継承されます。

このパラメーターが効果を持つには、対象のファイルシステムがファイルおよびディレクトリのセキュリティをサポートしている必要があります。 これは、GetVolumeInformationFS_PERSISTENT_ACLS を返すことで示されます。

hTransactionHANDLEinトランザクションへのハンドル。このハンドルは CreateTransaction 関数によって返されます。

戻り値の型: BOOL

公式ドキュメント

指定したテンプレートディレクトリの属性を使用して、新しいディレクトリをトランザクション操作として作成します。(ANSI)

戻り値

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

関数が失敗した場合、戻り値は 0 です。拡張エラー情報を取得するには、 GetLastError を呼び出します。発生し得るエラーには 次のものが含まれます。

Return code Description
ERROR_ALREADY_EXISTS
指定したディレクトリは既に存在します。
ERROR_EFS_NOT_ALLOWED_IN_TRANSACTION
暗号化が無効になっている親ディレクトリの下に子ディレクトリを作成することはできません。
ERROR_PATH_NOT_FOUND
1 つ以上の中間ディレクトリが存在しません。この関数はパス内の最終ディレクトリのみを作成します。

解説(Remarks)

CreateDirectoryTransacted 関数を使用すると、 他のディレクトリからストリーム情報を継承するディレクトリを作成できます。この関数は、 たとえば、ディレクトリの内容を属性として正しく識別するために必要なリソースストリームを持つ Macintosh ディレクトリを 使用している場合に役立ちます。

NTFS ファイルシステムなどの一部のファイルシステムは、個々のファイルおよび ディレクトリの圧縮または暗号化をサポートします。このようなファイルシステム向けにフォーマットされたボリュームでは、新しいディレクトリは その親ディレクトリの圧縮および暗号化属性を継承します。

暗号化が無効になっている親ディレクトリの下に子ディレクトリを作成しようとすると、 この関数は ERROR_EFS_NOT_ALLOWED_IN_TRANSACTION で失敗します。

ディレクトリへのハンドルは、 FILE_FLAG_BACKUP_SEMANTICS フラグを設定して CreateFileTransacted 関数を呼び出すことで取得できます。

Windows 8 および Windows Server 2012 では、この関数は次の技術によってサポートされます。

Technology Supported
Server Message Block (SMB) 3.0 protocol No
SMB 3.0 Transparent Failover (TFO) No
SMB 3.0 with Scale-out File Shares (SO) No
Cluster Shared Volume File System (CsvFS) No
Resilient File System (ReFS) No

SMB 3.0 は TxF をサポートしません。

メモ

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

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

各言語での呼び出し定義

// KERNEL32.dll  (ANSI / -A)
#include <windows.h>

BOOL CreateDirectoryTransactedA(
    LPCSTR lpTemplateDirectory,   // optional
    LPCSTR lpNewDirectory,
    SECURITY_ATTRIBUTES* lpSecurityAttributes,   // optional
    HANDLE hTransaction
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool CreateDirectoryTransactedA(
    [MarshalAs(UnmanagedType.LPStr)] string lpTemplateDirectory,   // LPCSTR optional
    [MarshalAs(UnmanagedType.LPStr)] string lpNewDirectory,   // LPCSTR
    IntPtr lpSecurityAttributes,   // SECURITY_ATTRIBUTES* optional
    IntPtr hTransaction   // HANDLE
);
<DllImport("KERNEL32.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CreateDirectoryTransactedA(
    <MarshalAs(UnmanagedType.LPStr)> lpTemplateDirectory As String,   ' LPCSTR optional
    <MarshalAs(UnmanagedType.LPStr)> lpNewDirectory As String,   ' LPCSTR
    lpSecurityAttributes As IntPtr,   ' SECURITY_ATTRIBUTES* optional
    hTransaction As IntPtr   ' HANDLE
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
' lpTemplateDirectory : LPCSTR optional
' lpNewDirectory : LPCSTR
' lpSecurityAttributes : SECURITY_ATTRIBUTES* optional
' hTransaction : HANDLE
Declare PtrSafe Function CreateDirectoryTransactedA Lib "kernel32" ( _
    ByVal lpTemplateDirectory As String, _
    ByVal lpNewDirectory As String, _
    ByVal lpSecurityAttributes As LongPtr, _
    ByVal hTransaction As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CreateDirectoryTransactedA = ctypes.windll.kernel32.CreateDirectoryTransactedA
CreateDirectoryTransactedA.restype = wintypes.BOOL
CreateDirectoryTransactedA.argtypes = [
    wintypes.LPCSTR,  # lpTemplateDirectory : LPCSTR optional
    wintypes.LPCSTR,  # lpNewDirectory : LPCSTR
    ctypes.c_void_p,  # lpSecurityAttributes : SECURITY_ATTRIBUTES* optional
    wintypes.HANDLE,  # hTransaction : HANDLE
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('KERNEL32.dll')
CreateDirectoryTransactedA = Fiddle::Function.new(
  lib['CreateDirectoryTransactedA'],
  [
    Fiddle::TYPE_VOIDP,  # lpTemplateDirectory : LPCSTR optional
    Fiddle::TYPE_VOIDP,  # lpNewDirectory : LPCSTR
    Fiddle::TYPE_VOIDP,  # lpSecurityAttributes : SECURITY_ATTRIBUTES* optional
    Fiddle::TYPE_VOIDP,  # hTransaction : HANDLE
  ],
  Fiddle::TYPE_INT)
#[link(name = "kernel32")]
extern "system" {
    fn CreateDirectoryTransactedA(
        lpTemplateDirectory: *const u8,  // LPCSTR optional
        lpNewDirectory: *const u8,  // LPCSTR
        lpSecurityAttributes: *mut SECURITY_ATTRIBUTES,  // SECURITY_ATTRIBUTES* optional
        hTransaction: *mut core::ffi::c_void  // HANDLE
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool CreateDirectoryTransactedA([MarshalAs(UnmanagedType.LPStr)] string lpTemplateDirectory, [MarshalAs(UnmanagedType.LPStr)] string lpNewDirectory, IntPtr lpSecurityAttributes, IntPtr hTransaction);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_CreateDirectoryTransactedA' -Namespace Win32 -PassThru
# $api::CreateDirectoryTransactedA(lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes, hTransaction)
#uselib "KERNEL32.dll"
#func global CreateDirectoryTransactedA "CreateDirectoryTransactedA" sptr, sptr, sptr, sptr
; CreateDirectoryTransactedA lpTemplateDirectory, lpNewDirectory, varptr(lpSecurityAttributes), hTransaction   ; 戻り値は stat
; lpTemplateDirectory : LPCSTR optional -> "sptr"
; lpNewDirectory : LPCSTR -> "sptr"
; lpSecurityAttributes : SECURITY_ATTRIBUTES* optional -> "sptr"
; hTransaction : HANDLE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "KERNEL32.dll"
#cfunc global CreateDirectoryTransactedA "CreateDirectoryTransactedA" str, str, var, sptr
; res = CreateDirectoryTransactedA(lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes, hTransaction)
; lpTemplateDirectory : LPCSTR optional -> "str"
; lpNewDirectory : LPCSTR -> "str"
; lpSecurityAttributes : SECURITY_ATTRIBUTES* optional -> "var"
; hTransaction : HANDLE -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL CreateDirectoryTransactedA(LPCSTR lpTemplateDirectory, LPCSTR lpNewDirectory, SECURITY_ATTRIBUTES* lpSecurityAttributes, HANDLE hTransaction)
#uselib "KERNEL32.dll"
#cfunc global CreateDirectoryTransactedA "CreateDirectoryTransactedA" str, str, var, intptr
; res = CreateDirectoryTransactedA(lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes, hTransaction)
; lpTemplateDirectory : LPCSTR optional -> "str"
; lpNewDirectory : LPCSTR -> "str"
; lpSecurityAttributes : SECURITY_ATTRIBUTES* optional -> "var"
; hTransaction : HANDLE -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procCreateDirectoryTransactedA = kernel32.NewProc("CreateDirectoryTransactedA")
)

// lpTemplateDirectory (LPCSTR optional), lpNewDirectory (LPCSTR), lpSecurityAttributes (SECURITY_ATTRIBUTES* optional), hTransaction (HANDLE)
r1, _, err := procCreateDirectoryTransactedA.Call(
	uintptr(unsafe.Pointer(windows.BytePtrFromString(lpTemplateDirectory))),
	uintptr(unsafe.Pointer(windows.BytePtrFromString(lpNewDirectory))),
	uintptr(lpSecurityAttributes),
	uintptr(hTransaction),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function CreateDirectoryTransactedA(
  lpTemplateDirectory: PAnsiChar;   // LPCSTR optional
  lpNewDirectory: PAnsiChar;   // LPCSTR
  lpSecurityAttributes: Pointer;   // SECURITY_ATTRIBUTES* optional
  hTransaction: THandle   // HANDLE
): BOOL; stdcall;
  external 'KERNEL32.dll' name 'CreateDirectoryTransactedA';
result := DllCall("KERNEL32\CreateDirectoryTransactedA"
    , "AStr", lpTemplateDirectory   ; LPCSTR optional
    , "AStr", lpNewDirectory   ; LPCSTR
    , "Ptr", lpSecurityAttributes   ; SECURITY_ATTRIBUTES* optional
    , "Ptr", hTransaction   ; HANDLE
    , "Int")   ; return: BOOL
●CreateDirectoryTransactedA(lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes, hTransaction) = DLL("KERNEL32.dll", "bool CreateDirectoryTransactedA(char*, char*, void*, void*)")
# 呼び出し: CreateDirectoryTransactedA(lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes, hTransaction)
# lpTemplateDirectory : LPCSTR optional -> "char*"
# lpNewDirectory : LPCSTR -> "char*"
# lpSecurityAttributes : SECURITY_ATTRIBUTES* optional -> "void*"
# hTransaction : HANDLE -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "kernel32" fn CreateDirectoryTransactedA(
    lpTemplateDirectory: [*c]const u8, // LPCSTR optional
    lpNewDirectory: [*c]const u8, // LPCSTR
    lpSecurityAttributes: [*c]SECURITY_ATTRIBUTES, // SECURITY_ATTRIBUTES* optional
    hTransaction: ?*anyopaque // HANDLE
) callconv(std.os.windows.WINAPI) i32;
proc CreateDirectoryTransactedA(
    lpTemplateDirectory: cstring,  # LPCSTR optional
    lpNewDirectory: cstring,  # LPCSTR
    lpSecurityAttributes: ptr SECURITY_ATTRIBUTES,  # SECURITY_ATTRIBUTES* optional
    hTransaction: pointer  # HANDLE
): int32 {.importc: "CreateDirectoryTransactedA", stdcall, dynlib: "KERNEL32.dll".}
pragma(lib, "kernel32");
extern(Windows)
int CreateDirectoryTransactedA(
    const(char)* lpTemplateDirectory,   // LPCSTR optional
    const(char)* lpNewDirectory,   // LPCSTR
    SECURITY_ATTRIBUTES* lpSecurityAttributes,   // SECURITY_ATTRIBUTES* optional
    void* hTransaction   // HANDLE
);
ccall((:CreateDirectoryTransactedA, "KERNEL32.dll"), stdcall, Int32,
      (Cstring, Cstring, Ptr{SECURITY_ATTRIBUTES}, Ptr{Cvoid}),
      lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes, hTransaction)
# lpTemplateDirectory : LPCSTR optional -> Cstring
# lpNewDirectory : LPCSTR -> Cstring
# lpSecurityAttributes : SECURITY_ATTRIBUTES* optional -> Ptr{SECURITY_ATTRIBUTES}
# hTransaction : HANDLE -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t CreateDirectoryTransactedA(
    const char* lpTemplateDirectory,
    const char* lpNewDirectory,
    void* lpSecurityAttributes,
    void* hTransaction);
]]
local kernel32 = ffi.load("kernel32")
-- kernel32.CreateDirectoryTransactedA(lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes, hTransaction)
-- lpTemplateDirectory : LPCSTR optional
-- lpNewDirectory : LPCSTR
-- lpSecurityAttributes : SECURITY_ATTRIBUTES* optional
-- hTransaction : HANDLE
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('KERNEL32.dll');
const CreateDirectoryTransactedA = lib.func('__stdcall', 'CreateDirectoryTransactedA', 'int32_t', ['str', 'str', 'void *', 'void *']);
// CreateDirectoryTransactedA(lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes, hTransaction)
// lpTemplateDirectory : LPCSTR optional -> 'str'
// lpNewDirectory : LPCSTR -> 'str'
// lpSecurityAttributes : SECURITY_ATTRIBUTES* optional -> 'void *'
// hTransaction : HANDLE -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("KERNEL32.dll", {
  CreateDirectoryTransactedA: { parameters: ["buffer", "buffer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.CreateDirectoryTransactedA(lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes, hTransaction)
// lpTemplateDirectory : LPCSTR optional -> "buffer"
// lpNewDirectory : LPCSTR -> "buffer"
// lpSecurityAttributes : SECURITY_ATTRIBUTES* optional -> "pointer"
// hTransaction : HANDLE -> "pointer"
// 文字列は "buffer"。ANSI(-A) は new TextEncoder() で UTF-8/ANSI バイト列(末尾に \x00)を渡す。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t CreateDirectoryTransactedA(
    const char* lpTemplateDirectory,
    const char* lpNewDirectory,
    void* lpSecurityAttributes,
    void* hTransaction);
C, "KERNEL32.dll");
// $ffi->CreateDirectoryTransactedA(lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes, hTransaction);
// lpTemplateDirectory : LPCSTR optional
// lpNewDirectory : LPCSTR
// lpSecurityAttributes : SECURITY_ATTRIBUTES* optional
// hTransaction : HANDLE
// 構造体/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.ASCII_OPTIONS);
    boolean CreateDirectoryTransactedA(
        String lpTemplateDirectory,   // LPCSTR optional
        String lpNewDirectory,   // LPCSTR
        Pointer lpSecurityAttributes,   // SECURITY_ATTRIBUTES* optional
        Pointer hTransaction   // HANDLE
    );
}
@[Link("kernel32")]
lib LibKERNEL32
  fun CreateDirectoryTransactedA = CreateDirectoryTransactedA(
    lpTemplateDirectory : UInt8*,   # LPCSTR optional
    lpNewDirectory : UInt8*,   # LPCSTR
    lpSecurityAttributes : SECURITY_ATTRIBUTES*,   # SECURITY_ATTRIBUTES* optional
    hTransaction : Void*   # HANDLE
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef CreateDirectoryTransactedANative = Int32 Function(Pointer<Utf8>, Pointer<Utf8>, Pointer<Void>, Pointer<Void>);
typedef CreateDirectoryTransactedADart = int Function(Pointer<Utf8>, Pointer<Utf8>, Pointer<Void>, Pointer<Void>);
final CreateDirectoryTransactedA = DynamicLibrary.open('KERNEL32.dll')
    .lookupFunction<CreateDirectoryTransactedANative, CreateDirectoryTransactedADart>('CreateDirectoryTransactedA');
// lpTemplateDirectory : LPCSTR optional -> Pointer<Utf8>
// lpNewDirectory : LPCSTR -> Pointer<Utf8>
// lpSecurityAttributes : SECURITY_ATTRIBUTES* optional -> Pointer<Void>
// hTransaction : HANDLE -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function CreateDirectoryTransactedA(
  lpTemplateDirectory: PAnsiChar;   // LPCSTR optional
  lpNewDirectory: PAnsiChar;   // LPCSTR
  lpSecurityAttributes: Pointer;   // SECURITY_ATTRIBUTES* optional
  hTransaction: THandle   // HANDLE
): BOOL; stdcall;
  external 'KERNEL32.dll' name 'CreateDirectoryTransactedA';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "CreateDirectoryTransactedA"
  c_CreateDirectoryTransactedA :: CString -> CString -> Ptr () -> Ptr () -> IO CInt
-- lpTemplateDirectory : LPCSTR optional -> CString
-- lpNewDirectory : LPCSTR -> CString
-- lpSecurityAttributes : SECURITY_ATTRIBUTES* optional -> Ptr ()
-- hTransaction : HANDLE -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let createdirectorytransacteda =
  foreign "CreateDirectoryTransactedA"
    (string @-> string @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* lpTemplateDirectory : LPCSTR optional -> string *)
(* lpNewDirectory : LPCSTR -> string *)
(* lpSecurityAttributes : SECURITY_ATTRIBUTES* optional -> (ptr void) *)
(* hTransaction : HANDLE -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library kernel32 (t "KERNEL32.dll"))
(cffi:use-foreign-library kernel32)

(cffi:defcfun ("CreateDirectoryTransactedA" create-directory-transacted-a :convention :stdcall) :int32
  (lp-template-directory :string)   ; LPCSTR optional
  (lp-new-directory :string)   ; LPCSTR
  (lp-security-attributes :pointer)   ; SECURITY_ATTRIBUTES* optional
  (h-transaction :pointer))   ; HANDLE
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $CreateDirectoryTransactedA = Win32::API::More->new('KERNEL32',
    'BOOL CreateDirectoryTransactedA(LPCSTR lpTemplateDirectory, LPCSTR lpNewDirectory, LPVOID lpSecurityAttributes, HANDLE hTransaction)');
# my $ret = $CreateDirectoryTransactedA->Call($lpTemplateDirectory, $lpNewDirectory, $lpSecurityAttributes, $hTransaction);
# lpTemplateDirectory : LPCSTR optional -> LPCSTR
# lpNewDirectory : LPCSTR -> LPCSTR
# lpSecurityAttributes : SECURITY_ATTRIBUTES* optional -> LPVOID
# hTransaction : HANDLE -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

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