Return Codes

The following documents the possible return codes from method calls when using the MetaDefender Endpoint Security SDK.

Return code macros

All success error codes are greater than or equal to 0 and all failure error codes are less than 0. There are 3 macros available for checking success or failure error codes.

To check an error code for success

 #define WAAPI_SUCCESS(code) (((wa_int)(code))>=0)

The following examples illustrate how to use this macro function:

 if( WAAPI_SUCCESS( WAAPI_OK ) ) 
 {
   // Will enter the if-statement
 }
 if( WAAPI_SUCCESS( WAAPI_ERROR_GENERAL ) )
 {
   // Will NOT enter the if-statement
 }

To check an error code for failure

 #define WAAPI_FAILED(code) (((wa_int)(code))<0)

The following examples illustrate how to use this macro function:

 if( WAAPI_FAILED( WAAPI_ERROR_GENERAL ) ) 
 {
   // Will enter the if-statement
 }
 if( WAAPI_FAILED( WAAPI_OK ) )
 {
   // Will NOT enter the if-statement
 }

To check an error code for special success case. These codes are considered successful, but provide additional information about the current product state. When a special success code is returned, some of the data returned from the call be be unavailable.

 #define WAAPI_SUCCESS_SPECIAL(code) (((wa_int)(code))>=1000)

The following examples illustrate how to use this macro function:

 if( WAAPI_SUCCESS_SPECIAL( WAAPI_OK_NO_SCAN_REPORTED ) ) 
 {
   // Will enter the if-statement
 }
 if( WAAPI_SUCCESS_SPECIAL( WAAPI_OK ) )
 {
   // Will NOT enter the if-statement
 }

Available return codes:

Every function call will return one of the following codes to determine the success or failure of the call.