Compare commits

...

20 Commits
v5.7 ... v5.8

Author SHA1 Message Date
Alistair Leslie-Hughes
7d92cd315b Release v5.8 2020-05-09 15:46:18 +10:00
Paul Gofman
3931c93628 Updated ntdll-WRITECOPY patchset.
Get the guard with STAGING_WRITECOPY env var back as the
patchset is currently causing some regressions.
2020-05-08 19:06:51 +03:00
Alistair Leslie-Hughes
813de5d6f8 Rebase against 148fc1adb53aa1d78a67b2a0ee5ea8058d92589a 2020-05-07 10:22:41 +10:00
Zebediah Figura
dfc3b0f583 Rebase against 1976685a0f57bdec939228d73f6252c68ccb8f80. 2020-05-05 16:17:09 -05:00
Zebediah Figura
3e39e3132b Fix a couple of errors. 2020-05-04 22:44:11 -05:00
Alistair Leslie-Hughes
76ba9d2387 Rebase against 4e2ad334b5881af7661be4d6df3c51aae92ca4a2 2020-05-04 22:19:25 -05:00
Zebediah Figura
d4918b4305 kernel32-Named_Pipe: Remove patch set.
We have had complete message mode named pipe support for multiple years now, and PIPE_NOWAIT for a while too.
2020-05-04 22:19:25 -05:00
Paul Gofman
dcd4faf1c9 Updated winebuild-Fake_Dlls patchset.
Fix Apple code path after ntdll-User_Shared_Data update.
2020-05-04 22:19:24 -05:00
Zebediah Figura
7557b3e2eb Revert "winebuild-Fake_Dlls: Get rid of the separate path for Mac OS."
This reverts commit 4147635dfc.
2020-05-04 22:19:24 -05:00
Zebediah Figura
4b12c5a4e3 Revert "Updated winebuild-Fake_Dlls, ntdll-Syscall_Emulation patchsets."
This reverts commit ca73dc62cd.
2020-05-04 22:19:24 -05:00
Paul Gofman
ca73dc62cd Updated winebuild-Fake_Dlls, ntdll-Syscall_Emulation patchsets.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49065
2020-05-01 14:36:17 +03:00
Zebediah Figura
4147635dfc winebuild-Fake_Dlls: Get rid of the separate path for Mac OS. 2020-04-30 18:58:33 -05:00
Zebediah Figura
4e6a477acd ntdll-User_Shared_Data: Replace with new wineserver-based implementation. 2020-04-30 18:14:40 -05:00
Zebediah Figura
169c49055d Rebase against 0c27d244f76ad90301c5db09d738b3a0389bcdac. 2020-04-30 17:39:18 -05:00
Alistair Leslie-Hughes
7b0b95ee53 Rebase against cf8a6eb2769d2c4ba5bb837d29db89f6b88706ae 2020-04-30 08:28:10 +10:00
Paul Gofman
1785a56934 Updated ntdll-NtSetLdtEntries patchset.
Fixed a test failure.
2020-04-29 17:18:02 +03:00
Paul Gofman
f2d1cc1a8c Updated wined3d-Indexed_Vertex_Blending patchset.
Fix crash in 'Raiden 3 Digital Edition'.
2020-04-29 15:22:03 +03:00
Zebediah Figura
8a46f19ece Rebase against 7ccc45f754a39a425ecc2358a4cfc5675ff11ffb. 2020-04-28 17:41:41 -05:00
Paul Gofman
d33cdb84fd Updated ntdll-WRITECOPY patchset.
Added patches by Andrew Wesie which complete the implementation
and remove the configuration option that was previously
disabled by default.
2020-04-28 14:55:04 +03:00
Zebediah Figura
69a4e4baa2 Rebase against 28ec2795186c7db83637b3b17e4fa95095ebb77d. 2020-04-27 16:42:51 -05:00
125 changed files with 2306 additions and 7401 deletions

View File

@@ -1,4 +1,4 @@
From 63d2046a8f4388fbc7c12a07ae5f412fccc1b202 Mon Sep 17 00:00:00 2001
From 449d193d2cc9255387903c16fe803219fa63f29a Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 29 May 2014 23:43:45 +0200
Subject: [PATCH] loader: Add commandline option --patches to show the patch
@@ -33,10 +33,10 @@ index c29a1c26c26..8906e194272 100644
* wine_get_build_id (NTDLL.@)
*/
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index e61a2578da5..52db67fd978 100644
index 4f5fa8c21d4..f4784428e2e 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1571,6 +1571,7 @@
@@ -1575,6 +1575,7 @@
# Version
@ cdecl wine_get_version() NTDLL_wine_get_version
@@ -45,22 +45,22 @@ index e61a2578da5..52db67fd978 100644
@ cdecl wine_get_host_version(ptr ptr) NTDLL_wine_get_host_version
diff --git a/include/wine/library.h b/include/wine/library.h
index f338c4da190..1f992da6062 100644
index 090b8349559..b8a4a2df576 100644
--- a/include/wine/library.h
+++ b/include/wine/library.h
@@ -47,6 +47,7 @@ extern const char *wine_get_data_dir(void);
extern const char *wine_get_server_dir(void);
extern const char *wine_get_user_name(void);
@@ -42,6 +42,7 @@ extern "C" {
/* configuration */
extern const char *wine_get_version(void);
+extern const void *wine_get_patches(void);
extern const char *wine_get_build_id(void);
extern void wine_init_argv0_path( const char *argv0 );
extern void wine_exec_wine_binary( const char *name, char **argv, const char *env_var );
diff --git a/libs/wine/config.c b/libs/wine/config.c
index 2a3314cbfda..5b66c063db6 100644
index f5b4c0de9af..e52739d55ad 100644
--- a/libs/wine/config.c
+++ b/libs/wine/config.c
@@ -504,6 +504,12 @@ const char *wine_get_version(void)
@@ -515,6 +515,12 @@ const char *wine_get_version(void)
return PACKAGE_VERSION;
}
@@ -74,12 +74,12 @@ index 2a3314cbfda..5b66c063db6 100644
const char *wine_get_build_id(void)
{
diff --git a/libs/wine/wine.map b/libs/wine/wine.map
index 7ea849b908e..a7359ee7872 100644
index 1143b129734..55f874d3e74 100644
--- a/libs/wine/wine.map
+++ b/libs/wine/wine.map
@@ -22,6 +22,7 @@ WINE_1.0
wine_get_server_dir;
wine_get_user_name;
@@ -13,6 +13,7 @@ WINE_1.0
wine_exec_wine_binary;
wine_get_build_id;
wine_get_version;
+ wine_get_patches;
wine_init;
@@ -146,5 +146,5 @@ index 407c897892d..d97d6b28bf8 100644
--
2.25.1
2.26.2

View File

@@ -1,4 +1,4 @@
From 8fe522dadc480b57415a7b63e0752de113851231 Mon Sep 17 00:00:00 2001
From bfd774b59dbfd3cc1f3b2d61d60797eb20654e96 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 5 Aug 2017 01:45:29 +0200
Subject: [PATCH] ntdll: Add function to create new tokens for elevation
@@ -14,10 +14,10 @@ Subject: [PATCH] ntdll: Add function to create new tokens for elevation
6 files changed, 117 insertions(+)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 853da5c3fcf..33c1355c8b5 100644
index fd60ec270ba..c50e83b5aa7 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1569,6 +1569,9 @@
@@ -1573,6 +1573,9 @@
# Virtual memory
@ cdecl __wine_locked_recvmsg(long ptr long)
@@ -28,10 +28,10 @@ index 853da5c3fcf..33c1355c8b5 100644
@ cdecl wine_get_version() NTDLL_wine_get_version
@ cdecl wine_get_patches() NTDLL_wine_get_patches
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index b62239de5b4..d494dc71263 100644
index 2e26d189a1e..6af681e5bde 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -96,6 +96,9 @@ extern int __wine_main_argc;
@@ -104,6 +104,9 @@ extern int __wine_main_argc;
extern char **__wine_main_argv;
extern WCHAR **__wine_main_wargv;
@@ -39,10 +39,10 @@ index b62239de5b4..d494dc71263 100644
+extern HANDLE CDECL __wine_create_default_token(BOOL admin);
+
/* server support */
extern timeout_t server_start_time DECLSPEC_HIDDEN;
extern unsigned int server_cpus DECLSPEC_HIDDEN;
extern const char *build_dir DECLSPEC_HIDDEN;
extern const char *data_dir DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c
index 6d506c85306..9940e6cf7c9 100644
index d2a3421ac58..d360491e770 100644
--- a/dlls/ntdll/process.c
+++ b/dlls/ntdll/process.c
@@ -124,6 +124,24 @@ HANDLE CDECL __wine_make_process_system(void)
@@ -71,10 +71,10 @@ index 6d506c85306..9940e6cf7c9 100644
#define UNIMPLEMENTED_INFO_CLASS(c) \
diff --git a/server/protocol.def b/server/protocol.def
index efacadac42b..434cd11baf0 100644
index f152afb97b6..68c66bc2fcb 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3749,6 +3749,14 @@ struct handle_info
@@ -3754,6 +3754,14 @@ struct handle_info
@END
@@ -215,5 +215,5 @@ index c4f1cd943c2..970ed1838da 100644
+ }
+}
--
2.26.0
2.26.2

