inetmib1: Improve SnmpExtensionQuery stub.

This commit is contained in:
Juan Lang 2008-05-20 20:50:45 -07:00 committed by Alexandre Julliard
parent 46f7f76b1e
commit 50f4bd16f6
2 changed files with 22 additions and 10 deletions

View File

@ -47,6 +47,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
return TRUE;
}
static UINT mib2[] = { 1,3,6,1,2,1 };
static UINT mib2System[] = { 1,3,6,1,2,1,1 };
BOOL WINAPI SnmpExtensionInit(DWORD dwUptimeReference,
@ -65,7 +66,24 @@ BOOL WINAPI SnmpExtensionInit(DWORD dwUptimeReference,
BOOL WINAPI SnmpExtensionQuery(BYTE bPduType, SnmpVarBindList *pVarBindList,
AsnInteger32 *pErrorStatus, AsnInteger32 *pErrorIndex)
{
FIXME("(0x%02x, %p, %p, %p): stub\n", bPduType, pVarBindList,
AsnObjectIdentifier mib2oid = DEFINE_OID(mib2);
AsnInteger32 error = SNMP_ERRORSTATUS_NOERROR, errorIndex = 0;
UINT i;
TRACE("(0x%02x, %p, %p, %p)\n", bPduType, pVarBindList,
pErrorStatus, pErrorIndex);
return FALSE;
for (i = 0; !error && i < pVarBindList->len; i++)
{
/* Ignore any OIDs not in MIB2 */
if (!SnmpUtilOidNCmp(&pVarBindList->list[i].name, &mib2oid,
mib2oid.idLength))
{
FIXME("%s: stub\n", SnmpUtilOidToA(&pVarBindList->list[i].name));
error = SNMP_ERRORSTATUS_NOSUCHNAME;
}
}
*pErrorStatus = error;
*pErrorIndex = errorIndex;
return TRUE;
}

View File

@ -81,12 +81,10 @@ static void testQuery(void)
error = 0xdeadbeef;
index = 0xdeadbeef;
ret = pQuery(SNMP_PDU_GET, &list, &error, &index);
todo_wine {
ok(ret, "SnmpExtensionQuery failed: %d\n", GetLastError());
ok(error == SNMP_ERRORSTATUS_NOERROR,
"expected SNMP_ERRORSTATUS_NOERROR, got %d\n", error);
ok(index == 0, "expected index 0, got %d\n", index);
}
/* Oddly enough, this "succeeds," even though the OID is clearly
* unsupported.
@ -100,12 +98,10 @@ static void testQuery(void)
error = 0xdeadbeef;
index = 0xdeadbeef;
ret = pQuery(SNMP_PDU_GET, &list, &error, &index);
todo_wine {
ok(ret, "SnmpExtensionQuery failed: %d\n", GetLastError());
ok(error == SNMP_ERRORSTATUS_NOERROR,
"expected SNMP_ERRORSTATUS_NOERROR, got %d\n", error);
ok(index == 0, "expected index 0, got %d\n", index);
}
/* The OID isn't changed either: */
ok(!strcmp("1.2.3.4", SnmpUtilOidToA(&vars[0].name)),
"expected 1.2.3.4, got %s\n", SnmpUtilOidToA(&vars[0].name));
@ -117,13 +113,12 @@ static void testQuery(void)
error = 0xdeadbeef;
index = 0xdeadbeef;
ret = pQuery(SNMP_PDU_GET, &list, &error, &index);
todo_wine {
ok(ret, "SnmpExtensionQuery failed: %d\n", GetLastError());
ok(error == SNMP_ERRORSTATUS_NOSUCHNAME,
"expected SNMP_ERRORSTATUS_NOSUCHNAME, got %d\n", error);
/* The index is 1-based rather than 0-based */
todo_wine
ok(index == 1, "expected index 1, got %d\n", index);
}
/* Even though SnmpExtensionInit says this DLL supports the MIB2 system
* variables, the first variable it returns a value for is the first
@ -137,12 +132,11 @@ static void testQuery(void)
list.list = vars2;
moreData = TRUE;
ret = pQuery(SNMP_PDU_GETNEXT, &list, &error, &index);
todo_wine {
ok(ret, "SnmpExtensionQuery failed: %d\n", GetLastError());
todo_wine
ok(error == SNMP_ERRORSTATUS_NOERROR,
"expected SNMP_ERRORSTATUS_NOERROR, got %d\n", error);
ok(index == 0, "expected index 0, got %d\n", index);
}
vars[0].name.idLength = sizeof(mib2If) / sizeof(mib2If[0]);
vars[0].name.ids = mib2If;
todo_wine