Rebase against b5e17b669a90d961a93f6092ebc3736ff8ca9cd6.

This commit is contained in:
Zebediah Figura 2021-09-14 21:44:56 -05:00
parent 5f19a81589
commit ad56d6b3d3
8 changed files with 24 additions and 370 deletions

View File

@ -1,119 +0,0 @@
From b2b7bc84befea8100d1996262ef1b36091df7ebc Mon Sep 17 00:00:00 2001
From: Chip Davis <cdavis@codeweavers.com>
Date: Tue, 18 Jun 2019 00:54:35 -0500
Subject: [PATCH 1/4] ntoskrnl.exe: Return driver dispatch result to caller.
As native does.
Signed-off-by: Chip Davis <cdavis@codeweavers.com>
---
dlls/ntoskrnl.exe/ntoskrnl.c | 31 ++++++++++++-------------------
1 file changed, 12 insertions(+), 19 deletions(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 93c9720e96..9b1efed6de 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -479,9 +479,10 @@ struct dispatch_context
void *in_buff;
};
-static void dispatch_irp( DEVICE_OBJECT *device, IRP *irp, struct dispatch_context *context )
+static NTSTATUS dispatch_irp( DEVICE_OBJECT *device, IRP *irp, struct dispatch_context *context )
{
LARGE_INTEGER count;
+ NTSTATUS status;
IoSetCompletionRoutine( irp, dispatch_irp_completion, context->handle, TRUE, TRUE, TRUE );
context->handle = 0;
@@ -491,9 +492,10 @@ static void dispatch_irp( DEVICE_OBJECT *device, IRP *irp, struct dispatch_conte
context->irp = irp;
device->CurrentIrp = irp;
KeEnterCriticalRegion();
- IoCallDriver( device, irp );
+ status = IoCallDriver( device, irp );
KeLeaveCriticalRegion();
device->CurrentIrp = NULL;
+ return status;
}
/* process a create request for a given file */
@@ -536,9 +538,7 @@ static NTSTATUS dispatch_create( struct dispatch_context *context )
irp->UserEvent = NULL;
irp->Flags |= IRP_CREATE_OPERATION;
- dispatch_irp( device, irp, context );
-
- return STATUS_SUCCESS;
+ return dispatch_irp( device, irp, context );
}
/* process a close request for a given file */
@@ -574,9 +574,7 @@ static NTSTATUS dispatch_close( struct dispatch_context *context )
irp->UserEvent = NULL;
irp->Flags |= IRP_CLOSE_OPERATION;
- dispatch_irp( device, irp, context );
-
- return STATUS_SUCCESS;
+ return dispatch_irp( device, irp, context );
}
/* process a read request for a given device */
@@ -616,9 +614,7 @@ static NTSTATUS dispatch_read( struct dispatch_context *context )
irp->Flags |= IRP_READ_OPERATION;
irp->Flags |= IRP_DEALLOCATE_BUFFER; /* deallocate out_buff */
- dispatch_irp( device, irp, context );
-
- return STATUS_SUCCESS;
+ return dispatch_irp( device, irp, context );
}
/* process a write request for a given device */
@@ -652,9 +648,7 @@ static NTSTATUS dispatch_write( struct dispatch_context *context )
irp->Flags |= IRP_WRITE_OPERATION;
irp->Flags |= IRP_DEALLOCATE_BUFFER; /* deallocate in_buff */
- dispatch_irp( device, irp, context );
-
- return STATUS_SUCCESS;
+ return dispatch_irp( device, irp, context );
}
/* process a flush request for a given device */
@@ -681,9 +675,7 @@ static NTSTATUS dispatch_flush( struct dispatch_context *context )
irpsp = IoGetNextIrpStackLocation( irp );
irpsp->FileObject = file;
- dispatch_irp( device, irp, context );
-
- return STATUS_SUCCESS;
+ return dispatch_irp( device, irp, context );
}
/* process an ioctl request for a given device */
@@ -696,6 +688,7 @@ static NTSTATUS dispatch_ioctl( struct dispatch_context *context )
DEVICE_OBJECT *device;
FILE_OBJECT *file = wine_server_get_ptr( context->params.ioctl.file );
ULONG out_size = context->params.ioctl.out_size;
+ NTSTATUS status;
if (!file) return STATUS_INVALID_HANDLE;
@@ -744,10 +737,10 @@ static NTSTATUS dispatch_ioctl( struct dispatch_context *context )
context->in_buff = NULL;
irp->Flags |= IRP_DEALLOCATE_BUFFER; /* deallocate in_buff */
- dispatch_irp( device, irp, context );
+ status = dispatch_irp( device, irp, context );
HeapFree( GetProcessHeap(), 0, to_free );
- return STATUS_SUCCESS;
+ return status;
}
static NTSTATUS dispatch_free( struct dispatch_context *context )
--
2.17.1

