Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
68991faf
Commit
68991faf
authored
May 20, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Jun 25, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inetmib1: Add tests for SnmpExtensionQuery.
parent
f451fefc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
103 additions
and
0 deletions
+103
-0
main.c
dlls/inetmib1/tests/main.c
+103
-0
No files found.
dlls/inetmib1/tests/main.c
View file @
68991faf
...
...
@@ -50,8 +50,111 @@ static void testInit(void)
"Expected 1.3.6.1.2.1.1, got %s
\n
"
,
SnmpUtilOidToA
(
&
oid
));
}
static
void
testQuery
(
void
)
{
BOOL
(
WINAPI
*
pQuery
)(
BYTE
,
SnmpVarBindList
*
,
AsnInteger32
*
,
AsnInteger32
*
);
BOOL
ret
,
moreData
;
SnmpVarBindList
list
;
AsnInteger32
error
,
index
;
UINT
bogus
[]
=
{
1
,
2
,
3
,
4
};
UINT
mib2System
[]
=
{
1
,
3
,
6
,
1
,
2
,
1
,
1
};
UINT
mib2If
[]
=
{
1
,
3
,
6
,
1
,
2
,
1
,
2
};
UINT
mib2IfTable
[]
=
{
1
,
3
,
6
,
1
,
2
,
1
,
2
,
2
};
SnmpVarBind
vars
[
3
],
vars2
[
3
];
pQuery
=
(
void
*
)
GetProcAddress
(
inetmib1
,
"SnmpExtensionQuery"
);
if
(
!
pQuery
)
{
skip
(
"couldn't find SnmpExtensionQuery
\n
"
);
return
;
}
/* Crash
ret = pQuery(0, NULL, NULL, NULL);
ret = pQuery(0, NULL, &error, NULL);
ret = pQuery(0, NULL, NULL, &index);
ret = pQuery(0, &list, NULL, NULL);
ret = pQuery(0, &list, &error, NULL);
*/
/* An empty list succeeds */
list
.
len
=
0
;
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.
*/
vars
[
0
].
name
.
idLength
=
sizeof
(
bogus
)
/
sizeof
(
bogus
[
0
]);
vars
[
0
].
name
.
ids
=
bogus
;
vars
[
0
].
value
.
asnType
=
0
;
list
.
len
=
1
;
list
.
list
=
vars
;
SetLastError
(
0xdeadbeef
);
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
));
/* The table is not an accessible variable, so it fails */
vars
[
0
].
name
.
idLength
=
sizeof
(
mib2IfTable
)
/
sizeof
(
mib2IfTable
[
0
]);
vars
[
0
].
name
.
ids
=
mib2IfTable
;
SetLastError
(
0xdeadbeef
);
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 */
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
* interface.
*/
vars
[
0
].
name
.
idLength
=
sizeof
(
mib2System
)
/
sizeof
(
mib2System
[
0
]);
vars
[
0
].
name
.
ids
=
mib2System
;
SnmpUtilOidCpy
(
&
vars2
[
0
].
name
,
&
vars
[
0
].
name
);
vars2
[
0
].
value
.
asnType
=
0
;
list
.
len
=
1
;
list
.
list
=
vars2
;
moreData
=
TRUE
;
ret
=
pQuery
(
SNMP_PDU_GETNEXT
,
&
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
);
}
vars
[
0
].
name
.
idLength
=
sizeof
(
mib2If
)
/
sizeof
(
mib2If
[
0
]);
vars
[
0
].
name
.
ids
=
mib2If
;
todo_wine
ok
(
!
SnmpUtilOidNCmp
(
&
vars2
[
0
].
name
,
&
vars
[
0
].
name
,
vars
[
0
].
name
.
idLength
),
"expected 1.3.6.1.2.1.2, got %s
\n
"
,
SnmpUtilOidToA
(
&
vars2
[
0
].
name
));
SnmpUtilVarBindFree
(
&
vars2
[
0
]);
}
START_TEST
(
main
)
{
inetmib1
=
LoadLibraryA
(
"inetmib1"
);
testInit
();
testQuery
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment