Platform SDK: Network Management

WinSNMP Common Error Codes

The SnmpGetLastError function can return a general error code after a WinSNMP function fails. The following table lists the WinSNMP common error codes.

Error code Meaning Recommended action
SNMPAPI_NOT_INITIALIZED The SnmpStartup function did not complete successfully either since program execution began, or since a call to the SnmpCleanup function completed successfully. The application should call SnmpGetLastError before it calls any other WinSNMP API function when SnmpStartup fails. The SnmpGetLastError function returns extended error information about the failure of SnmpStartup.
SNMPAPI_ALLOC_ERROR The application specified an invalid pointer, or an error occurred during memory allocation. The Microsoft WinSNMP implementation could not obtain sufficient resources to execute the request. The application should provide valid memory pointers for all output parameters. It should free resources, reduce resource requirements, or facilitate a graceful shutdown. A graceful shutdown includes multiple calls to the SnmpClose function, one for each open WinSNMP session. It also includes a call to the SnmpCleanup function.
SNMPAPI_NOOP The function did not complete successfully because all output parameters are NULL. The application must specify at least one output parameter that is not NULL when calling a function that returns information to the application.
SNMPAPI_OTHER_ERROR An unknown or undefined error occurred. The application should usually respond with a graceful shutdown. A graceful shutdown includes multiple calls to the SnmpClose function, one for each open WinSNMP session. It also includes a call to the SnmpCleanup function.

The WinSNMP errors that convey context-specific information are noted in each function's reference page.