WINE_DEFAULT_DEBUG_CHANNEL(snmpapi);
-static INT asn_any_copy(AsnAny *dst, AsnAny *src)
+static INT asn_any_copy(AsnAny *dst, const AsnAny *src)
{
memset(dst, 0, sizeof(AsnAny));
switch (src->asnType)
any->asnType = ASN_NULL;
}
+static ULONGLONG startTime;
+
/***********************************************************************
* DllMain for SNMPAPI
*/
return FALSE; /* prefer native version */
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hInstDLL);
+ startTime = GetTickCount64();
break;
case DLL_PROCESS_DETACH:
break;
return TRUE;
}
+/***********************************************************************
+ * SnmpSvcGetUptime (SNMPAPI.@)
+ *
+ * BUGS
+ * This returns the number of centiseconds since the DLL was loaded,
+ * rather than the number of centiseconds since the SNMP service was
+ * started, since there isn't yet any SNMP service in Wine.
+ */
+DWORD WINAPI SnmpSvcGetUptime(void)
+{
+ ULONGLONG now = GetTickCount64();
+
+ return (now - startTime) / 10;
+}
+
/***********************************************************************
* SnmpUtilDbgPrint (SNMPAPI.@)
*
*/
INT WINAPI SnmpUtilOidNCmp(AsnObjectIdentifier *oid1, AsnObjectIdentifier *oid2, UINT count)
{
- unsigned int i;
+ unsigned int i, len;
TRACE("(%p, %p, %d)\n", oid1, oid2, count);
if (!oid1 || !oid2) return 0;
- for (i = 0; i < count; i++)
+ len = min(count, oid1->idLength);
+ len = min(len, oid2->idLength);
+ for (i = 0; i < len; i++)
{
if (oid1->ids[i] > oid2->ids[i]) return 1;
if (oid1->ids[i] < oid2->ids[i]) return -1;
}
+ if (i == count) return 0;
+ if (oid1->idLength < oid2->idLength) return -1;
+ if (oid1->idLength > oid2->idLength) return 1;
return 0;
}
dst->len = 0;
return SNMPAPI_NOERROR;
}
- size = src->len * sizeof(SnmpVarBind *);
+ size = src->len * sizeof(SnmpVarBind);
if (!(dst->list = HeapAlloc(GetProcessHeap(), 0, size)))
- {
- HeapFree(GetProcessHeap(), 0, dst);
return SNMPAPI_ERROR;
- }
+
src_entry = src->list;
dst_entry = dst->list;
for (i = 0; i < src->len; i++)
case ASN_TIMETICKS: TRACE("Timeticks %u\n", any->asnValue.ticks); return;
case ASN_COUNTER64:
{
- TRACE("Counter64 %llu\n", any->asnValue.counter64.QuadPart);
+ TRACE("Counter64 %x%08x\n", (DWORD)(any->asnValue.counter64.QuadPart>>32),(DWORD)any->asnValue.counter64.QuadPart);
return;
}
case ASN_OCTETSTRING: