WIN32_FIND_DATA (Structures)
Last changed: -62.91.108.152

.
Summary

C# Definition:

// The CharSet must match the CharSet of the
// corresponding PInvoke signature
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
struct WIN32_FIND_DATA{
    public uint dwFileAttributes;
    public FILETIME ftCreationTime;
    public FILETIME ftLastAccessTime;
    public FILETIME ftLastWriteTime;
    public uint nFileSizeHigh;
    public uint nFileSizeLow;
    public uint dwReserved0;
    public uint dwReserved1;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst=260)]
    public string cFileName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst=14)]
    public string cAlternateFileName;
}

VB Definition:

    <Serializable(), StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> _
    Structure WIN32_FIND_DATA
    Public dwFileAttributes As Integer
    Public ftCreationTime As FILETIME
    Public ftLastAccessTime As FILETIME
    Public ftLastWriteTime As FILETIME
    Public nFileSizeHigh As Integer
    Public nFileSizeLow As Integer
    Public dwReserved0 As Integer
    Public dwReserved1 As Integer
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> _
      Public cFileName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=14)> _
        Public cAlternate As String
    End Structure

User-Defined Field Types:

None.

Notes:

There is a good reason to use [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)] (both for the FindFirstFile/FindNextFile and the WIN32 definitions), see FindFirstFile for more information.

Documentation