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