mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-24 09:23:37 -05:00
src: dotnet: WIP
This commit is contained in:
parent
c79785c2db
commit
1245a29be6
@ -22,6 +22,29 @@ namespace Fsp
|
|||||||
|
|
||||||
public partial class FileSystem
|
public partial class FileSystem
|
||||||
{
|
{
|
||||||
|
/* CreateOptions */
|
||||||
|
public const UInt32 FILE_DIRECTORY_FILE = 0x00000001;
|
||||||
|
public const UInt32 FILE_WRITE_THROUGH = 0x00000002;
|
||||||
|
public const UInt32 FILE_SEQUENTIAL_ONLY = 0x00000004;
|
||||||
|
public const UInt32 FILE_NO_INTERMEDIATE_BUFFERING = 0x00000008;
|
||||||
|
public const UInt32 FILE_SYNCHRONOUS_IO_ALERT = 0x00000010;
|
||||||
|
public const UInt32 FILE_SYNCHRONOUS_IO_NONALERT = 0x00000020;
|
||||||
|
public const UInt32 FILE_NON_DIRECTORY_FILE = 0x00000040;
|
||||||
|
public const UInt32 FILE_CREATE_TREE_CONNECTION = 0x00000080;
|
||||||
|
public const UInt32 FILE_COMPLETE_IF_OPLOCKED = 0x00000100;
|
||||||
|
public const UInt32 FILE_NO_EA_KNOWLEDGE = 0x00000200;
|
||||||
|
public const UInt32 FILE_OPEN_REMOTE_INSTANCE = 0x00000400;
|
||||||
|
public const UInt32 FILE_RANDOM_ACCESS = 0x00000800;
|
||||||
|
public const UInt32 FILE_DELETE_ON_CLOSE = 0x00001000;
|
||||||
|
public const UInt32 FILE_OPEN_BY_FILE_ID = 0x00002000;
|
||||||
|
public const UInt32 FILE_OPEN_FOR_BACKUP_INTENT = 0x00004000;
|
||||||
|
public const UInt32 FILE_NO_COMPRESSION = 0x00008000;
|
||||||
|
public const UInt32 FILE_OPEN_REQUIRING_OPLOCK = 0x00010000;
|
||||||
|
public const UInt32 FILE_RESERVE_OPFILTER = 0x00100000;
|
||||||
|
public const UInt32 FILE_OPEN_REPARSE_POINT = 0x00200000;
|
||||||
|
public const UInt32 FILE_OPEN_NO_RECALL = 0x00400000;
|
||||||
|
public const UInt32 FILE_OPEN_FOR_FREE_SPACE_QUERY = 0x00800000;
|
||||||
|
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
public const UInt32 CleanupDelete = 0x01;
|
public const UInt32 CleanupDelete = 0x01;
|
||||||
public const UInt32 CleanupSetAllocationSize = 0x02;
|
public const UInt32 CleanupSetAllocationSize = 0x02;
|
||||||
|
@ -215,15 +215,17 @@ namespace Fsp
|
|||||||
UInt32 CreateOptions,
|
UInt32 CreateOptions,
|
||||||
UInt32 GrantedAccess,
|
UInt32 GrantedAccess,
|
||||||
UInt32 FileAttributes,
|
UInt32 FileAttributes,
|
||||||
Object SecurityDescriptor,
|
Byte[] SecurityDescriptor,
|
||||||
UInt64 AllocationSize,
|
UInt64 AllocationSize,
|
||||||
out Object FileNode,
|
out Object FileNode,
|
||||||
out Object FileDesc,
|
out Object FileDesc,
|
||||||
out OpenFileInfo OpenFileInfo)
|
out FileInfo FileInfo,
|
||||||
|
out String NormalizedName)
|
||||||
{
|
{
|
||||||
FileNode = default(Object);
|
FileNode = default(Object);
|
||||||
FileDesc = default(Object);
|
FileDesc = default(Object);
|
||||||
OpenFileInfo = default(OpenFileInfo);
|
FileInfo = default(FileInfo);
|
||||||
|
NormalizedName = default(String);
|
||||||
return STATUS_INVALID_DEVICE_REQUEST;
|
return STATUS_INVALID_DEVICE_REQUEST;
|
||||||
}
|
}
|
||||||
protected virtual Int32 Open(
|
protected virtual Int32 Open(
|
||||||
@ -232,11 +234,13 @@ namespace Fsp
|
|||||||
UInt32 GrantedAccess,
|
UInt32 GrantedAccess,
|
||||||
out Object FileNode,
|
out Object FileNode,
|
||||||
out Object FileDesc,
|
out Object FileDesc,
|
||||||
out OpenFileInfo OpenFileInfo)
|
out FileInfo FileInfo,
|
||||||
|
out String NormalizedName)
|
||||||
{
|
{
|
||||||
FileNode = default(Object);
|
FileNode = default(Object);
|
||||||
FileDesc = default(Object);
|
FileDesc = default(Object);
|
||||||
OpenFileInfo = default(OpenFileInfo);
|
FileInfo = default(FileInfo);
|
||||||
|
NormalizedName = default(String);
|
||||||
return STATUS_INVALID_DEVICE_REQUEST;
|
return STATUS_INVALID_DEVICE_REQUEST;
|
||||||
}
|
}
|
||||||
protected virtual Int32 Overwrite(
|
protected virtual Int32 Overwrite(
|
||||||
@ -510,12 +514,13 @@ namespace Fsp
|
|||||||
IntPtr SecurityDescriptor,
|
IntPtr SecurityDescriptor,
|
||||||
UInt64 AllocationSize,
|
UInt64 AllocationSize,
|
||||||
ref FullContext FullContext,
|
ref FullContext FullContext,
|
||||||
out OpenFileInfo OpenFileInfo)
|
ref OpenFileInfo OpenFileInfo)
|
||||||
{
|
{
|
||||||
FileSystem self = (FileSystem)Api.GetUserContext(FileSystem);
|
FileSystem self = (FileSystem)Api.GetUserContext(FileSystem);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Object FileNode, FileDesc;
|
Object FileNode, FileDesc;
|
||||||
|
String NormalizedName;
|
||||||
Int32 Result;
|
Int32 Result;
|
||||||
Result = self.Create(
|
Result = self.Create(
|
||||||
FileName,
|
FileName,
|
||||||
@ -526,13 +531,18 @@ namespace Fsp
|
|||||||
AllocationSize,
|
AllocationSize,
|
||||||
out FileNode,
|
out FileNode,
|
||||||
out FileDesc,
|
out FileDesc,
|
||||||
out OpenFileInfo);
|
out OpenFileInfo.FileInfo,
|
||||||
|
out NormalizedName);
|
||||||
|
if (0 <= Result)
|
||||||
|
{
|
||||||
|
if (null != NormalizedName)
|
||||||
|
OpenFileInfo.SetNormalizedName(NormalizedName);
|
||||||
Api.SetFullContext(ref FullContext, FileNode, FileDesc);
|
Api.SetFullContext(ref FullContext, FileNode, FileDesc);
|
||||||
|
}
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
OpenFileInfo = default(OpenFileInfo);
|
|
||||||
return self.ExceptionHandler(ex);
|
return self.ExceptionHandler(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -542,12 +552,13 @@ namespace Fsp
|
|||||||
UInt32 CreateOptions,
|
UInt32 CreateOptions,
|
||||||
UInt32 GrantedAccess,
|
UInt32 GrantedAccess,
|
||||||
ref FullContext FullContext,
|
ref FullContext FullContext,
|
||||||
out OpenFileInfo OpenFileInfo)
|
ref OpenFileInfo OpenFileInfo)
|
||||||
{
|
{
|
||||||
FileSystem self = (FileSystem)Api.GetUserContext(FileSystem);
|
FileSystem self = (FileSystem)Api.GetUserContext(FileSystem);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Object FileNode, FileDesc;
|
Object FileNode, FileDesc;
|
||||||
|
String NormalizedName;
|
||||||
Int32 Result;
|
Int32 Result;
|
||||||
Result = self.Open(
|
Result = self.Open(
|
||||||
FileName,
|
FileName,
|
||||||
@ -555,13 +566,18 @@ namespace Fsp
|
|||||||
GrantedAccess,
|
GrantedAccess,
|
||||||
out FileNode,
|
out FileNode,
|
||||||
out FileDesc,
|
out FileDesc,
|
||||||
out OpenFileInfo);
|
out OpenFileInfo.FileInfo,
|
||||||
|
out NormalizedName);
|
||||||
|
if (0 <= Result)
|
||||||
|
{
|
||||||
|
if (null != NormalizedName)
|
||||||
|
OpenFileInfo.SetNormalizedName(NormalizedName);
|
||||||
Api.SetFullContext(ref FullContext, FileNode, FileDesc);
|
Api.SetFullContext(ref FullContext, FileNode, FileDesc);
|
||||||
|
}
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
OpenFileInfo = default(OpenFileInfo);
|
|
||||||
return self.ExceptionHandler(ex);
|
return self.ExceptionHandler(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,13 +130,13 @@ namespace Fsp.Interop
|
|||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct OpenFileInfo
|
internal struct OpenFileInfo
|
||||||
{
|
{
|
||||||
public FileInfo FileInfo;
|
internal FileInfo FileInfo;
|
||||||
public IntPtr NormalizedName;
|
internal IntPtr NormalizedName;
|
||||||
public UInt16 NormalizedNameSize;
|
internal UInt16 NormalizedNameSize;
|
||||||
|
|
||||||
public unsafe void SetNormalizedName(String Value)
|
internal unsafe void SetNormalizedName(String Value)
|
||||||
{
|
{
|
||||||
UInt16 *P = (UInt16 *)NormalizedName;
|
UInt16 *P = (UInt16 *)NormalizedName;
|
||||||
int Size = Value.Length;
|
int Size = Value.Length;
|
||||||
@ -211,7 +211,7 @@ namespace Fsp.Interop
|
|||||||
IntPtr SecurityDescriptor,
|
IntPtr SecurityDescriptor,
|
||||||
UInt64 AllocationSize,
|
UInt64 AllocationSize,
|
||||||
ref FullContext FullContext,
|
ref FullContext FullContext,
|
||||||
out OpenFileInfo OpenFileInfo);
|
ref OpenFileInfo OpenFileInfo);
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
internal delegate Int32 Open(
|
internal delegate Int32 Open(
|
||||||
IntPtr FileSystem,
|
IntPtr FileSystem,
|
||||||
@ -219,7 +219,7 @@ namespace Fsp.Interop
|
|||||||
UInt32 CreateOptions,
|
UInt32 CreateOptions,
|
||||||
UInt32 GrantedAccess,
|
UInt32 GrantedAccess,
|
||||||
ref FullContext FullContext,
|
ref FullContext FullContext,
|
||||||
out OpenFileInfo OpenFileInfo);
|
ref OpenFileInfo OpenFileInfo);
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
internal delegate Int32 Overwrite(
|
internal delegate Int32 Overwrite(
|
||||||
IntPtr FileSystem,
|
IntPtr FileSystem,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user