View File

@ -1,85 +0,0 @@
From 3d09e621ab0ed20a4e7fd6f120cd2251d15b5e43 Mon Sep 17 00:00:00 2001
From: Chip Davis <cdavis@codeweavers.com>
Date: Wed, 10 Jul 2019 19:12:06 -0500
Subject: [PATCH 2/4] ntoskrnl.exe: Always copy the buffer for
non-METHOD_BUFFERED ioctls.
In these cases, the driver expects to have direct access to some memory
within the user-mode client, either via an MDL (as in the
METHOD_IN_DIRECT/METHOD_OUT_DIRECT case) or via a raw address (as in the
METHOD_NEITHER case). Because of this, we have to copy the buffer back,
no matter what status is returned.
Signed-off-by: Chip Davis <cdavis@codeweavers.com>
---
dlls/ntoskrnl.exe/ntoskrnl.c | 36 ++++++++++++++++++++++++++++++++++--
1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 9b1efed6de..368bfcfd20 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -424,16 +424,48 @@ static void WINAPI cancel_completed_irp( DEVICE_OBJECT *device, IRP *irp )
IoCompleteRequest(irp, IO_NO_INCREMENT);
}
+static ULONG get_irp_out_size( IRP *irp, BOOLEAN *need_copy )
+{
+ IO_STACK_LOCATION *irpsp = IoGetNextIrpStackLocation(irp);
+ switch (irpsp->MajorFunction)
+ {
+ case IRP_MJ_FILE_SYSTEM_CONTROL:
+ case IRP_MJ_DEVICE_CONTROL:
+ case IRP_MJ_INTERNAL_DEVICE_CONTROL:
+ /* For an ioctl not using METHOD_BUFFERED, the driver is supposed to have
+ * direct access to userland's output buffer, either via an MDL (as in METHOD_OUT_DIRECT)
+ * or with the raw user VA (as in METHOD_NEITHER). In these cases, we need
+ * to copy the entire buffer back to the caller, whether or not Information
+ * is non-zero and whether or not the call succeeded. */
+ switch (irpsp->Parameters.DeviceIoControl.IoControlCode & 3)
+ {
+ case METHOD_BUFFERED:
+ break;
+ default:
+ *need_copy = TRUE;
+ return irpsp->Parameters.DeviceIoControl.OutputBufferLength;
+ }
+ break;
+ default:
+ break;
+ }
+ return irp->IoStatus.Information;
+}
+
/* 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;
+ ULONG out_size;
+ BOOLEAN need_copy = FALSE;
if (irp->Flags & IRP_WRITE_OPERATION)
out_buff = NULL; /* do not transfer back input buffer */
+ out_size = get_irp_out_size( irp, &need_copy );
+
EnterCriticalSection( &irp_completion_cs );
SERVER_START_REQ( set_irp_result )
@@ -441,9 +473,9 @@ static NTSTATUS WINAPI dispatch_irp_completion( DEVICE_OBJECT *device, IRP *irp,
req->handle = wine_server_obj_handle( irp_handle );
req->status = irp->IoStatus.u.Status;
req->size = irp->IoStatus.Information;
- if (!NT_ERROR(irp->IoStatus.u.Status))
+ if (!NT_ERROR(irp->IoStatus.u.Status) || need_copy)
{
- if (out_buff) wine_server_add_data( req, out_buff, irp->IoStatus.Information );
+ if (out_buff) wine_server_add_data( req, out_buff, out_size );
}
status = wine_server_call( req );
}
--
2.17.1

