Desktop Functions: Smart Device Functions:
|
Search Results for "FileAttributes" in [All]shell32
public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbFileInfo, uint uFlags);
ByVal dwFileAttributes As Integer, _
int dwFileAttributes,
UseFileAttributes= 0x000000010,
flags = SHGFI.Icon|SHGFI.SmallIcon|SHGFI.UseFileAttributes;
flags = SHGFI.Icon|SHGFI.LargeIcon|SHGFI.UseFileAttributes;
public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags);
USEFILEATTRIBUTES = &H10 Structures
public uint FileAttributes;
<FieldOffset(0)> Public dwFileAttributes As Int32
val mutable FileAttributes:UInt32
public UInt32 dwFileAttributes;
Public dwFileAttributes As UInt32
public uint FileAttributes;
EFileAttributes dwFlagsAndAttributes,
, EFileAttributes.BackupSemantics | EFileAttributes.OpenReparsePoint 7: USN_RECORD
public UInt32 FileAttributes;
<FieldOffset(52)> Public FileAttributes As Integer 'DWORD FileAttributes;
public UInt32 FileAttributes;
public uint dwFileAttributes;
Public dwFileAttributes As UInteger
Public dwFileAttributes As Integer kernel3210: DeviceIoControl
IntPtr.Zero, FileMode.Open, FileAttributes.Normal, IntPtr.Zero); 11: FindFirstFile
if ((findData.dwFileAttributes & FileAttributes.Directory) != FileAttributes.Directory) 12: FindFirstFileEx
if ((findData.dwFileAttributes & FileAttributes.Directory) != FileAttributes.Directory)
static extern bool GetFileAttributesEx(string lpFileName,
static extern bool GetFileAttributesEx(string lpFileName,
public static bool GetFileAttributesEx(string lpFileName, out WIN32_FILE_ATTRIBUTE_DATA fileData) {
return GetFileAttributesEx(lpFileName, GET_FILEEX_INFO_LEVELS.GetFileExInfoStandard, if (GetFileAttributesEx(path, GET_FILEEX_INFO_LEVELS.GetFileExInfoStandard, out fileData)){
static extern bool GetFileAttributesEx(string lpFileName,
static extern bool GetFileAttributesEx(string lpFileName,
public static bool GetFileAttributesEx(string lpFileName, out WIN32_FILE_ATTRIBUTE_DATA fileData) {
return GetFileAttributesEx(lpFileName, GET_FILEEX_INFO_LEVELS.GetFileExInfoStandard, if (GetFileAttributesEx(path, GET_FILEEX_INFO_LEVELS.GetFileExInfoStandard, out fileData))
static extern bool SetFileAttributes(string lpFileName, uint dwFileAttributes);
static extern bool SetFileAttributes(
[MarshalAs(UnmanagedType.U4)] FileAttributes dwFileAttributes); You can create this FileAttributes type to go in your class and be used with the alternative signature if you wish (or you can use the System.IO.FileAttributes as displayed in the below example):
[Flags] public enum FileAttributes : uint
SetFileAttributes("pathname", FileAttributes.System | FileAttributes.Hidden | FileAttributes.Archive);
private static extern bool SetFileAttributesW(string lpFileName, FileAttributes dwFileAttributes);
public static void SetFileAttributes(String path, FileAttributes dwFileAttributeFlags)
if (!SetFileAttributesW(UnicodeHeader + path, dwFileAttributeFlags)) System.IO.File.SetAttributes(String path, System.IO.FileAttributes fileAttributes);
public UInt32 FileAttributes; 17: WaitCommEvent
ByRef lpOverlap As EFileAttributes) As Int32 Constants19: PROPERTYKEY
public static PropertyKey PKEY_FileAttributes = new PropertyKey( 0xB725F130, 0x47EF, 0x101A, 0xA5, 0xF1, 0x02, 0x60, 0x8C, 0x9E, 0xEB, 0xAC, 13); 20: ShellAPI
public const int SHGFI_USEFILEATTRIBUTES = 0x000000010; // use passed dwFileAttribute 21: ShellAPI
public const int SHGFI_USEFILEATTRIBUTES = 0x000000010; // use passed dwFileAttribute shlwapi
[In] FileAttributes dwAttrFrom,
[In] FileAttributes dwAttrTo
@"c:\a\b\path", FileAttributes.Directory,
@"c:\a\x\y\file", FileAttributes.Normal rapi
public static extern int CeSetFileAttributes(string lpPathName, System.IO.FileAttributes dwAttributes);
Declare Function CeSetFileAttributes Lib "rapi.dll" (TODO) As TODO Microsoft doc link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceactsy/html/cerefCeSetFileAttributesRAPI.asp 24: CE_FIND_DATA
[FieldOffset( 0)] public uint dwFileAttributes;
Public dwFileAttributes As Integer Enums25: FileAttributes
enum FileAttributes : uint
Enum FileAttributes As UInteger System.IO.FileAttributes 26: FileInfoFlags
SHGFI_USEFILEATTRIBUTES = 0x000000010, // use passed dwFileAttribute 28: SHGFI
SHGFI_USEFILEATTRIBUTES = 0x000000010,
SHGFI_USEFILEATTRIBUTES = &H10 ntdll29: NtCreateFile
public static extern int NtCreateFile(out SafeFileHandle handle, FileAccess access, OBJECT_ATTRIBUTES* objectAttributes, IO_STATUS_BLOCK* ioStatus, ref long allocSize, uint fileAttributes, FileShare share, uint createDisposition, uint createOptions, IntPtr eaBuffer, uint eaLength);
uint fileAttributes, using System.Collections.Generic; // for ParseFileAttributes helper function (List<FileAttributes>
internal ulong FileAttributes;
public static List<FileAttributes> ParseFileAttributes(ulong fileAttributes) {
List<FileAttributes> listOfFileAttributesPresent = new List<FileAttributes>();
FileAttributes[] allPossibleValues = new FileAttributes[] { // per definition of FileAttributes
FileAttributes.ReadOnly,
FileAttributes.Hidden,
FileAttributes.System,
FileAttributes.Directory,
FileAttributes.Archive,
FileAttributes.Device,
FileAttributes.Normal,
FileAttributes.Temporary,
FileAttributes.SparseFile,
FileAttributes.ReparsePoint,
FileAttributes.Compressed,
FileAttributes.Offline,
FileAttributes.NotContentIndexed,
FileAttributes.Encrypted,
foreach(FileAttributes currentFileAttribute in allPossibleValues) {
if((fileAttributes & (ulong)currentFileAttribute) != 0) {
listOfFileAttributesPresent.Add(currentFileAttribute);
return listOfFileAttributesPresent;
out DateTime creationTime, out DateTime lastAccessTime, out DateTime lastWriteTime, out DateTime changeTime, out ulong fileAttributes, out string errMsg) {
fileAttributes = 0;
fileAttributes = fbi.FileAttributes;
FileAttributes fileAttributesBefore = File.GetAttributes(path2file);
Trace.Write("fileAttributesBefore=");
foreach(FileAttributes fa1 in Nt.ParseFileAttributes((ulong)fileAttributesBefore)) {
File.SetAttributes(path2file, FileAttributes.Normal);
ulong fileAttributesAfter;
brc = Nt.GetFourFileTimes(path2file, out creationTime, out lastAccessTime, out lastWriteTime, out changeTime, out fileAttributesAfter, out errMsg);
Trace.Write("fileAttributesAfter=");
foreach(FileAttributes fa1 in Nt.ParseFileAttributes(fileAttributesAfter)) {
//fileAttributesBefore=Archive
//fileAttributesAfter=Normal |