The callback function, often referred to as callback handler, is used for processing scan results received from KAV Engine when performing an on-demand scanning, which is made by calling a scanning function, or on-access scanning, performed by monitoring functions. Using the callback function is the only way for obtaining scanning results while monitoring and scanning files and memory objects asynchronously. For synchronous scanning there is the second way for accessing scan results—they are returned to the variable pointed by the pResult pointer of the scanning function. Nevertheless, if the one of the callback events occurs, the callback function defined on the initialization stage is always called regardless of the scanning mode.
A scanning or monitoring function calls the callback function with the appropriate parameters which allow your application to handle the callback event.
A pointer to the callback function must be specified while initializing KAV SDK.
Syntax
typedef CALLBACK_RESULT (__cdecl *PFNCALLBACK) (
unsigned long dwEvent,
unsigned long dwParam1,
unsigned long dwParam2,
const char *pObjectName,
const char *pVirusName,
unsigned long dwObjectID,
unsigned long dwMonitorID,
void *pUserContext);
Return value
The callback function return value is used by the calling scan function or monitor. For the list of possible values, see section "Callback function return values".
Parameters
The parameters of the callback function are described in the table below.
Callback function parameters
Name |
Description |
|---|---|
|
One of the event notification codes. If the Proactive Defense monitor is on, this parameter can also contain one of the PDM events. For more information, see section "Proactive Defense events". |
|
One of the values described in section "Return codes". Can be used as additional information about the callback event. If the function is called with any of the PDM events, the If the function is called with the If the function is called with the If the function is called with the If the function is called with the If the function is called with the If the function is called with the If the function is called with the If the function is called with the If the function is called with the If the callback function is called with the If the function is called with the If your callback handler is called with the
|
|
One of the values described in section "Return codes". Can be used as additional information on the callback event. If the function is called with the If the function is called with the If the function is called with the If the function is called with the If the function is called with the If the function is called with
|
|
A pointer to the object being scanned at the moment the callback event has occurred. When the scanned file is an embedded file, such as a file located within a scanned archive, the When invoked with the When the function is called with the If the function is called with the If the function is called with one of the Proactive Defense Monitor events, this parameter contains the name of the detected malware; this refers to the following events:
|
|
If a malware is detected, a pointer to the detected object name. This object can be some type of malware like virus or worm detected by signatures, potentially dangerous software or just an archiver, EXE packer or a cryptor. If the function is called with the If the function is called with the When the function is called with the |
|
A scan task identifier. The scan task ID can be used for canceling this particular scanning task. For more information, see When scanning a file via File Monitor, this parameter contains a unique file identifier allowing you to associate the raised event in If the function is called with one of the Proactive Defense Monitor events, this parameter contains the process identifier (PID) of the process intercepted by PDM; this refers to the following events:
|
|
An identifier of the monitor or scanning function that has been scanning the object at the moment the callback event has occurred. This can be one of the monitor type values described in section "Monitor types", or " |
|
A pointer to any user data to hand over additional information. |