SnmpCleanup function (winsnmp.h)
[SNMP is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use Windows Remote Management, which is the Microsoft implementation of WS-Man.]
The SnmpCleanup function informs the Microsoft WinSNMP implementation that the calling WinSNMP application no longer requires the implementation's services.
Syntax
SNMPAPI_STATUS SNMPAPI_CALL SnmpCleanup();
Return value
If the function succeeds, the return value is SNMPAPI_SUCCESS. Until the WinSNMP application successfully recalls the SnmpStartup function, any other call to a WinSNMP function returns SNMPAPI_FAILURE, with an extended error code of SNMPAPI_NOT_INITIALIZED.
If the function fails, the return value is SNMPAPI_FAILURE, but the WinSNMP application does not need to retry the call to SnmpCleanup. To get extended error information, call SnmpGetLastError specifying a NULL value in its session parameter. The SnmpGetLastError function can return one of the following errors.
Return code | Description |
---|---|
|
The SnmpStartup function did not complete successfully. |
|
An error occurred during memory allocation. |
|
An unknown or undefined error occurred. |
Remarks
Before the WinSNMP application calls SnmpCleanup, it should call the SnmpClose function once for each session the implementation opens as a result of a call to the SnmpCreateSession function.
When a WinSNMP application calls the SnmpCleanup function, the implementation deallocates all resources allocated to the application. However, it is recommended that a WinSNMP application free the specific resources that the implementation allocates for it with the WinSNMP function that corresponds to the resource. For additional information about freeing individual resources, see SnmpFreeEntity, SnmpFreeVbl, SnmpFreeDescriptor, SnmpFreeContext, and SnmpFreePdu.
If a WinSNMP application must perform an emergency exit, and it calls SnmpCleanup without freeing individual resources and without calling SnmpClose for every open session, the implementation deallocates all resources allocated to the WinSNMP application. However, to enable this functionality in the implementation, the application must still call SnmpCleanup.
SnmpCleanup must not be called when the application DLL is in the process of unloading.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | winsnmp.h |
Library | Wsnmp32.lib |
DLL | Wsnmp32.dll |