Skip to content

API: ObDestroyInterface

Archie_UwU edited this page Sep 19, 2024 · 1 revision

Destroys an interface created via ObCreateInterface and removes the interface from the global registry.

Syntax

AurieStatus ObDestroyInterface(
    [in] AurieModule* Module,
    [in] const char*  InterfaceName
);

Parameters

Module

The owner module of this interface. Even though interfaces are usually instantiated as global objects, they are linked to their owner module internally. If the caller specifies a wrong Module for a given interface, the interface will not be deleted, and the Destroy method will not be invoked.

InterfaceName

A pointer to a buffer specifying the case-insensitive name of the interface.

Return Value

The function returns AURIE_SUCCESS on success, otherwise returns a matching error code. The AURIE_OBJECT_NOT_FOUND code is returned if no interface with the requested name is linked to Module. If the interface exists, but the Module parameter doesn't match with the interface's owner, the AURIE_ACCESS_DENIED status code is returned.

Remarks

The Destroy function of the interface is always invoked prior to the interface being removed from the global registry. When a module unloads either due to the host process closing, the framework being unloaded, or because of a call to MdUnmapImage, interfaces are destroyed AFTER the specific module's ModuleUnload function is called (if one exists).

If runtime unloading is a concern, interfaces should implement a way to notify plugins holding handles to them of their destruction. Upon a successful destruction of an interface, no new handles can be created via ObGetInterface, but existing handles remain valid until the owner module unloads or the resources allocated for the interface are freed.