View File

@ -1,139 +0,0 @@
From 3ad0085d6003a4521dfd7089f34c431f105835df Mon Sep 17 00:00:00 2001
From: Chip Davis <cdavis@codeweavers.com>
Date: Wed, 10 Jul 2019 19:14:45 -0500
Subject: [PATCH 3/4] server: Delay completing a synchronous IRP.
Wait until the client fetches the result. Save any buffer that the
driver provided so it can be copied back to the client.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30155
Signed-off-by: Chip Davis <cdavis@codeweavers.com>
---
dlls/ntoskrnl.exe/tests/ntoskrnl.c | 4 +--
server/device.c | 50 ++++++++++++++++++++----------
2 files changed, 36 insertions(+), 18 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
index 2535ed903e..1765ae7ddf 100644
--- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
@@ -216,8 +216,8 @@ static void test_mismatched_status_ioctl(void)
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);
+ ok(res, "DeviceIoControl failed: %u\n", GetLastError());
+ ok(!strcmp(buf, teststr), "got '%s'\n", buf);
}
static void test_overlapped(void)
diff --git a/server/device.c b/server/device.c
index d3e2a84c1e..99492f8202 100644
--- a/server/device.c
+++ b/server/device.c
@@ -52,6 +52,7 @@ struct irp_call
struct async *async; /* pending async op */
irp_params_t params; /* irp parameters */
struct iosb *iosb; /* I/O status block */
+ int dispatched; /* the call's dispatch returned */
int canceled; /* the call was canceled */
client_ptr_t user_ptr; /* client side pointer */
};
@@ -349,13 +350,14 @@ static struct irp_call *create_irp( struct device_file *file, const irp_params_t
if ((irp = alloc_object( &irp_call_ops )))
{
- irp->file = file ? (struct device_file *)grab_object( file ) : NULL;
- irp->thread = NULL;
- irp->async = NULL;
- irp->params = *params;
- irp->iosb = NULL;
- irp->canceled = 0;
- irp->user_ptr = 0;
+ irp->file = file ? (struct device_file *)grab_object( file ) : NULL;
+ irp->thread = NULL;
+ irp->async = NULL;
+ irp->params = *params;
+ irp->iosb = NULL;
+ irp->dispatched = 0;
+ irp->canceled = 0;
+ irp->user_ptr = 0;
if (async) irp->iosb = async_get_iosb( async );
if (!irp->iosb && !(irp->iosb = create_iosb( NULL, 0, 0 )))
@@ -367,6 +369,19 @@ static struct irp_call *create_irp( struct device_file *file, const irp_params_t
return irp;
}
+static void set_irp_result_buffer( struct irp_call *irp, const void *out_data,
+ data_size_t out_size, data_size_t result )
+{
+ struct iosb *iosb = irp->iosb;
+
+ if (!irp->file) return; /* already finished */
+
+ iosb->result = result;
+ iosb->out_size = min( iosb->out_size, out_size );
+ if (iosb->out_size && !(iosb->out_data = memdup( out_data, iosb->out_size )))
+ iosb->out_size = 0;
+}
+
static void set_irp_result( struct irp_call *irp, unsigned int status,
const void *out_data, data_size_t out_size, data_size_t result )
{
@@ -377,17 +392,15 @@ static void set_irp_result( struct irp_call *irp, unsigned int status,
/* FIXME: handle the STATUS_PENDING case */
iosb->status = status;
- iosb->result = result;
- iosb->out_size = min( iosb->out_size, out_size );
- if (iosb->out_size && !(iosb->out_data = memdup( out_data, iosb->out_size )))
- iosb->out_size = 0;
+ if (!iosb->out_data || irp->dispatched)
+ set_irp_result_buffer( irp, out_data, out_size, result );
/* remove it from the device queue */
list_remove( &irp->dev_entry );
irp->file = NULL;
if (irp->async)
{
- if (result) status = STATUS_ALERTED;
+ if (iosb->out_size || result) status = STATUS_ALERTED;
async_terminate( irp->async, status );
release_object( irp->async );
irp->async = NULL;
@@ -933,13 +946,15 @@ DECL_HANDLER(get_next_device_request)
irp = manager->current_call;
irp->user_ptr = req->user_ptr;
- if (req->status)
- set_irp_result( irp, req->status, NULL, 0, 0 );
+ if (req->status != STATUS_PENDING)
+ set_irp_result( irp, req->status, NULL, 0, irp->iosb->result );
+ else
+ irp->dispatched = 1;
if (irp->canceled)
/* if it was canceled during dispatch, we couldn't queue cancel call without client pointer,
* so we need to do it now */
cancel_irp_call( irp );
- else if (irp->async)
+ else if (irp->async && req->status == STATUS_PENDING)
set_async_pending( irp->async, irp->file && is_fd_overlapped( irp->file->fd ) );
free_irp_params( irp );
@@ -991,7 +1006,10 @@ DECL_HANDLER(set_irp_result)
if ((irp = (struct irp_call *)get_handle_obj( current->process, req->handle, 0, &irp_call_ops )))
{
- if (!irp->canceled)
+ if (!irp->canceled && !irp->dispatched && irp->file && !is_fd_overlapped( irp->file->fd ))
+ /* Don't complete the IRP right away, but save the buffer. */
+ set_irp_result_buffer( irp, get_req_data(), get_req_data_size(), req->size );
+ else if (!irp->canceled)
set_irp_result( irp, req->status, get_req_data(), get_req_data_size(), req->size );
else if(irp->user_ptr) /* cancel already queued */
set_error( STATUS_MORE_PROCESSING_REQUIRED );
--
2.17.1

View File

@ -1,2 +0,0 @@
Fixes: [30155] Improve support for SafeDisc v2.05.030
Disabled: True

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "a8583acae9548e6340d8400ec7710136cd061ab2"
echo "b5e17b669a90d961a93f6092ebc3736ff8ca9cd6"
}
# Show version information

View File

@ -1,28 +1,27 @@
From 9048f6a6a21813d12a00e2b031e3aa916fb7b3f4 Mon Sep 17 00:00:00 2001
From 4b890399fb10c9ed8cf4d17db4373a170b3f0b66 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 15 Aug 2015 21:12:00 +0200
Subject: shell32: Set SFGAO_HASSUBFOLDER correctly for normal shellfolders.
Subject: [PATCH] shell32: Set SFGAO_HASSUBFOLDER correctly for normal
shellfolders.
---
dlls/shell32/shlfolder.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
dlls/shell32/shlfolder.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c
index 8688c5d..53fd323 100644
index f288b7f7ab1..18499190fee 100644
--- a/dlls/shell32/shlfolder.c
+++ b/dlls/shell32/shlfolder.c
@@ -449,8 +449,24 @@ HRESULT SHELL32_GetItemAttributes (IShellFolder2 *psf, LPCITEMIDLIST pidl, LPDWO
*pdwAttributes |= SFGAO_FILESYSTEM | SFGAO_DROPTARGET | SFGAO_HASPROPSHEET | SFGAO_CANDELETE |
@@ -450,7 +450,23 @@ HRESULT SHELL32_GetItemAttributes (IShellFolder2 *psf, LPCITEMIDLIST pidl, LPDWO
SFGAO_CANRENAME | SFGAO_CANLINK | SFGAO_CANMOVE | SFGAO_CANCOPY;
- if (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)
- *pdwAttributes |= (SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR);
+ if (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)
if (file_attr & FILE_ATTRIBUTE_DIRECTORY)
- *pdwAttributes |= (SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR | SFGAO_STORAGEANCESTOR | SFGAO_STORAGE);
+ {
+ IEnumIDList *enum_list;
+ IShellFolder *child;
+
+ *pdwAttributes |= (SFGAO_FOLDER | SFGAO_FILESYSANCESTOR);
+ *pdwAttributes |= (SFGAO_FOLDER | SFGAO_FILESYSANCESTOR | SFGAO_STORAGEANCESTOR | SFGAO_STORAGE);
+
+ if (SUCCEEDED(IShellFolder2_BindToObject(psf, pidl, NULL, &IID_IShellFolder, (void **)&child)))
+ {
@ -36,8 +35,8 @@ index 8688c5d..53fd323 100644
+ }
+ }
else
*pdwAttributes &= ~(SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR);
{
*pdwAttributes &= ~(SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR | SFGAO_STORAGEANCESTOR | SFGAO_STORAGE);
--
2.9.0
2.33.0

View File

@ -1,4 +1,4 @@
From ef8db03ac854f6f58ee8787f80b22c35efc69850 Mon Sep 17 00:00:00 2001
From f71bf1dbfced899bffb9f5baf0015f82779f81b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= <gabrielopcode@gmail.com>
Date: Wed, 16 Sep 2020 17:35:09 +0300
Subject: [PATCH] user32: Fix messages sent on a window without WS_CHILD, but
@ -22,18 +22,18 @@ Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index d6be31a7d8b..aaff4f94e2f 100644
index d61c813b492..92076573b90 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -16708,6 +16708,7 @@ static const struct message WmSetParentSeq_2[] = {
@@ -16796,6 +16796,7 @@ static const struct message WmSetParentSeq_2[] = {
{ HCBT_ACTIVATE, hook|optional },
{ EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 },
{ EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam|optional, 0, 0 },
{ WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE },
+ { WM_QUERYNEWPALETTE, sent|optional },
{ WM_NCACTIVATE, sent|wparam|optional, 1 },
{ WM_ACTIVATE, sent|wparam|optional, 1 },
{ HCBT_SETFOCUS, hook|optional },
@@ -16778,7 +16779,7 @@ static void test_SetParent(void)
@@ -16866,7 +16867,7 @@ static void test_SetParent(void)
SetParent(popup, child);
flush_events();
@ -43,10 +43,10 @@ index d6be31a7d8b..aaff4f94e2f 100644
ok(GetWindowLongA(popup, GWL_STYLE) & WS_VISIBLE, "WS_VISIBLE should be set\n");
ok(!IsWindowVisible(popup), "IsWindowVisible() should return FALSE\n");
diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
index de5d50d4c3a..fc8f2cd478c 100644
index fa2f7e6fede..5d9401f13a4 100644
--- a/dlls/user32/winpos.c
+++ b/dlls/user32/winpos.c
@@ -1130,8 +1130,8 @@ static BOOL show_window( HWND hwnd, INT cmd )
@@ -1144,8 +1144,8 @@ static BOOL show_window( HWND hwnd, INT cmd )
}
swp = new_swp;
@ -57,7 +57,7 @@ index de5d50d4c3a..fc8f2cd478c 100644
{
/* if parent is not visible simply toggle WS_VISIBLE and return */
if (showFlag) WIN_SetStyle( hwnd, WS_VISIBLE, 0 );
@@ -1980,8 +1980,11 @@ static BOOL fixup_flags( WINDOWPOS *winpos, const RECT *old_window_rect, int par
@@ -2042,8 +2042,11 @@ static BOOL fixup_flags( WINDOWPOS *winpos, const RECT *old_window_rect, int par
if (winpos->cy < 0) winpos->cy = 0;
else if (winpos->cy > 32767) winpos->cy = 32767;
@ -72,5 +72,5 @@ index de5d50d4c3a..fc8f2cd478c 100644
if (wndPtr->dwStyle & WS_VISIBLE) winpos->flags &= ~SWP_SHOWWINDOW;
else
--
2.30.2
2.33.0

View File

@ -1 +1 @@
a8583acae9548e6340d8400ec7710136cd061ab2
b5e17b669a90d961a93f6092ebc3736ff8ca9cd6