ホーム › Storage.FileSystem › GetFileAttributesExFromAppW
GetFileAttributesExFromAppW
関数アプリコンテナからファイルの拡張属性情報を取得する。
シグネチャ
// api-ms-win-core-file-fromapp-l1-1-0.dll
#include <windows.h>
BOOL GetFileAttributesExFromAppW(
LPCWSTR lpFileName,
GET_FILEEX_INFO_LEVELS fInfoLevelId,
void* lpFileInformation
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| lpFileName | LPCWSTR | in |
| fInfoLevelId | GET_FILEEX_INFO_LEVELS | in |
| lpFileInformation | void* | out |
戻り値の型: BOOL
各言語での呼び出し定義
// api-ms-win-core-file-fromapp-l1-1-0.dll
#include <windows.h>
BOOL GetFileAttributesExFromAppW(
LPCWSTR lpFileName,
GET_FILEEX_INFO_LEVELS fInfoLevelId,
void* lpFileInformation
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("api-ms-win-core-file-fromapp-l1-1-0.dll", ExactSpelling = true)]
static extern bool GetFileAttributesExFromAppW(
[MarshalAs(UnmanagedType.LPWStr)] string lpFileName, // LPCWSTR
int fInfoLevelId, // GET_FILEEX_INFO_LEVELS
IntPtr lpFileInformation // void* out
);<DllImport("api-ms-win-core-file-fromapp-l1-1-0.dll", ExactSpelling:=True)>
Public Shared Function GetFileAttributesExFromAppW(
<MarshalAs(UnmanagedType.LPWStr)> lpFileName As String, ' LPCWSTR
fInfoLevelId As Integer, ' GET_FILEEX_INFO_LEVELS
lpFileInformation As IntPtr ' void* out
) As Boolean
End Function' lpFileName : LPCWSTR
' fInfoLevelId : GET_FILEEX_INFO_LEVELS
' lpFileInformation : void* out
Declare PtrSafe Function GetFileAttributesExFromAppW Lib "api-ms-win-core-file-fromapp-l1-1-0" ( _
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
GetFileAttributesExFromAppW = ctypes.windll.LoadLibrary("api-ms-win-core-file-fromapp-l1-1-0.dll").GetFileAttributesExFromAppW
GetFileAttributesExFromAppW.restype = wintypes.BOOL
GetFileAttributesExFromAppW.argtypes = [
wintypes.LPCWSTR, # lpFileName : LPCWSTR
ctypes.c_int, # fInfoLevelId : GET_FILEEX_INFO_LEVELS
ctypes.POINTER(None), # lpFileInformation : void* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('api-ms-win-core-file-fromapp-l1-1-0.dll')
GetFileAttributesExFromAppW = Fiddle::Function.new(
lib['GetFileAttributesExFromAppW'],
[
Fiddle::TYPE_VOIDP, # lpFileName : LPCWSTR
Fiddle::TYPE_INT, # fInfoLevelId : GET_FILEEX_INFO_LEVELS
Fiddle::TYPE_VOIDP, # lpFileInformation : void* out
],
Fiddle::TYPE_INT)#[link(name = "api-ms-win-core-file-fromapp-l1-1-0")]
extern "system" {
fn GetFileAttributesExFromAppW(
lpFileName: *const u16, // LPCWSTR
fInfoLevelId: i32, // GET_FILEEX_INFO_LEVELS
lpFileInformation: *mut () // void* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("api-ms-win-core-file-fromapp-l1-1-0.dll")]
public static extern bool GetFileAttributesExFromAppW([MarshalAs(UnmanagedType.LPWStr)] string lpFileName, int fInfoLevelId, IntPtr lpFileInformation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-core-file-fromapp-l1-1-0_GetFileAttributesExFromAppW' -Namespace Win32 -PassThru
# $api::GetFileAttributesExFromAppW(lpFileName, fInfoLevelId, lpFileInformation)#uselib "api-ms-win-core-file-fromapp-l1-1-0.dll"
#func global GetFileAttributesExFromAppW "GetFileAttributesExFromAppW" sptr, sptr, sptr
; GetFileAttributesExFromAppW lpFileName, fInfoLevelId, lpFileInformation ; 戻り値は stat
; lpFileName : LPCWSTR -> "sptr"
; fInfoLevelId : GET_FILEEX_INFO_LEVELS -> "sptr"
; lpFileInformation : void* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "api-ms-win-core-file-fromapp-l1-1-0.dll"
#cfunc global GetFileAttributesExFromAppW "GetFileAttributesExFromAppW" wstr, int, sptr
; res = GetFileAttributesExFromAppW(lpFileName, fInfoLevelId, lpFileInformation)
; lpFileName : LPCWSTR -> "wstr"
; fInfoLevelId : GET_FILEEX_INFO_LEVELS -> "int"
; lpFileInformation : void* out -> "sptr"; BOOL GetFileAttributesExFromAppW(LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, void* lpFileInformation)
#uselib "api-ms-win-core-file-fromapp-l1-1-0.dll"
#cfunc global GetFileAttributesExFromAppW "GetFileAttributesExFromAppW" wstr, int, intptr
; res = GetFileAttributesExFromAppW(lpFileName, fInfoLevelId, lpFileInformation)
; lpFileName : LPCWSTR -> "wstr"
; fInfoLevelId : GET_FILEEX_INFO_LEVELS -> "int"
; lpFileInformation : void* out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
api_ms_win_core_file_fromapp_l1_1_0 = windows.NewLazySystemDLL("api-ms-win-core-file-fromapp-l1-1-0.dll")
procGetFileAttributesExFromAppW = api_ms_win_core_file_fromapp_l1_1_0.NewProc("GetFileAttributesExFromAppW")
)
// lpFileName (LPCWSTR), fInfoLevelId (GET_FILEEX_INFO_LEVELS), lpFileInformation (void* out)
r1, _, err := procGetFileAttributesExFromAppW.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpFileName))),
uintptr(fInfoLevelId),
uintptr(lpFileInformation),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GetFileAttributesExFromAppW(
lpFileName: PWideChar; // LPCWSTR
fInfoLevelId: Integer; // GET_FILEEX_INFO_LEVELS
lpFileInformation: Pointer // void* out
): BOOL; stdcall;
external 'api-ms-win-core-file-fromapp-l1-1-0.dll' name 'GetFileAttributesExFromAppW';result := DllCall("api-ms-win-core-file-fromapp-l1-1-0\GetFileAttributesExFromAppW"
, "WStr", lpFileName ; LPCWSTR
, "Int", fInfoLevelId ; GET_FILEEX_INFO_LEVELS
, "Ptr", lpFileInformation ; void* out
, "Int") ; return: BOOL●GetFileAttributesExFromAppW(lpFileName, fInfoLevelId, lpFileInformation) = DLL("api-ms-win-core-file-fromapp-l1-1-0.dll", "bool GetFileAttributesExFromAppW(char*, int, void*)")
# 呼び出し: GetFileAttributesExFromAppW(lpFileName, fInfoLevelId, lpFileInformation)
# lpFileName : LPCWSTR -> "char*"
# fInfoLevelId : GET_FILEEX_INFO_LEVELS -> "int"
# lpFileInformation : void* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。