Memory blocks are scanned by using the kaveScanMemory function. Except for the parameters common for all scanning functions, the kaveScanMemory function requires a pointer to the memory block (in the local process memory) to scan and its size.
The example below demonstrates usage of the kaveScanMemory function.
Example: // The kaveScanMemory function usage char szEICAR[] = "X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTI-VIRUS-TEST-FILE!$H+H*"; unsigned long dwScanningMode = KAV_O_M_PACKED | KAV_O_M_ARCHIVED | KAV_O_M_MAILPLAIN | KAV_O_M_HEURISTIC_LEVEL_SHALLOW; KAV_RESULT result = KAV_S_R_NOTSCANNED; unsigned long dwTaskID = 0; void *ctx;
HRESULT hr = kaveScanMemory ( (BYTE*) szEICAR, strlen ( szEICAR ), 5, dwScanningMode, KAV_CLEAN_SKIP, INFINITE, ctx, &dwTaskID, &result); |
The following parameter values of the kaveScanMemory function are specified in the example:
(BYTE*) szEICAR—pointer to the beginning of the memory block to scan.strlen (szEICAR)—size of the memory block to scan.5—scanning priority.dwScanningMode—scanning mode which is set to KAV_O_M_PACKED | KAV_O_M_ARCHIVED | KAV_O_M_MAILPLAIN | KAV_O_M_HEURISTIC_LEVEL_SHALLOW. This means that compressed executable files, archives and e-mail messages scanning is on, as well as using heuristic code analyzer.KAV_CLEAN_SKIP—cleaning mode. This particular value means that if the specified memory block is infected, the application will try to disinfect it. If disinfection fails, the scan task is skipped.INFINITE—scan timeout. In this example, scanning of the specified memory block will take as much time as necessary.ctx—user context that can be used by callback functions.dwTaskID—scan ID that can be used either to cancel this scan task or by a callback function. The KAV SDK will automatically fill this out parameter with the non-zero value.&result—pointer to the scanning result. In this example it is not NULL, and the scanning is synchronous.