Commit Graph

117 Commits

Author SHA1 Message Date
Michael Müller 504cf18e19 server: Hold a reference to the file in delete_file().
Otherwise, we may attempt to access freed memory trawling the device list.
This can occur if a device driver crashes during an IRP_CALL_CLOSE request.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-03 11:43:01 +01:00
Zebediah Figura 0bd7da4290 server: Hold a reference to the device on behalf of the device manager.
Otherwise, the only thing holding a reference to a device may be a
device_file. If this is released in delete_device(), the subsequent call to
unlink_named_object() will crash. This can occur if a device driver crashes
with pending IRPs outstanding.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-03 11:43:01 +01:00
Jacek Caban 7f0883ae88 server: Associate create and close IRPs with current thread.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-30 21:53:27 +02:00
Jacek Caban 49b834bb42 server: Use current thread for IRP calls without associated thread.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-30 21:53:26 +02:00
Jacek Caban b724024d5a server: Notify kernel when IRP is terminated by server.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-28 20:17:36 +02:00
Jacek Caban dc5421f950 server: Remove IRP from device queue before terminating async.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-28 20:17:20 +02:00
Jacek Caban 101da2b512 server: Store IRP client pointer on server side.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-28 20:17:03 +02:00
Jacek Caban dfe20465e8 server: Use stored current kernel call to interpret IRP dispatch status.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-28 20:16:39 +02:00
Jacek Caban a55a287cab server: Always block overlapped device requests until driver dispatches them.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-23 22:18:32 +02:00
Jacek Caban bd94c43fcf ntoskrnl.exe: Associate file object with server object before calling IRP routine.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-03 21:18:02 +02:00
Jacek Caban 29914d583f server: Pass file object handle in IRP_CALL_CREATE request.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-03 21:17:42 +02:00
Jacek Caban 781dd9a145 server: Store currently executed IRP call on server side.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-03 21:16:59 +02:00
Jacek Caban b1e1111d7b server: Don't use IRP_MJ_* constants for ntoskrnl.exe communication.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-03 21:16:56 +02:00
Jacek Caban 8bce6309ac server: Pass IRP output size in irp_params_t.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-03 21:15:46 +02:00
Jacek Caban 52ff9bd3ac server: Use generic kernel object list to store client device file pointer.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-25 17:28:11 +02:00
Jacek Caban a77a1a5433 server: Ensure that IRP_MJ_CLOSE is queued only once.
Client may alloc new handle inside IRP_MJ_CLOSE handler.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-25 17:28:11 +02:00
Jacek Caban 31f6f0eec2 server: Set file user pointer in get_next_device_request handler.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-25 17:28:10 +02:00
Jacek Caban 2ee040382f server: Return client thread object pointer from get_next_device_request if available.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-08 19:50:40 +02:00
Jacek Caban b4f78d6896 server: Use generic kernel object list to store client device pointer.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-05 22:16:31 +02:00
Jacek Caban f57a383d09 ntoskrnl.exe: Support waiting on kernel objects.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-26 13:59:04 +01:00
Jacek Caban a5c2f043e6 server: Notify client about freed object so that it may free associated kernel object.
Long term, we may consider making interface between server and device
manager more generic so that it could be used for messages other than IRPs.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-26 13:59:04 +01:00
Jacek Caban 4db5879742 server: Allow queuing IRPs with no file associated.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-26 13:57:31 +01:00
Jacek Caban 94c1ef0ee1 server: Allow kernel to keep reference to server objects by client pointer.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-26 13:57:18 +01:00
Jacek Caban 134e264ae5 server: Store pointers to objects created by kernel_object_from_handle in server.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-26 13:56:31 +01:00
Jacek Caban b2a546c92d server: Introduce kernel_object struct for generic association between server and kernel objects.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-03-26 13:55:15 +01:00
Jacek Caban 6531f79d8d server: Return proper object type for mailslot and device files.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-22 14:27:25 +01:00
Jacek Caban f003ac5e62 server: Use requested options for device pseudo fd.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-29 17:02:41 +01:00
Jacek Caban 04094a6669 server: Use server_get_file_info for all info classes not implemented on client side.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-10-24 16:58:08 +02:00
Jacek Caban 56dfb384c7 server: Pass proper async object to queue_irp in device_file_flush.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-02 15:52:22 +01:00
Jacek Caban 6b08e60f03 server: Introduce get_file_info request for server-side NtQueryInformationFile implementation.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-12-22 12:19:43 +01:00
Jacek Caban 2ab2f31f18 server: Allow server side NtQueryVolumeInformationFile implementation.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-10-03 09:39:52 +02:00
Jacek Caban 23dce6881b server: Call create_irp from queue_irp.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-05 10:43:49 +02:00
Jacek Caban 7b33613fc4 server: Make fd_queue_async infallible.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-05 10:43:14 +02:00
Jacek Caban 84bc9c3d56 server: Remove no longer needed need_handle from queue_irp.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-06-28 12:35:46 +02:00
Jacek Caban 10c1f245e4 server: Use create_request_async in flush request handler.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-06-28 12:35:33 +02:00
Jacek Caban c56c42ff79 server: Use create_request_async in ioctl request handler.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-06-28 12:32:49 +02:00
Jacek Caban 2bd828b13c server: Use create_request_async for write requests.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-06-28 12:23:36 +02:00
Jacek Caban 0fb6099b01 server: Preallocate wait handle in create_request_async and return it in read request.
alloc_handle is failable and when we're returning the handle, handling
error properly is not really possible.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-06-28 12:23:35 +02:00
Jacek Caban b76c1b468a server: Allocate wait handle on async object in queue_irp.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-05-10 11:46:34 -05:00
Jacek Caban 9d666869f3 server: Remove no longer needed blocking argument from flush fd op.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-12 19:11:29 +02:00
Jacek Caban c9d9adaf65 server: Remove no longer needed blocking argument from write fd op.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-12 19:11:27 +02:00
Jacek Caban 5e584e936b server: Remove no longer needed blocking argument from read fd op.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-12 19:11:26 +02:00
Jacek Caban 047062b28b server: Remove no longer needed blocking argument from ioctl fd op.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-12 19:11:24 +02:00
Jacek Caban 5126849f7f server: Use async_is_blocking in queue_irp.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-12 19:11:22 +02:00
Jacek Caban a3acdf117f server: Pass existing async object to fd_queue_async.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-22 20:20:50 +01:00
Jacek Caban a9c51f4e8a server: Create async object in flush request handler.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-21 14:24:13 +01:00
Jacek Caban bede6499ed server: Create async object in ioctl request handler.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-21 14:24:11 +01:00
Jacek Caban 8ef4f9a0c8 server: Create async objects in read and write request handlers.
async_get_data allows splitting patches, but will be removed later in
the series.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-21 14:22:46 +01:00
Jacek Caban 13daca6f1a server: Removed no longer needed user_arg from irp_call struct.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-21 14:22:41 +01:00
Jacek Caban cf08bd0e38 server: Create iosb objects inside read/write request handlers.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-01 21:19:38 +01:00