SnmpOidCopy 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 WinSNMP SnmpOidCopy function copies an SNMP object identifier, allocating any necessary memory for the copy.

Syntax

SNMPAPI_STATUS SNMPAPI_CALL SnmpOidCopy(
  [in]  smiLPCOID srcOID,
  [out] smiLPOID  dstOID
);

Parameters

[in] srcOID

Pointer to an smiOID structure to copy.

[out] dstOID

Pointer to an smiOID structure to receive a copy of the object identifier specified by the srcOID parameter.

Return value

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.

Return 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.

Remarks

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.

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

See also

SnmpFreeDescriptor

WinSNMP Functions

WinSNMP API Overview

smiOID