ホーム › Web.InternetExplorer › IECreateDirectory
IECreateDirectory
関数IE保護モードでディレクトリを作成する。
シグネチャ
// Ieframe.dll
#include <windows.h>
BOOL IECreateDirectory(
LPCWSTR lpPathName,
SECURITY_ATTRIBUTES* lpSecurityAttributes
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| lpPathName | LPCWSTR | in | 作成するディレクトリのパスを指す文字列を指定する。 |
| lpSecurityAttributes | SECURITY_ATTRIBUTES* | in | ディレクトリのセキュリティ記述子を持つSECURITY_ATTRIBUTES構造体へのポインタ。NULL可。 |
戻り値の型: BOOL
各言語での呼び出し定義
// Ieframe.dll
#include <windows.h>
BOOL IECreateDirectory(
LPCWSTR lpPathName,
SECURITY_ATTRIBUTES* lpSecurityAttributes
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("Ieframe.dll", ExactSpelling = true)]
static extern bool IECreateDirectory(
[MarshalAs(UnmanagedType.LPWStr)] string lpPathName, // LPCWSTR
IntPtr lpSecurityAttributes // SECURITY_ATTRIBUTES*
);<DllImport("Ieframe.dll", ExactSpelling:=True)>
Public Shared Function IECreateDirectory(
<MarshalAs(UnmanagedType.LPWStr)> lpPathName As String, ' LPCWSTR
lpSecurityAttributes As IntPtr ' SECURITY_ATTRIBUTES*
) As Boolean
End Function' lpPathName : LPCWSTR
' lpSecurityAttributes : SECURITY_ATTRIBUTES*
Declare PtrSafe Function IECreateDirectory Lib "ieframe" ( _
ByVal lpPathName As LongPtr, _
ByVal lpSecurityAttributes As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
IECreateDirectory = ctypes.windll.ieframe.IECreateDirectory
IECreateDirectory.restype = wintypes.BOOL
IECreateDirectory.argtypes = [
wintypes.LPCWSTR, # lpPathName : LPCWSTR
ctypes.c_void_p, # lpSecurityAttributes : SECURITY_ATTRIBUTES*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('Ieframe.dll')
IECreateDirectory = Fiddle::Function.new(
lib['IECreateDirectory'],
[
Fiddle::TYPE_VOIDP, # lpPathName : LPCWSTR
Fiddle::TYPE_VOIDP, # lpSecurityAttributes : SECURITY_ATTRIBUTES*
],
Fiddle::TYPE_INT)#[link(name = "ieframe")]
extern "system" {
fn IECreateDirectory(
lpPathName: *const u16, // LPCWSTR
lpSecurityAttributes: *mut SECURITY_ATTRIBUTES // SECURITY_ATTRIBUTES*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("Ieframe.dll")]
public static extern bool IECreateDirectory([MarshalAs(UnmanagedType.LPWStr)] string lpPathName, IntPtr lpSecurityAttributes);
"@
$api = Add-Type -MemberDefinition $sig -Name 'Ieframe_IECreateDirectory' -Namespace Win32 -PassThru
# $api::IECreateDirectory(lpPathName, lpSecurityAttributes)#uselib "Ieframe.dll"
#func global IECreateDirectory "IECreateDirectory" sptr, sptr
; IECreateDirectory lpPathName, varptr(lpSecurityAttributes) ; 戻り値は stat
; lpPathName : LPCWSTR -> "sptr"
; lpSecurityAttributes : SECURITY_ATTRIBUTES* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "Ieframe.dll" #cfunc global IECreateDirectory "IECreateDirectory" wstr, var ; res = IECreateDirectory(lpPathName, lpSecurityAttributes) ; lpPathName : LPCWSTR -> "wstr" ; lpSecurityAttributes : SECURITY_ATTRIBUTES* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "Ieframe.dll" #cfunc global IECreateDirectory "IECreateDirectory" wstr, sptr ; res = IECreateDirectory(lpPathName, varptr(lpSecurityAttributes)) ; lpPathName : LPCWSTR -> "wstr" ; lpSecurityAttributes : SECURITY_ATTRIBUTES* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL IECreateDirectory(LPCWSTR lpPathName, SECURITY_ATTRIBUTES* lpSecurityAttributes) #uselib "Ieframe.dll" #cfunc global IECreateDirectory "IECreateDirectory" wstr, var ; res = IECreateDirectory(lpPathName, lpSecurityAttributes) ; lpPathName : LPCWSTR -> "wstr" ; lpSecurityAttributes : SECURITY_ATTRIBUTES* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL IECreateDirectory(LPCWSTR lpPathName, SECURITY_ATTRIBUTES* lpSecurityAttributes) #uselib "Ieframe.dll" #cfunc global IECreateDirectory "IECreateDirectory" wstr, intptr ; res = IECreateDirectory(lpPathName, varptr(lpSecurityAttributes)) ; lpPathName : LPCWSTR -> "wstr" ; lpSecurityAttributes : SECURITY_ATTRIBUTES* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ieframe = windows.NewLazySystemDLL("Ieframe.dll")
procIECreateDirectory = ieframe.NewProc("IECreateDirectory")
)
// lpPathName (LPCWSTR), lpSecurityAttributes (SECURITY_ATTRIBUTES*)
r1, _, err := procIECreateDirectory.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpPathName))),
uintptr(lpSecurityAttributes),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction IECreateDirectory(
lpPathName: PWideChar; // LPCWSTR
lpSecurityAttributes: Pointer // SECURITY_ATTRIBUTES*
): BOOL; stdcall;
external 'Ieframe.dll' name 'IECreateDirectory';result := DllCall("Ieframe\IECreateDirectory"
, "WStr", lpPathName ; LPCWSTR
, "Ptr", lpSecurityAttributes ; SECURITY_ATTRIBUTES*
, "Int") ; return: BOOL●IECreateDirectory(lpPathName, lpSecurityAttributes) = DLL("Ieframe.dll", "bool IECreateDirectory(char*, void*)")
# 呼び出し: IECreateDirectory(lpPathName, lpSecurityAttributes)
# lpPathName : LPCWSTR -> "char*"
# lpSecurityAttributes : SECURITY_ATTRIBUTES* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。