Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
3b08a51b
Commit
3b08a51b
authored
Apr 07, 2021
by
Zebediah Figura
Committed by
Alexandre Julliard
Apr 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntoskrnl/tests: Add some tests for device interfaces.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0b8c1d69
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
2 deletions
+78
-2
driver.h
dlls/ntoskrnl.exe/tests/driver.h
+4
-1
driver_pnp.c
dlls/ntoskrnl.exe/tests/driver_pnp.c
+14
-1
ntoskrnl.c
dlls/ntoskrnl.exe/tests/ntoskrnl.c
+60
-0
No files found.
dlls/ntoskrnl.exe/tests/driver.h
View file @
3b08a51b
...
...
@@ -36,7 +36,10 @@
#define IOCTL_WINETEST_MISMATCHED_STATUS CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80b, METHOD_NEITHER, FILE_ANY_ACCESS)
#define IOCTL_WINETEST_COMPLETION CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80c, METHOD_NEITHER, FILE_ANY_ACCESS)
#define IOCTL_WINETEST_BUS_MAIN CTL_CODE(FILE_DEVICE_BUS_EXTENDER, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_WINETEST_BUS_MAIN CTL_CODE(FILE_DEVICE_BUS_EXTENDER, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_WINETEST_BUS_REGISTER_IFACE CTL_CODE(FILE_DEVICE_BUS_EXTENDER, 0x801, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_WINETEST_BUS_ENABLE_IFACE CTL_CODE(FILE_DEVICE_BUS_EXTENDER, 0x802, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_WINETEST_BUS_DISABLE_IFACE CTL_CODE(FILE_DEVICE_BUS_EXTENDER, 0x803, METHOD_BUFFERED, FILE_ANY_ACCESS)
static
const
char
teststr
[]
=
"Wine is not an emulator"
;
...
...
dlls/ntoskrnl.exe/tests/driver_pnp.c
View file @
3b08a51b
...
...
@@ -33,7 +33,8 @@
#include "utils.h"
static
const
GUID
control_class
=
{
0xdeadbeef
,
0x29ef
,
0x4538
,
{
0xa5
,
0xfd
,
0xb6
,
0x95
,
0x73
,
0xa3
,
0x62
,
0xc0
}};
static
UNICODE_STRING
control_symlink
;
static
const
GUID
bus_class
=
{
0xdeadbeef
,
0x29ef
,
0x4538
,
{
0xa5
,
0xfd
,
0xb6
,
0x95
,
0x73
,
0xa3
,
0x62
,
0xc1
}};
static
UNICODE_STRING
control_symlink
,
bus_symlink
;
static
DEVICE_OBJECT
*
bus_fdo
,
*
bus_pdo
;
...
...
@@ -60,6 +61,7 @@ static NTSTATUS fdo_pnp(IRP *irp)
IoDetachDevice
(
bus_pdo
);
IoDeleteDevice
(
bus_fdo
);
RtlFreeUnicodeString
(
&
control_symlink
);
RtlFreeUnicodeString
(
&
bus_symlink
);
return
ret
;
}
...
...
@@ -259,6 +261,17 @@ static NTSTATUS fdo_ioctl(IRP *irp, IO_STACK_LOCATION *stack, ULONG code)
test_bus_query
();
return
STATUS_SUCCESS
;
case
IOCTL_WINETEST_BUS_REGISTER_IFACE
:
return
IoRegisterDeviceInterface
(
bus_pdo
,
&
bus_class
,
NULL
,
&
bus_symlink
);
case
IOCTL_WINETEST_BUS_ENABLE_IFACE
:
IoSetDeviceInterfaceState
(
&
bus_symlink
,
TRUE
);
return
STATUS_SUCCESS
;
case
IOCTL_WINETEST_BUS_DISABLE_IFACE
:
IoSetDeviceInterfaceState
(
&
bus_symlink
,
FALSE
);
return
STATUS_SUCCESS
;
default:
ok
(
0
,
"Unexpected ioctl %#x.
\n
"
,
code
);
return
STATUS_NOT_IMPLEMENTED
;
...
...
dlls/ntoskrnl.exe/tests/ntoskrnl.c
View file @
3b08a51b
...
...
@@ -987,6 +987,7 @@ static void add_file_to_catalog(HANDLE catalog, const WCHAR *file)
static
void
test_pnp_devices
(
void
)
{
static
const
GUID
control_class
=
{
0xdeadbeef
,
0x29ef
,
0x4538
,
{
0xa5
,
0xfd
,
0xb6
,
0x95
,
0x73
,
0xa3
,
0x62
,
0xc0
}};
static
const
GUID
bus_class
=
{
0xdeadbeef
,
0x29ef
,
0x4538
,
{
0xa5
,
0xfd
,
0xb6
,
0x95
,
0x73
,
0xa3
,
0x62
,
0xc1
}};
char
buffer
[
200
];
SP_DEVICE_INTERFACE_DETAIL_DATA_A
*
iface_detail
=
(
void
*
)
buffer
;
...
...
@@ -1028,6 +1029,65 @@ static void test_pnp_devices(void)
ret
=
DeviceIoControl
(
bus
,
IOCTL_WINETEST_BUS_MAIN
,
NULL
,
0
,
NULL
,
0
,
&
size
,
NULL
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
/* Test IoRegisterDeviceInterface() and IoSetDeviceInterfaceState(). */
set
=
SetupDiGetClassDevsA
(
&
bus_class
,
NULL
,
NULL
,
DIGCF_DEVICEINTERFACE
);
ok
(
set
!=
INVALID_HANDLE_VALUE
,
"failed to get device list, error %#x
\n
"
,
GetLastError
());
ret
=
SetupDiEnumDeviceInterfaces
(
set
,
NULL
,
&
bus_class
,
0
,
&
iface
);
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_NO_MORE_ITEMS
,
"got error %#x
\n
"
,
GetLastError
());
SetupDiDestroyDeviceInfoList
(
set
);
ret
=
DeviceIoControl
(
bus
,
IOCTL_WINETEST_BUS_REGISTER_IFACE
,
NULL
,
0
,
NULL
,
0
,
&
size
,
NULL
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
set
=
SetupDiGetClassDevsA
(
&
bus_class
,
NULL
,
NULL
,
DIGCF_DEVICEINTERFACE
);
ok
(
set
!=
INVALID_HANDLE_VALUE
,
"failed to get device list, error %#x
\n
"
,
GetLastError
());
ret
=
SetupDiEnumDeviceInterfaces
(
set
,
NULL
,
&
bus_class
,
0
,
&
iface
);
ok
(
ret
,
"failed to get interface, error %#x
\n
"
,
GetLastError
());
ok
(
IsEqualGUID
(
&
iface
.
InterfaceClassGuid
,
&
bus_class
),
"wrong class %s
\n
"
,
debugstr_guid
(
&
iface
.
InterfaceClassGuid
));
ok
(
!
iface
.
Flags
,
"got flags %#x
\n
"
,
iface
.
Flags
);
SetupDiDestroyDeviceInfoList
(
set
);
set
=
SetupDiGetClassDevsA
(
&
bus_class
,
NULL
,
NULL
,
DIGCF_DEVICEINTERFACE
|
DIGCF_PRESENT
);
ok
(
set
!=
INVALID_HANDLE_VALUE
,
"failed to get device list, error %#x
\n
"
,
GetLastError
());
ret
=
SetupDiEnumDeviceInterfaces
(
set
,
NULL
,
&
bus_class
,
0
,
&
iface
);
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_NO_MORE_ITEMS
,
"got error %#x
\n
"
,
GetLastError
());
SetupDiDestroyDeviceInfoList
(
set
);
ret
=
DeviceIoControl
(
bus
,
IOCTL_WINETEST_BUS_ENABLE_IFACE
,
NULL
,
0
,
NULL
,
0
,
&
size
,
NULL
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
set
=
SetupDiGetClassDevsA
(
&
bus_class
,
NULL
,
NULL
,
DIGCF_DEVICEINTERFACE
|
DIGCF_PRESENT
);
ok
(
set
!=
INVALID_HANDLE_VALUE
,
"failed to get device list, error %#x
\n
"
,
GetLastError
());
ret
=
SetupDiEnumDeviceInterfaces
(
set
,
NULL
,
&
bus_class
,
0
,
&
iface
);
ok
(
ret
,
"failed to get interface, error %#x
\n
"
,
GetLastError
());
ok
(
IsEqualGUID
(
&
iface
.
InterfaceClassGuid
,
&
bus_class
),
"wrong class %s
\n
"
,
debugstr_guid
(
&
iface
.
InterfaceClassGuid
));
ok
(
iface
.
Flags
==
SPINT_ACTIVE
,
"got flags %#x
\n
"
,
iface
.
Flags
);
SetupDiDestroyDeviceInfoList
(
set
);
ret
=
DeviceIoControl
(
bus
,
IOCTL_WINETEST_BUS_DISABLE_IFACE
,
NULL
,
0
,
NULL
,
0
,
&
size
,
NULL
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
set
=
SetupDiGetClassDevsA
(
&
bus_class
,
NULL
,
NULL
,
DIGCF_DEVICEINTERFACE
);
ok
(
set
!=
INVALID_HANDLE_VALUE
,
"failed to get device list, error %#x
\n
"
,
GetLastError
());
ret
=
SetupDiEnumDeviceInterfaces
(
set
,
NULL
,
&
bus_class
,
0
,
&
iface
);
ok
(
ret
,
"failed to get interface, error %#x
\n
"
,
GetLastError
());
ok
(
IsEqualGUID
(
&
iface
.
InterfaceClassGuid
,
&
bus_class
),
"wrong class %s
\n
"
,
debugstr_guid
(
&
iface
.
InterfaceClassGuid
));
ok
(
!
iface
.
Flags
,
"got flags %#x
\n
"
,
iface
.
Flags
);
SetupDiDestroyDeviceInfoList
(
set
);
set
=
SetupDiGetClassDevsA
(
&
bus_class
,
NULL
,
NULL
,
DIGCF_DEVICEINTERFACE
|
DIGCF_PRESENT
);
ok
(
set
!=
INVALID_HANDLE_VALUE
,
"failed to get device list, error %#x
\n
"
,
GetLastError
());
ret
=
SetupDiEnumDeviceInterfaces
(
set
,
NULL
,
&
bus_class
,
0
,
&
iface
);
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_NO_MORE_ITEMS
,
"got error %#x
\n
"
,
GetLastError
());
SetupDiDestroyDeviceInfoList
(
set
);
CloseHandle
(
bus
);
}
...
...
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