mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-24 17:32:29 -05:00
src: dotnet: WIP
This commit is contained in:
parent
08e520e0ec
commit
d545b8df26
@ -210,11 +210,11 @@ namespace Fsp
|
|||||||
UInt64 AllocationSize,
|
UInt64 AllocationSize,
|
||||||
out Object FileNode,
|
out Object FileNode,
|
||||||
out Object FileDesc,
|
out Object FileDesc,
|
||||||
out FileInfo FileInfo)
|
out OpenFileInfo OpenFileInfo)
|
||||||
{
|
{
|
||||||
FileNode = default(Object);
|
FileNode = default(Object);
|
||||||
FileDesc = default(Object);
|
FileDesc = default(Object);
|
||||||
FileInfo = default(FileInfo);
|
OpenFileInfo = default(OpenFileInfo);
|
||||||
return STATUS_INVALID_DEVICE_REQUEST;
|
return STATUS_INVALID_DEVICE_REQUEST;
|
||||||
}
|
}
|
||||||
protected virtual Int32 Open(
|
protected virtual Int32 Open(
|
||||||
@ -223,11 +223,11 @@ namespace Fsp
|
|||||||
UInt32 GrantedAccess,
|
UInt32 GrantedAccess,
|
||||||
out Object FileNode,
|
out Object FileNode,
|
||||||
out Object FileDesc,
|
out Object FileDesc,
|
||||||
out FileInfo FileInfo)
|
out OpenFileInfo OpenFileInfo)
|
||||||
{
|
{
|
||||||
FileNode = default(Object);
|
FileNode = default(Object);
|
||||||
FileDesc = default(Object);
|
FileDesc = default(Object);
|
||||||
FileInfo = default(FileInfo);
|
OpenFileInfo = default(OpenFileInfo);
|
||||||
return STATUS_INVALID_DEVICE_REQUEST;
|
return STATUS_INVALID_DEVICE_REQUEST;
|
||||||
}
|
}
|
||||||
protected virtual Int32 Overwrite(
|
protected virtual Int32 Overwrite(
|
||||||
@ -501,7 +501,7 @@ namespace Fsp
|
|||||||
IntPtr SecurityDescriptor,
|
IntPtr SecurityDescriptor,
|
||||||
UInt64 AllocationSize,
|
UInt64 AllocationSize,
|
||||||
ref FullContext FullContext,
|
ref FullContext FullContext,
|
||||||
out FileInfo FileInfo)
|
out OpenFileInfo OpenFileInfo)
|
||||||
{
|
{
|
||||||
FileSystem self = (FileSystem)Api.FspFileSystemGetUserContext(FileSystem);
|
FileSystem self = (FileSystem)Api.FspFileSystemGetUserContext(FileSystem);
|
||||||
try
|
try
|
||||||
@ -517,13 +517,13 @@ namespace Fsp
|
|||||||
AllocationSize,
|
AllocationSize,
|
||||||
out FileNode,
|
out FileNode,
|
||||||
out FileDesc,
|
out FileDesc,
|
||||||
out FileInfo);
|
out OpenFileInfo);
|
||||||
Api.SetFullContext(ref FullContext, FileNode, FileDesc);
|
Api.SetFullContext(ref FullContext, FileNode, FileDesc);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
FileInfo = default(FileInfo);
|
OpenFileInfo = default(OpenFileInfo);
|
||||||
return self.ExceptionHandler(ex);
|
return self.ExceptionHandler(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -533,7 +533,7 @@ namespace Fsp
|
|||||||
UInt32 CreateOptions,
|
UInt32 CreateOptions,
|
||||||
UInt32 GrantedAccess,
|
UInt32 GrantedAccess,
|
||||||
ref FullContext FullContext,
|
ref FullContext FullContext,
|
||||||
out FileInfo FileInfo)
|
out OpenFileInfo OpenFileInfo)
|
||||||
{
|
{
|
||||||
FileSystem self = (FileSystem)Api.FspFileSystemGetUserContext(FileSystem);
|
FileSystem self = (FileSystem)Api.FspFileSystemGetUserContext(FileSystem);
|
||||||
try
|
try
|
||||||
@ -546,13 +546,13 @@ namespace Fsp
|
|||||||
GrantedAccess,
|
GrantedAccess,
|
||||||
out FileNode,
|
out FileNode,
|
||||||
out FileDesc,
|
out FileDesc,
|
||||||
out FileInfo);
|
out OpenFileInfo);
|
||||||
Api.SetFullContext(ref FullContext, FileNode, FileDesc);
|
Api.SetFullContext(ref FullContext, FileNode, FileDesc);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
FileInfo = default(FileInfo);
|
OpenFileInfo = default(OpenFileInfo);
|
||||||
return self.ExceptionHandler(ex);
|
return self.ExceptionHandler(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ namespace Fsp.Interop
|
|||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
internal struct VolumeParams
|
internal struct VolumeParams
|
||||||
{
|
{
|
||||||
/* const */
|
|
||||||
internal const UInt32 CaseSensitiveSearch = 0x00000001;
|
internal const UInt32 CaseSensitiveSearch = 0x00000001;
|
||||||
internal const UInt32 CasePreservedNames = 0x00000002;
|
internal const UInt32 CasePreservedNames = 0x00000002;
|
||||||
internal const UInt32 UnicodeOnDisk = 0x00000004;
|
internal const UInt32 UnicodeOnDisk = 0x00000004;
|
||||||
@ -46,7 +45,6 @@ namespace Fsp.Interop
|
|||||||
internal const int PrefixSize = 192;
|
internal const int PrefixSize = 192;
|
||||||
internal const int FileSystemNameSize = 16;
|
internal const int FileSystemNameSize = 16;
|
||||||
|
|
||||||
/* fields */
|
|
||||||
internal UInt16 Version;
|
internal UInt16 Version;
|
||||||
internal UInt16 SectorSize;
|
internal UInt16 SectorSize;
|
||||||
internal UInt16 SectorsPerAllocationUnit;
|
internal UInt16 SectorsPerAllocationUnit;
|
||||||
@ -61,7 +59,6 @@ namespace Fsp.Interop
|
|||||||
internal unsafe fixed UInt16 Prefix[PrefixSize];
|
internal unsafe fixed UInt16 Prefix[PrefixSize];
|
||||||
internal unsafe fixed UInt16 FileSystemName[FileSystemNameSize];
|
internal unsafe fixed UInt16 FileSystemName[FileSystemNameSize];
|
||||||
|
|
||||||
/* helpers */
|
|
||||||
internal unsafe void SetPrefix(String Value)
|
internal unsafe void SetPrefix(String Value)
|
||||||
{
|
{
|
||||||
fixed (UInt16 *P = Prefix)
|
fixed (UInt16 *P = Prefix)
|
||||||
@ -112,7 +109,7 @@ namespace Fsp.Interop
|
|||||||
Size = VolumeLabelSize;
|
Size = VolumeLabelSize;
|
||||||
for (int I = 0; Size > I; I++)
|
for (int I = 0; Size > I; I++)
|
||||||
P[I] = Value[I];
|
P[I] = Value[I];
|
||||||
VolumeLabelLength = VolumeLabelSize;
|
VolumeLabelLength = (UInt16)Size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,6 +135,17 @@ namespace Fsp.Interop
|
|||||||
public FileInfo FileInfo;
|
public FileInfo FileInfo;
|
||||||
public IntPtr NormalizedName;
|
public IntPtr NormalizedName;
|
||||||
public UInt16 NormalizedNameSize;
|
public UInt16 NormalizedNameSize;
|
||||||
|
|
||||||
|
public unsafe void SetNormalizedName(String Value)
|
||||||
|
{
|
||||||
|
UInt16 *P = (UInt16 *)NormalizedName;
|
||||||
|
int Size = Value.Length;
|
||||||
|
if (Size > NormalizedNameSize)
|
||||||
|
Size = NormalizedNameSize;
|
||||||
|
for (int I = 0; Size > I; I++)
|
||||||
|
P[I] = Value[I];
|
||||||
|
NormalizedNameSize = (UInt16)Size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
@ -203,7 +211,7 @@ namespace Fsp.Interop
|
|||||||
IntPtr SecurityDescriptor,
|
IntPtr SecurityDescriptor,
|
||||||
UInt64 AllocationSize,
|
UInt64 AllocationSize,
|
||||||
ref FullContext FullContext,
|
ref FullContext FullContext,
|
||||||
out FileInfo FileInfo);
|
out OpenFileInfo OpenFileInfo);
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
internal delegate Int32 Open(
|
internal delegate Int32 Open(
|
||||||
IntPtr FileSystem,
|
IntPtr FileSystem,
|
||||||
@ -211,7 +219,7 @@ namespace Fsp.Interop
|
|||||||
UInt32 CreateOptions,
|
UInt32 CreateOptions,
|
||||||
UInt32 GrantedAccess,
|
UInt32 GrantedAccess,
|
||||||
ref FullContext FullContext,
|
ref FullContext FullContext,
|
||||||
out FileInfo FileInfo);
|
out 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