Added ml-patches patchset

Patches directly from the mailing list with second sign-off if
supplied.
This commit is contained in:
Alistair Leslie-Hughes 2018-08-03 10:08:24 +10:00
parent f23105a6d8
commit 7da7ae71d2
38 changed files with 4221 additions and 114 deletions

View File

@ -1 +1,2 @@
Depends: ml-array_size
Depends: ml-patches

View File

@ -1,4 +1,4 @@
From 5353d54df3ddf2f7bb62ea0214e040aa391b596f Mon Sep 17 00:00:00 2001
From 07d42b7a75491947866e6edb9d7746ca35274238 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 4 Mar 2016 22:22:42 +0100
Subject: [PATCH] ddraw: Set ddsOldCaps correctly in ddraw7_GetCaps.
@ -12,7 +12,7 @@ Subject: [PATCH] ddraw: Set ddsOldCaps correctly in ddraw7_GetCaps.
5 files changed, 106 insertions(+)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 33e18b8d6ab..2628b7654f4 100644
index ed90478..47f079f 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -1542,6 +1542,8 @@ static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DD
@ -25,10 +25,10 @@ index 33e18b8d6ab..2628b7654f4 100644
if(DriverCaps)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index fb0858f253b..b7becc389cb 100644
index c767d3a..70d4b8f 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -11415,6 +11415,31 @@ static void test_execute_data(void)
@@ -11411,6 +11411,31 @@ static void test_execute_data(void)
DestroyWindow(window);
}
@ -60,7 +60,7 @@ index fb0858f253b..b7becc389cb 100644
static void test_viewport(void)
{
static struct
@@ -11690,6 +11715,7 @@ START_TEST(ddraw1)
@@ -11686,6 +11711,7 @@ START_TEST(ddraw1)
test_depth_readback();
test_clear();
test_enum_surfaces();
@ -69,10 +69,10 @@ index fb0858f253b..b7becc389cb 100644
test_viewport();
}
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index c2b438cf2ae..61857991f8f 100644
index 794f90b..9c6055e 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -12677,6 +12677,31 @@ static void test_enum_surfaces(void)
@@ -12673,6 +12673,31 @@ static void test_enum_surfaces(void)
IDirectDraw2_Release(ddraw);
}
@ -104,7 +104,7 @@ index c2b438cf2ae..61857991f8f 100644
static void test_viewport(void)
{
static struct
@@ -12981,5 +13006,6 @@ START_TEST(ddraw2)
@@ -12977,5 +13002,6 @@ START_TEST(ddraw2)
test_depth_readback();
test_clear();
test_enum_surfaces();
@ -112,10 +112,10 @@ index c2b438cf2ae..61857991f8f 100644
test_viewport();
}
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 9c4c5a3e5b2..6eebcb30311 100644
index 172d99d..c036a6d 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -14957,6 +14957,31 @@ static void test_viewport(void)
@@ -14953,6 +14953,31 @@ static void test_viewport(void)
DestroyWindow(window);
}
@ -147,17 +147,17 @@ index 9c4c5a3e5b2..6eebcb30311 100644
START_TEST(ddraw4)
{
DDDEVICEIDENTIFIER identifier;
@@ -15082,4 +15107,5 @@ START_TEST(ddraw4)
@@ -15078,4 +15103,5 @@ START_TEST(ddraw4)
test_clear();
test_enum_surfaces();
test_viewport();
+ test_caps();
}
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index b4910c196cd..bf1e1cf1207 100644
index 7cbf408..095212b 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -14289,6 +14289,31 @@ static void test_viewport(void)
@@ -14417,6 +14417,31 @@ static void test_color_vertex(void)
DestroyWindow(window);
}
@ -189,12 +189,13 @@ index b4910c196cd..bf1e1cf1207 100644
START_TEST(ddraw7)
{
DDDEVICEIDENTIFIER2 identifier;
@@ -14424,4 +14449,5 @@ START_TEST(ddraw7)
@@ -14552,5 +14577,6 @@ START_TEST(ddraw7)
test_clear();
test_enum_surfaces();
test_viewport();
+ test_caps();
test_color_vertex();
}
--
2.17.0
1.9.1

View File

