From 1a3b158f0be9cf8bdee090a635af8cff75be99ae Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 28 Jun 2021 21:09:42 -0500 Subject: [PATCH] Rebase against 362eed3ae30e17da64888407140334925499071c. --- ...ined3d_resource-and-sub-resource-ind.patch | 208 ------------------ ...-validation-to-wined3d_device_contex.patch | 53 ----- patches/kernel32-CopyFileEx/definition | 1 - ...d-tests-to-set-disposition-on-file-w.patch | 107 --------- ...low-to-set-disposition-on-file-which.patch | 64 ------ .../definition | 3 - patches/patchinstall.sh | 48 +--- patches/ws2_32-getsockopt/definition | 2 + staging/upstream-commit | 2 +- 9 files changed, 6 insertions(+), 482 deletions(-) delete mode 100644 patches/d3d11-Deferred_Context/0001-wined3d-Pass-a-wined3d_resource-and-sub-resource-ind.patch delete mode 100644 patches/d3d11-Deferred_Context/0002-wined3d-Move-box-validation-to-wined3d_device_contex.patch delete mode 100644 patches/ntdll-FileDispositionInformation/0001-ntdll-tests-Added-tests-to-set-disposition-on-file-w.patch delete mode 100644 patches/ntdll-FileDispositionInformation/0002-server-Do-not-allow-to-set-disposition-on-file-which.patch delete mode 100644 patches/ntdll-FileDispositionInformation/definition diff --git a/patches/d3d11-Deferred_Context/0001-wined3d-Pass-a-wined3d_resource-and-sub-resource-ind.patch b/patches/d3d11-Deferred_Context/0001-wined3d-Pass-a-wined3d_resource-and-sub-resource-ind.patch deleted file mode 100644 index 543b14e1..00000000 --- a/patches/d3d11-Deferred_Context/0001-wined3d-Pass-a-wined3d_resource-and-sub-resource-ind.patch +++ /dev/null @@ -1,208 +0,0 @@ -From eb98e2cffac9434f3c3afc97e7a90e6fb3058c2d Mon Sep 17 00:00:00 2001 -From: Zebediah Figura -Date: Wed, 23 Jun 2021 15:49:58 -0500 -Subject: [PATCH] wined3d: Pass a wined3d_resource and sub-resource index to - wined3d_texture_check_box_dimensions(). - -Signed-off-by: Zebediah Figura ---- - dlls/wined3d/device.c | 9 ++---- - dlls/wined3d/resource.c | 38 ++++++++++++++++++++++++++ - dlls/wined3d/texture.c | 50 +++------------------------------- - dlls/wined3d/wined3d_private.h | 4 +-- - 4 files changed, 47 insertions(+), 54 deletions(-) - -diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 2af705b10e3..5b2bd7ae03b 100644 ---- a/dlls/wined3d/device.c -+++ b/dlls/wined3d/device.c -@@ -4608,7 +4608,7 @@ HRESULT CDECL wined3d_device_context_copy_sub_resource_region(struct wined3d_dev - wined3d_box_set(&b, 0, 0, min(src_w, dst_w), min(src_h, dst_h), 0, min(src_d, dst_d)); - src_box = &b; - } -- else if (FAILED(wined3d_texture_check_box_dimensions(src_texture, src_level, src_box))) -+ else if (FAILED(wined3d_resource_check_box_dimensions(src_resource, src_sub_resource_idx, src_box))) - { - WARN("Invalid source box %s.\n", debug_box(src_box)); - return WINED3DERR_INVALIDCALL; -@@ -4631,8 +4631,7 @@ HRESULT CDECL wined3d_device_context_copy_sub_resource_region(struct wined3d_dev - dst_y + (src_row_count * dst_resource->format->block_height), - dst_z, dst_z + (src_box->back - src_box->front)); - } -- if (FAILED(wined3d_texture_check_box_dimensions(dst_texture, -- dst_sub_resource_idx % dst_texture->level_count, &dst_box))) -+ if (FAILED(wined3d_resource_check_box_dimensions(dst_resource, dst_sub_resource_idx, &dst_box))) - { - WARN("Invalid destination box %s.\n", debug_box(&dst_box)); - return WINED3DERR_INVALIDCALL; -@@ -4760,11 +4759,9 @@ HRESULT CDECL wined3d_device_context_clear_rendertarget_view(struct wined3d_devi - else - { - struct wined3d_box b = {rect->left, rect->top, rect->right, rect->bottom, 0, 1}; -- struct wined3d_texture *texture = texture_from_resource(view->resource); - HRESULT hr; - -- if (FAILED(hr = wined3d_texture_check_box_dimensions(texture, -- view->sub_resource_idx % texture->level_count, &b))) -+ if (FAILED(hr = wined3d_resource_check_box_dimensions(resource, view->sub_resource_idx, &b))) - return hr; - } - -diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c -index 58e3e5c77fd..f37c313e023 100644 ---- a/dlls/wined3d/resource.c -+++ b/dlls/wined3d/resource.c -@@ -501,6 +501,44 @@ unsigned int wined3d_resource_get_sample_count(const struct wined3d_resource *re - return resource->multisample_type; - } - -+HRESULT wined3d_resource_check_box_dimensions(struct wined3d_resource *resource, -+ unsigned int sub_resource_idx, const struct wined3d_box *box) -+{ -+ const struct wined3d_format *format = resource->format; -+ struct wined3d_sub_resource_desc desc; -+ unsigned int width_mask, height_mask; -+ -+ wined3d_resource_get_sub_resource_desc(resource, sub_resource_idx, &desc); -+ -+ if (box->left >= box->right || box->right > desc.width -+ || box->top >= box->bottom || box->bottom > desc.height -+ || box->front >= box->back || box->back > desc.depth) -+ { -+ WARN("Box %s is invalid.\n", debug_box(box)); -+ return WINEDDERR_INVALIDRECT; -+ } -+ -+ if (resource->format_flags & WINED3DFMT_FLAG_BLOCKS) -+ { -+ /* This assumes power of two block sizes, but NPOT block sizes would -+ * be silly anyway. -+ * -+ * This also assumes that the format's block depth is 1. */ -+ width_mask = format->block_width - 1; -+ height_mask = format->block_height - 1; -+ -+ if ((box->left & width_mask) || (box->top & height_mask) -+ || (box->right & width_mask && box->right != desc.width) -+ || (box->bottom & height_mask && box->bottom != desc.height)) -+ { -+ WARN("Box %s is misaligned for %ux%u blocks.\n", debug_box(box), format->block_width, format->block_height); -+ return WINED3DERR_INVALIDCALL; -+ } -+ } -+ -+ return WINED3D_OK; -+} -+ - VkAccessFlags vk_access_mask_from_bind_flags(uint32_t bind_flags) - { - VkAccessFlags flags = 0; -diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 5876f580e0d..0f753e66704 100644 ---- a/dlls/wined3d/texture.c -+++ b/dlls/wined3d/texture.c -@@ -1653,46 +1653,6 @@ void * CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture) - return texture->resource.parent; - } - --HRESULT wined3d_texture_check_box_dimensions(const struct wined3d_texture *texture, -- unsigned int level, const struct wined3d_box *box) --{ -- const struct wined3d_format *format = texture->resource.format; -- unsigned int width_mask, height_mask, width, height, depth; -- -- width = wined3d_texture_get_level_width(texture, level); -- height = wined3d_texture_get_level_height(texture, level); -- depth = wined3d_texture_get_level_depth(texture, level); -- -- if (box->left >= box->right || box->right > width -- || box->top >= box->bottom || box->bottom > height -- || box->front >= box->back || box->back > depth) -- { -- WARN("Box %s is invalid.\n", debug_box(box)); -- return WINEDDERR_INVALIDRECT; -- } -- -- if (texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS) -- { -- /* This assumes power of two block sizes, but NPOT block sizes would -- * be silly anyway. -- * -- * This also assumes that the format's block depth is 1. */ -- width_mask = format->block_width - 1; -- height_mask = format->block_height - 1; -- -- if ((box->left & width_mask) || (box->top & height_mask) -- || (box->right & width_mask && box->right != width) -- || (box->bottom & height_mask && box->bottom != height)) -- { -- WARN("Box %s is misaligned for %ux%u blocks.\n", -- debug_box(box), format->block_width, format->block_height); -- return WINED3DERR_INVALIDCALL; -- } -- } -- -- return WINED3D_OK; --} -- - void CDECL wined3d_texture_get_pitch(const struct wined3d_texture *texture, - unsigned int level, unsigned int *row_pitch, unsigned int *slice_pitch) - { -@@ -2250,7 +2210,7 @@ HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, - return WINED3DERR_INVALIDCALL; - } - -- if (dirty_region && FAILED(wined3d_texture_check_box_dimensions(texture, 0, dirty_region))) -+ if (dirty_region && FAILED(wined3d_resource_check_box_dimensions(&texture->resource, 0, dirty_region))) - { - WARN("Invalid dirty_region %s specified.\n", debug_box(dirty_region)); - return WINED3DERR_INVALIDCALL; -@@ -3553,7 +3513,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour - sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx); - - texture_level = sub_resource_idx % texture->level_count; -- if (FAILED(wined3d_texture_check_box_dimensions(texture, texture_level, box))) -+ if (FAILED(wined3d_resource_check_box_dimensions(resource, sub_resource_idx, box))) - { - WARN("Map box is invalid.\n"); - if (((fmt_flags & WINED3DFMT_FLAG_BLOCKS) && !(resource->access & WINED3D_RESOURCE_ACCESS_CPU)) -@@ -4024,12 +3984,10 @@ HRESULT CDECL wined3d_device_context_blt(struct wined3d_device_context *context, - && filter != WINED3D_TEXF_LINEAR) - return WINED3DERR_INVALIDCALL; - -- if (FAILED(hr = wined3d_texture_check_box_dimensions(dst_texture, -- dst_sub_resource_idx % dst_texture->level_count, &dst_box))) -+ if (FAILED(hr = wined3d_resource_check_box_dimensions(&dst_texture->resource, dst_sub_resource_idx, &dst_box))) - return hr; - -- if (FAILED(hr = wined3d_texture_check_box_dimensions(src_texture, -- src_sub_resource_idx % src_texture->level_count, &src_box))) -+ if (FAILED(hr = wined3d_resource_check_box_dimensions(&src_texture->resource, src_sub_resource_idx, &src_box))) - return hr; - - if (dst_texture->sub_resources[dst_sub_resource_idx].map_count -diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h -index 84dad38f0c9..6700302b481 100644 ---- a/dlls/wined3d/wined3d_private.h -+++ b/dlls/wined3d/wined3d_private.h -@@ -4134,6 +4134,8 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * - unsigned int size, void *parent, const struct wined3d_parent_ops *parent_ops, - const struct wined3d_resource_ops *resource_ops) DECLSPEC_HIDDEN; - void resource_unload(struct wined3d_resource *resource) DECLSPEC_HIDDEN; -+HRESULT wined3d_resource_check_box_dimensions(struct wined3d_resource *resource, -+ unsigned int sub_resource_idx, const struct wined3d_box *box) DECLSPEC_HIDDEN; - void wined3d_resource_free_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; - const struct wined3d_format *wined3d_resource_get_decompress_format( - const struct wined3d_resource *resource) DECLSPEC_HIDDEN; -@@ -4358,8 +4360,6 @@ void texture2d_load_fb_texture(struct wined3d_texture_gl *texture_gl, unsigned i - void texture2d_read_from_framebuffer(struct wined3d_texture *texture, unsigned int sub_resource_idx, - struct wined3d_context *context, DWORD src_location, DWORD dst_location) DECLSPEC_HIDDEN; - --HRESULT wined3d_texture_check_box_dimensions(const struct wined3d_texture *texture, -- unsigned int level, const struct wined3d_box *box) DECLSPEC_HIDDEN; - void wined3d_texture_cleanup(struct wined3d_texture *texture) DECLSPEC_HIDDEN; - void wined3d_texture_download_from_texture(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, - struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx) DECLSPEC_HIDDEN; --- -2.30.2 - diff --git a/patches/d3d11-Deferred_Context/0002-wined3d-Move-box-validation-to-wined3d_device_contex.patch b/patches/d3d11-Deferred_Context/0002-wined3d-Move-box-validation-to-wined3d_device_contex.patch deleted file mode 100644 index d46f2ead..00000000 --- a/patches/d3d11-Deferred_Context/0002-wined3d-Move-box-validation-to-wined3d_device_contex.patch +++ /dev/null @@ -1,53 +0,0 @@ -From ffd6adde2136c44bae66146c3f852c9520b1d9e1 Mon Sep 17 00:00:00 2001 -From: Zebediah Figura -Date: Tue, 22 Jun 2021 18:05:18 -0500 -Subject: [PATCH] wined3d: Move box validation to wined3d_device_context_map(). - -Signed-off-by: Zebediah Figura ---- - dlls/wined3d/device.c | 10 ++++++++++ - dlls/wined3d/texture.c | 7 ------- - 2 files changed, 10 insertions(+), 7 deletions(-) - -diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c -index 5b2bd7ae03b..96657141419 100644 ---- a/dlls/wined3d/device.c -+++ b/dlls/wined3d/device.c -@@ -4866,6 +4866,16 @@ HRESULT CDECL wined3d_device_context_map(struct wined3d_device_context *context, - wined3d_box_set(&b, 0, 0, desc.width, desc.height, 0, desc.depth); - box = &b; - } -+ else if (FAILED(wined3d_resource_check_box_dimensions(resource, sub_resource_idx, box))) -+ { -+ WARN("Map box is invalid.\n"); -+ -+ if (resource->type != WINED3D_RTYPE_BUFFER && resource->type != WINED3D_RTYPE_TEXTURE_2D) -+ return WINED3DERR_INVALIDCALL; -+ -+ if ((resource->format_flags & WINED3DFMT_FLAG_BLOCKS) && !(resource->access & WINED3D_RESOURCE_ACCESS_CPU)) -+ return WINED3DERR_INVALIDCALL; -+ } - - if (SUCCEEDED(hr = context->ops->map(context, resource, sub_resource_idx, &map_desc->data, box, flags))) - wined3d_resource_get_sub_resource_map_pitch(resource, sub_resource_idx, -diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c -index 0f753e66704..62f38a1d592 100644 ---- a/dlls/wined3d/texture.c -+++ b/dlls/wined3d/texture.c -@@ -3513,13 +3513,6 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour - sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx); - - texture_level = sub_resource_idx % texture->level_count; -- if (FAILED(wined3d_resource_check_box_dimensions(resource, sub_resource_idx, box))) -- { -- WARN("Map box is invalid.\n"); -- if (((fmt_flags & WINED3DFMT_FLAG_BLOCKS) && !(resource->access & WINED3D_RESOURCE_ACCESS_CPU)) -- || resource->type != WINED3D_RTYPE_TEXTURE_2D) -- return WINED3DERR_INVALIDCALL; -- } - - if (texture->flags & WINED3D_TEXTURE_DC_IN_USE) - { --- -2.30.2 - diff --git a/patches/kernel32-CopyFileEx/definition b/patches/kernel32-CopyFileEx/definition index b64a7dfb..0d53c43d 100644 --- a/patches/kernel32-CopyFileEx/definition +++ b/patches/kernel32-CopyFileEx/definition @@ -1,3 +1,2 @@ Fixes: [22692] Add support for CopyFileEx progress callback Fixes: [22690] Allow to cancel a file operation via progress callback -Depends: ntdll-FileDispositionInformation diff --git a/patches/ntdll-FileDispositionInformation/0001-ntdll-tests-Added-tests-to-set-disposition-on-file-w.patch b/patches/ntdll-FileDispositionInformation/0001-ntdll-tests-Added-tests-to-set-disposition-on-file-w.patch deleted file mode 100644 index 48d844f5..00000000 --- a/patches/ntdll-FileDispositionInformation/0001-ntdll-tests-Added-tests-to-set-disposition-on-file-w.patch +++ /dev/null @@ -1,107 +0,0 @@ -From dea43afaba40a2ab0744a4e5ac8a931ab81df5c2 Mon Sep 17 00:00:00 2001 -From: Qian Hong -Date: Fri, 17 Apr 2015 00:59:02 +0800 -Subject: [PATCH] ntdll/tests: Added tests to set disposition on file which is - mapped to memory - ---- - dlls/ntdll/tests/file.c | 71 ++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 70 insertions(+), 1 deletion(-) - -diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c -index 9971a2b5702..4f6c0d7f847 100644 ---- a/dlls/ntdll/tests/file.c -+++ b/dlls/ntdll/tests/file.c -@@ -2844,12 +2844,13 @@ static void test_file_disposition_information(void) - { - char tmp_path[MAX_PATH], buffer[MAX_PATH + 16]; - DWORD dirpos; -- HANDLE handle, handle2, handle3; -+ HANDLE handle, handle2, handle3, mapping; - NTSTATUS res; - IO_STATUS_BLOCK io; - FILE_DISPOSITION_INFORMATION fdi; - BOOL fileDeleted; - DWORD fdi2; -+ void *ptr; - - GetTempPathA( MAX_PATH, tmp_path ); - -@@ -3195,6 +3196,74 @@ todo_wine - ok( !fileDeleted, "Directory shouldn't have been deleted\n" ); - fileDeleted = RemoveDirectoryA( buffer ); - ok( fileDeleted, "Directory should have been deleted\n" ); -+ -+ /* cannot set disposition on file with file mapping opened */ -+ GetTempFileNameA( tmp_path, "dis", 0, buffer ); -+ handle = CreateFileA(buffer, GENERIC_READ | GENERIC_WRITE | DELETE, 0, NULL, CREATE_ALWAYS, 0, 0); -+ ok( handle != INVALID_HANDLE_VALUE, "failed to create temp file\n" ); -+ mapping = CreateFileMappingA( handle, NULL, PAGE_READWRITE, 0, 64 * 1024, "DelFileTest" ); -+ ok( mapping != NULL, "failed to create file mapping\n"); -+ fdi.DoDeleteFile = TRUE; -+ res = pNtSetInformationFile( handle, &io, &fdi, sizeof fdi, FileDispositionInformation ); -+ todo_wine -+ ok( res == STATUS_CANNOT_DELETE, "unexpected FileDispositionInformation result (expected STATUS_CANNOT_DELETE, got %x)\n", res ); -+ CloseHandle( handle ); -+ fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; -+ ok( !fileDeleted, "File shouldn't have been deleted\n" ); -+ CloseHandle( mapping ); -+ DeleteFileA( buffer ); -+ -+ /* can set disposition on file with file mapping closed */ -+ GetTempFileNameA( tmp_path, "dis", 0, buffer ); -+ handle = CreateFileA(buffer, GENERIC_READ | GENERIC_WRITE | DELETE, 0, NULL, CREATE_ALWAYS, 0, 0); -+ ok( handle != INVALID_HANDLE_VALUE, "failed to create temp file\n" ); -+ mapping = CreateFileMappingA( handle, NULL, PAGE_READWRITE, 0, 64 * 1024, "DelFileTest" ); -+ ok( mapping != NULL, "failed to create file mapping\n"); -+ CloseHandle( mapping ); -+ fdi.DoDeleteFile = TRUE; -+ res = pNtSetInformationFile( handle, &io, &fdi, sizeof fdi, FileDispositionInformation ); -+ ok( res == STATUS_SUCCESS, "unexpected FileDispositionInformation result (expected STATUS_SUCCESS, got %x)\n", res ); -+ CloseHandle( handle ); -+ fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; -+ ok( fileDeleted, "File should have been deleted\n" ); -+ DeleteFileA( buffer ); -+ -+ /* cannot set disposition on file which is mapped to memory */ -+ GetTempFileNameA( tmp_path, "dis", 0, buffer ); -+ handle = CreateFileA(buffer, GENERIC_READ | GENERIC_WRITE | DELETE, 0, NULL, CREATE_ALWAYS, 0, 0); -+ ok( handle != INVALID_HANDLE_VALUE, "failed to create temp file\n" ); -+ mapping = CreateFileMappingA( handle, NULL, PAGE_READWRITE, 0, 64 * 1024, "DelFileTest" ); -+ ok( mapping != NULL, "failed to create file mapping\n"); -+ ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 4096 ); -+ ok( ptr != NULL, "MapViewOfFile failed\n"); -+ CloseHandle( mapping ); -+ fdi.DoDeleteFile = TRUE; -+ res = pNtSetInformationFile( handle, &io, &fdi, sizeof fdi, FileDispositionInformation ); -+ todo_wine -+ ok( res == STATUS_CANNOT_DELETE, "unexpected FileDispositionInformation result (expected STATUS_CANNOT_DELETE, got %x)\n", res ); -+ CloseHandle( handle ); -+ fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; -+ ok( !fileDeleted, "File shouldn't have been deleted\n" ); -+ UnmapViewOfFile( ptr ); -+ DeleteFileA( buffer ); -+ -+ /* can set disposition on file which is mapped to memory and unmapped again */ -+ GetTempFileNameA( tmp_path, "dis", 0, buffer ); -+ handle = CreateFileA(buffer, GENERIC_READ | GENERIC_WRITE | DELETE, 0, NULL, CREATE_ALWAYS, 0, 0); -+ ok( handle != INVALID_HANDLE_VALUE, "failed to create temp file\n" ); -+ mapping = CreateFileMappingA( handle, NULL, PAGE_READWRITE, 0, 64 * 1024, "DelFileTest" ); -+ ok( mapping != NULL, "failed to create file mapping\n"); -+ ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 4096 ); -+ ok( ptr != NULL, "MapViewOfFile failed\n"); -+ CloseHandle( mapping ); -+ UnmapViewOfFile( ptr ); -+ fdi.DoDeleteFile = TRUE; -+ res = pNtSetInformationFile( handle, &io, &fdi, sizeof fdi, FileDispositionInformation ); -+ ok( res == STATUS_SUCCESS, "unexpected FileDispositionInformation result (expected STATUS_SUCCESS, got %x)\n", res ); -+ CloseHandle( handle ); -+ fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; -+ ok( fileDeleted, "File should have been deleted\n" ); -+ DeleteFileA( buffer ); - } - - static void test_file_name_information(void) --- -2.26.2 - diff --git a/patches/ntdll-FileDispositionInformation/0002-server-Do-not-allow-to-set-disposition-on-file-which.patch b/patches/ntdll-FileDispositionInformation/0002-server-Do-not-allow-to-set-disposition-on-file-which.patch deleted file mode 100644 index 65492e8e..00000000 --- a/patches/ntdll-FileDispositionInformation/0002-server-Do-not-allow-to-set-disposition-on-file-which.patch +++ /dev/null @@ -1,64 +0,0 @@ -From f41db2526967d4e662fdcf8f602701af6e4e19f8 Mon Sep 17 00:00:00 2001 -From: Qian Hong -Date: Fri, 17 Apr 2015 18:39:59 +0800 -Subject: [PATCH] server: Do not allow to set disposition on file which has a - file mapping. - ---- - dlls/ntdll/tests/file.c | 2 -- - server/fd.c | 12 ++++++++++++ - 2 files changed, 12 insertions(+), 2 deletions(-) - -diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c -index 4f6c0d7f847..776de6d0cc8 100644 ---- a/dlls/ntdll/tests/file.c -+++ b/dlls/ntdll/tests/file.c -@@ -3205,7 +3205,6 @@ todo_wine - ok( mapping != NULL, "failed to create file mapping\n"); - fdi.DoDeleteFile = TRUE; - res = pNtSetInformationFile( handle, &io, &fdi, sizeof fdi, FileDispositionInformation ); -- todo_wine - ok( res == STATUS_CANNOT_DELETE, "unexpected FileDispositionInformation result (expected STATUS_CANNOT_DELETE, got %x)\n", res ); - CloseHandle( handle ); - fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; -@@ -3239,7 +3238,6 @@ todo_wine - CloseHandle( mapping ); - fdi.DoDeleteFile = TRUE; - res = pNtSetInformationFile( handle, &io, &fdi, sizeof fdi, FileDispositionInformation ); -- todo_wine - ok( res == STATUS_CANNOT_DELETE, "unexpected FileDispositionInformation result (expected STATUS_CANNOT_DELETE, got %x)\n", res ); - CloseHandle( handle ); - fileDeleted = GetFileAttributesA( buffer ) == INVALID_FILE_ATTRIBUTES && GetLastError() == ERROR_FILE_NOT_FOUND; -diff --git a/server/fd.c b/server/fd.c -index 0a0683e5bce..2cbbdad6e62 100644 ---- a/server/fd.c -+++ b/server/fd.c -@@ -2487,6 +2487,7 @@ static int is_dir_empty( int fd ) - static void set_fd_disposition( struct fd *fd, int unlink ) - { - struct stat st; -+ struct list *ptr; - - if (!fd->inode) - { -@@ -2534,6 +2535,17 @@ static void set_fd_disposition( struct fd *fd, int unlink ) - } - } - -+ /* can't unlink files which are mapped to memory */ -+ LIST_FOR_EACH( ptr, &fd->inode->open ) -+ { -+ struct fd *fd_ptr = LIST_ENTRY( ptr, struct fd, inode_entry ); -+ if (fd_ptr != fd && (fd_ptr->access & FILE_MAPPING_ACCESS)) -+ { -+ set_error( STATUS_CANNOT_DELETE ); -+ return; -+ } -+ } -+ - fd->closed->unlink = unlink ? 1 : 0; - if (fd->options & FILE_DELETE_ON_CLOSE) - fd->closed->unlink = -1; --- -2.26.2 - diff --git a/patches/ntdll-FileDispositionInformation/definition b/patches/ntdll-FileDispositionInformation/definition deleted file mode 100644 index 6db46c84..00000000 --- a/patches/ntdll-FileDispositionInformation/definition +++ /dev/null @@ -1,3 +0,0 @@ -# Fixes: [30397] Support for NtSetInformationFile class FileDispositionInformation -# Fixes: [30399] Support for NtSetInformationFile class FileRenameInformation -# Fixes: Support for NtSetInformationFile class FileLinkInformation diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 6649f4c2..f03bd62a 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "542175ab10420953920779f3c64eb310dd3aa258" + echo "362eed3ae30e17da64888407140334925499071c" } # Show version information @@ -152,7 +152,6 @@ patch_enable_all () enable_ntdll_CriticalSection="$1" enable_ntdll_DOS_Attributes="$1" enable_ntdll_Exception="$1" - enable_ntdll_FileDispositionInformation="$1" enable_ntdll_FileFsFullSizeInformation="$1" enable_ntdll_ForceBottomUpAlloc="$1" enable_ntdll_HashLinks="$1" @@ -280,7 +279,6 @@ patch_enable_all () enable_winmm_mciSendCommandA="$1" enable_wintab32_improvements="$1" enable_wintrust_WTHelperGetProvCertFromChain="$1" - enable_ws2_32_getsockopt="$1" enable_wscript_support_d_u_switches="$1" enable_xactengine_initial="$1" enable_xactengine3_7_Notification="$1" @@ -501,9 +499,6 @@ patch_enable () ntdll-Exception) enable_ntdll_Exception="$2" ;; - ntdll-FileDispositionInformation) - enable_ntdll_FileDispositionInformation="$2" - ;; ntdll-FileFsFullSizeInformation) enable_ntdll_FileFsFullSizeInformation="$2" ;; @@ -885,9 +880,6 @@ patch_enable () wintrust-WTHelperGetProvCertFromChain) enable_wintrust_WTHelperGetProvCertFromChain="$2" ;; - ws2_32-getsockopt) - enable_ws2_32_getsockopt="$2" - ;; wscript-support-d-u-switches) enable_wscript_support_d_u_switches="$2" ;; @@ -1364,13 +1356,6 @@ if test "$enable_ntdll_WRITECOPY" -eq 1; then enable_ntdll_ForceBottomUpAlloc=1 fi -if test "$enable_kernel32_CopyFileEx" -eq 1; then - if test "$enable_ntdll_FileDispositionInformation" -gt 1; then - abort "Patchset ntdll-FileDispositionInformation disabled, but kernel32-CopyFileEx depends on that." - fi - enable_ntdll_FileDispositionInformation=1 -fi - if test "$enable_imm32_com_initialization" -eq 1; then if test "$enable_winex11__NET_ACTIVE_WINDOW" -gt 1; then abort "Patchset winex11-_NET_ACTIVE_WINDOW disabled, but imm32-com-initialization depends on that." @@ -1633,8 +1618,6 @@ fi # | dlls/wined3d/resource.c, dlls/wined3d/texture.c, dlls/wined3d/utils.c, dlls/wined3d/wined3d_private.h # | if test "$enable_d3d11_Deferred_Context" -eq 1; then - patch_apply d3d11-Deferred_Context/0001-wined3d-Pass-a-wined3d_resource-and-sub-resource-ind.patch - patch_apply d3d11-Deferred_Context/0002-wined3d-Move-box-validation-to-wined3d_device_contex.patch patch_apply d3d11-Deferred_Context/0003-wined3d-Report-a-byte-count-of-1-for-WINED3DFMT_UNKN.patch patch_apply d3d11-Deferred_Context/0004-wined3d-Use-wined3d_buffer_copy_bo_address-in-wined3.patch patch_apply d3d11-Deferred_Context/0005-wined3d-Pass-a-wined3d_const_bo_address-to-wined3d_c.patch @@ -2338,21 +2321,8 @@ if test "$enable_iphlpapi_System_Ping" -eq 1; then patch_apply iphlpapi-System_Ping/0001-iphlpapi-Fallback-to-system-ping-when-ICMP-permissio.patch fi -# Patchset ntdll-FileDispositionInformation -# | -# | Modified files: -# | * dlls/ntdll/tests/file.c, server/fd.c -# | -if test "$enable_ntdll_FileDispositionInformation" -eq 1; then - patch_apply ntdll-FileDispositionInformation/0001-ntdll-tests-Added-tests-to-set-disposition-on-file-w.patch - patch_apply ntdll-FileDispositionInformation/0002-server-Do-not-allow-to-set-disposition-on-file-which.patch -fi - # Patchset kernel32-CopyFileEx # | -# | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-FileDispositionInformation -# | # | This patchset fixes the following Wine bugs: # | * [#22692] Add support for CopyFileEx progress callback # | * [#22690] Allow to cancel a file operation via progress callback @@ -3228,7 +3198,7 @@ fi # Patchset shell32-Progress_Dialog # | # | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-FileDispositionInformation, kernel32-CopyFileEx, shell32-SHFileOperation_Move +# | * kernel32-CopyFileEx, shell32-SHFileOperation_Move # | # | Modified files: # | * dlls/shell32/shell32.rc, dlls/shell32/shlfileop.c, dlls/shell32/shresdef.h @@ -3243,7 +3213,7 @@ fi # Patchset shell32-ACE_Viewer # | # | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-FileDispositionInformation, kernel32-CopyFileEx, shell32-SHFileOperation_Move, shell32-Progress_Dialog +# | * kernel32-CopyFileEx, shell32-SHFileOperation_Move, shell32-Progress_Dialog # | # | Modified files: # | * dlls/shell32/Makefile.in, dlls/shell32/shell32.rc, dlls/shell32/shlview_cmenu.c, dlls/shell32/shresdef.h @@ -4261,18 +4231,6 @@ if test "$enable_wintrust_WTHelperGetProvCertFromChain" -eq 1; then patch_apply wintrust-WTHelperGetProvCertFromChain/0001-wintrust-Add-parameter-check-in-WTHelperGetProvCertF.patch fi -# Patchset ws2_32-getsockopt -# | -# | This patchset fixes the following Wine bugs: -# | * [#8606] Divide values returned by SO_RCVBUF and SO_SNDBUF getsockopt options by two -# | -# | Modified files: -# | * dlls/ws2_32/socket.c, dlls/ws2_32/tests/sock.c -# | -if test "$enable_ws2_32_getsockopt" -eq 1; then - patch_apply ws2_32-getsockopt/0001-ws2_32-Divide-values-returned-by-SO_RCVBUF-and-SO_SN.patch -fi - # Patchset wscript-support-d-u-switches # | # | This patchset fixes the following Wine bugs: diff --git a/patches/ws2_32-getsockopt/definition b/patches/ws2_32-getsockopt/definition index b0782086..8c346c78 100644 --- a/patches/ws2_32-getsockopt/definition +++ b/patches/ws2_32-getsockopt/definition @@ -1 +1,3 @@ Fixes: [8606] Divide values returned by SO_RCVBUF and SO_SNDBUF getsockopt options by two +# In the process of upstreaming. +Disabled: true \ No newline at end of file diff --git a/staging/upstream-commit b/staging/upstream-commit index d7c9dc05..0aeab77f 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -542175ab10420953920779f3c64eb310dd3aa258 +362eed3ae30e17da64888407140334925499071c