CallbackRegistry

Control registry operations in Windows and .NET applications

OnPreOpenKey event/delegate/callback

Filter:

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

CallbackRegistry     See also    

Overview

This callback is called before key opening request is processed by the system code which deals with the registry.

Declaration

[Pascal]
    property OnPreOpenKey : TCbRegPreOpenKeyEvent;
    TCbRegPreOpenKeyEvent = procedure( Sender : TObject; FullName : TCBString; DesiredAccess: ACCESS_MASK; var KeyHandle: THandle; var KeyHandleContext: pointer; var GrantedAccess: ACCESS_MASK; var UserContext: pointer; var StopFiltering : boolean ) of object;
    type ACCESS_MASK = DWORD;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    typedef void (*CbRegPreOpenKeyEvent)( CallbackRegistry* Sender, LPCWSTR FullName, DWORD DesiredAccess, HANDLE *KeyHandle, LPVOID *KeyHandleContext, DWORD *GrantedAccess, LPVOID *UserContext, BOOL * StopFiltering );

[C++ (VCL)]
    typedef void __fastcall (__closure *TCbRegPreOpenKeyEvent)( System::TObject* Sender, TCBString FullName, unsigned DesiredAccess, unsigned &KeyHandle, void* &KeyHandleContext, unsigned &GrantedAccess, void * &UserContext, bool &StopFiltering );
    #ifdef UNICODE
    typedef UnicodeString TCBString;
    #else
    typedef WideString TCBString;
    #endif

[C++ (.NET)]
    public delegate void CbRegPreOpenKeyEvent( CallbackRegistry^ Sender, String^ FullName, UInt32 DesiredAccess, SafeHandle^ %KeyHandle, Object^ %KeyHandleContext, UInt32 %GrantedAccess, Object^ UserContext, bool %StopFiltering );

[C#]
    delegate void CbRegPreOpenKeyEvent( CallbackRegistry Sender, string FullName, UInt32 DesiredAccess, ref SafeHandle KeyHandle, ref Object KeyHandleContext, ref UInt32 GrantedAccess, ref Object UserContext, ref bool StopFiltering );

[VB.NET]
    Delegate Sub CbRegPreOpenKeyEvent( ByVal Sender As CallbackRegistry, ByVal FullName As String, ByVal DesiredAccess As UInt32, ByRef KeyHandle As SafeHandle, ByRef KeyHandleContext As Object, ByRef GrantedAccess As UInt32, ByRef UserContext As Object, ByRef StopFiltering As Boolean )

Parameters

  • Sender - reference to the class that called the delegate/event handler
  • FullName - The "full" name of the key to be opened in system format (for example for "HKEY_LOCAL_MACHINE\System" key the name will be "\Registry\Machine\System").
  • DesiredAccess - The access mask that was specified by the thread that is attempting to open the registry key.
  • KeyHandle - handle of the key which the application may open instead of the system-opened key (see Description for details)
  • KeyHandleContext - the placeholder for the application-defined data which will be passed to OnCloseHandle event
  • GrantedAccess - if the KeyHandle parameter is used the granted access rights must be set here
  • UserContext - the placeholder for the application-defined data
  • StopFiltering - If StopFiltering is set to true, no other callbacks for the created key handle will be called

Description

This callback/event handler is called before a key is created. You can pass the name of the key to other callbacks/event handlers by storing FullName in the UserContext object that you create.
Read more about contexts.

Error handling

See Error handling topic for detailed information about how to report errors, which occur in the event handlers, back to CallbackRegistry.

See also

OnCloseKeyHandle     OnPostOpenKey     OnPreCloseKey     OnPreCreateKey    

Back to top