Return values of functions and monitors

The Kaspersky Anti-Virus Engine C API library does not throw exceptions or handle errors. Discovered errors and values are returned as return codes.

Functions from the Kaspersky Anti-Virus Software Development Kit 8 Level 3 for Windows use two types of return codes: system codes and custom codes.

Most KAV SDK functions targeted for Windows platform return HRESULT data type values.

System values are defined in the winerror.h file. Custom return values are defined in the SDK_folder/Include/kave8_def.h file where SDK_folder is your SDK folder.

Return values can be either returned by an SDK function, or sent to the callback function in case of the EVENT_ERROR callback event.

The table below describes operating system return codes.

For more information about the system codes, please see the documentation for the winerror.h header file provided by Microsoft.

System return codes

Return value

Description

S_OK

The operation completed successfully.

S_FALSE

An attempt to call kaveInitialize or kaveInitializeEx is made with KAV_SHT_ENGINE_KSN host type specified when available KEY file expired.

KAV SDK will initialize, but cloud features will not be available.

If logging is turn on, KAV SDK adds details to the log file.

E_FAIL

Unexpected error occurred during execution.

E_UNEXPECTED

The function was called at unexpected moment. For example, this code is returned when calling function before initializing or after uninitializing, or invoking it before the previous call is completed (for example, the function is called from different threads).

E_INVALIDARG

Invalid arguments were passed into the function.

E_NOTIMPL

There was an attempt to call function before loading the library.

E_OUTOFMEMORY

The process is running out of system memory.

E_NOINTERFACE

The specified programming interface is not supported.

E_POINTER

The specified pointer is invalid.

E_HANDLE

The specified handle of an object is invalid.

E_ABORT

Operation has been aborted.

E_ACCESSDENIED

General access error.

The table below lists custom return codes and their descriptions.

Custom return codes

Return code

Description

KAV_E_QUEUE_OVERFLOW

The scanning task queue is overloaded (the queue length is set during initialization and can be changed by using the kaveSetQueueLen function).

KAV_E_MOD_NOT_FOUND

One of the SDK modules is not found during initialization.

KAV_E_INVALID_BASES

Anti-virus database used by the SDK is corrupted. This value is also returned when no database is found in the indicated location (the location is specified during initialization, otherwise the default path is used).

KAV_E_PRODUCT_NOT_REGISTERED

This value is returned in case the appinfo.kli file is not found, or when the application is not signed with the private key.

An attempt to call kaveInitialize or kaveInitializeEx is made when any of the following is true:

  • Application information file (appinfo.kli) is missing or its digital signature cannot be validated
  • Digital signature of the caller executable cannot be validated.

KAV_E_LICENSE_EXPIRED_OR_MISSING

Specified license KEY file is expired or missing from the default or custom location.

Note that when using kaveReloadDatabase this error code is not returned even if your copy of KAV SDK is running with an expired license key.

For more information, see section "License lifecycle".

KAV_E_LICENSE_LIMITED

You attempt to start KAV SDK with limited functionality. Used KEY file does not allow you to initialize KAV SDK with the specified flags.

KAV SDK will not initialize.

KAV_E_TIMEOUT

This code is returned after the timeout period specified in the dwScanTimeout variable of a scanning function has expired; the EVENT_ERROR callback event arises with this code.

For more information about the dwScanTimeout variable, see section "Scanning functions".

KAV_E_OUT_OF_SPACE

Please notice that in some cases this event may not be raised when there is not enough disk space left. Please always be sure check with KAV SDK system requirements to avoid issues with running SDK on a low disk space. For more information, refer to section "System requirements".

There is not enough disk space to store temporary files during the scanning process.

KAV_E_ACCESS_DENIED

Not enough rights to access the file.

KAV_E_MAILBOMB_SUSPICIOUS

The nesting level is too high to scan the object.

KAV_E_NEED_REBOOT

Reboot is necessary for normal POP3 monitor functioning.

This code can be returned only after the POP3 anti-virus database is updated; the EVENT_ERROR callback event arises with this code.

For more information about callback events, see section "Event notification codes".

KAV_E_DELETE_ON_REBOOT_FAILED

This return code indicates that infected file will not be removed upon the next reboot.

Preparing the infected file for deletion on the next reboot has failed for some reason and deletion cannot be performed on the next reboot.

This code is returned by KAV SDK when Advanced Disinfection mechanism (see section "Advanced Disinfection mode") fails to mark the infected file for deletion. This could be caused by a locking problem such as when the file to be marked is being locked by another process and cannot be deleted in-place.