@ -1,4 +1,4 @@
From 6cd8711153dfad60cf2816d2f9f07189bd37719b Mon Sep 17 00:00:00 2001
From ca172d5f44df90a62426572ef6f461b27bf57689 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 15 Nov 2016 13:02:13 +0800
Subject: [PATCH] kernel32: MoveFile(source, source) should succeed.
@ -11,7 +11,7 @@ Subject: [PATCH] kernel32: MoveFile(source, source) should succeed.
4 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index 232ea7e..ba75b7e 100644
index bde58e9..c7c5cbd 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -1354,7 +1354,7 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
@ -21,10 +21,10 @@ index 232ea7e..ba75b7e 100644
- HANDLE source_handle = 0, dest_handle;
+ HANDLE source_handle = 0, dest_handle = 0;
ANSI_STRING source_unix, dest_unix;
DWORD options;
TRACE("(%s,%s,%p,%p,%04x)\n",
@@ -1413,18 +1413,22 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
@@ -1414,18 +1414,22 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
status = NtOpenFile( &dest_handle, GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, &attr, &io, 0, options );
if (status == STATUS_SUCCESS) /* destination exists */
{
- NtClose( dest_handle );
@ -50,7 +50,7 @@ index 232ea7e..ba75b7e 100644
}
else if (status != STATUS_OBJECT_NAME_NOT_FOUND)
{
@@ -1484,6 +1488,7 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
@@ -1485,6 +1489,7 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
error:
if (source_handle) NtClose( source_handle );
@ -59,7 +59,7 @@ index 232ea7e..ba75b7e 100644
RtlFreeAnsiString( &dest_unix );
return FALSE;
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index e201f62..e152cf1 100644
index ef4eebc..07b3ffb 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -1886,7 +1886,7 @@ static void test_MoveFileA(void)
@ -72,10 +72,10 @@ index e201f62..e152cf1 100644
ret = MoveFileA(source, dest);
ok(!ret && GetLastError() == ERROR_ALREADY_EXISTS,
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index 969902d..d6051b0 100644
index db9517d..7275e28 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -1402,7 +1402,7 @@ static void test_tr2_sys__Rename(void)
@@ -1524,7 +1524,7 @@ static void test_tr2_sys__Rename(void)
CloseHandle(file);
ret = p_tr2_sys__Rename("tr2_test_dir\\f1", "tr2_test_dir\\f1");
@ -85,10 +85,10 @@ index 969902d..d6051b0 100644
errno = 0xdeadbeef;
if(tests[i].val == ERROR_SUCCESS) {
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index dcc9629..e16f9f3 100644
index ea4157c..298c4e9 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -1261,8 +1261,8 @@ file move succeeded
@@ -1295,8 +1295,8 @@ file move succeeded
@todo_wine@bar@or_broken@baz
read-only files are moveable
file moved in subdirectory

View File

@ -1,8 +1,8 @@
From 96e7b57c5591087cfd07b0658ac33a1ec6bde3b5 Mon Sep 17 00:00:00 2001
From 6e5c9277d35def4b312820f11ef8a7586f788124 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 15 Nov 2016 13:32:42 +0800
Subject: kernel32: MoveFile should make sure that it has the delete access to
the source file.
Subject: [PATCH] kernel32: MoveFile should make sure that it has the delete
access to the source file.
---
dlls/kernel32/path.c | 6 ++++--
@ -10,10 +10,10 @@ Subject: kernel32: MoveFile should make sure that it has the delete access to
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index f554d14..d7fc20e 100644
index c7c5cbd..855330b 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -1338,7 +1338,8 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
@@ -1383,7 +1383,8 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
@ -23,21 +23,21 @@ index f554d14..d7fc20e 100644
if (status == STATUS_SUCCESS)
status = wine_nt_to_unix_file_name( &nt_name, &source_unix, FILE_OPEN, FALSE );
RtlFreeUnicodeString( &nt_name );
@@ -1362,7 +1363,8 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
SetLastError( ERROR_PATH_NOT_FOUND );
goto error;
}
- status = NtOpenFile( &dest_handle, GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, &attr, &io, 0,
+ status = NtOpenFile( &dest_handle, GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, &attr, &io,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
@@ -1411,7 +1412,8 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
options = FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT;
if (flag & MOVEFILE_WRITE_THROUGH)
options |= FILE_WRITE_THROUGH;
- status = NtOpenFile( &dest_handle, GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, &attr, &io, 0, options );
+ status = NtOpenFile( &dest_handle, GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, &attr, &io,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, options );
if (status == STATUS_SUCCESS) /* destination exists */
{
if (!(flag & MOVEFILE_REPLACE_EXISTING))
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index f0f9232..6fcf019 100644
index 07b3ffb..4729e75 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -1905,12 +1905,10 @@ static void test_MoveFileA(void)
@@ -1906,12 +1906,10 @@ static void test_MoveFileA(void)
ok(hmapfile != NULL, "CreateFileMapping: error %d\n", GetLastError());
ret = MoveFileA(source, dest);
@ -54,7 +54,7 @@ index f0f9232..6fcf019 100644
CloseHandle(hmapfile);
CloseHandle(hfile);
@@ -1925,12 +1923,10 @@ static void test_MoveFileA(void)
@@ -1926,12 +1924,10 @@ static void test_MoveFileA(void)
ok(hmapfile != NULL, "CreateFileMapping: error %d\n", GetLastError());
ret = MoveFileA(source, dest);
@ -72,5 +72,5 @@ index f0f9232..6fcf019 100644
CloseHandle(hmapfile);
CloseHandle(hfile);
--
2.9.0
1.9.1

View File

@ -0,0 +1,75 @@
From d466b7735488b900ae331a5541bbe8db7d760afc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 25 Jul 2018 22:00:42 +0200
Subject: [PATCH 01/24] wined3d: Fix WINED3D_MCS_COLOR2.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Don't use it unless we have a specular color in the vertex attributes,
but allow it if there's no diffuse color.
Signed-off-by: Stefan Dösinger <stefan@codeweavers.com>
---
dlls/wined3d/utils.c | 37 ++++++++++++++++++++++++++++++++-----
1 file changed, 32 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 937c1bc..ccf5b84 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -5854,6 +5854,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_d3d_info *d3d_info = context->d3d_info;
unsigned int coord_idx, i;
+ BOOL has_diffuse, has_specular;
memset(settings, 0, sizeof(*settings));
@@ -5911,12 +5912,38 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
settings->point_size = state->gl_primitive_type == GL_POINTS;
settings->per_vertex_point_size = !!(si->use_map & 1u << WINED3D_FFP_PSIZE);
- if (state->render_states[WINED3D_RS_COLORVERTEX] && (si->use_map & (1u << WINED3D_FFP_DIFFUSE)))
+ has_diffuse = si->use_map & (1u << WINED3D_FFP_DIFFUSE);
+ has_specular = si->use_map & (1u << WINED3D_FFP_SPECULAR);
+
+ if (state->render_states[WINED3D_RS_COLORVERTEX] && (has_diffuse || has_specular))
{
- settings->diffuse_source = state->render_states[WINED3D_RS_DIFFUSEMATERIALSOURCE];
- settings->emissive_source = state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE];
- settings->ambient_source = state->render_states[WINED3D_RS_AMBIENTMATERIALSOURCE];
- settings->specular_source = state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE];
+ if (state->render_states[WINED3D_RS_DIFFUSEMATERIALSOURCE] == WINED3D_MCS_COLOR1 && has_diffuse)
+ settings->diffuse_source = WINED3D_MCS_COLOR1;
+ else if (state->render_states[WINED3D_RS_DIFFUSEMATERIALSOURCE] == WINED3D_MCS_COLOR2 && has_specular)
+ settings->diffuse_source = WINED3D_MCS_COLOR2;
+ else
+ settings->diffuse_source = WINED3D_MCS_MATERIAL;
+
+ if (state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE] == WINED3D_MCS_COLOR1 && has_diffuse)
+ settings->emissive_source = WINED3D_MCS_COLOR1;
+ else if (state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE] == WINED3D_MCS_COLOR2 && has_specular)
+ settings->emissive_source = WINED3D_MCS_COLOR2;
+ else
+ settings->emissive_source = WINED3D_MCS_MATERIAL;
+
+ if (state->render_states[WINED3D_RS_AMBIENTMATERIALSOURCE] == WINED3D_MCS_COLOR1 && has_diffuse)
+ settings->ambient_source = WINED3D_MCS_COLOR1;
+ else if (state->render_states[WINED3D_RS_AMBIENTMATERIALSOURCE] == WINED3D_MCS_COLOR2 && has_specular)
+ settings->ambient_source = WINED3D_MCS_COLOR2;
+ else
+ settings->ambient_source = WINED3D_MCS_MATERIAL;
+
+ if (state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE] == WINED3D_MCS_COLOR1 && has_diffuse)
+ settings->specular_source = WINED3D_MCS_COLOR1;
+ else if (state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE] == WINED3D_MCS_COLOR2 && has_specular)
+ settings->specular_source = WINED3D_MCS_COLOR2;
+ else
+ settings->specular_source = WINED3D_MCS_MATERIAL;
}
else
{
--
1.9.1

View File

@ -0,0 +1,145 @@
From 11bcbf7ddfb38cd895c6465d188fd441e364e4aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 25 Jul 2018 22:00:43 +0200
Subject: [PATCH 02/24] d3d9/tests: Add a test for D3DMCS_COLOR{1/2}.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stefan Dösinger <stefan@codeweavers.com>
---
dlls/d3d9/tests/visual.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 113 insertions(+)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index b36c189..4be84a9 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -24027,6 +24027,118 @@ done:
DestroyWindow(window);
}
+static void test_color_vertex(void)
+{
+ IDirect3D9 *d3d;
+ IDirect3DDevice9 *device;
+ D3DCOLOR color;
+ ULONG refcount;
+ HWND window;
+ HRESULT hr;
+ D3DMATERIAL9 material;
+ unsigned int i;
+
+ /* The idea here is to set up ambient light parameters in a way that the ambient color from the
+ * material is just passed through. The emissive color is just passed through anyway. The sum of
+ * ambient + emissive should allow deduction of where the material color came from.
+ *
+ * Note that in cases without a D3DFVF_DIFFUSE flag the first color value in the struct will be
+ * fed into the specular vertex color slot. */
+ static const struct
+ {
+ DWORD fvf, color_vertex, ambient, emissive, result;
+ }
+ tests[] =
+ {
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, FALSE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0},
+
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ffff00},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x0000ff80},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR1, 0x00ff0000},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR2, D3DMCS_COLOR2, 0x0000ff00},
+
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0080},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x000000c0},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x00ff0080},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0040},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR2, D3DMCS_MATERIAL, 0x000000c0},
+
+ {0, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0},
+ };
+
+ static const struct
+ {
+ struct vec3 position;
+ DWORD diffuse;
+ DWORD specular;
+ }
+ quad[] =
+ {
+ {{-1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{-1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ };
+
+ window = create_window();
+ ok(!!window, "Failed to create a window.\n");
+
+ d3d = Direct3DCreate9(D3D_SDK_VERSION);
+ ok(!!d3d, "Failed to create a D3D object.\n");
+ if (!(device = create_device(d3d, window, window, TRUE)))
+ {
+ skip("Failed to create a D3D device, skipping tests.\n");
+ IDirect3D9_Release(d3d);
+ DestroyWindow(window);
+ return;
+ }
+
+ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, TRUE);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_AMBIENT, 0xffffffff);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ memset(&material, 0, sizeof(material));
+ material.Ambient.b = 0.5;
+ material.Emissive.b = 0.25;
+ hr = IDirect3DDevice9_SetMaterial(device, &material);
+ ok(SUCCEEDED(hr), "Failed to set material, hr %#x\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_COLORVERTEX, tests[i].color_vertex);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_AMBIENTMATERIALSOURCE, tests[i].ambient);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_EMISSIVEMATERIALSOURCE, tests[i].emissive);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | tests[i].fvf);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x77777777, 0.0f, 0);
+ ok(SUCCEEDED(hr), "Failed to clear depth/stencil, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice9_BeginScene(device);
+ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(quad[0]));
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+ color = getPixelColor(device, 320, 240);
+ ok(color_match(color, tests[i].result, 1),
+ "Expected color 0x%08x for test %u, got 0x%08x.\n",
+ tests[i].result, i, color);
+ }
+
+ refcount = IDirect3DDevice9_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ IDirect3D9_Release(d3d);
+ DestroyWindow(window);
+}
+
START_TEST(visual)
{
D3DADAPTER_IDENTIFIER9 identifier;
@@ -24164,4 +24276,5 @@ START_TEST(visual)
test_mvp_software_vertex_shaders();
test_null_format();
test_map_synchronisation();
+ test_color_vertex();
}
--
1.9.1

View File

