75 lines
2.3 KiB
C#
75 lines
2.3 KiB
C#
using System;
|
|
using System.Net;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Ink;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Animation;
|
|
using System.Windows.Shapes;
|
|
|
|
namespace FileSystemApi
|
|
{
|
|
[ComImport, Guid("F0D5AFD8-DA24-4e85-9335-BEBCADE5B92A"),
|
|
ClassInterface(ClassInterfaceType.None)]
|
|
internal class FileSystemClass
|
|
{
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
internal struct FILETIME
|
|
{
|
|
public uint dwLowDateTime;
|
|
public uint dwHighDateTime;
|
|
};
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
|
internal struct WIN32_FIND_DATA
|
|
{
|
|
public FileAttributes dwFileAttributes;
|
|
public FILETIME ftCreationTime;
|
|
public FILETIME ftLastAccessTime;
|
|
public FILETIME ftLastWriteTime;
|
|
public int nFileSizeHigh;
|
|
public int nFileSizeLow;
|
|
public int dwReserved0;
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
|
|
public string cFileName;
|
|
}
|
|
|
|
[ComImport, Guid("2C49FA3D-C6B7-4168-BE80-D044A9C0D9DD"),
|
|
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
|
|
internal interface IFileSystemIO
|
|
{
|
|
[PreserveSig]
|
|
int OpenFile(string lpFilename, int dwDesiredAccess, int dwShareMode, int dwCreationDisposition, int dwFlagsAndAttributes, out IntPtr hFile);
|
|
|
|
[PreserveSig]
|
|
int ReadFile(IntPtr hfile, IntPtr lpBuffer, int nNumberOfBytesToRead, out int lpNumberOfBytesRead);
|
|
|
|
[PreserveSig]
|
|
int CloseFile(IntPtr hFile);
|
|
|
|
[PreserveSig]
|
|
int SeekFile(IntPtr hFile, int lDistanceToMove, ref int lpDistanceToMoveHigh, int dwMoveMethod);
|
|
|
|
[PreserveSig]
|
|
int GetFileSize(IntPtr hFile, out int lpFileSizeHigh);
|
|
|
|
[PreserveSig]
|
|
int CopyFile(string lpExistingFileName, string lpNewFileName, bool bFailIfExists);
|
|
|
|
[PreserveSig]
|
|
int FindFirstFile(string lpFileName, out WIN32_FIND_DATA lpFindFileData, out IntPtr hFind);
|
|
|
|
[PreserveSig]
|
|
int FindNextFile(IntPtr hFind, out WIN32_FIND_DATA lpFindFileData);
|
|
|
|
[PreserveSig]
|
|
int FindClose(IntPtr hFind);
|
|
}
|
|
}
|