View File

@@ -1,64 +0,0 @@
From cdcb9581d105a7964b06ca9c5525e28db25d6206 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Sun, 16 Jul 2017 17:39:28 +0200
Subject: d3dx9_36/tests: Remove useless \n within some ok messages.
---
dlls/d3dx9_36/tests/mesh.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
index 95dd06e4662..b1ab0aaf594 100644
--- a/dlls/d3dx9_36/tests/mesh.c
+++ b/dlls/d3dx9_36/tests/mesh.c
@@ -10195,10 +10195,10 @@ static void test_clone_mesh(void)
hr = mesh->lpVtbl->CloneMesh(mesh, tc[i].clone_options, tc[i].new_declaration,
test_context->device, &mesh_clone);
- ok(hr == D3D_OK, "CloneMesh test case %d failed. Got %x\n, expected D3D_OK\n", i, hr);
+ ok(hr == D3D_OK, "CloneMesh test case %d failed. Got %x, expected D3D_OK.\n", i, hr);
hr = mesh_clone->lpVtbl->GetDeclaration(mesh_clone, new_declaration);
- ok(hr == D3D_OK, "GetDeclaration test case %d failed. Got %x\n, expected D3D_OK\n", i, hr);
+ ok(hr == D3D_OK, "GetDeclaration test case %d failed. Got %x, expected D3D_OK.\n", i, hr);
/* Check declaration elements */
for (j = 0; tc[i].new_declaration[j].Stream != 0xFF; j++)
{
@@ -10385,7 +10385,7 @@ static void test_valid_mesh(void)
hr = D3DXValidMesh(mesh, tc[i].adjacency, &errors_and_warnings);
todo_wine ok(hr == tc[i].exp_hr, "D3DXValidMesh test case %d failed. "
- "Got %x\n, expected %x\n", i, hr, tc[i].exp_hr);
+ "Got %x, expected %x.\n", i, hr, tc[i].exp_hr);
/* Note errors_and_warnings is deliberately not checked because that
* would require copying wast amounts of the text output. */
@@ -10529,7 +10529,7 @@ static void test_optimize_faces(void)
tc[i].num_vertices, tc[i].indices_are_32bit,
face_remap);
ok(hr == D3D_OK, "D3DXOptimizeFaces test case %d failed. "
- "Got %x\n, expected D3D_OK\n", i, hr);
+ "Got %x, expected D3D_OK.\n", i, hr);
/* Compare face remap with expected face remap */
for (j = 0; j < tc[i].num_faces; j++)
@@ -10547,14 +10547,14 @@ static void test_optimize_faces(void)
tc[0].num_vertices, tc[0].indices_are_32bit,
NULL);
ok(hr == D3DERR_INVALIDCALL, "D3DXOptimizeFaces passed NULL face_remap "
- "pointer. Got %x\n, expected D3DERR_INVALIDCALL\n", hr);
+ "pointer. Got %x, expected D3DERR_INVALIDCALL.\n", hr);
/* Number of faces must be smaller than 2^15 */
hr = D3DXOptimizeFaces(tc[0].indices, 2 << 15,
tc[0].num_vertices, FALSE,
&smallest_face_remap);
ok(hr == D3DERR_INVALIDCALL, "D3DXOptimizeFaces should not accept 2^15 "
- "faces when using 16-bit indices. Got %x\n, expected D3DERR_INVALIDCALL\n", hr);
+ "faces when using 16-bit indices. Got %x, expected D3DERR_INVALIDCALL.\n", hr);
}
static HRESULT clear_normals(ID3DXMesh *mesh)
--
2.13.1

View File

