Whenever KAV SDK scans an object through a monitor component or via a supported scanning function, you can request the SDK to provide a hash sum for the scanned object.
The following monitor components provided in KAV SDK are supported:
The following scanning functions that allow on-demand scanning are supported:
kaveScanFile and kaveScanFileExkaveScanMemory and kaveScanMemoryExkaveScanStream and kaveScanStreamExkaveScanCriticalAreaWorking with hash sum functionality
Your typical scenario for working with MD5 using KAV SDK is as follows:
Remember, by default KAV SDK uses callback function specified in kaveInitializeEx. This function is globally used in SDK to notify about the events raised by scanning functions and monitoring components.
Alternatively, when scanning files using monitoring components, you may provide a separate callback function that will be used to handle events raised specifically by these components.
CLBK_GET_OBJECT_HASH callback code.This code can be returned only when callback is called with the following codes in dwEvent:
EVENT_PREDETECTThis event is supported for all types of monitoring components (except for Proactive Defense Monitor (PDM)) and scanning functions.
EVENT_SUSPECTEDThis event is supported only for PDM, a monitoring component that does not use EVENT_PREDETECT. Never return CLBK_GET_OBJECT_HASH when this event is returned by another type of monitoring component or a scanning function.
EVENT_OBJECT_HASH notification code in dwEvent.Return CLBK_OK to further handle this object. Any but CLBK_CANCEL_OBJECT and CLBK_CANCEL_ALL return codes can be used to confirm disinfection of the found threat. For example, return of CLBK_GET_OBJECT_HASH on this step is interpreted as a confirmation code. Indeed, because KAV SDK already returned you the hash of the file, there is no need to resend it, and repetitive CLBK_GET_OBJECT_HASH are handled as CLBK_OK.
Return CLBK_CANCEL_ALL to cancel scanning object with dwObjectID and all its embedded objects, or CLBK_CANCEL_OBJECT to cancel processing only current object; embedded objects will be scanned next.
dwObjectID or finishes scanning infected object.What information is returned with callback on detection of threat
When KAV SDK calls your callback function to notify about the detection event, it returns the following data:
A typical example is a path the to infected file.
A unique identifier assigned to the found object by KAV SDK in current scanning session. For PDM detects this is the PID of the process that caused PDM to trigger the detect event.
A unique identifier assigned to the started monitoring component that detected object in current scanning session. If detect event is raised by a scanning function, Monitor ID is not available, KAV SDK returns null value.
Requesting MD5 hash
To request an MD5 hash sum for the scanned dwObjectID, you must return the CLBK_GET_OBJECT_HASH callback code.
KAV SDK accepts this code only on the following stages:
Predetect stage (callback handler is called with EVENT_PREDETECT passed in dwEvent parameter).
Detect stage; only for potentially harmful objects detected by PDM (callback handler is called with EVENT_SUSPECTED passed in dwEvent parameter).
When you do not need KAV SDK to provide you a hash sum for the scanned object, do not return CLBK_GET_OBJECT_HASH.
What information is returned with callback upon the generation of MD5
When KAV SDK calls your callback function to notify generated MD5 hash sum, it returns the following data:
EVENT_OBJECT_HASH code is used to notify you that KAV SDK finished computing MD5 hash sum for the scanned object.
KAV_OBJECT_HASH is used to store hash data.
A typical example is a path the to infected file.
A unique identifier assigned to the found object by KAV SDK in current scanning session.
A unique identifier assigned to the started monitoring component that detected object in current scanning session.
How types of handled objects affect the resulting MD5 sum
Depending on the type of object where KAV SDK detects a threat, you may see the difference in how KAV SDK handles such objects when MD5 sum is requested. KAV SDK provides MD5 hash sums for specific types. Other types are supported for scanning and are not supported by MD5 hash sum functionality.
The following types of objects are supported:
Hash sum is provided for the infected archived file within the scanned archive.
Use KAV_O_M_ARCHIVED scanning mode option to enable scanning of such objects.
Hash sum is provided for the image of the packed file/container.
Use KAV_O_M_PACKED scanning mode option to enable scanning of such objects.
Hash sum is provided for the ADS file system fork of the main stream.
Use KAV_O_M_NTFS_ADS scanning mode option to enable scanning of such objects.
All listed types of scanned objects are either parent objects or child objects. Parent objects may hold another objects within them, where child objects are nested within other objects, or, like the ADS, these objects originate from some other objects of similar kind.
There is a difference in how KAV SDK handles these objects design-wise. Whenever infected file is found within the scanned archive, KAV SDK returns MD5 hash sum for the unpacked version of infected file. However, if infection is defected in a packed file or container, hash sum is provided for packed file/container. If an alternate data stream is found infected, MD5 hash sum is provided for the main data stream, the stream from which stems the infected ADS.