Discuss this help topic in CBFS Forum

CallbackFileSystem.GetOriginatorProcessId method

Filter:

Pascal    C++ (Lib)    C++ (VCL)    C++ (.NET)    C#    VB.NET    Java 

CallbackFileSystem     See also    

Overview

Returns the PID (process ID) of the process that initiated the operation

Declaration

[Pascal]
    function GetOriginatorProcessId( var ProcessId : LongWord) : boolean;

[C++ (Lib)]
    bool GetOriginatorProcessId( unsigned long * ProcessId);

[C++ (VCL)]
    bool __fastcall GetOriginatorProcessId( unsigned long& ProcessId);

[C++ (.NET)]
    bool GetOriginatorProcessId( unsigned long & ProcessId);

[C#]
    bool GetOriginatorProcessId( ref UInt32 ProcessId);

[VB.NET]
    Function GetOriginatorProcessId( ByRef ProcessId As UInt32) As Boolean

[Java]
    boolean getOriginatorProcessId( longRef processId);

Parameters

  • ProcessId - On return this parameter contains the PID of the process.

Return values

TRUE / true if the function succeeded or FALSE / false if the function failed.

Description

Use GetOriginatorProcessId to get the process ID (PID) of the process that originated the operation.

Note that the PID is guaranteed to be unique only during lifetime of the process. When the process is terminated, its PID can (in theory) be used by other process. In fact this never happens, but such possibility is documented by Microsoft.

Do not call this method from handlers for OnReadFile, OnWriteFile and other callbacks that work with opened files, as that callbacks can be initiated by the system components (cache manager, memory manager etc.). Instead do the following:

  1. Call GetOriginatorProcessId from OnCreateFile or OnOpenFile event handlers / callbacks;
  2. Store obtained information somewhere and store the reference to this information in the UserContext;
  3. When you need to check the originator information in some file-related callback, access the stored information via UserContext

Call from...

This method may be called only from callback / event handlers.

See also

GetOriginatorProcessName     GetOriginatorToken    

Discuss this help topic in CBFS Forum