@@ -1,235 +0,0 @@
From 4c6b3da41feef98226bbfe14c2b0e88acf39807e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 25 Aug 2015 11:15:59 +0200
Subject: ddraw/tests: Add more tests for IDirectDraw7::EnumSurfaces.
---
dlls/ddraw/ddraw.c | 3 +
dlls/ddraw/tests/d3d.c | 177 ++++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 172 insertions(+), 8 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index b3caba2..4b7a207 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -3135,6 +3135,9 @@ static HRESULT WINAPI ddraw7_EnumSurfaces(IDirectDraw7 *iface, DWORD Flags,
if (!Callback)
return DDERR_INVALIDPARAMS;
+ if (!all && !DDSD)
+ return DDERR_INVALIDPARAMS;
+
wined3d_mutex_lock();
/* Use the _SAFE enumeration, the app may destroy enumerated surfaces */
diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c
index ec4197a..e9c616e 100644
--- a/dlls/ddraw/tests/d3d.c
+++ b/dlls/ddraw/tests/d3d.c
@@ -57,6 +57,12 @@ typedef struct {
int total;
} D3D7ECancelTest;
+typedef struct
+{
+ int found;
+ int surfaces;
+} EnumSurfaceTest;
+
#define MAX_ENUMERATION_COUNT 10
typedef struct
{
@@ -85,17 +91,21 @@ static ULONG getRefcount(IUnknown *iface)
static HRESULT WINAPI SurfaceCounter(IDirectDrawSurface7 *surface, DDSURFACEDESC2 *desc, void *context)
{
- UINT *num = context;
- (*num)++;
- IDirectDrawSurface_Release(surface);
+ EnumSurfaceTest *count = context;
+ count->found++;
+ if (surface)
+ {
+ count->surfaces++;
+ IDirectDrawSurface_Release(surface);
+ }
return DDENUMRET_OK;
}
static BOOL CreateDirect3D(void)
{
HRESULT rc;
- DDSURFACEDESC2 ddsd;
- UINT num;
+ DDSURFACEDESC2 ddsd, ddsd2;
+ EnumSurfaceTest count;
rc = pDirectDrawCreateEx(NULL, (void**)&lpDD,
&IID_IDirectDraw7, NULL);
@@ -122,9 +132,160 @@ static BOOL CreateDirect3D(void)
if (FAILED(rc))
return FALSE;
- num = 0;
- IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_ALL | DDENUMSURFACES_DOESEXIST, NULL, &num, SurfaceCounter);
- ok(num == 1, "Has %d surfaces, expected 1\n", num);
+ memset(&ddsd2, 0, sizeof(ddsd2));
+ ddsd2.dwSize = sizeof(ddsd2);
+ ddsd2.dwFlags = DDSD_WIDTH | DDSD_HEIGHT;
+ ddsd2.dwWidth = 256;
+ ddsd2.dwHeight = 256;
+
+ /* without search type flags */
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, 0, NULL, &count, SurfaceCounter);
+ ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, 0, &ddsd, &count, SurfaceCounter);
+ todo_wine ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_ALL, NULL, &count, SurfaceCounter);
+ todo_wine ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ todo_wine ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ todo_wine ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_MATCH, NULL, &count, SurfaceCounter);
+ ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_NOMATCH, NULL, &count, SurfaceCounter);
+ ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+
+ /* search type DDENUMSURFACES_DOESEXIST */
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST, NULL, &count, SurfaceCounter);
+ ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST, &ddsd, &count, SurfaceCounter);
+ ok(rc == DD_OK, "Expected DD_OK, got %x\n", rc);
+ ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST, &ddsd2, &count, SurfaceCounter);
+ ok(rc == DD_OK, "Expected DD_OK, got %x\n", rc);
+ ok(count.found == 1, "Has %d surface descriptions, expected 1\n", count.found);
+ ok(count.surfaces == 1, "Has %d surfaces, expected 1\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL,
+ NULL, &count, SurfaceCounter);
+ ok(rc == DD_OK, "Expected DD_OK, got %x\n", rc);
+ ok(count.found == 1, "Has %d surface descriptions, expected 1\n", count.found);
+ ok(count.surfaces == 1, "Has %d surfaces, expected 1\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH,
+ &ddsd, &count, SurfaceCounter);
+ ok(rc == DD_OK, "Expected DD_OK, got %x\n", rc);
+ ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_NOMATCH,
+ &ddsd, &count, SurfaceCounter);
+ ok(rc == DD_OK, "Expected DD_OK, got %x\n", rc);
+ ok(count.found == 1, "Has %d surface descriptions, expected 1\n", count.found);
+ ok(count.surfaces == 1, "Has %d surfaces, expected 1\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH,
+ &ddsd2, &count, SurfaceCounter);
+ ok(rc == DD_OK, "Expected DD_OK, got %x\n", rc);
+ ok(count.found == 1, "Has %d surface descriptions, expected 1\n", count.found);
+ ok(count.surfaces == 1, "Has %d surfaces, expected 1\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_NOMATCH,
+ &ddsd2, &count, SurfaceCounter);
+ ok(rc == DD_OK, "Expected DD_OK, got %x\n", rc);
+ todo_wine ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ todo_wine ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL |
+ DDENUMSURFACES_MATCH, NULL, &count, SurfaceCounter);
+ todo_wine ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ todo_wine ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ todo_wine ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL |
+ DDENUMSURFACES_NOMATCH, NULL, &count, SurfaceCounter);
+ todo_wine ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ todo_wine ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ todo_wine ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH |
+ DDENUMSURFACES_NOMATCH, NULL, &count, SurfaceCounter);
+ ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+
+ /* search type DDENUMSURFACES_CANBECREATED */
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_CANBECREATED, &ddsd, &count, SurfaceCounter);
+ todo_wine ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL,
+ &ddsd, &count, SurfaceCounter);
+ todo_wine ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ todo_wine ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ todo_wine ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_NOMATCH,
+ &ddsd, &count, SurfaceCounter);
+ todo_wine ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ todo_wine ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ todo_wine ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH,
+ NULL, &count, SurfaceCounter);
+ ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH,
+ &ddsd, &count, SurfaceCounter);
+ ok(rc == DD_OK, "Expected DD_OK, got %x\n", rc);
+ todo_wine ok(count.found == 1, "Has %d surface descriptions, expected 1\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+
+ /* combination of DDENUMSURFACES_DOESEXIST and DDENUMSURFACES_CANBECREATED */
+ count.found = count.surfaces = 0;
+ rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_CANBECREATED |
+ DDENUMSURFACES_MATCH, &ddsd, &count, SurfaceCounter);
+ ok(rc == DD_OK, "Expected DD_OK, got %x\n", rc);
+ todo_wine ok(count.found == 1, "Has %d surface descriptions, expected 1\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
--
2.5.0

View File

@@ -1,248 +0,0 @@
From 5dcbd836e663da908a9a39b5791da65d64a00eb8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 25 Aug 2015 11:17:07 +0200
Subject: ddraw: Implement DDENUMSURFACES_CANBECREATED flag in
ddraw7_EnumSurfaces.
Also fixes various test failures related to DDENUMSURFACES_DOESEXIST.
The "Unexpected destination texture level pixels" testfailure on the w8 VM is not related to this patch.
---
dlls/ddraw/ddraw.c | 98 +++++++++++++++++++++++++++++++++++++-------------
dlls/ddraw/tests/d3d.c | 42 +++++++++++-----------
2 files changed, 94 insertions(+), 46 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 4b7a207..19ed213 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -3122,49 +3122,97 @@ static HRESULT WINAPI ddraw7_EnumSurfaces(IDirectDraw7 *iface, DWORD Flags,
{
struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
struct ddraw_surface *surf;
- BOOL all, nomatch;
- DDSURFACEDESC2 desc;
- struct list *entry, *entry2;
+ DWORD match_flags = Flags & (DDENUMSURFACES_ALL | DDENUMSURFACES_NOMATCH | DDENUMSURFACES_MATCH);
TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n",
iface, Flags, DDSD, Context, Callback);
- all = Flags & DDENUMSURFACES_ALL;
- nomatch = Flags & DDENUMSURFACES_NOMATCH;
-
if (!Callback)
return DDERR_INVALIDPARAMS;
- if (!all && !DDSD)
- return DDERR_INVALIDPARAMS;
+ if (Flags & DDENUMSURFACES_CANBECREATED)
+ {
+ IDirectDrawSurface7 *surface;
+ DDSURFACEDESC2 testdesc;
+ HRESULT hr;
- wined3d_mutex_lock();
+ if (match_flags != DDENUMSURFACES_MATCH)
+ return DDERR_INVALIDPARAMS;
- /* Use the _SAFE enumeration, the app may destroy enumerated surfaces */
- LIST_FOR_EACH_SAFE(entry, entry2, &ddraw->surface_list)
- {
- surf = LIST_ENTRY(entry, struct ddraw_surface, surface_list_entry);
+ if (!DDSD)
+ return DDERR_INVALIDPARAMS;
+
+ memcpy(&testdesc, DDSD, sizeof(testdesc));
+ if (!(testdesc.dwFlags & DDSD_WIDTH))
+ {
+ testdesc.dwFlags |= DDSD_WIDTH;
+ testdesc.dwWidth = 512;
+ }
+ if (!(testdesc.dwFlags & DDSD_HEIGHT))
+ {
+ testdesc.dwFlags |= DDSD_HEIGHT;
+ testdesc.dwHeight = 512;
+ }
- if (!surf->iface_count)
+ hr = IDirectDraw7_CreateSurface(iface, &testdesc, &surface, NULL);
+ if (SUCCEEDED(hr))
{
- WARN("Not enumerating surface %p because it doesn't have any references.\n", surf);
- continue;
+ surf = unsafe_impl_from_IDirectDrawSurface7(surface);
+ Callback(NULL, &surf->surface_desc, Context);
+ IDirectDrawSurface7_Release(surface);
}
+ else
+ ERR("Failed to create surface, hr %#x.\n", hr);
+ }
+ else if (Flags & DDENUMSURFACES_DOESEXIST)
+ {
+ BOOL all, nomatch;
+ DDSURFACEDESC2 desc;
+ struct list *entry, *entry2;
+
+ /* a combination of match flags is not allowed */
+ if (match_flags != 0 &&
+ match_flags != DDENUMSURFACES_ALL &&
+ match_flags != DDENUMSURFACES_MATCH &&
+ match_flags != DDENUMSURFACES_NOMATCH)
+ return DDERR_INVALIDPARAMS;
+
+ all = (Flags & DDENUMSURFACES_ALL) != 0;
+ nomatch = (Flags & DDENUMSURFACES_NOMATCH) != 0;
+
+ if (!all && !DDSD)
+ return DDERR_INVALIDPARAMS;
- if (all || (nomatch != ddraw_match_surface_desc(DDSD, &surf->surface_desc)))
+ wined3d_mutex_lock();
+
+ /* Use the _SAFE enumeration, the app may destroy enumerated surfaces */
+ LIST_FOR_EACH_SAFE(entry, entry2, &ddraw->surface_list)
{
- TRACE("Enumerating surface %p.\n", surf);
- desc = surf->surface_desc;
- IDirectDrawSurface7_AddRef(&surf->IDirectDrawSurface7_iface);
- if (Callback(&surf->IDirectDrawSurface7_iface, &desc, Context) != DDENUMRET_OK)
+ surf = LIST_ENTRY(entry, struct ddraw_surface, surface_list_entry);
+
+ if (!surf->iface_count)
{
- wined3d_mutex_unlock();
- return DD_OK;
+ WARN("Not enumerating surface %p because it doesn't have any references.\n", surf);
+ continue;
+ }
+
+ if (all || (nomatch != ddraw_match_surface_desc(DDSD, &surf->surface_desc)))
+ {
+ TRACE("Enumerating surface %p.\n", surf);
+ desc = surf->surface_desc;
+ IDirectDrawSurface7_AddRef(&surf->IDirectDrawSurface7_iface);
+ if (Callback(&surf->IDirectDrawSurface7_iface, &desc, Context) != DDENUMRET_OK)
+ {
+ wined3d_mutex_unlock();
+ return DD_OK;
+ }
}
}
- }
- wined3d_mutex_unlock();
+ wined3d_mutex_unlock();
+ }
+ else
+ return DDERR_INVALIDPARAMS;
return DD_OK;
}
diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c
index e9c616e..930460f 100644
--- a/dlls/ddraw/tests/d3d.c
+++ b/dlls/ddraw/tests/d3d.c
@@ -147,15 +147,15 @@ static BOOL CreateDirect3D(void)
count.found = count.surfaces = 0;
rc = IDirectDraw7_EnumSurfaces(lpDD, 0, &ddsd, &count, SurfaceCounter);
- todo_wine ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
count.found = count.surfaces = 0;
rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_ALL, NULL, &count, SurfaceCounter);
- todo_wine ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
- todo_wine ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
- todo_wine ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+ ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
count.found = count.surfaces = 0;
rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_MATCH, NULL, &count, SurfaceCounter);
@@ -220,22 +220,22 @@ static BOOL CreateDirect3D(void)
rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_NOMATCH,
&ddsd2, &count, SurfaceCounter);
ok(rc == DD_OK, "Expected DD_OK, got %x\n", rc);
- todo_wine ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
- todo_wine ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+ ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
count.found = count.surfaces = 0;
rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL |
DDENUMSURFACES_MATCH, NULL, &count, SurfaceCounter);
- todo_wine ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
- todo_wine ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
- todo_wine ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+ ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
count.found = count.surfaces = 0;
rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL |
DDENUMSURFACES_NOMATCH, NULL, &count, SurfaceCounter);
- todo_wine ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
- todo_wine ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
- todo_wine ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+ ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
count.found = count.surfaces = 0;
rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_MATCH |
@@ -247,23 +247,23 @@ static BOOL CreateDirect3D(void)
/* search type DDENUMSURFACES_CANBECREATED */
count.found = count.surfaces = 0;
rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_CANBECREATED, &ddsd, &count, SurfaceCounter);
- todo_wine ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
count.found = count.surfaces = 0;
rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_ALL,
&ddsd, &count, SurfaceCounter);
- todo_wine ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
- todo_wine ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
- todo_wine ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+ ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
count.found = count.surfaces = 0;
rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_NOMATCH,
&ddsd, &count, SurfaceCounter);
- todo_wine ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
- todo_wine ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
- todo_wine ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
+ ok(rc == DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, got %x\n", rc);
+ ok(count.found == 0, "Has %d surface descriptions, expected 0\n", count.found);
+ ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
count.found = count.surfaces = 0;
rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH,
@@ -276,7 +276,7 @@ static BOOL CreateDirect3D(void)
rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_CANBECREATED | DDENUMSURFACES_MATCH,
&ddsd, &count, SurfaceCounter);
ok(rc == DD_OK, "Expected DD_OK, got %x\n", rc);
- todo_wine ok(count.found == 1, "Has %d surface descriptions, expected 1\n", count.found);
+ ok(count.found == 1, "Has %d surface descriptions, expected 1\n", count.found);
ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
/* combination of DDENUMSURFACES_DOESEXIST and DDENUMSURFACES_CANBECREATED */
@@ -284,7 +284,7 @@ static BOOL CreateDirect3D(void)
rc = IDirectDraw7_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_CANBECREATED |
DDENUMSURFACES_MATCH, &ddsd, &count, SurfaceCounter);
ok(rc == DD_OK, "Expected DD_OK, got %x\n", rc);
- todo_wine ok(count.found == 1, "Has %d surface descriptions, expected 1\n", count.found);
+ ok(count.found == 1, "Has %d surface descriptions, expected 1\n", count.found);
ok(count.surfaces == 0, "Has %d surfaces, expected 0\n", count.surfaces);
memset(&ddsd, 0, sizeof(ddsd));
--
2.5.0

