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
9157129f
Commit
9157129f
authored
May 28, 2019
by
Jacek Caban
Committed by
Alexandre Julliard
May 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntoskrnl.exe: Cancel IRPs terminated by server.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b724024d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
6 deletions
+35
-6
ntoskrnl.c
dlls/ntoskrnl.exe/ntoskrnl.c
+35
-3
ntoskrnl.c
dlls/ntoskrnl.exe/tests/ntoskrnl.c
+0
-3
No files found.
dlls/ntoskrnl.exe/ntoskrnl.c
View file @
9157129f
...
...
@@ -523,15 +523,31 @@ static void *create_file_object( HANDLE handle )
return
file
;
}
DECLARE_CRITICAL_SECTION
(
irp_completion_cs
);
static
void
WINAPI
cancel_completed_irp
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
{
TRACE
(
"(%p %p)
\n
"
,
device
,
irp
);
IoReleaseCancelSpinLock
(
irp
->
CancelIrql
);
irp
->
IoStatus
.
u
.
Status
=
STATUS_CANCELLED
;
irp
->
IoStatus
.
Information
=
0
;
IoCompleteRequest
(
irp
,
IO_NO_INCREMENT
);
}
/* transfer result of IRP back to wineserver */
static
NTSTATUS
WINAPI
dispatch_irp_completion
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
,
void
*
context
)
{
HANDLE
irp_handle
=
context
;
void
*
out_buff
=
irp
->
UserBuffer
;
NTSTATUS
status
;
if
(
irp
->
Flags
&
IRP_WRITE_OPERATION
)
out_buff
=
NULL
;
/* do not transfer back input buffer */
EnterCriticalSection
(
&
irp_completion_cs
);
SERVER_START_REQ
(
set_irp_result
)
{
req
->
handle
=
wine_server_obj_handle
(
irp_handle
);
...
...
@@ -541,16 +557,29 @@ static NTSTATUS WINAPI dispatch_irp_completion( DEVICE_OBJECT *device, IRP *irp,
req
->
size
=
irp
->
IoStatus
.
Information
;
if
(
out_buff
)
wine_server_add_data
(
req
,
out_buff
,
irp
->
IoStatus
.
Information
);
}
wine_server_call
(
req
);
status
=
wine_server_call
(
req
);
}
SERVER_END_REQ
;
if
(
status
==
STATUS_MORE_PROCESSING_REQUIRED
)
{
/* IRP is complete, but server may have already ordered cancel call. In such case,
* it will return STATUS_MORE_PROCESSING_REQUIRED, leaving the IRP alive until
* cancel frees it. */
if
(
irp
->
Cancel
)
status
=
STATUS_SUCCESS
;
else
IoSetCancelRoutine
(
irp
,
cancel_completed_irp
);
}
if
(
irp
->
UserBuffer
!=
irp
->
AssociatedIrp
.
SystemBuffer
)
{
HeapFree
(
GetProcessHeap
(),
0
,
irp
->
UserBuffer
);
irp
->
UserBuffer
=
NULL
;
}
return
STATUS_SUCCESS
;
LeaveCriticalSection
(
&
irp_completion_cs
);
return
status
;
}
struct
dispatch_context
...
...
@@ -842,8 +871,11 @@ static NTSTATUS dispatch_cancel( struct dispatch_context *context )
{
IRP
*
irp
=
wine_server_get_ptr
(
context
->
params
.
cancel
.
irp
);
FIXM
E
(
"%p
\n
"
,
irp
);
TRAC
E
(
"%p
\n
"
,
irp
);
EnterCriticalSection
(
&
irp_completion_cs
);
IoCancelIrp
(
irp
);
LeaveCriticalSection
(
&
irp_completion_cs
);
return
STATUS_SUCCESS
;
}
...
...
dlls/ntoskrnl.exe/tests/ntoskrnl.c
View file @
9157129f
...
...
@@ -234,7 +234,6 @@ static void test_overlapped(void)
cancel_cnt
=
0xdeadbeef
;
res
=
DeviceIoControl
(
file
,
IOCTL_WINETEST_GET_CANCEL_COUNT
,
NULL
,
0
,
&
cancel_cnt
,
sizeof
(
cancel_cnt
),
NULL
,
&
overlapped
);
ok
(
res
,
"DeviceIoControl failed: %u
\n
"
,
GetLastError
());
todo_wine
ok
(
cancel_cnt
==
2
,
"cancel_cnt = %u
\n
"
,
cancel_cnt
);
/* test cancelling selected overlapped event */
...
...
@@ -254,7 +253,6 @@ static void test_overlapped(void)
cancel_cnt
=
0xdeadbeef
;
res
=
DeviceIoControl
(
file
,
IOCTL_WINETEST_GET_CANCEL_COUNT
,
NULL
,
0
,
&
cancel_cnt
,
sizeof
(
cancel_cnt
),
NULL
,
&
overlapped
);
ok
(
res
,
"DeviceIoControl failed: %u
\n
"
,
GetLastError
());
todo_wine
ok
(
cancel_cnt
==
1
,
"cancel_cnt = %u
\n
"
,
cancel_cnt
);
pCancelIoEx
(
file
,
&
overlapped2
);
...
...
@@ -262,7 +260,6 @@ static void test_overlapped(void)
cancel_cnt
=
0xdeadbeef
;
res
=
DeviceIoControl
(
file
,
IOCTL_WINETEST_GET_CANCEL_COUNT
,
NULL
,
0
,
&
cancel_cnt
,
sizeof
(
cancel_cnt
),
NULL
,
&
overlapped
);
ok
(
res
,
"DeviceIoControl failed: %u
\n
"
,
GetLastError
());
todo_wine
ok
(
cancel_cnt
==
2
,
"cancel_cnt = %u
\n
"
,
cancel_cnt
);
}
...
...
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