@ -0,0 +1,144 @@
From 57b372d60b79f1bd08253181e15078f101055c7d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 25 Jul 2018 22:00:44 +0200
Subject: [PATCH 03/24] d3d8/tests: Add a test for D3DMCS_COLOR{1/2}.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stefan Dösinger <stefan@codeweavers.com>
---
dlls/d3d8/tests/visual.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 112 insertions(+)
diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index bed70d8..c60af69 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -10279,6 +10279,117 @@ done:
DestroyWindow(window);
}
+static void test_color_vertex(void)
+{
+ IDirect3D8 *d3d;
+ IDirect3DDevice8 *device;
+ D3DCOLOR color;
+ ULONG refcount;
+ HWND window;
+ HRESULT hr;
+ D3DMATERIAL8 material;
+ unsigned int i;
+
+ /* The idea here is to set up ambient light parameters in a way that the ambient color from the
+ * material is just passed through. The emissive color is just passed through anyway. The sum of
+ * ambient + emissive should allow deduction of where the material color came from.
+ *
+ * Note that in cases without a D3DFVF_DIFFUSE flag the first color value in the struct will be
+ * fed into the specular vertex color slot. */
+ static const struct
+ {
+ DWORD fvf, color_vertex, ambient, emissive, result;
+ }
+ tests[] =
+ {
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, FALSE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0},
+
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ffff00},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x0000ff80},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR1, 0x00ff0000},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR2, D3DMCS_COLOR2, 0x0000ff00},
+
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0080},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x000000c0},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x00ff0080},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0040},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR2, D3DMCS_MATERIAL, 0x000000c0},
+
+ {0, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0},
+ };
+ static const struct
+ {
+ struct vec3 position;
+ DWORD diffuse;
+ DWORD specular;
+ }
+ quad[] =
+ {
+ {{-1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{-1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ };
+
+ window = create_window();
+ ok(!!window, "Failed to create a window.\n");
+
+ d3d = Direct3DCreate8(D3D_SDK_VERSION);
+ ok(!!d3d, "Failed to create a D3D object.\n");
+ if (!(device = create_device(d3d, window, window, TRUE)))
+ {
+ skip("Failed to create a D3D device, skipping tests.\n");
+ IDirect3D8_Release(d3d);
+ DestroyWindow(window);
+ return;
+ }
+
+ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, TRUE);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_AMBIENT, 0xffffffff);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ memset(&material, 0, sizeof(material));
+ material.Ambient.b = 0.5;
+ material.Emissive.b = 0.25;
+ hr = IDirect3DDevice8_SetMaterial(device, &material);
+ ok(SUCCEEDED(hr), "Failed to set material, hr %#x\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_COLORVERTEX, tests[i].color_vertex);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_AMBIENTMATERIALSOURCE, tests[i].ambient);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetRenderState(device, D3DRS_EMISSIVEMATERIALSOURCE, tests[i].emissive);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | tests[i].fvf);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x77777777, 0.0f, 0);
+ ok(SUCCEEDED(hr), "Failed to clear depth/stencil, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice8_BeginScene(device);
+ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(quad[0]));
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice8_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+ color = getPixelColor(device, 320, 240);
+ ok(color_match(color, tests[i].result, 1),
+ "Expected color 0x%08x for test %u, got 0x%08x.\n",
+ tests[i].result, i, color);
+ }
+
+ refcount = IDirect3DDevice8_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ IDirect3D8_Release(d3d);
+ DestroyWindow(window);
+}
+
START_TEST(visual)
{
D3DADAPTER_IDENTIFIER8 identifier;
@@ -10352,4 +10463,5 @@ START_TEST(visual)
test_drawindexedprimitiveup();
test_map_synchronisation();
test_viewport();
+ test_color_vertex();
}
--
1.9.1

View File

@ -0,0 +1,172 @@
From 32b2c4ee0b87bcfabccb5d84090c964094a29ed0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 25 Jul 2018 22:00:45 +0200
Subject: [PATCH 04/24] ddraw/tests: Add a test for D3DMCS_COLOR{1/2}.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
A ddraw4 version is on my TODO list. ddraw1 and ddraw2 cannot use
lighting and per-vertex color at the same time due to the predefined
D3D*VERTEX structs. ddraw4 can, and it has D3DLIGHTSTATE_COLORVERTEX,
but the material source states are missing. I assume that one or more of
the material properties then track the vertex color, but I have to find
out which.
Signed-off-by: Stefan Dösinger <stefan@codeweavers.com>
---
dlls/ddraw/tests/ddraw7.c | 133 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 133 insertions(+)
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 35a45c0..bf34962 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -14267,6 +14267,138 @@ static void test_viewport(void)
DestroyWindow(window);
}
+static void test_color_vertex(void)
+{
+ IDirectDrawSurface7 *rt;
+ IDirect3DDevice7 *device;
+ unsigned int i;
+ ULONG refcount;
+ HWND window;
+ HRESULT hr;
+ D3DMATERIAL7 material;
+ D3DCOLOR color;
+
+ static struct
+ {
+ struct vec3 position;
+ DWORD diffuse;
+ DWORD specular;
+ }
+ quad_2c[] =
+ {
+ {{-1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{-1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ {{ 1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff00ff00},
+ };
+ static struct
+ {
+ struct vec3 position;
+ DWORD color;
+ }
+ quad_1c[] =
+ {
+ {{-1.0f, -1.0f, 0.0f}, 0xffff0000},
+ {{-1.0f, 1.0f, 0.0f}, 0xffff0000},
+ {{ 1.0f, -1.0f, 0.0f}, 0xffff0000},
+ {{ 1.0f, 1.0f, 0.0f}, 0xffff0000},
+ };
+ static struct
+ {
+ struct vec3 position;
+ }
+ quad_0c[] =
+ {
+ {{-1.0f, -1.0f, 0.0f}},
+ {{-1.0f, 1.0f, 0.0f}},
+ {{ 1.0f, -1.0f, 0.0f}},
+ {{ 1.0f, 1.0f, 0.0f}},
+ };
+
+ /* The idea here is to set up ambient light parameters in a way that the ambient color from the
+ * material is just passed through. The emissive color is just passed through anyway. The sum of
+ * ambient + emissive should allow deduction of where the material color came from. */
+ static const struct
+ {
+ DWORD fvf, color_vertex, ambient, emissive, result;
+ void *vtx;
+ }
+ tests[] =
+ {
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, FALSE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0, quad_2c},
+
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ffff00, quad_2c},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x0000ff80, quad_2c},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040, quad_2c},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR1, 0x00ff0000, quad_2c},
+ {D3DFVF_DIFFUSE | D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR2, D3DMCS_COLOR2, 0x0000ff00, quad_2c},
+
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0080, quad_1c},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x000000c0, quad_1c},
+ {D3DFVF_SPECULAR, TRUE, D3DMCS_MATERIAL, D3DMCS_COLOR2, 0x00ff0080, quad_1c},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x00ff0040, quad_1c},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR1, D3DMCS_MATERIAL, 0x00ff0040, quad_1c},
+ {D3DFVF_DIFFUSE, TRUE, D3DMCS_COLOR2, D3DMCS_MATERIAL, 0x000000c0, quad_1c},
+
+ {0, TRUE, D3DMCS_COLOR1, D3DMCS_COLOR2, 0x000000c0, quad_0c},
+ };
+
+ window = CreateWindowA("static", "d3d7_test", WS_OVERLAPPEDWINDOW,
+ 0, 0, 640, 480, 0, 0, 0, 0);
+ if (!(device = create_device(window, DDSCL_NORMAL)))
+ {
+ skip("Failed to create a 3D device, skipping test.\n");
+ DestroyWindow(window);
+ return;
+ }
+ hr = IDirect3DDevice7_GetRenderTarget(device, &rt);
+ ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, TRUE);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_AMBIENT, 0xffffffff);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ memset(&material, 0, sizeof(material));
+ U3(U1(material).ambient).b = 0.5;
+ U3(U3(material).emissive).b = 0.25f;
+ hr = IDirect3DDevice7_SetMaterial(device, &material);
+ ok(SUCCEEDED(hr), "Failed to set material, hr %#x\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_COLORVERTEX, tests[i].color_vertex);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_AMBIENTMATERIALSOURCE, tests[i].ambient);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_EMISSIVEMATERIALSOURCE, tests[i].emissive);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE);
+ ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x77777777, 0.0f, 0);
+ ok(SUCCEEDED(hr), "Failed to clear depth/stencil, hr %#x.\n", hr);
+
+ hr = IDirect3DDevice7_BeginScene(device);
+ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ | tests[i].fvf,
+ tests[i].vtx, 4, 0);
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice7_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+ color = get_surface_color(rt, 320, 240);
+ ok(compare_color(color, tests[i].result, 1),
+ "Expected color 0x%08x for test %u, got 0x%08x.\n",
+ tests[i].result, i, color);
+ }
+
+ IDirectDrawSurface7_Release(rt);
+ refcount = IDirect3DDevice7_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ DestroyWindow(window);
+}
+
START_TEST(ddraw7)
{
DDDEVICEIDENTIFIER2 identifier;
@@ -14402,4 +14534,5 @@ START_TEST(ddraw7)
test_clear();
test_enum_surfaces();
test_viewport();
+ test_color_vertex();
}
--
1.9.1

View File

