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
b332f962
Commit
b332f962
authored
Aug 24, 2021
by
Zebediah Figura
Committed by
Alexandre Julliard
Aug 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntoskrnl/tests: Add some tests for IRP pending flags.
Signed-off-by:
Zebediah Figura
<
zfigura@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8b6be442
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
102 additions
and
7 deletions
+102
-7
driver.c
dlls/ntoskrnl.exe/tests/driver.c
+102
-7
No files found.
dlls/ntoskrnl.exe/tests/driver.c
View file @
b332f962
...
@@ -1737,11 +1737,44 @@ static void test_stack_limits(void)
...
@@ -1737,11 +1737,44 @@ static void test_stack_limits(void)
ok
(
low
<
(
ULONG_PTR
)
&
low
&&
(
ULONG_PTR
)
&
low
<
high
,
"stack variable is not in stack limits
\n
"
);
ok
(
low
<
(
ULONG_PTR
)
&
low
&&
(
ULONG_PTR
)
&
low
<
high
,
"stack variable is not in stack limits
\n
"
);
}
}
static
unsigned
int
got_completion
;
static
unsigned
int
got_completion
,
completion_lower_pending
,
completion_upper_pending
;
static
NTSTATUS
WINAPI
completion_cb
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
,
void
*
context
)
static
NTSTATUS
WINAPI
completion_cb
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
,
void
*
context
)
{
{
IO_STACK_LOCATION
*
stack
=
IoGetCurrentIrpStackLocation
(
irp
);
ok
(
device
==
context
,
"Got device %p; expected %p.
\n
"
,
device
,
context
);
ok
(
device
==
context
,
"Got device %p; expected %p.
\n
"
,
device
,
context
);
if
(
device
==
upper_device
)
{
todo_wine_if
(
completion_lower_pending
)
ok
(
irp
->
PendingReturned
==
completion_lower_pending
,
"Got PendingReturned %u, expected %u.
\n
"
,
irp
->
PendingReturned
,
completion_lower_pending
);
ok
(
irp
->
CurrentLocation
==
2
,
"Got current location %u.
\n
"
,
irp
->
CurrentLocation
);
ok
(
stack
->
Control
==
(
SL_INVOKE_ON_CANCEL
|
SL_INVOKE_ON_ERROR
|
SL_INVOKE_ON_SUCCESS
),
"Got control flags %#x.
\n
"
,
stack
->
Control
);
stack
=
IoGetNextIrpStackLocation
(
irp
);
todo_wine
ok
(
!
stack
->
Control
,
"Got control flags %#x.
\n
"
,
stack
->
Control
);
stack
=
irp
->
Tail
.
Overlay
.
CurrentStackLocation
+
1
;
/* previous location */
ok
(
!
stack
->
Control
,
"Got control flags %#x.
\n
"
,
stack
->
Control
);
if
(
irp
->
PendingReturned
&&
completion_upper_pending
)
IoMarkIrpPending
(
irp
);
}
else
{
todo_wine_if
(
completion_upper_pending
)
ok
(
irp
->
PendingReturned
==
completion_upper_pending
,
"Got PendingReturned %u, expected %u.
\n
"
,
irp
->
PendingReturned
,
completion_upper_pending
);
ok
(
irp
->
CurrentLocation
==
3
,
"Got current location %u.
\n
"
,
irp
->
CurrentLocation
);
ok
(
!
stack
->
Control
,
"Got control flags %#x.
\n
"
,
stack
->
Control
);
stack
=
IoGetNextIrpStackLocation
(
irp
);
todo_wine
ok
(
!
stack
->
Control
,
"Got control flags %#x.
\n
"
,
stack
->
Control
);
stack
=
irp
->
Tail
.
Overlay
.
CurrentStackLocation
-
2
;
/* lowest location */
todo_wine
ok
(
!
stack
->
Control
,
"Got control flags %#x.
\n
"
,
stack
->
Control
);
}
++
got_completion
;
++
got_completion
;
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
...
@@ -1753,15 +1786,50 @@ static void test_completion(void)
...
@@ -1753,15 +1786,50 @@ static void test_completion(void)
KEVENT
event
;
KEVENT
event
;
IRP
*
irp
;
IRP
*
irp
;
completion_lower_pending
=
completion_upper_pending
=
FALSE
;
KeInitializeEvent
(
&
event
,
NotificationEvent
,
FALSE
);
KeInitializeEvent
(
&
event
,
NotificationEvent
,
FALSE
);
irp
=
IoBuildDeviceIoControlRequest
(
IOCTL_WINETEST_COMPLETION
,
upper_device
,
irp
=
IoBuildDeviceIoControlRequest
(
IOCTL_WINETEST_COMPLETION
,
upper_device
,
NULL
,
0
,
NULL
,
0
,
FALSE
,
&
event
,
&
io
);
NULL
,
0
,
NULL
,
0
,
FALSE
,
&
event
,
&
io
);
IoSetCompletionRoutine
(
irp
,
completion_cb
,
NULL
,
TRUE
,
TRUE
,
TRUE
);
IoSetCompletionRoutine
(
irp
,
completion_cb
,
NULL
,
TRUE
,
TRUE
,
TRUE
);
ret
=
IoCallDriver
(
upper_device
,
irp
);
ret
=
IoCallDriver
(
upper_device
,
irp
);
ok
(
ret
==
STATUS_SUCCESS
,
"IoCallDriver returned %#x
\n
"
,
ret
);
ok
(
ret
==
STATUS_SUCCESS
,
"IoCallDriver returned %#x
\n
"
,
ret
);
ok
(
got_completion
==
2
,
"got %u calls to completion routine
\n
"
,
got_completion
);
ok
(
got_completion
==
2
,
"got %u calls to completion routine
\n
"
,
got_completion
);
completion_lower_pending
=
TRUE
;
got_completion
=
0
;
irp
=
IoBuildDeviceIoControlRequest
(
IOCTL_WINETEST_COMPLETION
,
upper_device
,
NULL
,
0
,
NULL
,
0
,
FALSE
,
&
event
,
&
io
);
IoSetCompletionRoutine
(
irp
,
completion_cb
,
NULL
,
TRUE
,
TRUE
,
TRUE
);
ret
=
IoCallDriver
(
upper_device
,
irp
);
ok
(
ret
==
STATUS_PENDING
,
"IoCallDriver returned %#x
\n
"
,
ret
);
ok
(
!
got_completion
,
"got %u calls to completion routine
\n
"
,
got_completion
);
ok
(
irp
->
CurrentLocation
==
1
,
"Got current location %u.
\n
"
,
irp
->
CurrentLocation
);
ok
(
!
irp
->
PendingReturned
,
"Got pending flag %u.
\n
"
,
irp
->
PendingReturned
);
irp
->
IoStatus
.
Status
=
STATUS_SUCCESS
;
IoCompleteRequest
(
irp
,
IO_NO_INCREMENT
);
ok
(
got_completion
==
2
,
"got %u calls to completion routine
\n
"
,
got_completion
);
completion_upper_pending
=
TRUE
;
got_completion
=
0
;
irp
=
IoBuildDeviceIoControlRequest
(
IOCTL_WINETEST_COMPLETION
,
upper_device
,
NULL
,
0
,
NULL
,
0
,
FALSE
,
&
event
,
&
io
);
IoSetCompletionRoutine
(
irp
,
completion_cb
,
NULL
,
TRUE
,
TRUE
,
TRUE
);
ret
=
IoCallDriver
(
upper_device
,
irp
);
ok
(
ret
==
STATUS_PENDING
,
"IoCallDriver returned %#x
\n
"
,
ret
);
ok
(
!
got_completion
,
"got %u calls to completion routine
\n
"
,
got_completion
);
ok
(
irp
->
CurrentLocation
==
1
,
"Got current location %u.
\n
"
,
irp
->
CurrentLocation
);
ok
(
!
irp
->
PendingReturned
,
"Got pending flag %u.
\n
"
,
irp
->
PendingReturned
);
irp
->
IoStatus
.
Status
=
STATUS_SUCCESS
;
IoCompleteRequest
(
irp
,
IO_NO_INCREMENT
);
ok
(
got_completion
==
2
,
"got %u calls to completion routine
\n
"
,
got_completion
);
}
}
static
void
test_IoAttachDeviceToDeviceStack
(
void
)
static
void
test_IoAttachDeviceToDeviceStack
(
void
)
...
@@ -2392,10 +2460,19 @@ static NTSTATUS test_mismatched_status_ioctl(IRP *irp, IO_STACK_LOCATION *stack,
...
@@ -2392,10 +2460,19 @@ static NTSTATUS test_mismatched_status_ioctl(IRP *irp, IO_STACK_LOCATION *stack,
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
static
NTSTATUS
test_completion_ioctl
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
static
NTSTATUS
completion_ioctl
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
,
IO_STACK_LOCATION
*
stack
)
{
{
if
(
device
==
upper_device
)
if
(
device
==
upper_device
)
{
{
ok
(
irp
->
CurrentLocation
==
2
,
"Got current location %u.
\n
"
,
irp
->
CurrentLocation
);
ok
(
!
irp
->
PendingReturned
,
"Got pending flag %u.
\n
"
,
irp
->
PendingReturned
);
ok
(
stack
->
Control
==
(
SL_INVOKE_ON_CANCEL
|
SL_INVOKE_ON_ERROR
|
SL_INVOKE_ON_SUCCESS
),
"Got control flags %#x.
\n
"
,
stack
->
Control
);
stack
=
IoGetNextIrpStackLocation
(
irp
);
ok
(
!
stack
->
Control
,
"Got control flags %#x.
\n
"
,
stack
->
Control
);
stack
=
irp
->
Tail
.
Overlay
.
CurrentStackLocation
+
1
;
/* previous location */
ok
(
!
stack
->
Control
,
"Got control flags %#x.
\n
"
,
stack
->
Control
);
IoCopyCurrentIrpStackLocationToNext
(
irp
);
IoCopyCurrentIrpStackLocationToNext
(
irp
);
IoSetCompletionRoutine
(
irp
,
completion_cb
,
upper_device
,
TRUE
,
TRUE
,
TRUE
);
IoSetCompletionRoutine
(
irp
,
completion_cb
,
upper_device
,
TRUE
,
TRUE
,
TRUE
);
return
IoCallDriver
(
lower_device
,
irp
);
return
IoCallDriver
(
lower_device
,
irp
);
...
@@ -2403,9 +2480,27 @@ static NTSTATUS test_completion_ioctl(DEVICE_OBJECT *device, IRP *irp)
...
@@ -2403,9 +2480,27 @@ static NTSTATUS test_completion_ioctl(DEVICE_OBJECT *device, IRP *irp)
else
else
{
{
ok
(
device
==
lower_device
,
"Got wrong device.
\n
"
);
ok
(
device
==
lower_device
,
"Got wrong device.
\n
"
);
irp
->
IoStatus
.
Status
=
STATUS_SUCCESS
;
ok
(
irp
->
CurrentLocation
==
1
,
"Got current location %u.
\n
"
,
irp
->
CurrentLocation
);
IoCompleteRequest
(
irp
,
IO_NO_INCREMENT
);
ok
(
!
irp
->
PendingReturned
,
"Got pending flag %u.
\n
"
,
irp
->
PendingReturned
);
return
STATUS_SUCCESS
;
ok
(
stack
->
Control
==
(
SL_INVOKE_ON_CANCEL
|
SL_INVOKE_ON_ERROR
|
SL_INVOKE_ON_SUCCESS
),
"Got control flags %#x.
\n
"
,
stack
->
Control
);
stack
=
irp
->
Tail
.
Overlay
.
CurrentStackLocation
+
1
;
/* previous location */
ok
(
stack
->
Control
==
(
SL_INVOKE_ON_CANCEL
|
SL_INVOKE_ON_ERROR
|
SL_INVOKE_ON_SUCCESS
),
"Got control flags %#x.
\n
"
,
stack
->
Control
);
stack
=
irp
->
Tail
.
Overlay
.
CurrentStackLocation
+
2
;
/* top location */
ok
(
!
stack
->
Control
,
"Got control flags %#x.
\n
"
,
stack
->
Control
);
if
(
completion_lower_pending
)
{
IoMarkIrpPending
(
irp
);
return
STATUS_PENDING
;
}
else
{
irp
->
IoStatus
.
Status
=
STATUS_SUCCESS
;
IoCompleteRequest
(
irp
,
IO_NO_INCREMENT
);
return
STATUS_SUCCESS
;
}
}
}
}
}
...
@@ -2481,7 +2576,7 @@ static NTSTATUS WINAPI driver_IoControl(DEVICE_OBJECT *device, IRP *irp)
...
@@ -2481,7 +2576,7 @@ static NTSTATUS WINAPI driver_IoControl(DEVICE_OBJECT *device, IRP *irp)
case
IOCTL_WINETEST_MISMATCHED_STATUS
:
case
IOCTL_WINETEST_MISMATCHED_STATUS
:
return
test_mismatched_status_ioctl
(
irp
,
stack
,
&
irp
->
IoStatus
.
Information
);
return
test_mismatched_status_ioctl
(
irp
,
stack
,
&
irp
->
IoStatus
.
Information
);
case
IOCTL_WINETEST_COMPLETION
:
case
IOCTL_WINETEST_COMPLETION
:
return
test_completion_ioctl
(
device
,
irp
);
return
completion_ioctl
(
device
,
irp
,
stack
);
default:
default:
break
;
break
;
}
}
...
...
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