When handling this code, it is recommended that you use external tools developed by Kaspersky Lab. For more information about these tools contact with your Technology Account Manager (TAM).

KAV_E_DISINFECT_ON_REBOOT_FAILED

This return code indicates that infected file will not be disinfected upon the next reboot.

Preparing the infected file for disinfection on the next reboot has failed for some reason and disinfection cannot be performed on the next reboot.

This code is returned by KAV SDK when Advanced Disinfection mechanism (see section "Advanced Disinfection mode") fails to mark the infected file for disinfection.

KAV_E_READ_ERROR

Error occurred while trying to read the file.

KAV_E_WRITE_ERROR

The object cannot be disinfected because it cannot be accessed for writing.

Handling return values in service mode

In UNIX environment you can troubleshoot KAV SDK server workflow issues at the run time using error codes returned by kavehost service. The kavehost service implements server functionality and may return an error code while it is running or at startup to help you resolve issues.

The error codes are returned by kavehost service to the standard output (console STDOUT). The 0 return code indicates a successful operation performed by KAV Engine. Any non-zero value of return code indicates an issue. For detailed information about the type of an issue please appeal to your Technical Account Manager. The following types of issues may be reported:

The following table allows you to retrieve error descriptions by the error code and message returned by kavehost to standard output:

Error codes returned by kavehost service

Return code

Message

Description

0

N/A. No error message is returned.

This is a success return code and indicates successful operation performed by KAV server. No error message is returned to stdout.

1

Config path must be absolute; now [%s]

An invalid path to the kavehost service configuration file has been specified.

2

Error load settings from config file: [%s]

There was an error parsing configuration XML file. Please check that XML layout is correct and all configuration file options have been correctly specified.

Refer to section "Kavehost service configuration file" for more information about configuring kavehost service settings using configuration file.

3

Cannot start server: set signal processing failed

The kavehost service could not be started. There was an error handling signal notification during inter-process communication performed by kavehost service.

4

Cannot start server: fork failed

There was an error starting a child kavehost process at initialization stage.

During initialization kavehost process forks from console. This error indicates such fork failed.

5

Cannot start server: setsid failed

The server could not be started, because there was an error creating new session for kavehost service.

6

Cannot start server: out of memory

Operating system is running out of memory. There is not enough memory to start kavehost service.

7

Cannot start server: preparing server connections failed

Starting kavehost service could not be done. There was an error creating UNIX connection sockets.

81

Cannot start server: Necessary module not found!

Error starting kavehost service, a required component is missing.

For more information, see description of the KAV_E_MOD_NOT_FOUND error code in the "Custom return codes" table in this section.

82

Cannot start server: Invalid updateable antivirus databases!

Anti-virus database used by the SDK is corrupted. This value is also returned when no database is found in the indicated location (the location is specified during initialization, otherwise the default path is used).

Additionally, see description of the KAV_E_INVALID_BASES error code in the "Custom return codes" table in this section.

83

Cannot start server: Product is not registered!

This value is returned in case the appinfo.kli file is not found, or when the application is not signed with the private key.

For more information, see section "Licensing".

Additionally, see description of the KAV_E_PRODUCT_NOT_REGISTERED error code in the "Custom return codes" table in this section.

84

Cannot start server: Product license is expired or missing!

The license key file is not found, or it is expired.

For more information, see section "License lifecycle".

Additionally, see description of the KAV_E_LICENSE_EXPIRED_OR_MISSING error code in the "Custom return codes" table in this section.

8

Cannot start server: initializing server object failed

There was an error initializing KAV Engine.

This error code indicates some issue with initialization of scanning engine loaded by kavehost service, which cannot be categorized by particular failure type.

9

Cannot run server object

There was an error at the post-initialization workflow, for example, service failed accessing UNIX sockets.

This error may occur, when UNIX sockets that were present at initialization have been forcibly removed by external process at kavehost runtime.

10

Cannot write pid file %s.kavehost ended

The kavehost failed creating its PID file and will be closed.

11

Cannot start server: waiting signal failed

The sigwait operating system function returned a non-zero value indicating that suspending of the calling thread failed.

Sigwait is called to validate that fork has been successfully performed.

12

Cannot start server: sigchild

The kavehost service has been forcibly terminated by external process.

13

Cannot run server: Extended error!

Some unexpected error occurred that cannot be handled.

Page top