@ -0,0 +1,33 @@
From 0eeb6d6b57cb8e1c50c65915799fbd4a7b2b6c43 Mon Sep 17 00:00:00 2001
From: Andrew Eikum <aeikum@codeweavers.com>
Date: Tue, 24 Jul 2018 11:05:06 -0500
Subject: [PATCH 05/24] dsound: Correctly calculate angle between vectors with
equal and opposite directions
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
---
dlls/dsound/sound3d.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/dsound/sound3d.c b/dlls/dsound/sound3d.c
index 03fd3d4..118bb60 100644
--- a/dlls/dsound/sound3d.c
+++ b/dlls/dsound/sound3d.c
@@ -111,7 +111,13 @@ static inline D3DVALUE AngleBetweenVectorsRad (const D3DVECTOR *a, const D3DVECT
return 0;
cos = product/(la*lb);
- angle = acos(cos);
+ if(cos > 1.f){
+ angle = 0;
+ }else if(cos < -1.f){
+ angle = M_PI;
+ }else{
+ angle = acos(cos);
+ }
TRACE("angle between (%f,%f,%f) and (%f,%f,%f) = %f radians (%f degrees)\n", a->x, a->y, a->z, b->x,
b->y, b->z, angle, RadToDeg(angle));
return angle;
--
1.9.1

View File

@ -0,0 +1,155 @@
From c6c0b64be4f8505a769aa08dca8fa3078831aed5 Mon Sep 17 00:00:00 2001
From: Aric Stewart <aric@codeweavers.com>
Date: Tue, 24 Jul 2018 08:16:45 -0500
Subject: [PATCH 06/24] hidclass.sys: Unload all devices before unloading a
minidriver
Signed-off-by: Aric Stewart <aric@codeweavers.com>
---
dlls/hidclass.sys/hid.h | 8 ++++++++
dlls/hidclass.sys/main.c | 8 ++++++++
dlls/hidclass.sys/pnp.c | 35 +++++++++++++++++++++++++++++++----
3 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/dlls/hidclass.sys/hid.h b/dlls/hidclass.sys/hid.h
index 1829319..4e8ba3c 100644
--- a/dlls/hidclass.sys/hid.h
+++ b/dlls/hidclass.sys/hid.h
@@ -70,6 +70,12 @@ void RingBuffer_Destroy(struct ReportRingBuffer *buffer) DECLSPEC_HIDDEN;
struct ReportRingBuffer* RingBuffer_Create(UINT buffer_size) DECLSPEC_HIDDEN;
NTSTATUS RingBuffer_SetSize(struct ReportRingBuffer *buffer, UINT size) DECLSPEC_HIDDEN;
+typedef struct _hiddevice
+{
+ struct list entry;
+ DEVICE_OBJECT *device;
+} hid_device;
+
typedef struct _minidriver
{
struct list entry;
@@ -80,6 +86,7 @@ typedef struct _minidriver
pAddDevice AddDevice;
PDRIVER_DISPATCH PNPDispatch;
+ struct list device_list;
} minidriver;
NTSTATUS call_minidriver(ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG in_size, void *out_buff, ULONG out_size) DECLSPEC_HIDDEN;
@@ -100,6 +107,7 @@ NTSTATUS WINAPI HID_PNP_Dispatch(DEVICE_OBJECT *device, IRP *irp) DECLSPEC_HIDDE
/* Pseudo-Plug and Play support*/
NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT* PDO) DECLSPEC_HIDDEN;
+NTSTATUS PNP_RemoveDevice(minidriver *minidriver, DEVICE_OBJECT* device, IRP* irp) DECLSPEC_HIDDEN;
/* Parsing HID Report Descriptors into preparsed data */
WINE_HIDP_PREPARSED_DATA* ParseDescriptor(BYTE *descriptor, unsigned int length) DECLSPEC_HIDDEN;
diff --git a/dlls/hidclass.sys/main.c b/dlls/hidclass.sys/main.c
index 1742cfe..8bb423b 100644
--- a/dlls/hidclass.sys/main.c
+++ b/dlls/hidclass.sys/main.c
@@ -49,6 +49,12 @@ static VOID WINAPI UnloadDriver(DRIVER_OBJECT *driver)
md = find_minidriver(driver);
if (md)
{
+ hid_device *device, *next;
+ TRACE("%i devices to unload\n", list_count(&md->device_list));
+ LIST_FOR_EACH_ENTRY_SAFE(device, next, &md->device_list, hid_device, entry)
+ {
+ PNP_RemoveDevice(md, device->device, NULL);
+ }
if (md->DriverUnload)
md->DriverUnload(md->minidriver.DriverObject);
list_remove(&md->entry);
@@ -82,6 +88,8 @@ NTSTATUS WINAPI HidRegisterMinidriver(HID_MINIDRIVER_REGISTRATION *registration)
driver->minidriver = *registration;
list_add_tail(&minidriver_list, &driver->entry);
+ list_init(&driver->device_list);
+
return STATUS_SUCCESS;
}
diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c
index 30d1045..c501a74 100644
--- a/dlls/hidclass.sys/pnp.c
+++ b/dlls/hidclass.sys/pnp.c
@@ -75,6 +75,7 @@ static NTSTATUS get_device_id(DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCH
NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
{
+ hid_device *hiddev;
DEVICE_OBJECT *device = NULL;
NTSTATUS status;
minidriver *minidriver;
@@ -96,13 +97,19 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
TRACE("PDO add device(%p:%s)\n", PDO, debugstr_w(PDO_id));
minidriver = find_minidriver(driver);
- status = HID_CreateDevice(PDO, &minidriver->minidriver, &device);
+ hiddev = HeapAlloc(GetProcessHeap(), 0, sizeof(*hiddev));
+ if (!hiddev)
+ return STATUS_NO_MEMORY;
+
+ status = HID_CreateDevice(PDO, &minidriver->minidriver, &hiddev->device);
if (status != STATUS_SUCCESS)
{
ERR("Failed to create HID object (%x)\n",status);
HeapFree(GetProcessHeap(), 0, PDO_id);
+ HeapFree(GetProcessHeap(), 0, hiddev);
return status;
}
+ device = hiddev->device;
ext = device->DeviceExtension;
InitializeListHead(&ext->irp_queue);
@@ -177,6 +184,8 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
return STATUS_NOT_SUPPORTED;
}
+ list_add_tail(&(minidriver->device_list), &hiddev->entry);
+
ext->information.DescriptorSize = ext->preparseData->dwSize;
lstrcpyW(ext->instance_id, device_enumeratorW);
@@ -200,6 +209,26 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
return STATUS_SUCCESS;
}
+NTSTATUS PNP_RemoveDevice(minidriver *minidriver, DEVICE_OBJECT *device, IRP* irp)
+{
+ hid_device *hiddev;
+ NTSTATUS rc = STATUS_NOT_SUPPORTED;
+
+ if (irp)
+ rc = minidriver->PNPDispatch(device, irp);
+ HID_DeleteDevice(&minidriver->minidriver, device);
+ LIST_FOR_EACH_ENTRY(hiddev, &minidriver->device_list, hid_device, entry)
+ {
+ if (hiddev->device == device)
+ {
+ list_remove(&hiddev->entry);
+ HeapFree(GetProcessHeap(), 0, hiddev);
+ break;
+ }
+ }
+ return rc;
+}
+
NTSTATUS WINAPI HID_PNP_Dispatch(DEVICE_OBJECT *device, IRP *irp)
{
NTSTATUS rc = STATUS_NOT_SUPPORTED;
@@ -255,9 +284,7 @@ NTSTATUS WINAPI HID_PNP_Dispatch(DEVICE_OBJECT *device, IRP *irp)
}
case IRP_MN_REMOVE_DEVICE:
{
- rc = minidriver->PNPDispatch(device, irp);
- HID_DeleteDevice(&minidriver->minidriver, device);
- return rc;
+ return PNP_RemoveDevice(minidriver, device, irp);
}
default:
{
--
1.9.1

View File

@ -0,0 +1,26 @@
From 45cf0122c89190fe8264be3e9b5e4ab65814fa87 Mon Sep 17 00:00:00 2001
From: Gijs Vermeulen <gijsvrm@gmail.com>
Date: Wed, 25 Jul 2018 01:52:06 +0200
Subject: [PATCH 07/24] wine.inf: Add "Sources" key.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44981
Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
---
loader/wine.inf.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/loader/wine.inf.in b/loader/wine.inf.in
index 9a76509..7774289 100644
--- a/loader/wine.inf.in
+++ b/loader/wine.inf.in
@@ -3416,6 +3416,7 @@ HKLM,%CurrentVersionNT%\SvcHost,"netsvcs",0x00010008,"Schedule"
HKLM,%CurrentVersion%\RunServices,"winemenubuilder",2,"%11%\winemenubuilder.exe -a -r"
HKLM,"System\CurrentControlSet\Services\Eventlog\Application",,16
HKLM,"System\CurrentControlSet\Services\Eventlog\System",,16
+HKLM,"System\CurrentControlSet\Services\Eventlog\System","Sources",0x10000,""
HKLM,"System\CurrentControlSet\Services\Tcpip\Parameters",,16
HKLM,"System\CurrentControlSet\Services\VxD\MSTCP",,16
HKLM,"System\CurrentControlSet\Services\Winsock\Parameters",,16
--
1.9.1

View File

@ -0,0 +1,200 @@
From 9448c872e54c1f930c213bd639c5650c98e3e89f Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Wed, 25 Jul 2018 15:22:57 +0800
Subject: [PATCH 08/24] programs: Allow to disable MIME-type associations.
This patch should at least mitigate the state of the bug 19182.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
---
programs/winecfg/resource.h | 1 +
programs/winecfg/theme.c | 30 ++++++++++++++++++++--
programs/winecfg/winecfg.rc | 40 ++++++++++++++++--------------
programs/winemenubuilder/winemenubuilder.c | 23 ++++++++++++++++-
4 files changed, 73 insertions(+), 21 deletions(-)
diff --git a/programs/winecfg/resource.h b/programs/winecfg/resource.h
index 0c0b038..2760e92 100644
--- a/programs/winecfg/resource.h
+++ b/programs/winecfg/resource.h
@@ -176,6 +176,7 @@
#define IDC_SYSPARAM_COLOR_TEXT 1415
#define IDC_SYSPARAM_COLOR 1416
#define IDC_SYSPARAM_FONT 1417
+#define IDC_ENABLE_FILE_ASSOCIATIONS 1418
#define IDC_SYSPARAMS_BUTTON 8400
#define IDC_SYSPARAMS_BUTTON_TEXT 8401
diff --git a/programs/winecfg/theme.c b/programs/winecfg/theme.c
index f98dcc3..863bc6b 100644
--- a/programs/winecfg/theme.c
+++ b/programs/winecfg/theme.c
@@ -1168,6 +1168,26 @@ static void on_select_font(HWND hDlg)
SendMessageW(GetParent(hDlg), PSM_CHANGED, 0, 0);
}
+static void init_mime_types(HWND hDlg)
+{
+ char *buf = get_reg_key(config_key, keypath("MIME-types"), "EnableFileAssociations", "Y");
+ int state = IS_OPTION_TRUE(*buf) ? BST_CHECKED : BST_UNCHECKED;
+
+ CheckDlgButton(hDlg, IDC_ENABLE_FILE_ASSOCIATIONS, state);
+
+ HeapFree(GetProcessHeap(), 0, buf);
+}
+
+static void update_mime_types(HWND hDlg)
+{
+ const char *state = "Y";
+
+ if (IsDlgButtonChecked(hDlg, IDC_ENABLE_FILE_ASSOCIATIONS) != BST_CHECKED)
+ state = "N";
+
+ set_reg_key(config_key, keypath("MIME-types"), "EnableFileAssociations", state);
+}
+
INT_PTR CALLBACK
ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
@@ -1177,8 +1197,9 @@ ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
init_shell_folder_listview_headers(hDlg);
update_shell_folder_listview(hDlg);
read_sysparams(hDlg);
+ init_mime_types(hDlg);
break;
-
+
case WM_DESTROY:
free_theme_files();
break;
@@ -1186,7 +1207,7 @@ ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_SHOWWINDOW:
set_window_title(hDlg);
break;
-
+
case WM_COMMAND:
switch(HIWORD(wParam)) {
case CBN_SELCHANGE: {
@@ -1296,6 +1317,10 @@ ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
break;
}
+
+ case IDC_ENABLE_FILE_ASSOCIATIONS:
+ update_mime_types(hDlg);
+ break;
}
break;
}
@@ -1314,6 +1339,7 @@ ThemeDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
apply_sysparams();
read_shell_folder_link_targets();
update_shell_folder_listview(hDlg);
+ update_mime_types(hDlg);
SetWindowLongPtrW(hDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
break;
}
diff --git a/programs/winecfg/winecfg.rc b/programs/winecfg/winecfg.rc
index 5908b49..d37a55e 100644
--- a/programs/winecfg/winecfg.rc
+++ b/programs/winecfg/winecfg.rc
@@ -284,25 +284,29 @@ IDD_DESKTOP_INTEGRATION DIALOG 0, 0, 260, 220
STYLE WS_CHILD | WS_DISABLED
FONT 8, "MS Shell Dlg"
BEGIN
- GROUPBOX "Appearance",IDC_STATIC,8,4,244,106
- LTEXT "&Theme:",IDC_STATIC,15,16,130,8
- COMBOBOX IDC_THEME_THEMECOMBO,15,26,130,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- PUSHBUTTON "&Install theme...",IDC_THEME_INSTALL,152,26,93,14
- LTEXT "&Color:",IDC_THEME_COLORTEXT,15,48,105,8
- COMBOBOX IDC_THEME_COLORCOMBO,15,58,105,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- LTEXT "&Size:",IDC_THEME_SIZETEXT,126,48,120,8
- COMBOBOX IDC_THEME_SIZECOMBO,126,58,120,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- LTEXT "It&em:",IDC_STATIC,15,80,105,8
- COMBOBOX IDC_SYSPARAM_COMBO,15,90,105,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT
- LTEXT "C&olor:",IDC_SYSPARAM_COLOR_TEXT,126,80,25,8,WS_DISABLED
- PUSHBUTTON "",IDC_SYSPARAM_COLOR,126,90,25,13,WS_DISABLED | BS_OWNERDRAW
- LTEXT "Si&ze:",IDC_SYSPARAM_SIZE_TEXT,157,80,30,8,WS_DISABLED
- EDITTEXT IDC_SYSPARAM_SIZE,157,90,30,13,ES_AUTOHSCROLL | WS_TABSTOP | WS_DISABLED
- CONTROL "",IDC_SYSPARAM_SIZE_UD,UPDOWN_CLASSA,UDS_SETBUDDYINT | UDS_ALIGNRIGHT | WS_DISABLED, 185,90,15,13
- PUSHBUTTON "&Font...",IDC_SYSPARAM_FONT,190,90,55,13,WS_DISABLED
- GROUPBOX "Folders",IDC_STATIC,8,114,244,100
+ GROUPBOX "Appearance",IDC_STATIC,8,4,244,90
+ LTEXT "&Theme:",IDC_STATIC,15,15,130,8
+ COMBOBOX IDC_THEME_THEMECOMBO,15,25,130,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "&Install theme...",IDC_THEME_INSTALL,152,25,93,13
+ LTEXT "&Color:",IDC_THEME_COLORTEXT,15,40,105,8
+ COMBOBOX IDC_THEME_COLORCOMBO,15,50,105,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "&Size:",IDC_THEME_SIZETEXT,126,40,120,8
+ COMBOBOX IDC_THEME_SIZECOMBO,126,50,120,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "It&em:",IDC_STATIC,15,65,105,8
+ COMBOBOX IDC_SYSPARAM_COMBO,15,75,105,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT
+ LTEXT "C&olor:",IDC_SYSPARAM_COLOR_TEXT,126,65,25,8,WS_DISABLED
+ PUSHBUTTON "",IDC_SYSPARAM_COLOR,126,75,25,13,WS_DISABLED | BS_OWNERDRAW
+ LTEXT "Si&ze:",IDC_SYSPARAM_SIZE_TEXT,157,65,30,8,WS_DISABLED
+ EDITTEXT IDC_SYSPARAM_SIZE,157,75,30,13,ES_AUTOHSCROLL | WS_TABSTOP | WS_DISABLED
+ CONTROL "",IDC_SYSPARAM_SIZE_UD,UPDOWN_CLASSA,UDS_SETBUDDYINT | UDS_ALIGNRIGHT | WS_DISABLED, 185,75,15,13
+
+ GROUPBOX "MIME types",IDC_STATIC,8,95,244,23
+ CONTROL "Allow Wine to manage file &associations",IDC_ENABLE_FILE_ASSOCIATIONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,105,230,8
+
+ PUSHBUTTON "&Font...",IDC_SYSPARAM_FONT,190,75,55,13,WS_DISABLED
+ GROUPBOX "Folders",IDC_STATIC,8,120,244,94
CONTROL "",IDC_LIST_SFPATHS,"SysListView32",LVS_REPORT | LVS_AUTOARRANGE | LVS_ALIGNLEFT |
- LVS_SINGLESEL | WS_BORDER | WS_TABSTOP, 15,126,230,64
+ LVS_SINGLESEL | WS_BORDER | WS_TABSTOP, 15,132,230,58
CONTROL "&Link to:",IDC_LINK_SFPATH,"Button",BS_AUTOCHECKBOX|WS_TABSTOP|WS_DISABLED,15,195,65,13
EDITTEXT IDC_EDIT_SFPATH,80,195,110,13,ES_AUTOHSCROLL|WS_TABSTOP|WS_DISABLED
PUSHBUTTON "B&rowse...",IDC_BROWSE_SFPATH,195,195,50,13,WS_DISABLED
diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c
index 0013b04..dd69ff9 100644
--- a/programs/winemenubuilder/winemenubuilder.c
+++ b/programs/winemenubuilder/winemenubuilder.c
@@ -104,6 +104,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(menubuilder);
#define in_startmenu(csidl) ((csidl)==CSIDL_STARTMENU || \
(csidl)==CSIDL_COMMON_STARTMENU)
+#define IS_OPTION_TRUE(ch) \
+ ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
+
/* link file formats */
#include "pshpack1.h"
@@ -3619,6 +3622,23 @@ static BOOL init_xdg(void)
return FALSE;
}
+static BOOL associations_enabled(void)
+{
+ BOOL ret = TRUE;
+ HKEY hkey;
+ BYTE buf[32];
+ DWORD len;
+
+ if (!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\MIME-types", &hkey))
+ {
+ len = sizeof(buf);
+ if (!RegQueryValueExA(hkey, "EnableFileAssociations", NULL, NULL, buf, &len))
+ ret = IS_OPTION_TRUE(buf[0]);
+ }
+
+ return ret;
+}
+
/***********************************************************************
*
* wWinMain
@@ -3654,7 +3674,8 @@ int PASCAL wWinMain (HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sh
break;
if( !strcmpW( token, dash_aW ) )
{
- RefreshFileTypeAssociations();
+ if (associations_enabled())
+ RefreshFileTypeAssociations();
continue;
}
if( !strcmpW( token, dash_rW ) )
--
1.9.1

View File

@ -0,0 +1,114 @@
From c5f3c80ec9c35af958a232a9deb8f98f2225b992 Mon Sep 17 00:00:00 2001
From: Andrey Gusev <andrey.goosev@gmail.com>
Date: Mon, 23 Jul 2018 15:07:39 +0300
Subject: [PATCH 09/24] api-ms-win-devices-config-l1-1-0: Add dll.
Signed-off-by: Andrey Gusev <andrey.goosev@gmail.com>
---
configure | 2 ++
configure.ac | 1 +
dlls/api-ms-win-devices-config-l1-1-0/Makefile.in | 1 +
.../api-ms-win-devices-config-l1-1-0.spec | 38 ++++++++++++++++++++++
tools/make_specfiles | 1 +
5 files changed, 43 insertions(+)
create mode 100644 dlls/api-ms-win-devices-config-l1-1-0/Makefile.in
create mode 100644 dlls/api-ms-win-devices-config-l1-1-0/api-ms-win-devices-config-l1-1-0.spec
diff --git a/configure b/configure
index 337ce91..fd58e15 100755
--- a/configure
+++ b/configure
@@ -1045,6 +1045,7 @@ enable_api_ms_win_crt_stdio_l1_1_0
enable_api_ms_win_crt_string_l1_1_0
enable_api_ms_win_crt_time_l1_1_0
enable_api_ms_win_crt_utility_l1_1_0
+enable_api_ms_win_devices_config_l1_1_0
enable_api_ms_win_devices_config_l1_1_1
enable_api_ms_win_devices_query_l1_1_1
enable_api_ms_win_downlevel_advapi32_l1_1_0
@@ -19137,6 +19138,7 @@ wine_fn_config_makefile dlls/api-ms-win-crt-stdio-l1-1-0 enable_api_ms_win_crt_s
wine_fn_config_makefile dlls/api-ms-win-crt-string-l1-1-0 enable_api_ms_win_crt_string_l1_1_0
wine_fn_config_makefile dlls/api-ms-win-crt-time-l1-1-0 enable_api_ms_win_crt_time_l1_1_0
wine_fn_config_makefile dlls/api-ms-win-crt-utility-l1-1-0 enable_api_ms_win_crt_utility_l1_1_0
+wine_fn_config_makefile dlls/api-ms-win-devices-config-l1-1-0 enable_api_ms_win_devices_config_l1_1_0
wine_fn_config_makefile dlls/api-ms-win-devices-config-l1-1-1 enable_api_ms_win_devices_config_l1_1_1
wine_fn_config_makefile dlls/api-ms-win-devices-query-l1-1-1 enable_api_ms_win_devices_query_l1_1_1
wine_fn_config_makefile dlls/api-ms-win-downlevel-advapi32-l1-1-0 enable_api_ms_win_downlevel_advapi32_l1_1_0
diff --git a/configure.ac b/configure.ac
index be247ea..ddf7ee3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2998,6 +2998,7 @@ WINE_CONFIG_MAKEFILE(dlls/api-ms-win-crt-stdio-l1-1-0)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-crt-string-l1-1-0)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-crt-time-l1-1-0)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-crt-utility-l1-1-0)
+WINE_CONFIG_MAKEFILE(dlls/api-ms-win-devices-config-l1-1-0)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-devices-config-l1-1-1)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-devices-query-l1-1-1)
WINE_CONFIG_MAKEFILE(dlls/api-ms-win-downlevel-advapi32-l1-1-0)
diff --git a/dlls/api-ms-win-devices-config-l1-1-0/Makefile.in b/dlls/api-ms-win-devices-config-l1-1-0/Makefile.in
new file mode 100644
index 0000000..1e11946
--- /dev/null
+++ b/dlls/api-ms-win-devices-config-l1-1-0/Makefile.in
@@ -0,0 +1 @@
+MODULE = api-ms-win-devices-config-l1-1-0.dll
diff --git a/dlls/api-ms-win-devices-config-l1-1-0/api-ms-win-devices-config-l1-1-0.spec b/dlls/api-ms-win-devices-config-l1-1-0/api-ms-win-devices-config-l1-1-0.spec
new file mode 100644
index 0000000..fcd3aaa
--- /dev/null
+++ b/dlls/api-ms-win-devices-config-l1-1-0/api-ms-win-devices-config-l1-1-0.spec
@@ -0,0 +1,38 @@
+@ stub CM_Delete_Class_Key
+@ stub CM_Delete_DevNode_Key
+@ stub CM_Delete_Device_Interface_KeyW
+@ stub CM_Disable_DevNode
+@ stub CM_Enable_DevNode
+@ stdcall CM_Get_Child(ptr long long) setupapi.CM_Get_Child
+@ stub CM_Get_Class_PropertyW
+@ stub CM_Get_Class_Property_Keys
+@ stdcall CM_Get_Class_Registry_PropertyW(ptr long ptr ptr long long ptr) setupapi.CM_Get_Class_Registry_PropertyW
+@ stub CM_Get_Depth
+@ stub CM_Get_DevNode_PropertyW
+@ stub CM_Get_DevNode_Property_Keys
+@ stdcall CM_Get_DevNode_Registry_PropertyW(long long ptr ptr ptr long) setupapi.CM_Get_DevNode_Registry_PropertyW
+@ stdcall CM_Get_DevNode_Status(ptr ptr long long) setupapi.CM_Get_DevNode_Status
+@ stdcall CM_Get_Device_IDW(ptr ptr long long) setupapi.CM_Get_Device_IDW
+@ stdcall CM_Get_Device_ID_ListW(wstr ptr long long) setupapi.CM_Get_Device_ID_ListW
+@ stdcall CM_Get_Device_ID_List_SizeW(ptr wstr long) setupapi.CM_Get_Device_ID_List_SizeW
+@ stdcall CM_Get_Device_ID_Size(ptr ptr long) setupapi.CM_Get_Device_ID_Size
+@ stub CM_Get_Device_Interface_ListW
+@ stdcall CM_Get_Device_Interface_List_SizeW(ptr ptr wstr long) setupapi.CM_Get_Device_Interface_List_SizeW
+@ stub CM_Get_Device_Interface_PropertyW
+@ stub CM_Get_Device_Interface_Property_KeysW
+@ stdcall CM_Get_Parent(ptr long long) setupapi.CM_Get_Parent
+@ stub CM_Get_Sibling
+@ stdcall CM_Locate_DevNodeW(ptr wstr long) setupapi.CM_Locate_DevNodeW
+@ stub CM_Open_Class_KeyW
+@ stdcall CM_Open_DevNode_Key(long long long long ptr long) setupapi.CM_Open_DevNode_Key
+@ stub CM_Open_Device_Interface_KeyW
+@ stub CM_Query_And_Remove_SubTreeW
+@ stub CM_Register_Notification
+@ stub CM_Set_Class_PropertyW
+@ stdcall CM_Set_Class_Registry_PropertyW(ptr long ptr long long ptr) setupapi.CM_Set_Class_Registry_PropertyW
+@ stub CM_Set_DevNode_PropertyW
+@ stub CM_Set_DevNode_Registry_PropertyW
+@ stub CM_Set_Device_Interface_PropertyW
+@ stub CM_Setup_DevNode
+@ stub CM_Uninstall_DevNode
+@ stub CM_Unregister_Notification
diff --git a/tools/make_specfiles b/tools/make_specfiles
index 4faf665..cd3af87 100755
--- a/tools/make_specfiles
+++ b/tools/make_specfiles
@@ -105,6 +105,7 @@ my @dll_groups =
[
"setupapi",
"cfgmgr32",
+ "api-ms-win-devices-config-l1-1-0",
"api-ms-win-devices-config-l1-1-1",
"api-ms-win-devices-query-l1-1-1",
],
--
1.9.1

View File

@ -0,0 +1,50 @@
From 569cd096daa90aa4d4fb8602453843f73feb7fe6 Mon Sep 17 00:00:00 2001
From: Fabian Maurer <dark.shadow4@web.de>
Date: Fri, 20 Jul 2018 21:05:05 +0200
Subject: [PATCH 10/24] wnet: Make WNetGetUniversalNameW return required size
when buffer is too small and add test
The pointer is set to the required size not only when the input size
is 0, but generally when it is too small.
Signed-off-by: Fabian Maurer <dark.shadow4@web.de>
---
dlls/mpr/tests/mpr.c | 5 ++++-
dlls/mpr/wnet.c | 1 +
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/mpr/tests/mpr.c b/dlls/mpr/tests/mpr.c
index fc067d9..3e5ca09 100644
--- a/dlls/mpr/tests/mpr.c
+++ b/dlls/mpr/tests/mpr.c
@@ -51,11 +51,14 @@ static void test_WNetGetUniversalName(void)
ok(info_size == sizeof(buffer), "Got wrong size: %u\n", info_size);
- fail_size = 0;
+ fail_size = 1;
ret = WNetGetUniversalNameA(driveA, UNIVERSAL_NAME_INFO_LEVEL,
buffer, &fail_size);
if(drive_type == DRIVE_REMOTE)
+ {
todo_wine ok(ret == WN_BAD_VALUE || ret == WN_MORE_DATA, "WNetGetUniversalNameA failed: %08x\n", ret);
+ ok(fail_size > 1, "Got %d\n", fail_size);
+ }
else
ok(ret == WN_NOT_CONNECTED || ret == WN_NO_NET_OR_BAD_PATH,
"(%s) WNetGetUniversalNameW gave wrong error: %u\n", driveA, ret);
diff --git a/dlls/mpr/wnet.c b/dlls/mpr/wnet.c
index ad4f1dd..a2f8a04 100644
--- a/dlls/mpr/wnet.c
+++ b/dlls/mpr/wnet.c
@@ -2385,6 +2385,7 @@ DWORD WINAPI WNetGetUniversalNameW ( LPCWSTR lpLocalPath, DWORD dwInfoLevel,
size = sizeof(*info) + (lstrlenW(lpLocalPath) + 1) * sizeof(WCHAR);
if (*lpBufferSize < size)
{
+ *lpBufferSize = size;
err = WN_MORE_DATA;
break;
}
--
1.9.1

View File

@ -0,0 +1,43 @@
From 98b0a706020f3728e01cc7d38a6bba8ed8dd91f5 Mon Sep 17 00:00:00 2001
From: Piotr Caban <piotr@codeweavers.com>
Date: Thu, 26 Jul 2018 14:40:21 +0200
Subject: [PATCH 11/24] msvcp90: Fix EOF delimiter handling in
basic_istream<char>::ignore.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45495
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
---
dlls/msvcp60/ios.c | 2 +-
dlls/msvcp90/ios.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcp60/ios.c b/dlls/msvcp60/ios.c
index 8a5813e..518c8da 100644
--- a/dlls/msvcp60/ios.c
+++ b/dlls/msvcp60/ios.c
@@ -8101,7 +8101,7 @@ basic_istream_char* __thiscall basic_istream_char_ignore(basic_istream_char *thi
break;
}
- if(ch==(unsigned char)delim)
+ if(ch==delim)
break;
this->count++;
diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index 6a82db6..e71d30f 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -8583,7 +8583,7 @@ basic_istream_char* __thiscall basic_istream_char_ignore(basic_istream_char *thi
break;
}
- if(ch==(unsigned char)delim)
+ if(ch==delim)
break;
this->count++;
--
1.9.1

View File

@ -0,0 +1,33 @@
From 7a654e3796602a21c0e8cd93f12e16446ea26678 Mon Sep 17 00:00:00 2001
From: Fabian Maurer <dark.shadow4@web.de>
Date: Sat, 28 Jul 2018 16:31:46 +0200
Subject: [PATCH 12/24] ntoskrnl: Emulate sti/cli instructions on x86_64
Fixes bug 45521.
Thanks to Anastasius Focht for the clear bug report.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45521
Signed-off-by: Fabian Maurer <dark.shadow4@web.de>
---
dlls/ntoskrnl.exe/instr.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/dlls/ntoskrnl.exe/instr.c b/dlls/ntoskrnl.exe/instr.c
index b2dac58..67cdd32 100644
--- a/dlls/ntoskrnl.exe/instr.c
+++ b/dlls/ntoskrnl.exe/instr.c
@@ -815,6 +815,11 @@ static DWORD emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT *context )
}
break; /* Unable to emulate it */
}
+
+ case 0xfa: /* cli */
+ case 0xfb: /* sti */
+ context->Rip += prefixlen + 1;
+ return ExceptionContinueExecution;
}
return ExceptionContinueSearch; /* Unable to emulate it */
}
--
1.9.1

