Expected return codes for callback function
When the scanning or monitoring function calls a callback function with one of the events, it expects that the function will return a consistent callback return value. For example, if the scanning function calls the callback function with the EVENT_RELOAD_DATABASES_STARTED event, there is no sense to return the CLBK_DELETE_OBJECT value, and this value will not be taken into consideration by the engine. There are certain expected return values for each event, and only such values will be processed.
If your callback function returns an event code that does not match a raised event code following table, KAV SDK interprets the code as CLBK_OK. Callback codes that match their specific event notification codes are listed in a table later in this section.
The expected callback function return values for each callback event are listed in the table below. There are also Proactive Defense Monitor events which have their own expected return codes. For more details on these codes, see table "Expected return values for PDM events".
Callback event codes can be classified into the following types:
- informational
Event notification codes of this type serve only informational purposes and do not demand a set of codes to confirm any specific operation with the current object. Such notification codes assume that you may use CLBK_OK to accept further processing of the current object.
- request
This type of codes implies options in how you can respond. You can choose from multiple return codes when handling these event codes. Each return code confirms a specific action that must be performed by KAV SDK as explained in the description for a specific return code.
Expected return codes from callback
Event notification code
|
Expected return code
|
EVENT_ERROR
EVENT_DELETED
EVENT_OK
EVENT_PASSWORD_PROTECTED
EVENT_BACKUPSUCCEEDED
EVENT_BACKUPFAILED
EVENT_DISINFECTED
EVENT_NEWSIZE
EVENT_MAX_DEPTH_EXCEEDED
EVENT_RELOAD_DATABASES_FINISHED
EVENT_RELOAD_DATABASES_STARTED
EVENT_ADVDIS_STARTED
EVENT_TCP_CONNINFO
EVENT_EMAIL_BLOCKED
EVENT_PROXY_SETTINGS_SUCCEEDED
EVENT_CLEAN_ALREADY_DONE
EVENT_PID
|
CLBK_OK—process current object.
|
EVENT_OBJECT_BEGIN
EVENT_INPROGRESS
|
CLBK_OK—process current objectCLBK_CANCEL_ALL—stop processing current object.
|
EVENT_RECORD_NAME
|
CLBK_OK—retrieve the next item in the list of known objects in malware definition database.CLBK_CANCEL_ALL—stop retrieving the list of known objects from the definition database.
|
EVENT_ASK_PASSWORD
EVENT_CLEANFAILED
EVENT_ARCHIVE
EVENT_MAILBASE
EVENT_PACKED
EVENT_ENCRYPTED
EVENT_BACKUP
EVENT_CORRUPTED
EVENT_PID
|
CLBK_OK—process current objectCLBK_CANCEL_OBJECT—stop processing current object.If the object is an embedded object (for example, a file in an archive), KAV SDK moves to process the next embedded object in the common parent object for these objects.
CLBK_CANCEL_ALL—stop processing current object and related objects.If the object is an embedded object, KAV SDK stops to process not only this object but also its parent object. No other object within the parent object will be processed further in this scanning task.
|
EVENT_ALLOW_ADVDIS
|
CLBK_OK—turn on Advanced Disinfection mode and attempt to scan current object in this mode.CLBK_CANCEL_OBJECT—cancel request to scan current object in Advanced Disinfection mode.
|
EVENT_REBOOTNEEDED
|
CLBK_REBOOT—allow system restart.When confirmed, KAV SDK will restart Windows.
CLBK_OK—cancel request to restart operating system.Note, the CLBK_OK code is handled as a cancelation code.
|
EVENT_FIRSTBYTES
|
CLBK_MORE_BYTES—read more bytes from the fileCLBK_OK—cancel request to read more bytes from the file.
|
EVENT_PROXY_QUERY
|
CLBK_USE_PROXY—connect to the cloud via proxyCLBK_OK—connect to the cloud using direct connection.
|
EVENT_PROXY_SETTINGS_FAILED
|
|
EVENT_PREDETECT
|
CLBK_OK—process current objectCLBK_CANCEL_OBJECT—stop KAV SDK to raise EVENT_VERDICT_CURABILITY and EVENT_DETECT notification codes that may follow EVENT_PREDETECT and stop processing the current object.If the scanned object contains multiple malicious objects, only the first malicious object is skipped; returning CLBK_CANCEL_OBJECT applies on the "per object" basis. This does not affect other malicious objects detected in the scanned object.
CLBK_CANCEL_ALL—stop KAV SDK to raise EVENT_VERDICT_CURABILITY and EVENT_DETECT for the current and embedded objects.CLBK_GETPIDObtain identifier of the process that requested a malicious web address. Available only for Web Monitor component, see section "Obtaining process info for the malicious web address".
|
EVENT_DETECT
EVENT_SUSPECTED
|
|
EVENT_DELETE_ARCHIVE
|
For this event the expected callback function return values are as follows:
|
EVENT_REQUEST
|
For this event the expected callback function return values are the following:
|
EVENT_PDM_HEURISTIC
|
For this event the expected callback function return values depends on the mode implemented in your application.
For automatic mode return values are as follows:
|
EVENT_PDM_SURE
|
For this event the expected callback function return codes depends on the mode implemented in your application.
For automatic mode return values depend on the severity level type returned in the dwParam2 value of callback function with this event returned in dwEvent parameter, and is as follows:
|
EVENT_PDM_BLOCKING
|
For this event the expected callback function return values depends on the mode implemented in your application.
For automatic mode return values are as follows:
|
EVENT_OBJECT_HASH
|
CLBK_OK—process current objectYou can return any callback return code !={CLBK_CANCEL_OBJECT|CLBK_CANCEL_ALL}, it is handled the same way as CLBK_OK.
CLBK_CANCEL_OBJECT—cancel processing current object.If a nested object is scanned (such as a file within an archive), only the current file is canceled, KAV SDK moves to processing the next object in the archive being scanned.
CLBK_CANCEL_ALL—cancel processing all objectsIf a nested object is scanned (such as a file within an archive), scanning of the parent object (archive) for the current is canceled, and all nested objects (other files in archive) are not scanned.
|
EVENT_EXTERNAL_SCAN
|
CLBK_OK—partner function finished processing an object.
|
Handling specific Proactive Defense actions
When the monitoring function calls a callback function with one of the Proactive Defense Monitor events, it expects that the function will return a consistent callback return value. This value depends on the PDM action which is passed to the callback function as the dwParam1 parameter value while the PDM event is written to the dwEvent parameter value.
If the callback function returns a value not listed as expected for the specific event notification code, the KAV SDK handles this value as CLBK_OK return code.
The expected callback function return values for each PDM action received with one of the PDM events are listed in the table below. For expected return codes for callback events raised not for Proactive Defense Monitor, see table "Expected return codes from callback".
The KAV SDK library does NOT notify you when it completes to handle the code returned by your application in a response to the PDM action received in the callback with a particular PDM event.
Expected return values for PDM events
PDM action
|
Expected return code
|
PDM_ACTION_DETECT
|
|
PDM_ACTION_DETECT_DENIABLE
|
CLBK_DENY—prevent suspicious activityKAV SDK returns in response one of the following constants.
PDM_ACTION_DENY_SUCCEEDED—KAV SDK successfully prevented activity of the application intercepted by PDM.
PDM_ACTION_DENY_FAILED—KAV SDK could not prevent activity.
Return CLBK_OK when these constants are received.
CLBK_OK—allow suspicious activity.
|
PDM_ACTION_ROLLBACK
|
CLBK_ROLLBACK—try to perform a rollback operation.CLBK_OK—allow suspicious activity.
|
PDM_ACTION_DENY_SUCCEEDED
PDM_ACTION_DENY_FAILED
PDM_ACTION_ROLLBACK_SUCCEEDED
PDM_ACTION_ROLLBACK_FAILED
PDM_ACTION_PROCESS_TERMINATED
PDM_ACTION_TERMINATE_FAILED
PDM_ACTION_UNKNOWN
|
CLBK_OK—continue processing of the current object.
|
For more information about the PDM actions, see section "Proactive Defense actions". For more information about the PDM events, see section "Proactive Defense events".
Page top