kaveScanCriticalArea

Scans a critical area.

When scanning system memory, installation of the File Monitor driver is necessary for detection and curing of some types of malware. For more information, see section "Drivers".

The function is not implemented for Linux-based solutions.

When the Cloud Protection is enabled, this function performs additional checking of object reputation via Kaspersky Security Network.

Syntax

HRESULT kaveScanCriticalArea (

  CRITICAL_AREA_TYPE enCriticalAreaType,

  unsigned long  dwScanPriority,

  unsigned long  dwScanningMode,

  unsigned long  dwCleaningMode,

  unsigned long  dwScanTimeout,

  void  *pUserContext,

  unsigned long  *pdwObjectID,

  KAV_RESULT  *pResult);

Types of critical areas

There are areas on the computer that are critical from a security perspective. These are the targets of malicious programs aimed at infecting the operating system, modifying its components and system registry, hiding itself in the system memory and taking control over system processes, or stealing and corrupting user and system data on drives, such as making modifications to boot records. It is extremely important to protect these critical areas.

When scanning critical areas, the KAV Engine does not return the EVENT_OBJECT_BEGIN event even if you have explicitly specified returning the events that show progress of scanning by calling the kaveEnableInprogressEvents function.

The kaveScanCriticalArea function can scan critical areas of several types. Each type can be specified as the value of the enCriticalAreaType argument. The table below lists the possible types.

Types of critical areas

Value

Critical area to scan

SYSTEM_MEMORY

System memory.

BOOT_SECTORS

Boot sectors.

Scanning boot sectors does not work for Windows x64 solutions.

STARTUP_OBJECTS

Startup objects.

Functionality provided by the kaveScanCriticalArea function when this value is used for the enCriticalAreaType parameter is currently obsolete and has been replaced by QSCAN functionality. The QSCAN functionality can be enabled by using the STARTUP_QSCAN value for the enCriticalAreaType parameter.

STARTUP_QSCAN

Areas that are enumerated by KAV SDK using QSCAN component. QSCAN component provides a database of areas used by malware to run malicious operations and helps KAV SDK to scan your system for rootkits (see subsection "Startup enumeration").

Before scanning a critical area of such type, load the QSCAN component (a part of the anti-virus database implementing anti-rootkit technology), register the klif and kl1 drivers with the operating system, and started them (see section "Drivers").

Supported in: Windows only.

Startup enumeration

When the QSCAN component is invoked by calling the kaveScanCriticalArea function with enCriticalAreaType set to STARTUP_QSCAN, it scans through the list of known critical areas which are as follows.

Enumerated areas

Area

Description

System memory

Libraries loaded into the running processes.

Startup objects

System startup objects, such as those referenced by system registry and HKEY_LOCAL_MACHINE hive. Examples include but are not limited to the Run key for the computer and the Run key for the user, which are as follows:

  • HKLM\Software\Microsoft\Windows\CurrentVersion\Run
  • HKCU\Software\Microsoft\Windows\CurrentVersion\Run
  • HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Run

Boot sectors

A region of hard disks that contains machine code to be loaded into computer memory.

Using kaveScanCriticalArea you can do a quick scan, a type of scanning when only the system critical areas are scanned. Or, you can explicitly specify areas that you want KAV SDK to scan.

Note that STARTUP_QSCAN does not replace the functionality provided by KAV SDK when kaveScanCriticalArea is invoked with enCriticalAreaType set to SYSTEM_MEMORY or BOOT_SECTORS.

To run a quick scan or scan critical areas as part of the full scanning operation, call kaveScanCriticalArea subsequently passing the following parameters in enCriticalAreaType:

  1. SYSTEM_MEMORY
  2. BOOT_SECTORS
  3. STARTUP_QSCAN.

Parameters

The kaveScanCriticalArea function has the following parameters.

kaveScanCriticalArea function parameters

Name

Type

Description

enCriticalAreaType

in

One of the critical area types (see subsection "Types of critical areas").

dwScanPriority

in

A priority level for scanning the indicated area. The higher the value is, the higher the priority is.

Priority level is taken into consideration when selecting the objects from the scanning queue. The queue is sorted according to the objects’ priority. The objects with higher priority are scanned first.

dwScanningMode

in

Scanning mode.

For more information, see section "Scanning modes".

In case the user is supposed to decide on the action with an infected object, such action is requested by calling the callback function with the appropriate parameters.

dwCleaningMode

in

An action upon detection a malware. For possible parameter values, see section "Cleaning modes".

Regardless of the cleaning mode settings, the KAV SDK reacts to the malware detection event by calling a callback function with the appropriate parameters.

dwScanTimeout

in

The maximum time in milliseconds allotted for performing a scan task. After the specified timeout expires, the scanning is stopped and the function returns with the KAV_E_TIMEOUT error code.

To set no time limit for the scanning task, use the INFINITE value or set it to zero.

pUserContext

in

A pointer to any user data that can be used by a callback function.

pdwObjectID

out

A pointer to the scan task identifier. It helps to distinguish scan tasks and their results in case of asynchronous scanning and monitoring—it is used for accessing the scanning result through a callback function.

The scan task ID can also be used for canceling this particular scanning task. For more information, see kaveCancelScan.

When scanning files via File Monitor, unique identifiers assigned to scanned files by KAV SDK are returned directly to callback function in the dwObjectID parameter. For more details, see "Callback function prototype".

pResult

out

A pointer to the variable describing the scan result.

If this variable does not have the NULL value, the function is called synchronously—the function does not return until the scan is completed. The scan result will be written to the pResult variable.

If this variable has the NULL value, the function is called asynchronously. In this case the scan result can be obtained only by calling a callback function with the appropriate parameters.

Return value

As with any other scanning function, once invoked, the function checks whether KAV Engine has been initialized properly. If this checking fails, the E_UNEXPECTED error code is returned. When proper initialization is confirmed, licensing is then verified and a license error is returned in case of any problem with KAV SDK license. After all these checks are done, the function parameters are verified. If the function is called with the enCriticalAreaType set to STARTUP_OBJECT, the E_NOTIMPL error code is returned. See the kave8_def.h header file for the values of the CRITICAL_AREA_TYPE enumeration type. Consider using the STARTUP_QSCAN constant as the value for the enCriticalAreaType parameter, which enables QSCAN functionality.

If the kaveScanCriticalArea function succeeds, its return value is S_OK. For information on other return codes, see section "Return codes".

Page top