View File

@ -0,0 +1,198 @@
From 6b416c0b1c963ced6ec11ccf46b9e99650267297 Mon Sep 17 00:00:00 2001
From: Kai Krakow <kai@kaishome.de>
Date: Sat, 28 Jul 2018 10:24:04 +0200
Subject: [PATCH 13/24] winebus.sys: Do not report HID report read errors
unconditionally
Device reports may come in faster than our consumers could possibly read
them, this is especially true for multi-axis events: When you move a
stick across its range, it will always generate at least two events, one
for the x axis, and one for the y axis. This is not really an error
situation, so let's report this situation only once at most. If we
already know the multi-event situation, let's skip logging this
completely: We won't loose any information anyway because the report
contains a complete device state and only axis positions were updated.
Thus, this commit adds a parameter to process_hid_report() to let it
know if we are currently processing reports that are known to be sent
multiple times in sequence (with updated reports).
Also, if our consumers are slow to respond, then report the issue only
once and not per each occurrence during the duration of one consumer
read cycle.
Finally, this is not really an error, it's a warning at most, thus
degrade the error message to a warning to not pollute peoples consoles
and logs with unimportant stuff.
Especially during gaming I was seeing screens over screens full of only
this single log message. This commit fixes it.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43125
CC: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Kai Krakow <kai@kaishome.de>
---
dlls/winebus.sys/bus.h | 2 +-
dlls/winebus.sys/bus_iohid.c | 2 +-
dlls/winebus.sys/bus_sdl.c | 12 ++++++------
dlls/winebus.sys/bus_udev.c | 4 ++--
dlls/winebus.sys/main.c | 18 +++++++++++++++---
5 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/dlls/winebus.sys/bus.h b/dlls/winebus.sys/bus.h
index bf93c04..1e2989e 100644
--- a/dlls/winebus.sys/bus.h
+++ b/dlls/winebus.sys/bus.h
@@ -45,7 +45,7 @@ DEVICE_OBJECT *bus_create_hid_device(DRIVER_OBJECT *driver, const WCHAR *busidW,
DEVICE_OBJECT *bus_find_hid_device(const platform_vtbl *vtbl, void *platform_dev) DECLSPEC_HIDDEN;
void bus_remove_hid_device(DEVICE_OBJECT *device) DECLSPEC_HIDDEN;
NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) DECLSPEC_HIDDEN;
-void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length) DECLSPEC_HIDDEN;
+void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length, BOOL warn_multi_events) DECLSPEC_HIDDEN;
DEVICE_OBJECT* bus_enumerate_hid_devices(const platform_vtbl *vtbl, enum_func function, void* context) DECLSPEC_HIDDEN;
/* General Bus Functions */
diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c
index 501a40d..74e5d82 100644
--- a/dlls/winebus.sys/bus_iohid.c
+++ b/dlls/winebus.sys/bus_iohid.c
@@ -135,7 +135,7 @@ static void handle_IOHIDDeviceIOHIDReportCallback(void *context,
uint32_t reportID, uint8_t *report, CFIndex report_length)
{
DEVICE_OBJECT *device = (DEVICE_OBJECT*)context;
- process_hid_report(device, report, report_length);
+ process_hid_report(device, report, report_length, TRUE);
}
static int compare_platform_device(DEVICE_OBJECT *device, void *platform_dev)
diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c
index 159727f..99a206c 100644
--- a/dlls/winebus.sys/bus_sdl.c
+++ b/dlls/winebus.sys/bus_sdl.c
@@ -683,7 +683,7 @@ static BOOL set_report_from_event(SDL_Event *event)
set_button_value(ie->button, ie->state, private->report_buffer);
- process_hid_report(device, private->report_buffer, private->buffer_length);
+ process_hid_report(device, private->report_buffer, private->buffer_length, TRUE);
break;
}
case SDL_JOYAXISMOTION:
@@ -693,7 +693,7 @@ static BOOL set_report_from_event(SDL_Event *event)
if (ie->axis < 6)
{
set_axis_value(private, ie->axis, ie->value);
- process_hid_report(device, private->report_buffer, private->buffer_length);
+ process_hid_report(device, private->report_buffer, private->buffer_length, FALSE);
}
break;
}
@@ -702,7 +702,7 @@ static BOOL set_report_from_event(SDL_Event *event)
SDL_JoyBallEvent *ie = &event->jball;
set_ball_value(private, ie->ball, ie->xrel, ie->yrel);
- process_hid_report(device, private->report_buffer, private->buffer_length);
+ process_hid_report(device, private->report_buffer, private->buffer_length, FALSE);
break;
}
case SDL_JOYHATMOTION:
@@ -710,7 +710,7 @@ static BOOL set_report_from_event(SDL_Event *event)
SDL_JoyHatEvent *ie = &event->jhat;
set_hat_value(private, ie->hat, ie->value);
- process_hid_report(device, private->report_buffer, private->buffer_length);
+ process_hid_report(device, private->report_buffer, private->buffer_length, TRUE);
break;
}
default:
@@ -765,7 +765,7 @@ static BOOL set_mapped_report_from_event(SDL_Event *event)
if (usage >= 0)
{
set_button_value(usage, ie->state, private->report_buffer);
- process_hid_report(device, private->report_buffer, private->buffer_length);
+ process_hid_report(device, private->report_buffer, private->buffer_length, TRUE);
}
break;
}
@@ -774,7 +774,7 @@ static BOOL set_mapped_report_from_event(SDL_Event *event)
SDL_ControllerAxisEvent *ie = &event->caxis;
set_axis_value(private, ie->axis, ie->value);
- process_hid_report(device, private->report_buffer, private->buffer_length);
+ process_hid_report(device, private->report_buffer, private->buffer_length, FALSE);
break;
}
default:
diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c
index d34e18c..47b9758 100644
--- a/dlls/winebus.sys/bus_udev.c
+++ b/dlls/winebus.sys/bus_udev.c
@@ -768,7 +768,7 @@ static DWORD CALLBACK device_report_thread(void *args)
else if (size == 0)
TRACE_(hid_report)("Failed to read report\n");
else
- process_hid_report(device, report_buffer, size);
+ process_hid_report(device, report_buffer, size, TRUE);
}
return 0;
}
@@ -979,7 +979,7 @@ static DWORD CALLBACK lnxev_device_report_thread(void *args)
else if (size == 0)
TRACE_(hid_report)("Failed to read report\n");
else if (set_report_from_event(private, &ie))
- process_hid_report(device, private->current_report_buffer, private->buffer_length);
+ process_hid_report(device, private->current_report_buffer, private->buffer_length, TRUE);
}
return 0;
}
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c
index 2f3c05a..624ddd5 100644
--- a/dlls/winebus.sys/main.c
+++ b/dlls/winebus.sys/main.c
@@ -614,11 +614,12 @@ NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
return status;
}
-void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length)
+void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length, BOOL warn_multi_events)
{
struct device_extension *ext = (struct device_extension*)device->DeviceExtension;
IRP *irp;
LIST_ENTRY *entry;
+ static int overwrite_reported;
if (!length || !report)
return;
@@ -641,8 +642,18 @@ void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length)
ext->buffer_size = length;
}
- if (!ext->last_report_read)
- ERR_(hid_report)("Device reports coming in too fast, last report not read yet!\n");
+ /*
+ * Device reports may come in faster than our consumers could possibly
+ * read them, this is especially true for multi-axis events: When you move
+ * a stick across its range, it will always generate at least two events,
+ * one for the x axis, and one for the y axis. This is not really an error
+ * situation, so let's report this situation only once at most. If we
+ * already know the multi-event situation, let's skip logging this
+ * completely: We won't loose any information anyway because the report
+ * contains a complete device state and only axis positions were updated.
+ */
+ if (warn_multi_events && !ext->last_report_read && !overwrite_reported++)
+ WARN_(hid_report)("Device reports coming in too fast, last report not read yet!\n");
memcpy(ext->last_report, report, length);
ext->last_report_size = length;
@@ -659,6 +670,7 @@ void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length)
irp->UserBuffer, &irp->IoStatus.Information);
ext->last_report_read = TRUE;
IoCompleteRequest(irp, IO_NO_INCREMENT);
+ overwrite_reported = 0;
}
LeaveCriticalSection(&ext->report_cs);
}
--
1.9.1

