kaveEnableAutoReload

This function is only supported when updating malware definiton database files using Updater SDK. The Updater SDK is purchased as a separate product. If you are updating the database files using a custom update solution, you will not receive any notifications that can be turned on or off by calling kaveEnableAutoReload.

It is recommended to reload the definition database no more frequently than once per minute.

Windows platforms

This function turns on or off sending of EVENT_RELOAD_DATABASES_STARTED and EVENT_RELOAD_DATABASES_FINISHED events from KAV SDK to your callback handler. The events notify you about start and finish of malware definition files download performed by Updater SDK.

Reloading of malware definition database is initiated by Updater SDK and performed by KAV SDK automatically regardless of interaction model you use – in-process, out-of-process, or service. You can implement callback functions which will process the events.

Please note, that memory consumption increases twice when new malware definition database is loaded.

The scanning tasks which was started before malware definition database reloading will be continued using old malware definition database.

UNIX-like platforms

This function is not available in service mode. Automatic reloading of malware databases is enabled on initializing and remains turned on during service lifetime.

This function turns on or off automatic reloading of malware definition database on user-defined POSIX signal SIGUSR1 or SIGUSR2.

When automatic reloading of malware definition database is turned on, you send SIGUSR1 or SIGUSR2 signals from your application to initiate the reloading of the malware definition database. When the SDK receives the POSIX signal, it returns the EVENT_RELOAD_DATABASES_STARTED and EVENT_RELOAD_DATABASES_FINISHED events to your application. The events notify about starting and finishing of new anti-virus database downloading correspondingly.

You can check the current state of automatic reloading by calling kaveIsEnabledAutoReload function. When automatic reloading of malware definition database is turned off, you can initiate reloading of malware definition database by calling the kaveReloadDatabases function.

By default, KAV SDK handles both types of user-defined signals. This behavior may be overridden using the kaveSetAutoreloadSignal function that allows you to specify what user-defined signal your want to be used for reloading of anti-virus database.

When working in the in-process or out-of-process interaction modes, you can initiate reloading of malware definition database by sending command looking as kill –USR1 "${PID}" where PID is the identifier of your application process.

When working in service mode, you can reload anti-virus database using kavehost service init script:

kavehost.sh reloaddb

For detailed information about the kavehost init script, see section "Kavehost service init script".

Syntax

HRESULT kaveEnableAutoReload (

BOOL bEnable);

Parameters

The kaveEnableAutoReload function has the following parameters.

kaveEnableAutoReload function parameters

Name

Type

Description

bEnable

in

This boolean parameter is handled differently depending on the target platform.

The following is valid when kaveEnableAutoReload in invoked on Windows platform:

  • If the variable is TRUE (one or another non-zero value), reload notifications are turned on.

    KAV SDK sends an event when it starts and finishes automatic reloading of anti-virus database.

  • Setting this variable to FALSE disables such notifications.

    Note that the function only manages notifications but not the automatic reload procedure. When you set bEnable to FALSE, you will not be informed of when reloading has stared, reloading will be done anyways.

    The following is valid when kaveEnableAutoReload in invoked on Unix-like platform:

  • If the variable is TRUE (one or another non-zero value), automatic reloading of malware definition database is turned on and KAV SDK sends an events to notify you of start and finish of automatic reloading of anti-virus database;
  • Setting this variable to FALSE disables automatic reloading of malware definition database.

Return value

If the kaveEnableAutoReload function succeeds, its return value is S_OK.

For other return codes, see section "Return codes".

Remarks

When implementing desktop integration of KAV SDK on Windows platform, please always use Updater SDK to update malware definition database and KAV SDK components and notify the KAV SDK about the performed update. Additionally, you must enable Updater SDK to always download and update the HIPS2 component that is required for proper integration of KAV SDK on desktop Windows platforms.

Note that on Windows platform calling kaveEnableAutoReload does not automatically reload malware definition database. Updating and reloading is performed by Updater SDK. Instead, you use the kaveEnableAutoReload function to enable KAV SDK with update notifications that are sent by Updater SDK when the latter initializes KAV SDK to reload database files upon the update. If you do not use the kaveEnableAutoReload function but use Updater SDK to update the components of KAV SDK, your malware definition database will still be reloaded by Updater SDK when it completes the update of KAV SDK components. However, failing to call kaveEnableAutoReload will make your application unaware of the fact that Updater SDK has just initiated reloading the definition files into the memory of KAV SDK.

Using custom tools to update definition files is not permitted.

To obtain and update the HIPS2 component of KAV SDK:

  1. Be sure to use Updater SDK

    Please obtain the component from Kaspersky update servers; do not use custom update tools.

  2. Configure Updater SDK

    You can do that by specifying the HIPS2 code in the value of ComponentsToUpdate parameter in the update configuration XML file. This configuration file is used by Updater SDK components.

    Alternatively, you may specify the HIPS2 component code in the PRODUCT_SETTINGS data structure provided by Updater SDK API and initialized using Updater SDK. The HIPS2 component is only supported on Windows platform.

    When configured, Updater SDK automatically downloads the HIPS2 component from Kaspersky update servers and notifies the KAV SDK that updated component is ready to update.

  3. [optional] Enable KAV SDK with Updater SDK notifications

    Call kaveEnableAutoReload to enable KAV SDK with update notifications sent by Updater SDK on reloading of the updated component.

Examples

The following example shows how you may initialize the Updater SDK to properly download HIPS2 component that is necessary to integrate KAV SDK components on desktop platforms.

Example:

// Specifying component codes to download using Updater SDK

const TCHAR szComponentsToUpdate[] = _T("Updater;AVS;CORE;KDBI386;VLNS;EMUI386;BLST;SSA;BB;BB2;WAVI386;AH2I386;HIPS2");

int _tmain(int argc, _TCHAR* argv[])

{

// loading Updater SDK components

 

if(kuLoad(NULL))

{

// Initializing Updater SDK settings

 

UPDATER_SETTINGS Settings;

HRESULT hResult = kuInitialize(&Settings, NULL, NULL, NULL);

 

if(FAILED(hResult))

{

tprintf(_T("Can't initialize Updater SDK 8 modules. Error: %08x.\n"), hResult);

}

else

{

// Specifying KAV SDK components to update

Settings.ProductSettings.ComponentsToUpdate = (TCHAR*)szComponentsToUpdate;

...

// Updating KAV SDK components

kuDoDownload();

}

kuUnload();

}

}

This sample code assumes that you are using Updater SDK components to download KAV SDK components and notify the KAV SDK about successful update.

Page top