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
a2248247
Commit
a2248247
authored
Nov 25, 2019
by
Chip Davis
Committed by
Alexandre Julliard
Nov 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntoskrnl.exe: Add tests for METHOD_NEITHER ioctl behavior.
Signed-off-by:
Chip Davis
<
cdavis@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d45456ce
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
0 deletions
+44
-0
driver.c
dlls/ntoskrnl.exe/tests/driver.c
+30
-0
driver.h
dlls/ntoskrnl.exe/tests/driver.h
+1
-0
ntoskrnl.c
dlls/ntoskrnl.exe/tests/ntoskrnl.c
+13
-0
No files found.
dlls/ntoskrnl.exe/tests/driver.c
View file @
a2248247
...
...
@@ -1855,6 +1855,34 @@ static NTSTATUS test_load_driver_ioctl(IRP *irp, IO_STACK_LOCATION *stack, ULONG
return
ZwUnloadDriver
(
&
name
);
}
static
NTSTATUS
test_mismatched_status_ioctl
(
IRP
*
irp
,
IO_STACK_LOCATION
*
stack
,
ULONG_PTR
*
info
)
{
ULONG
length
=
stack
->
Parameters
.
DeviceIoControl
.
OutputBufferLength
;
char
*
buffer
=
irp
->
UserBuffer
;
if
(
!
buffer
)
{
irp
->
IoStatus
.
Status
=
STATUS_ACCESS_VIOLATION
;
IoCompleteRequest
(
irp
,
IO_NO_INCREMENT
);
return
STATUS_ACCESS_VIOLATION
;
}
if
(
length
<
sizeof
(
teststr
))
{
irp
->
IoStatus
.
Status
=
STATUS_BUFFER_TOO_SMALL
;
IoCompleteRequest
(
irp
,
IO_NO_INCREMENT
);
return
STATUS_BUFFER_TOO_SMALL
;
}
memcpy
(
buffer
,
teststr
,
sizeof
(
teststr
));
/* This is deliberate; some broken drivers do this */
*
info
=
0
;
irp
->
IoStatus
.
Status
=
STATUS_UNSUCCESSFUL
;
IoCompleteRequest
(
irp
,
IO_NO_INCREMENT
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
WINAPI
driver_Create
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
{
IO_STACK_LOCATION
*
irpsp
=
IoGetCurrentIrpStackLocation
(
irp
);
...
...
@@ -1916,6 +1944,8 @@ static NTSTATUS WINAPI driver_IoControl(DEVICE_OBJECT *device, IRP *irp)
IoDetachDevice
(
lower_device
);
status
=
STATUS_SUCCESS
;
break
;
case
IOCTL_WINETEST_MISMATCHED_STATUS
:
return
test_mismatched_status_ioctl
(
irp
,
stack
,
&
irp
->
IoStatus
.
Information
);
default:
break
;
}
...
...
dlls/ntoskrnl.exe/tests/driver.h
View file @
a2248247
...
...
@@ -33,6 +33,7 @@
#define IOCTL_WINETEST_GET_CLOSE_COUNT CTL_CODE(FILE_DEVICE_UNKNOWN, 0x808, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_WINETEST_GET_FSCONTEXT CTL_CODE(FILE_DEVICE_UNKNOWN, 0x809, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_WINETEST_RETURN_STATUS CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80a, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_WINETEST_MISMATCHED_STATUS CTL_CODE(FILE_DEVICE_UNKNOWN, 0x80b, METHOD_NEITHER, FILE_ANY_ACCESS)
static
const
char
teststr
[]
=
"Wine is not an emulator"
;
...
...
dlls/ntoskrnl.exe/tests/ntoskrnl.c
View file @
a2248247
...
...
@@ -208,6 +208,18 @@ static void test_basic_ioctl(void)
ok
(
!
strcmp
(
buf
,
"Wine is no"
),
"got '%s'
\n
"
,
buf
);
}
static
void
test_mismatched_status_ioctl
(
void
)
{
DWORD
written
;
char
buf
[
32
];
BOOL
res
;
res
=
DeviceIoControl
(
device
,
IOCTL_WINETEST_MISMATCHED_STATUS
,
NULL
,
0
,
buf
,
sizeof
(
buf
),
&
written
,
NULL
);
todo_wine
ok
(
res
,
"DeviceIoControl failed: %u
\n
"
,
GetLastError
());
todo_wine
ok
(
!
strcmp
(
buf
,
teststr
),
"got '%s'
\n
"
,
buf
);
}
static
void
test_overlapped
(
void
)
{
OVERLAPPED
overlapped
,
overlapped2
,
*
o
;
...
...
@@ -514,6 +526,7 @@ START_TEST(ntoskrnl)
ok
(
device
!=
INVALID_HANDLE_VALUE
,
"failed to open device: %u
\n
"
,
GetLastError
());
test_basic_ioctl
();
test_mismatched_status_ioctl
();
main_test
();
test_overlapped
();
test_load_driver
(
service2
);
...
...
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