Win32 API 日本語リファレンス
ホームWeb.InternetExplorer › IEGetFileAttributesEx

IEGetFileAttributesEx

関数
IE保護モードでファイルの属性情報を取得する。
DLLIeframe.dll呼出規約winapi

シグネチャ

// Ieframe.dll
#include <windows.h>

BOOL IEGetFileAttributesEx(
    LPCWSTR lpFileName,
    GET_FILEEX_INFO_LEVELS fInfoLevelId,
    void* lpFileInformation
);

パラメーター

名前方向説明
lpFileNameLPCWSTRin属性情報を取得する対象ファイルまたはディレクトリの名前を指す文字列を指定する。
fInfoLevelIdGET_FILEEX_INFO_LEVELSin取得する属性情報のレベルを指定する。GetFileExInfoStandard等の列挙値。
lpFileInformationvoid*in取得した属性情報を受け取るバッファへのポインタを指定する。情報レベルに応じた構造体。

戻り値の型: BOOL

各言語での呼び出し定義

// Ieframe.dll
#include <windows.h>

BOOL IEGetFileAttributesEx(
    LPCWSTR lpFileName,
    GET_FILEEX_INFO_LEVELS fInfoLevelId,
    void* lpFileInformation
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("Ieframe.dll", ExactSpelling = true)]
static extern bool IEGetFileAttributesEx(
    [MarshalAs(UnmanagedType.LPWStr)] string lpFileName,   // LPCWSTR
    int fInfoLevelId,   // GET_FILEEX_INFO_LEVELS
    IntPtr lpFileInformation   // void*
);
<DllImport("Ieframe.dll", ExactSpelling:=True)>
Public Shared Function IEGetFileAttributesEx(
    <MarshalAs(UnmanagedType.LPWStr)> lpFileName As String,   ' LPCWSTR
    fInfoLevelId As Integer,   ' GET_FILEEX_INFO_LEVELS
    lpFileInformation As IntPtr   ' void*
) As Boolean
End Function
' lpFileName : LPCWSTR
' fInfoLevelId : GET_FILEEX_INFO_LEVELS
' lpFileInformation : void*
Declare PtrSafe Function IEGetFileAttributesEx Lib "ieframe" ( _
    ByVal lpFileName As LongPtr, _
    ByVal fInfoLevelId As Long, _
    ByVal lpFileInformation As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

IEGetFileAttributesEx = ctypes.windll.ieframe.IEGetFileAttributesEx
IEGetFileAttributesEx.restype = wintypes.BOOL
IEGetFileAttributesEx.argtypes = [
    wintypes.LPCWSTR,  # lpFileName : LPCWSTR
    ctypes.c_int,  # fInfoLevelId : GET_FILEEX_INFO_LEVELS
    ctypes.POINTER(None),  # lpFileInformation : void*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('Ieframe.dll')
IEGetFileAttributesEx = Fiddle::Function.new(
  lib['IEGetFileAttributesEx'],
  [
    Fiddle::TYPE_VOIDP,  # lpFileName : LPCWSTR
    Fiddle::TYPE_INT,  # fInfoLevelId : GET_FILEEX_INFO_LEVELS
    Fiddle::TYPE_VOIDP,  # lpFileInformation : void*
  ],
  Fiddle::TYPE_INT)
#[link(name = "ieframe")]
extern "system" {
    fn IEGetFileAttributesEx(
        lpFileName: *const u16,  // LPCWSTR
        fInfoLevelId: i32,  // GET_FILEEX_INFO_LEVELS
        lpFileInformation: *mut ()  // void*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("Ieframe.dll")]
public static extern bool IEGetFileAttributesEx([MarshalAs(UnmanagedType.LPWStr)] string lpFileName, int fInfoLevelId, IntPtr lpFileInformation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'Ieframe_IEGetFileAttributesEx' -Namespace Win32 -PassThru
# $api::IEGetFileAttributesEx(lpFileName, fInfoLevelId, lpFileInformation)
#uselib "Ieframe.dll"
#func global IEGetFileAttributesEx "IEGetFileAttributesEx" sptr, sptr, sptr
; IEGetFileAttributesEx lpFileName, fInfoLevelId, lpFileInformation   ; 戻り値は stat
; lpFileName : LPCWSTR -> "sptr"
; fInfoLevelId : GET_FILEEX_INFO_LEVELS -> "sptr"
; lpFileInformation : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "Ieframe.dll"
#cfunc global IEGetFileAttributesEx "IEGetFileAttributesEx" wstr, int, sptr
; res = IEGetFileAttributesEx(lpFileName, fInfoLevelId, lpFileInformation)
; lpFileName : LPCWSTR -> "wstr"
; fInfoLevelId : GET_FILEEX_INFO_LEVELS -> "int"
; lpFileInformation : void* -> "sptr"
; BOOL IEGetFileAttributesEx(LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, void* lpFileInformation)
#uselib "Ieframe.dll"
#cfunc global IEGetFileAttributesEx "IEGetFileAttributesEx" wstr, int, intptr
; res = IEGetFileAttributesEx(lpFileName, fInfoLevelId, lpFileInformation)
; lpFileName : LPCWSTR -> "wstr"
; fInfoLevelId : GET_FILEEX_INFO_LEVELS -> "int"
; lpFileInformation : void* -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	ieframe = windows.NewLazySystemDLL("Ieframe.dll")
	procIEGetFileAttributesEx = ieframe.NewProc("IEGetFileAttributesEx")
)

// lpFileName (LPCWSTR), fInfoLevelId (GET_FILEEX_INFO_LEVELS), lpFileInformation (void*)
r1, _, err := procIEGetFileAttributesEx.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpFileName))),
	uintptr(fInfoLevelId),
	uintptr(lpFileInformation),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function IEGetFileAttributesEx(
  lpFileName: PWideChar;   // LPCWSTR
  fInfoLevelId: Integer;   // GET_FILEEX_INFO_LEVELS
  lpFileInformation: Pointer   // void*
): BOOL; stdcall;
  external 'Ieframe.dll' name 'IEGetFileAttributesEx';
result := DllCall("Ieframe\IEGetFileAttributesEx"
    , "WStr", lpFileName   ; LPCWSTR
    , "Int", fInfoLevelId   ; GET_FILEEX_INFO_LEVELS
    , "Ptr", lpFileInformation   ; void*
    , "Int")   ; return: BOOL
●IEGetFileAttributesEx(lpFileName, fInfoLevelId, lpFileInformation) = DLL("Ieframe.dll", "bool IEGetFileAttributesEx(char*, int, void*)")
# 呼び出し: IEGetFileAttributesEx(lpFileName, fInfoLevelId, lpFileInformation)
# lpFileName : LPCWSTR -> "char*"
# fInfoLevelId : GET_FILEEX_INFO_LEVELS -> "int"
# lpFileInformation : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。