[This is preliminary documentation and subject to change.]
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. 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 manager 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: Requires version 5.0 or later. Available as a redistributable for Windows NT 4.0.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in winsnmp.h.
Import Library: Use wsnmp32.lib.
WinSNMP Manager API Overview, WinSNMP Functions, SnmpFreeDescriptor, smiOID