View File

@ -0,0 +1,65 @@
From 5fa2778cf0726855905b3318b115a05fd2ced4a4 Mon Sep 17 00:00:00 2001
From: Fabian Maurer <dark.shadow4@web.de>
Date: Thu, 2 Aug 2018 17:33:43 +0200
Subject: [PATCH] winmm: Don't crash in waveOutOpen when nSamplesPerSec is 0
and add tests
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45530
Signed-off-by: Fabian Maurer <dark.shadow4@web.de>
---
dlls/winmm/tests/wave.c | 20 ++++++++++++++++++++
dlls/winmm/waveform.c | 7 +++++++
2 files changed, 27 insertions(+)
diff --git a/dlls/winmm/tests/wave.c b/dlls/winmm/tests/wave.c
index b402e21..e490040 100644
--- a/dlls/winmm/tests/wave.c
+++ b/dlls/winmm/tests/wave.c
@@ -1415,6 +1415,26 @@ static void wave_out_test_device(UINT_PTR device)
} else
trace("waveOutOpen(%s): 32 bit float samples not supported\n",
dev_name(device));
+
+ /* Test invalid parameters */
+
+ format.wFormatTag = WAVE_FORMAT_PCM;
+ format.nChannels = 1;
+ format.nSamplesPerSec = 11025;
+ format.nBlockAlign = 1;
+ format.nAvgBytesPerSec = 11025 * 1;
+ format.wBitsPerSample = 8;
+ format.cbSize = 0;
+
+ format.nAvgBytesPerSec = 0;
+ rc = waveOutOpen(&wout, 0, &format, 0, 0, 0);
+ ok(rc == MMSYSERR_NOERROR, "Got %d\n", rc);
+ waveOutClose(wout);
+ format.nAvgBytesPerSec = 11025 * 1;
+
+ format.nSamplesPerSec = 0;
+ rc = waveOutOpen(&wout, 0, &format, 0, 0, 0);
+ ok(rc == MMSYSERR_INVALPARAM || rc == WAVERR_BADFORMAT, "Got %d\n", rc); /* XP and lower return WAVERR_BADFORMAT */
}
static void wave_out_tests(void)
diff --git a/dlls/winmm/waveform.c b/dlls/winmm/waveform.c
index 045bf4a..0a259c0 100644
--- a/dlls/winmm/waveform.c
+++ b/dlls/winmm/waveform.c
@@ -1088,6 +1088,13 @@ static LRESULT WINMM_OpenDevice(WINMM_Device *device, WINMM_OpenInfo *info,
}
if(info->format->wFormatTag == WAVE_FORMAT_PCM){
+
+ if (info->format->nSamplesPerSec == 0)
+ {
+ ret = MMSYSERR_INVALPARAM;
+ goto error;
+ }
+
/* we aren't guaranteed that the struct in lpFormat is a full
* WAVEFORMATEX struct, which IAC::IsFormatSupported requires */
device->orig_fmt = HeapAlloc(GetProcessHeap(), 0, sizeof(WAVEFORMATEX));
--
1.9.1

View File

@ -0,0 +1,63 @@
From 47e5c48c7eadb3dd96d5fa3eb130f75f6c371c4b Mon Sep 17 00:00:00 2001
From: Zebediah Figura <zfigura@codeweavers.com>
Date: Mon, 30 Jul 2018 14:11:11 -0500
Subject: [PATCH 16/24] msi: Generate unique names for 32- and 64-bit custom
action server pipes.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
---
dlls/msi/custom.c | 6 ++++--
programs/msiexec/msiexec.c | 4 ++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c
index 1a8a982..51755f2 100644
--- a/dlls/msi/custom.c
+++ b/dlls/msi/custom.c
@@ -590,7 +590,7 @@ UINT CDECL __wine_msi_call_dll_function(const GUID *guid)
static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch)
{
- static const WCHAR pipe_name[] = {'\\','\\','.','\\','p','i','p','e','\\','m','s','i','c','a','_','%','x',0};
+ static const WCHAR pipe_name[] = {'\\','\\','.','\\','p','i','p','e','\\','m','s','i','c','a','_','%','x','_','%','d',0};
static const WCHAR msiexecW[] = {'\\','m','s','i','e','x','e','c','.','e','x','e',0};
static const WCHAR argsW[] = {'%','s',' ','-','E','m','b','e','d','d','i','n','g',' ','%','d',0};
@@ -606,9 +606,11 @@ static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch)
(arch == SCS_64BIT_BINARY && package->custom_server_64_process))
return ERROR_SUCCESS;
- sprintfW(buffer, pipe_name, GetCurrentProcessId());
+ sprintfW(buffer, pipe_name, GetCurrentProcessId(), arch == SCS_32BIT_BINARY ? 32 : 64);
pipe = CreateNamedPipeW(buffer, PIPE_ACCESS_DUPLEX, 0, 1, sizeof(DWORD64),
sizeof(GUID), 0, NULL);
+ if (pipe == INVALID_HANDLE_VALUE)
+ ERR("Failed to create custom action client pipe: %u\n", GetLastError());
if (sizeof(void *) == 8 && arch == SCS_32BIT_BINARY)
GetSystemWow64DirectoryW(path, MAX_PATH - sizeof(msiexecW)/sizeof(WCHAR));
diff --git a/programs/msiexec/msiexec.c b/programs/msiexec/msiexec.c
index 47cef7e..ead3bfb 100644
--- a/programs/msiexec/msiexec.c
+++ b/programs/msiexec/msiexec.c
@@ -406,7 +406,7 @@ static DWORD CALLBACK custom_action_thread(void *arg)
static int custom_action_server(const WCHAR *arg)
{
- static const WCHAR pipe_name[] = {'\\','\\','.','\\','p','i','p','e','\\','m','s','i','c','a','_','%','x',0};
+ static const WCHAR pipe_name[] = {'\\','\\','.','\\','p','i','p','e','\\','m','s','i','c','a','_','%','x','_','%','d',0};
DWORD client_pid = atoiW(arg);
DWORD64 thread64;
WCHAR buffer[24];
@@ -423,7 +423,7 @@ static int custom_action_server(const WCHAR *arg)
return 1;
}
- sprintfW(buffer, pipe_name, client_pid);
+ sprintfW(buffer, pipe_name, client_pid, sizeof(void *) * 8);
pipe = CreateFileW(buffer, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (pipe == INVALID_HANDLE_VALUE)
{
--
1.9.1

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