View File

@@ -1 +0,0 @@
Fixes: [17233] Implement DDENUMSURFACES_CANBECREATED in IDirectDraw7::EnumSurfaces

View File

@@ -1,45 +0,0 @@
From 9ac9e58e5c76a02e3746c4e4bd16b43766b35066 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 2 Oct 2015 17:29:43 +0200
Subject: ddraw: Remove const from ddraw1_vtbl and ddraw_surface1_vtbl.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Bad Mojo Redux tries to hook ddraw1 and expects both interfaces to be writable.
Signed-off-by: Michael MĂĽller <michael@fds-team.de>
---
dlls/ddraw/ddraw.c | 2 +-
dlls/ddraw/surface.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index c94bfee..bcb1608 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -4494,7 +4494,7 @@ static const struct IDirectDraw2Vtbl ddraw2_vtbl =
ddraw2_GetAvailableVidMem,
};
-static const struct IDirectDrawVtbl ddraw1_vtbl =
+static struct IDirectDrawVtbl ddraw1_vtbl =
{
/* IUnknown */
ddraw1_QueryInterface,
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index 6b6ddb9..71bcba4 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -5421,7 +5421,7 @@ static const struct IDirectDrawSurface2Vtbl ddraw_surface2_vtbl =
ddraw_surface2_PageUnlock,
};
-static const struct IDirectDrawSurfaceVtbl ddraw_surface1_vtbl =
+static struct IDirectDrawSurfaceVtbl ddraw_surface1_vtbl =
{
/* IUnknown */
ddraw_surface1_QueryInterface,
--
2.5.1

View File

@@ -1,67 +0,0 @@
From 4d068ed386b282bc2fc30c13ba0845dfa6f135ef Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 3 Apr 2019 10:36:47 +1100
Subject: [PATCH] ddraw: Allow writing to vtable for surface and palette
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=46949
---
dlls/ddraw/palette.c | 2 +-
dlls/ddraw/surface.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/ddraw/palette.c b/dlls/ddraw/palette.c
index 87aec96443a..7cfd662f2ec 100644
--- a/dlls/ddraw/palette.c
+++ b/dlls/ddraw/palette.c
@@ -218,7 +218,7 @@ static HRESULT WINAPI ddraw_palette_GetEntries(IDirectDrawPalette *iface,
return hr;
}
-static const struct IDirectDrawPaletteVtbl ddraw_palette_vtbl =
+static struct IDirectDrawPaletteVtbl ddraw_palette_vtbl =
{
/*** IUnknown ***/
ddraw_palette_QueryInterface,
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index 8820f211852..9c9cdb358bf 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -5399,7 +5399,7 @@ static HRESULT WINAPI d3d_texture1_Load(IDirect3DTexture *iface, IDirect3DTextur
* The VTable
*****************************************************************************/
-static const struct IDirectDrawSurface7Vtbl ddraw_surface7_vtbl =
+static struct IDirectDrawSurface7Vtbl ddraw_surface7_vtbl =
{
/* IUnknown */
ddraw_surface7_QueryInterface,
@@ -5458,7 +5458,7 @@ static const struct IDirectDrawSurface7Vtbl ddraw_surface7_vtbl =
ddraw_surface7_GetLOD,
};
-static const struct IDirectDrawSurface4Vtbl ddraw_surface4_vtbl =
+static struct IDirectDrawSurface4Vtbl ddraw_surface4_vtbl =
{
/* IUnknown */
ddraw_surface4_QueryInterface,
@@ -5512,7 +5512,7 @@ static const struct IDirectDrawSurface4Vtbl ddraw_surface4_vtbl =
ddraw_surface4_ChangeUniquenessValue,
};
-static const struct IDirectDrawSurface3Vtbl ddraw_surface3_vtbl =
+static struct IDirectDrawSurface3Vtbl ddraw_surface3_vtbl =
{
/* IUnknown */
ddraw_surface3_QueryInterface,
@@ -5560,7 +5560,7 @@ static const struct IDirectDrawSurface3Vtbl ddraw_surface3_vtbl =
ddraw_surface3_SetSurfaceDesc,
};
-static const struct IDirectDrawSurface2Vtbl ddraw_surface2_vtbl =
+static struct IDirectDrawSurface2Vtbl ddraw_surface2_vtbl =
{
/* IUnknown */
ddraw_surface2_QueryInterface,
--
2.20.1

View File

@@ -1,2 +0,0 @@
Fixes: [39534] Make ddraw1 and ddraw_surface1 vtable as writable.
Fixes: [46949] Make ddraw[2-7] and palette vtable as writable.

View File

@@ -1,4 +1,4 @@
From 43baedbee4f25d88f8af30c216b888f5161e62df Mon Sep 17 00:00:00 2001
From f75d03835dd04b2838a2cdcde64346efc26e9972 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Thu, 7 Jun 2018 20:29:21 -0500
Subject: [PATCH] ntdll: Create eventfd-based objects for semaphores.
@@ -16,10 +16,10 @@ This patch break things, of course. That is fine. Its purpose is to prevent a Ma
create mode 100644 dlls/ntdll/esync.h
diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in
index ed4bb94e4dc..b75e8308ac7 100644
index 7971ef98cf0..2f26f0dc958 100644
--- a/dlls/ntdll/Makefile.in
+++ b/dlls/ntdll/Makefile.in
@@ -15,6 +15,7 @@ C_SRCS = \
@@ -17,6 +17,7 @@ C_SRCS = \
directory.c \
env.c \
error.c \
@@ -213,10 +213,10 @@ index 00000000000..1a88170cfc4
+ * "server_fd_section" or something similar. */
+extern RTL_CRITICAL_SECTION fd_cache_section;
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 11463146da0..a370256245c 100644
index 177d4fd9e44..51c067bb8a0 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -106,6 +106,7 @@ extern unsigned int server_queue_process_apc( HANDLE process, const apc_call_t *
@@ -136,6 +136,7 @@ extern unsigned int server_queue_process_apc( HANDLE process, const apc_call_t *
extern int server_remove_fd_from_cache( HANDLE handle ) DECLSPEC_HIDDEN;
extern int server_get_unix_fd( HANDLE handle, unsigned int access, int *unix_fd,
int *needs_close, enum server_fd_type *type, unsigned int *options ) DECLSPEC_HIDDEN;
@@ -225,18 +225,18 @@ index 11463146da0..a370256245c 100644
extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_attributes **ret,
data_size_t *ret_len ) DECLSPEC_HIDDEN;
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index 43dfe9303bb..46f1cae3f1f 100644
index 973804967d1..c240bd1d9f8 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -81,6 +81,7 @@
#include "wine/server.h"
@@ -98,6 +98,7 @@
#include "wine/debug.h"
#include "ntdll_misc.h"
#include "ddk/wdm.h"
+#include "esync.h"
WINE_DEFAULT_DEBUG_CHANNEL(server);
WINE_DECLARE_DEBUG_CHANNEL(winediag);
@@ -120,14 +121,14 @@ sigset_t server_block_set; /* signals to block during server calls */
@@ -170,14 +171,14 @@ sigset_t server_block_set; /* signals to block during server calls */
static int fd_socket = -1; /* socket to exchange file descriptors with the server */
static pid_t server_pid;
@@ -253,7 +253,7 @@ index 43dfe9303bb..46f1cae3f1f 100644
/* atomically exchange a 64-bit value */
static inline LONG64 interlocked_xchg64( LONG64 *dest, LONG64 val )
@@ -764,7 +765,7 @@ void CDECL wine_server_send_fd( int fd )
@@ -919,7 +920,7 @@ void CDECL wine_server_send_fd( int fd )
*
* Receive a file descriptor passed from the server.
*/
@@ -263,7 +263,7 @@ index 43dfe9303bb..46f1cae3f1f 100644
struct iovec vec;
struct msghdr msghdr;
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index 8974c7ed907..3939ce1ba78 100644
index fbfb8f893ec..74dbde017e8 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -59,7 +59,9 @@
@@ -276,7 +276,7 @@ index 8974c7ed907..3939ce1ba78 100644
WINE_DEFAULT_DEBUG_CHANNEL(sync);
@@ -249,6 +251,9 @@ NTSTATUS WINAPI NtCreateSemaphore( OUT PHANDLE SemaphoreHandle,
@@ -259,6 +261,9 @@ NTSTATUS WINAPI NtCreateSemaphore( OUT PHANDLE SemaphoreHandle,
if (MaximumCount <= 0 || InitialCount < 0 || InitialCount > MaximumCount)
return STATUS_INVALID_PARAMETER;
@@ -287,5 +287,5 @@ index 8974c7ed907..3939ce1ba78 100644
SERVER_START_REQ( create_semaphore )
--
2.20.1
2.26.2

View File

@@ -82,7 +82,7 @@ index da35bdf85..2bb85d910 100644
+ }
+ }
+
+ obj = interlocked_xchg_ptr((void **)&esync_list[entry][idx], obj);
+ obj = InterlockedExchangePointer((void **)&esync_list[entry][idx], obj);
+ assert(!obj);
+ return TRUE;
+}

View File

@@ -26,7 +26,7 @@ index bca95b9b2d9..f7a427425b7 100644
+
+ if (entry < ESYNC_LIST_ENTRIES && esync_list[entry])
+ {
+ if ((obj = interlocked_xchg_ptr( (void **)&esync_list[entry][idx], 0 )))
+ if ((obj = InterlockedExchangePointer( (void **)&esync_list[entry][idx], 0 )))
+ {
+ close( obj->fd );
+ RtlFreeHeap( GetProcessHeap(), 0, obj );

View File

@@ -1,8 +1,8 @@
From 86714f32b54c3135e5626f66f65ae5daf946f744 Mon Sep 17 00:00:00 2001
From f7855379ad40d50af6d63a8e7349504ece2f3464 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Tue, 12 Jun 2018 10:01:08 -0500
Subject: [PATCH 23/83] ntdll, wineandroid.drv, winemac.drv, winex11.drv: Store
the thread's queue fd in ntdll.
Subject: [PATCH] ntdll, wineandroid.drv, winemac.drv, winex11.drv: Store the
thread's queue fd in ntdll.
I originally had esync grab it from the server in order to avoid touching the USER drivers, but this doesn't really work since we might perform a MsgWait before ever doing any operations which might initialize the USER driver's thread data. Doing it this way also has the advantage that we won't use extra file descriptors.
@@ -18,7 +18,7 @@ In any case I haven't bothered to guard this code with do_esync(); it'd require
7 files changed, 20 insertions(+)
diff --git a/dlls/ntdll/esync.c b/dlls/ntdll/esync.c
index 0655ab779..210556fc2 100644
index c53818b5485..5d8dbac2df4 100644
--- a/dlls/ntdll/esync.c
+++ b/dlls/ntdll/esync.c
@@ -74,6 +74,12 @@ int do_esync(void)
@@ -35,10 +35,10 @@ index 0655ab779..210556fc2 100644
{
ESYNC_SEMAPHORE = 1,
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 74cebfc42..343ab66a5 100644
index 3e7327211b3..784635a53c8 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1498,6 +1498,8 @@
@@ -1555,6 +1555,8 @@
# All functions must be prefixed with '__wine_' (for internal functions)
# or 'wine_' (for user-visible functions) to avoid namespace conflicts.
@@ -48,10 +48,10 @@ index 74cebfc42..343ab66a5 100644
@ cdecl -norelay wine_server_call(ptr)
@ cdecl wine_server_close_fds_by_type(long)
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index dad0996c4..e2ef7d9b8 100644
index 98caabbf8e8..8e07b148c88 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -280,6 +280,7 @@ struct debug_info
@@ -270,6 +270,7 @@ struct debug_info
struct ntdll_thread_data
{
struct debug_info *debug_info; /* info for debugstr functions */
@@ -60,18 +60,18 @@ index dad0996c4..e2ef7d9b8 100644
int request_fd; /* fd for sending server requests */
int reply_fd; /* fd for receiving server replies */
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index a1ff7c1dd..87134db09 100644
index cbbdafb2e97..688f16eb528 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -326,6 +326,7 @@ void thread_init(void)
@@ -345,6 +345,7 @@ TEB *thread_init(void)
thread_data->reply_fd = -1;
thread_data->wait_fd[0] = -1;
thread_data->wait_fd[1] = -1;
+ thread_data->esync_queue_fd = -1;
signal_init_thread( teb );
virtual_init_threading();
@@ -694,6 +695,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT
debug_init();
init_paths();
@@ -718,6 +719,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT
thread_data->wait_fd[0] = -1;
thread_data->wait_fd[1] = -1;
thread_data->start_stack = (char *)teb->Tib.StackBase;
@@ -80,7 +80,7 @@ index a1ff7c1dd..87134db09 100644
pthread_attr_init( &pthread_attr );
pthread_attr_setstack( &pthread_attr, teb->DeallocationStack,
diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c
index eb05aaf28..2fc258dfd 100644
index c1e7b000a8f..d96f001432d 100644
--- a/dlls/wineandroid.drv/window.c
+++ b/dlls/wineandroid.drv/window.c
@@ -364,6 +364,8 @@ jboolean motion_event( JNIEnv *env, jobject obj, jint win, jint action, jint x,
@@ -101,10 +101,10 @@ index eb05aaf28..2fc258dfd 100644
{
ERR( "Can't allocate handle for event fd\n" );
diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c
index 544d448f9..5dfa54966 100644
index 694a46b11e6..64b8d69b16d 100644
--- a/dlls/winemac.drv/macdrv_main.c
+++ b/dlls/winemac.drv/macdrv_main.c
@@ -321,6 +321,7 @@ void CDECL macdrv_ThreadDetach(void)
@@ -323,6 +323,7 @@ void CDECL macdrv_ThreadDetach(void)
}
}
@@ -112,7 +112,7 @@ index 544d448f9..5dfa54966 100644
/***********************************************************************
* set_queue_display_fd
@@ -332,6 +333,8 @@ static void set_queue_display_fd(int fd)
@@ -334,6 +335,8 @@ static void set_queue_display_fd(int fd)
HANDLE handle;
int ret;
@@ -122,10 +122,10 @@ index 544d448f9..5dfa54966 100644
{
MESSAGE("macdrv: Can't allocate handle for event queue fd\n");
diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c
index 40cd8ca29..18c98e3ec 100644
index 4eaedd1c556..323b71534ac 100644
--- a/dlls/winex11.drv/x11drv_main.c
+++ b/dlls/winex11.drv/x11drv_main.c
@@ -624,6 +624,7 @@ void CDECL X11DRV_ThreadDetach(void)
@@ -643,6 +643,7 @@ void CDECL X11DRV_ThreadDetach(void)
}
}
@@ -133,7 +133,7 @@ index 40cd8ca29..18c98e3ec 100644
/* store the display fd into the message queue */
static void set_queue_display_fd( Display *display )
@@ -631,6 +632,8 @@ static void set_queue_display_fd( Display *display )
@@ -650,6 +651,8 @@ static void set_queue_display_fd( Display *display )
HANDLE handle;
int ret;
@@ -143,5 +143,5 @@ index 40cd8ca29..18c98e3ec 100644
{
MESSAGE( "x11drv: Can't allocate handle for display fd\n" );
--
2.20.1
2.26.2

View File

@@ -62,7 +62,7 @@ index 9da300853..25e049291 100644
+
+ if (count + current > semaphore->max)
+ return STATUS_SEMAPHORE_LIMIT_EXCEEDED;
+ } while (interlocked_cmpxchg( &semaphore->count, count + current, current ) != current);
+ } while (InterlockedCompareExchange( &semaphore->count, count + current, current ) != current);
+
+ if (prev) *prev = current;
+
@@ -83,7 +83,7 @@ index 9da300853..25e049291 100644
+ * the fact that we were able to grab it at all means the count
+ * is nonzero, and if someone else grabbed it then the count
+ * must have been >= 2, etc. */
+ interlocked_xchg_add( &semaphore->count, -1 );
+ InterlockedDecrement( &semaphore->count );
+ }
return i;
}
@@ -105,7 +105,7 @@ index 9da300853..25e049291 100644
+ else if (objs[i]->type == ESYNC_SEMAPHORE)
+ {
+ struct semaphore *semaphore = (struct semaphore *)objs[i];
+ interlocked_xchg_add( &semaphore->count, -1 );
+ InterlockedDecrement( &semaphore->count );
+ }
}
TRACE("Wait successful.\n");

View File

@@ -1,4 +1,4 @@
From 430aff7c0693c5529ce4af2d515bf48d6ba49e15 Mon Sep 17 00:00:00 2001
From 3248f2b2ee3d8aeede1d3d51f8e3d570d982a69b Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Mon, 11 Jun 2018 13:10:36 -0500
Subject: [PATCH] ntdll: Use shared memory segments to store semaphore and
@@ -16,7 +16,7 @@ since now we don't have to allocate separate structures.
3 files changed, 155 insertions(+), 199 deletions(-)
diff --git a/dlls/ntdll/esync.c b/dlls/ntdll/esync.c
index c1d8882d817..e8ee1cbc9ff 100644
index c1d8882d817..ea71c960007 100644
--- a/dlls/ntdll/esync.c
+++ b/dlls/ntdll/esync.c
@@ -32,6 +32,7 @@
@@ -63,8 +63,8 @@ index c1d8882d817..e8ee1cbc9ff 100644
+{
+ struct stat st;
+
+ if (stat( wine_get_config_dir(), &st ) == -1)
+ ERR("Cannot stat %s\n", wine_get_config_dir());
+ if (stat( config_dir, &st ) == -1)
+ ERR("Cannot stat %s\n", config_dir);
+
+ if (st.st_ino != (unsigned long)st.st_ino)
+ sprintf( shm_name, "/wine-%lx%08lx-esync", (unsigned long)((unsigned long long)st.st_ino >> 32), (unsigned long)st.st_ino );
@@ -100,7 +100,7 @@ index c1d8882d817..e8ee1cbc9ff 100644
+
+ TRACE("Mapping page %d at %p.\n", entry, addr);
+
+ if (interlocked_cmpxchg_ptr( &shm_addrs[entry], addr, 0 ))
+ if (InterlockedCompareExchangePointer( &shm_addrs[entry], addr, 0 ))
+ munmap( addr, pagesize ); /* someone beat us to it */
+ }
+
@@ -654,7 +654,7 @@ index c1d8882d817..e8ee1cbc9ff 100644
{
- struct semaphore *semaphore = (struct semaphore *)objs[i];
+ struct semaphore *semaphore = objs[i]->shm;
interlocked_xchg_add( &semaphore->count, -1 );
InterlockedDecrement( &semaphore->count );
}
}
diff --git a/dlls/ntdll/esync.h b/dlls/ntdll/esync.h
@@ -670,10 +670,10 @@ index f79b9a06c90..88f491e5ab4 100644
extern NTSTATUS esync_create_semaphore(HANDLE *handle, ACCESS_MASK access,
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 119d35731f4..2ac4ef6a23b 100644
index f7f9910daf6..752a0b3b622 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -44,6 +44,7 @@
@@ -51,6 +51,7 @@
#include "wine/server.h"
#include "ntdll_misc.h"
#include "ddk/wdm.h"
@@ -681,7 +681,7 @@ index 119d35731f4..2ac4ef6a23b 100644
WINE_DEFAULT_DEBUG_CHANNEL(module);
WINE_DECLARE_DEBUG_CHANNEL(relay);
@@ -4404,6 +4405,9 @@ void __wine_process_init(void)
@@ -4647,6 +4648,9 @@ void __wine_process_init(void)
peb->ProcessHeap = RtlCreateHeap( HEAP_GROWABLE, NULL, 0, 0, NULL, NULL );
peb->LoaderLock = &loader_section;
@@ -692,5 +692,5 @@ index 119d35731f4..2ac4ef6a23b 100644
init_directories();
init_user_process_params( info_size );
--
2.24.0
2.26.2

View File

@@ -1,4 +1,4 @@
From 454430de5505b16af9d90ee99d5fa8a034853d2b Mon Sep 17 00:00:00 2001
From ef25a40d4d6e2676ff66347297f96ca0c7a59460 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Fri, 15 Jun 2018 14:12:22 -0500
Subject: [PATCH] server, ntdll: Implement alertable waits.
@@ -16,7 +16,7 @@ We do this quite simply by waiting on an extra eventfd descriptor, which the ser
8 files changed, 121 insertions(+), 17 deletions(-)
diff --git a/dlls/ntdll/esync.c b/dlls/ntdll/esync.c
index 119a36f3611..5db7adcace7 100644
index d177bb47989..6f41c5e030b 100644
--- a/dlls/ntdll/esync.c
+++ b/dlls/ntdll/esync.c
@@ -684,19 +684,43 @@ static int do_poll( struct pollfd *fds, nfds_t nfds, ULONGLONG *end )
@@ -196,10 +196,10 @@ index 119a36f3611..5db7adcace7 100644
NTSTATUS esync_signal_and_wait( HANDLE signal, HANDLE wait, BOOLEAN alertable,
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 009cfe73330..d7f88f7f8f0 100644
index 8e07b148c88..8ba11bcf94c 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -261,6 +261,7 @@ struct ntdll_thread_data
@@ -271,6 +271,7 @@ struct ntdll_thread_data
{
struct debug_info *debug_info; /* info for debugstr functions */
int esync_queue_fd;/* fd to wait on for driver events */
@@ -208,18 +208,18 @@ index 009cfe73330..d7f88f7f8f0 100644
int request_fd; /* fd for sending server requests */
int reply_fd; /* fd for receiving server replies */
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 97e6d816bdd..129f42b3e01 100644
index 688f16eb528..391c3b62ee3 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -357,6 +357,7 @@ TEB *thread_init(void)
@@ -346,6 +346,7 @@ TEB *thread_init(void)
thread_data->wait_fd[0] = -1;
thread_data->wait_fd[1] = -1;
thread_data->esync_queue_fd = -1;
+ thread_data->esync_apc_fd = -1;
signal_init_thread( teb );
virtual_init_threading();
@@ -757,6 +758,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT
debug_init();
init_paths();
@@ -720,6 +721,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT
thread_data->wait_fd[1] = -1;
thread_data->start_stack = (char *)teb->Tib.StackBase;
thread_data->esync_queue_fd = -1;
@@ -284,10 +284,10 @@ index aeb58c5469c..cea025d9308 100644
void esync_clear( int fd );
diff --git a/server/protocol.def b/server/protocol.def
index eca0325e5c5..975802737fa 100644
index 8991462eb45..3955a8bd1c7 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -4083,6 +4083,11 @@ struct handle_info
@@ -4069,6 +4069,11 @@ struct handle_info
unsigned int shm_idx; /* this object's index into the shm section */
@END
@@ -300,10 +300,10 @@ index eca0325e5c5..975802737fa 100644
{
ESYNC_SEMAPHORE = 1,
diff --git a/server/thread.c b/server/thread.c
index 7c8b6da8a55..7da1a620ddd 100644
index 9341261b580..5677aa518da 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -188,6 +188,7 @@ static inline void init_thread_structure( struct thread *thread )
@@ -224,6 +224,7 @@ static inline void init_thread_structure( struct thread *thread )
thread->teb = 0;
thread->entry_point = 0;
thread->esync_fd = -1;
@@ -311,7 +311,7 @@ index 7c8b6da8a55..7da1a620ddd 100644
thread->debug_ctx = NULL;
thread->system_regs = 0;
thread->queue = NULL;
@@ -297,7 +298,10 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
@@ -362,7 +363,10 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
}
if (do_esync())
@@ -322,7 +322,7 @@ index 7c8b6da8a55..7da1a620ddd 100644
set_fd_events( thread->request_fd, POLLIN ); /* start listening to events */
add_process_thread( thread->process, thread );
@@ -1077,8 +1081,13 @@ static int queue_apc( struct process *process, struct thread *thread, struct thr
@@ -1153,8 +1157,13 @@ static int queue_apc( struct process *process, struct thread *thread, struct thr
grab_object( apc );
list_add_tail( queue, &apc->entry );
if (!list_prev( queue, &apc->entry )) /* first one */
@@ -336,7 +336,7 @@ index 7c8b6da8a55..7da1a620ddd 100644
return 1;
}
@@ -1124,6 +1133,10 @@ static struct thread_apc *thread_dequeue_apc( struct thread *thread, int system
@@ -1200,6 +1209,10 @@ static struct thread_apc *thread_dequeue_apc( struct thread *thread, int system
apc = LIST_ENTRY( ptr, struct thread_apc, entry );
list_remove( ptr );
}
@@ -348,7 +348,7 @@ index 7c8b6da8a55..7da1a620ddd 100644
}
diff --git a/server/thread.h b/server/thread.h
index 8a737010a5b..53409c11956 100644
index 1b2973cba63..9ed70aee857 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -55,6 +55,7 @@ struct thread
@@ -360,5 +360,5 @@ index 8a737010a5b..53409c11956 100644
unsigned int system_regs; /* which system regs have been set */
struct msg_queue *queue; /* message queue */
--
2.26.0
2.26.2

View File

@@ -43,10 +43,10 @@ index 0a1999162..3d0c17fd1 100644
}
}
- obj = interlocked_xchg_ptr((void **)&esync_list[entry][idx], obj);
- obj = InterlockedExchangePointer((void **)&esync_list[entry][idx], obj);
- assert(!obj);
- return TRUE;
+ if (!interlocked_cmpxchg((int *)&esync_list[entry][idx].type, type, 0))
+ if (!InterlockedCompareExchange((int *)&esync_list[entry][idx].type, type, 0))
+ {
+ esync_list[entry][idx].fd = fd;
+ esync_list[entry][idx].shm = shm;
@@ -129,8 +129,8 @@ index 0a1999162..3d0c17fd1 100644
if (entry < ESYNC_LIST_ENTRIES && esync_list[entry])
{
- if ((obj = interlocked_xchg_ptr( (void **)&esync_list[entry][idx], 0 )))
+ if (interlocked_xchg((int *)&esync_list[entry][idx].type, 0))
- if ((obj = InterlockedExchangePointer( (void **)&esync_list[entry][idx], 0 )))
+ if (InterlockedExchange((int *)&esync_list[entry][idx].type, 0))
{
- close( obj->fd );
- RtlFreeHeap( GetProcessHeap(), 0, obj );

View File

@@ -68,7 +68,7 @@ index 506d1c99d..4e5fcef8e 100644
+ if ((size = read( obj->fd, &value, sizeof(value) )) == sizeof(value))
+ {
+ TRACE("Woken up by handle %p [%d].\n", handles[i], i);
+ interlocked_xchg_add( &semaphore->count, -1 );
+ InterlockedDecrement( &semaphore->count );
+ return i;
+ }
+ }

View File

@@ -155,12 +155,12 @@ index 4e5fcef8e..663b3658b 100644
+ event = obj->shm;
+
+ /* Acquire the spinlock. */
+ while (interlocked_cmpxchg( &event->locked, 1, 0 ))
+ while (InterlockedCompareExchange( &event->locked, 1, 0 ))
+ small_pause();
- if (prev)
+ /* Only bother signaling the fd if we weren't already signaled. */
+ if (!(current = interlocked_xchg( &event->signaled, 1 )))
+ if (!(current = InterlockedExchange( &event->signaled, 1 )))
{
- FIXME("Can't write previous value.\n");
- *prev = 1;
@@ -192,12 +192,12 @@ index 4e5fcef8e..663b3658b 100644
+ event = obj->shm;
+
+ /* Acquire the spinlock. */
+ while (interlocked_cmpxchg( &event->locked, 1, 0 ))
+ while (InterlockedCompareExchange( &event->locked, 1, 0 ))
+ small_pause();
- if (prev)
+ /* Only bother signaling the fd if we weren't already signaled. */
+ if ((current = interlocked_xchg( &event->signaled, 0 )))
+ if ((current = InterlockedExchange( &event->signaled, 0 )))
{
- FIXME("Can't write previous value.\n");
- *prev = 1;
@@ -233,7 +233,7 @@ index 4e5fcef8e..663b3658b 100644
- *prev = 1;
- }
+ /* Acquire the spinlock. */
+ while (interlocked_cmpxchg( &event->locked, 1, 0 ))
+ while (InterlockedCompareExchange( &event->locked, 1, 0 ))
+ small_pause();
/* This isn't really correct; an application could miss the write.
@@ -242,7 +242,7 @@ index 4e5fcef8e..663b3658b 100644
return FILE_GetNtStatus();
read( obj->fd, &value, sizeof(value) );
+ current = interlocked_xchg( &event->signaled, 0 );
+ current = InterlockedExchange( &event->signaled, 0 );
+ if (prev) *prev = current;
+
+ /* Release the spinlock. */
@@ -273,7 +273,7 @@ index 4e5fcef8e..663b3658b 100644
+ * fact that we were able to grab it at all means the count is nonzero,
+ * and if someone else grabbed it then the count must have been >= 2,
+ * etc. */
+ interlocked_xchg_add( &semaphore->count, -1 );
+ InterlockedDecrement( &semaphore->count );
+ }
+ else if (obj->type == ESYNC_AUTO_EVENT)
+ {
@@ -340,7 +340,7 @@ index 4e5fcef8e..663b3658b 100644
- * the fact that we were able to grab it at all means the count
- * is nonzero, and if someone else grabbed it then the count
- * must have been >= 2, etc. */
- interlocked_xchg_add( &semaphore->count, -1 );
- InterlockedDecrement( &semaphore->count );
- }
+ update_grabbed_object( obj );
return i;
@@ -360,7 +360,7 @@ index 4e5fcef8e..663b3658b 100644
- else if (objs[i]->type == ESYNC_SEMAPHORE)
- {
- struct semaphore *semaphore = objs[i]->shm;
- interlocked_xchg_add( &semaphore->count, -1 );
- InterlockedDecrement( &semaphore->count );
- }
- }
+ update_grabbed_object( objs[i] );

View File

@@ -78,7 +78,7 @@ index 847f1e974..1fc9316b1 100644
+ if (debug_level)
+ fprintf( stderr, "esync: Mapping page %d at %p.\n", entry, addr );
+
+ if (interlocked_cmpxchg_ptr( &shm_addrs[entry], addr, 0 ))
+ if (InterlockedCompareExchangePointer( &shm_addrs[entry], addr, 0 ))
+ munmap( addr, pagesize ); /* someone beat us to it */
+ }
+
@@ -116,10 +116,10 @@ index 847f1e974..1fc9316b1 100644
+ fprintf( stderr, "esync_set_event() fd=%d\n", esync->fd );
+
+ /* Acquire the spinlock. */
+ while (interlocked_cmpxchg( &event->locked, 1, 0 ))
+ while (InterlockedCompareExchange( &event->locked, 1, 0 ))
+ small_pause();
+
+ if (!interlocked_xchg( &event->signaled, 1 ))
+ if (!InterlockedExchange( &event->signaled, 1 ))
+ {
+ if (write( esync->fd, &value, sizeof(value) ) == -1)
+ perror( "esync: write" );
@@ -143,11 +143,11 @@ index 847f1e974..1fc9316b1 100644
+ fprintf( stderr, "esync_reset_event() fd=%d\n", esync->fd );
+
+ /* Acquire the spinlock. */
+ while (interlocked_cmpxchg( &event->locked, 1, 0 ))
+ while (InterlockedCompareExchange( &event->locked, 1, 0 ))
+ small_pause();
+
+ /* Only bother signaling the fd if we weren't already signaled. */
+ if (interlocked_xchg( &event->signaled, 0 ))
+ if (InterlockedExchange( &event->signaled, 0 ))
+ {
+ /* we don't care about the return value */
+ read( esync->fd, &value, sizeof(value) );

Some files were not shown because too many files have changed in this diff Show More