Scan File

API

Scan

Function

This is the main function of the custom engine. The scan result returned from this function call is used by Metadefender Core’s scan-related API.

Function prototype

int Scan
(
int dataType,
const void * data,
int * scanResult,
wchar_t ** threatName,
void ** reserved
)

Arguments

Argument

Description

dataType

0: if data is a file path string (wide characters)

Other dataType values are not supported with 3.2.5

data

When dataType indicates a file path, you must cast to a const wchar_t pointer.

e.g.,

wstring filePathToScan = (const wchar_t *)data;

scanResult

Scan result to be returned:

  • 0: clean

  • 1: found threat

  • 2: suspicious

  • 3: failed to scan

  • 10: not scanned (during update)

threatName

Threat name to be returned.

reserved

Reserved for future.

Important: threatName is a double pointer to wchar_t. It must be allocated by the custom engine in a way that can be deallocated by the FreeString function.

Return value

Value

Description

0

Scan completed successfully.

1

Failed to start or finish scanning.