mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 00:43:00 -05:00
src: dotnet: WIP
This commit is contained in:
parent
f2391d99d5
commit
4cbee05849
@ -174,32 +174,96 @@ namespace Fsp
|
||||
return _FileSystem;
|
||||
}
|
||||
|
||||
/* FSP_FILE_SYSTEM_INTERFACE */
|
||||
private static Int32 GetVolumeInfo(
|
||||
IntPtr FileSystem,
|
||||
/* operations */
|
||||
protected virtual Int32 ExceptionHandler(Exception ex)
|
||||
{
|
||||
return STATUS_UNEXPECTED_IO_ERROR;
|
||||
}
|
||||
protected virtual Int32 GetVolumeInfo(
|
||||
out VolumeInfo VolumeInfo)
|
||||
{
|
||||
VolumeInfo = default(VolumeInfo);
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
}
|
||||
private static Int32 SetVolumeLabel(
|
||||
IntPtr FileSystem,
|
||||
protected virtual Int32 SetVolumeLabel(
|
||||
String VolumeLabel,
|
||||
out VolumeInfo VolumeInfo)
|
||||
{
|
||||
VolumeInfo = default(VolumeInfo);
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
}
|
||||
protected virtual Int32 GetSecurityByName(
|
||||
String FileName,
|
||||
out UInt32 PFileAttributes/* or ReparsePointIndex */,
|
||||
out GenericSecurityDescriptor SecurityDescriptor)
|
||||
{
|
||||
PFileAttributes = default(UInt32);
|
||||
SecurityDescriptor = default(GenericSecurityDescriptor);
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
}
|
||||
|
||||
/* FSP_FILE_SYSTEM_INTERFACE */
|
||||
private static Int32 GetVolumeInfo(
|
||||
IntPtr FileSystem,
|
||||
out VolumeInfo VolumeInfo)
|
||||
{
|
||||
FileSystem self = (FileSystem)Api.FspFileSystemGetUserContext(FileSystem);
|
||||
try
|
||||
{
|
||||
return self.GetVolumeInfo(out VolumeInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
VolumeInfo = default(VolumeInfo);
|
||||
return self.ExceptionHandler(ex);
|
||||
}
|
||||
}
|
||||
private static Int32 SetVolumeLabel(
|
||||
IntPtr FileSystem,
|
||||
String VolumeLabel,
|
||||
out VolumeInfo VolumeInfo)
|
||||
{
|
||||
FileSystem self = (FileSystem)Api.FspFileSystemGetUserContext(FileSystem);
|
||||
try
|
||||
{
|
||||
return self.SetVolumeLabel(VolumeLabel, out VolumeInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
VolumeInfo = default(VolumeInfo);
|
||||
return self.ExceptionHandler(ex);
|
||||
}
|
||||
}
|
||||
private static Int32 GetSecurityByName(
|
||||
IntPtr FileSystem,
|
||||
String FileName,
|
||||
out UInt32 PFileAttributes/* or ReparsePointIndex */,
|
||||
IntPtr PFileAttributes/* or ReparsePointIndex */,
|
||||
IntPtr SecurityDescriptor,
|
||||
out UIntPtr PSecurityDescriptorSize)
|
||||
IntPtr PSecurityDescriptorSize)
|
||||
{
|
||||
PFileAttributes = default(UInt32);
|
||||
PSecurityDescriptorSize = default(UIntPtr);
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
#if false
|
||||
FileSystem self = (FileSystem)Api.FspFileSystemGetUserContext(FileSystem);
|
||||
GenericSecurityDescriptor GenericSecurityDescriptor = null;
|
||||
Int32 Result;
|
||||
try
|
||||
{
|
||||
Result = self.GetSecurityByName(FileName, out PFileAttributes,
|
||||
out GenericSecurityDescriptor);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PFileAttributes = default(UInt32);
|
||||
return self.ExceptionHandler(ex);
|
||||
}
|
||||
if (null != GenericSecurityDescriptor)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
return Result;
|
||||
#endif
|
||||
}
|
||||
private static Int32 Create(
|
||||
IntPtr FileSystem,
|
||||
@ -334,9 +398,8 @@ namespace Fsp
|
||||
IntPtr FileSystem,
|
||||
IntPtr FileContext,
|
||||
IntPtr SecurityDescriptor,
|
||||
out UIntPtr PSecurityDescriptorSize)
|
||||
IntPtr PSecurityDescriptorSize)
|
||||
{
|
||||
PSecurityDescriptorSize = default(UIntPtr);
|
||||
return STATUS_INVALID_DEVICE_REQUEST;
|
||||
}
|
||||
private static Int32 SetSecurity(
|
||||
|
@ -94,14 +94,27 @@ namespace Fsp.Interop
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct VolumeInfo
|
||||
public struct VolumeInfo
|
||||
{
|
||||
internal const int VolumeLabelSize = 32;
|
||||
|
||||
internal UInt64 TotalSize;
|
||||
internal UInt64 FreeSize;
|
||||
public UInt64 TotalSize;
|
||||
public UInt64 FreeSize;
|
||||
internal UInt16 VolumeLabelLength;
|
||||
internal unsafe fixed UInt16 VolumeLabel[VolumeLabelSize];
|
||||
|
||||
internal unsafe void SetVolumeLabel(String Value)
|
||||
{
|
||||
fixed (UInt16 *P = VolumeLabel)
|
||||
{
|
||||
int Size = Value.Length;
|
||||
if (Size > VolumeLabelSize)
|
||||
Size = VolumeLabelSize;
|
||||
for (int I = 0; Size > I; I++)
|
||||
P[I] = Value[I];
|
||||
VolumeLabelLength = VolumeLabelSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
@ -161,9 +174,9 @@ namespace Fsp.Interop
|
||||
internal delegate Int32 GetSecurityByName(
|
||||
IntPtr FileSystem,
|
||||
[MarshalAs(UnmanagedType.LPWStr)] String FileName,
|
||||
out UInt32 PFileAttributes/* or ReparsePointIndex */,
|
||||
IntPtr PFileAttributes/* or ReparsePointIndex */,
|
||||
IntPtr SecurityDescriptor,
|
||||
out UIntPtr PSecurityDescriptorSize);
|
||||
IntPtr PSecurityDescriptorSize);
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
internal delegate Int32 Create(
|
||||
IntPtr FileSystem,
|
||||
@ -264,7 +277,7 @@ namespace Fsp.Interop
|
||||
IntPtr FileSystem,
|
||||
IntPtr FileContext,
|
||||
IntPtr SecurityDescriptor,
|
||||
out UIntPtr PSecurityDescriptorSize);
|
||||
IntPtr PSecurityDescriptorSize);
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
internal delegate Int32 SetSecurity(
|
||||
IntPtr FileSystem,
|
||||
|
Loading…
x
Reference in New Issue
Block a user