From 436e31da349a55cf36c6092be1bcb1049583f060 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Wed, 11 Oct 2017 17:07:38 -0700 Subject: [PATCH] dotnet: GetOperationProcessId --- src/dotnet/FileSystemBase.cs | 10 ++++++++++ src/dotnet/Interop.cs | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/src/dotnet/FileSystemBase.cs b/src/dotnet/FileSystemBase.cs index 84ea3dab..cfd89637 100644 --- a/src/dotnet/FileSystemBase.cs +++ b/src/dotnet/FileSystemBase.cs @@ -983,6 +983,16 @@ namespace Fsp return Api.FspWin32FromNtStatus(Status); } /// + /// Gets the originating process ID. + /// + /// + /// Valid only during Create, Open and Rename requests when the target exists. + /// + public static int GetOperationProcessId() + { + return (int)Api.FspFileSystemOperationProcessId(); + } + /// /// Modifies a security descriptor. /// /// diff --git a/src/dotnet/Interop.cs b/src/dotnet/Interop.cs index 43838240..ed39d279 100644 --- a/src/dotnet/Interop.cs +++ b/src/dotnet/Interop.cs @@ -539,6 +539,8 @@ namespace Fsp.Interop IntPtr FileSystem, UInt32 DebugLog); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate UInt32 FspFileSystemOperationProcessIdF(); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.U1)] internal delegate Boolean FspFileSystemAddDirInfo( IntPtr DirInfo, @@ -706,6 +708,7 @@ namespace Fsp.Interop internal static Proto.FspFileSystemMountPointF FspFileSystemMountPoint; internal static Proto.FspFileSystemSetOperationGuardStrategyF FspFileSystemSetOperationGuardStrategy; internal static Proto.FspFileSystemSetDebugLogF FspFileSystemSetDebugLog; + internal static Proto.FspFileSystemOperationProcessIdF FspFileSystemOperationProcessId; internal static Proto.FspFileSystemAddDirInfo _FspFileSystemAddDirInfo; internal static Proto.FspFileSystemFindReparsePoint FspFileSystemFindReparsePoint; internal static Proto.FspFileSystemResolveReparsePoints FspFileSystemResolveReparsePoints; @@ -1015,6 +1018,7 @@ namespace Fsp.Interop FspFileSystemMountPoint = GetEntryPoint(Module); FspFileSystemSetOperationGuardStrategy = GetEntryPoint(Module); FspFileSystemSetDebugLog = GetEntryPoint(Module); + FspFileSystemOperationProcessId = GetEntryPoint(Module); _FspFileSystemAddDirInfo = GetEntryPoint(Module); FspFileSystemFindReparsePoint = GetEntryPoint(Module); FspFileSystemResolveReparsePoints = GetEntryPoint(Module);