Platform SDK: Network Management |
The WinSNMP SnmpOidCopy function copies an SNMP object identifier, allocating any necessary memory for the copy.
SNMPAPI_STATUS SnmpOidCopy( smiLPCOID srcOID, // source object identifier smiLPOID dstOID // destination object identifier );
If the function succeeds, the return value is the number of subidentifiers in the copied object identifier. This number is also the value of the len member of the smiOID structure pointed to by the dstOID parameter.
If the function fails, the return value is SNMPAPI_FAILURE. 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.
Error code | Description |
---|---|
SNMPAPI_NOT_INITIALIZED | The SnmpStartup function did not complete successfully. |
SNMPAPI_ALLOC_ERROR | An error occurred during memory allocation. |
SNMPAPI_OID_INVALID | The srcOID parameter is invalid. |
SNMPAPI_OTHER_ERROR | An unknown or undefined error occurred. |
On input, the SnmpOidCopy function ignores the members of the smiOID structure pointed to by the dstOID parameter. The Microsoft WinSNMP implementation overwrites the smiOID members if the function completes successfully.
The WinSNMP application must call the SnmpFreeDescriptor function to enable the implementation to free resources allocated for the ptr member of the smiOID structure pointed to by the dstOID parameter. For additional information, see WinSNMP Data Management Concepts and Freeing WinSNMP Descriptors.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Unsupported.
Header: Declared in Winsnmp.h.
Library: Use Wsnmp32.lib.
WinSNMP API Overview, WinSNMP Functions, SnmpFreeDescriptor, smiOID