Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

BY_HANDLE_FILE_INFORMATION (Structures)
 
.
Summary

C# Definition:

[StructLayout(LayoutKind.Sequential, Pack=4)]
[StructLayout(LayoutKind.Sequential)]
struct BY_HANDLE_FILE_INFORMATION {
        public uint FileAttributes;
        public FILETIME CreationTime;
        public FILETIME LastAccessTime;
        public FILETIME LastWriteTime;
        public uint VolumeSerialNumber;
        public uint FileSizeHigh;
        public uint FileSizeLow;
        public uint NumberOfLinks;
        public uint FileIndexHigh;
        public uint FileIndexLow;
}

VB Definition:

<StructLayout(LayoutKind.Explicit)> _
Structure BY_HANDLE_FILE_INFORMATION
  <FieldOffset(0)> Public dwFileAttributes As Int32
  <FieldOffset(4)> Public ftCreationTime As Int64         ' FILETIME
  <FieldOffset(12)> Public ftLastAccessTime As Int64      ' FILETIME
  <FieldOffset(20)> Public ftLastWriteTime As Int64       ' FILETIME
  <FieldOffset(28)> Public dwVolumeSerialNumber As Int32
  <FieldOffset(32)> Public nFileSizeHigh As Int32
  <FieldOffset(36)> Public nFileSizeLow As Int32
  <FieldOffset(40)> Public nNumberOfLinks As Int32
  <FieldOffset(44)> Public nFileIndexHigh As Int32
  <FieldOffset(48)> Public nFileIndexLow As Int32
End Structure

F# Definition:

[<Struct>]
[<StructLayout(LayoutKind.Sequential)>]    
type BY_HANDLE_FILE_INFORMATION =

[<Struct>]

[<StructLayout(LayoutKind.Sequential)>]

type BY_HANDLE_FILE_INFORMATION =

    val mutable FileAttributes:UInt32
    val mutable CreationTime:FILETIME
    val mutable LastAccessTime:FILETIME
    val mutable LastWriteTime:FILETIME
    val mutable VolumeSerialNumber:UInt32
    val mutable FileSizeHigh:UInt32
    val mutable FileSizeLow:UInt32
    val mutable NumberOfLinks:UInt32
    val mutable FileIndexHigh:UInt32
    val mutable FileIndexLow:UInt32

User-Defined Field Types:

None.

Notes:

In C# You must remember about alignment!

So,

You can use `Pack': [StructLayout(LayoutKind.Sequential, Pack=4)]

Or, as is in VB example, use:

[StructLayout(LayoutKind.Explicit)]

with [FieldOffset()] for every field of structure.

This is, I think, better way.

Otherwise, You can get strange values in fields after GetFileInformationByHandle - in Win/64

Documentation

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions