Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
March 2021
- 75 participants
- 2277 messages
[PATCH 4/5] wined3d: Introduce wined3d_device_context_draw_indirect().
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/wined3d/cs.c | 16 ++++++++--------
dlls/wined3d/device.c | 10 ++--------
dlls/wined3d/wined3d.spec | 1 +
dlls/wined3d/wined3d_private.h | 3 ---
include/wine/wined3d.h | 3 +++
5 files changed, 14 insertions(+), 19 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index cbc97d3614a..ef3c0c76c14 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -1072,17 +1072,17 @@ void wined3d_device_context_emit_draw(struct wined3d_device_context *context,
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
}
-void wined3d_cs_emit_draw_indirect(struct wined3d_cs *cs, enum wined3d_primitive_type primitive_type,
- unsigned int patch_vertex_count, struct wined3d_buffer *buffer, unsigned int offset, bool indexed)
+void CDECL wined3d_device_context_draw_indirect(struct wined3d_device_context *context,
+ struct wined3d_buffer *buffer, unsigned int offset, bool indexed)
{
- const struct wined3d_d3d_info *d3d_info = &cs->c.device->adapter->d3d_info;
- const struct wined3d_state *state = cs->c.state;
+ const struct wined3d_d3d_info *d3d_info = &context->device->adapter->d3d_info;
+ const struct wined3d_state *state = context->state;
struct wined3d_cs_draw *op;
- op = wined3d_device_context_require_space(&cs->c, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
+ op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
op->opcode = WINED3D_CS_OP_DRAW;
- op->primitive_type = primitive_type;
- op->patch_vertex_count = patch_vertex_count;
+ op->primitive_type = state->primitive_type;
+ op->patch_vertex_count = state->patch_vertex_count;
op->parameters.indirect = TRUE;
op->parameters.u.indirect.buffer = buffer;
op->parameters.u.indirect.offset = offset;
@@ -1091,7 +1091,7 @@ void wined3d_cs_emit_draw_indirect(struct wined3d_cs *cs, enum wined3d_primitive
acquire_graphics_pipeline_resources(state, indexed, d3d_info);
wined3d_resource_acquire(&buffer->resource);
- wined3d_device_context_submit(&cs->c, WINED3D_CS_QUEUE_DEFAULT);
+ wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
}
static void wined3d_cs_exec_flush(struct wined3d_cs *cs, const void *data)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index c5b3f10bac2..38292e9daa8 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4484,12 +4484,9 @@ void CDECL wined3d_device_draw_primitive_instanced(struct wined3d_device *device
void CDECL wined3d_device_draw_primitive_instanced_indirect(struct wined3d_device *device,
struct wined3d_buffer *buffer, unsigned int offset)
{
- struct wined3d_state *state = device->cs->c.state;
-
TRACE("device %p, buffer %p, offset %u.\n", device, buffer, offset);
- wined3d_cs_emit_draw_indirect(device->cs, state->primitive_type,
- state->patch_vertex_count, buffer, offset, false);
+ wined3d_device_context_draw_indirect(&device->cs->c, buffer, offset, true);
}
void CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count)
@@ -4516,12 +4513,9 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
void CDECL wined3d_device_draw_indexed_primitive_instanced_indirect(struct wined3d_device *device,
struct wined3d_buffer *buffer, unsigned int offset)
{
- struct wined3d_state *state = device->cs->c.state;
-
TRACE("device %p, buffer %p, offset %u.\n", device, buffer, offset);
- wined3d_cs_emit_draw_indirect(device->cs, state->primitive_type,
- state->patch_vertex_count, buffer, offset, true);
+ wined3d_device_context_draw_indirect(&device->cs->c, buffer, offset, true);
}
HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device,
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index bae5a6d42f0..918e9e253cc 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -168,6 +168,7 @@
@ cdecl wined3d_device_context_draw(ptr long long long long)
@ cdecl wined3d_device_context_draw_indexed(ptr long long long long long)
+@ cdecl wined3d_device_context_draw_indirect(ptr ptr long long)
@ cdecl wined3d_device_context_dispatch(ptr long long long)
@ cdecl wined3d_device_context_dispatch_indirect(ptr ptr long)
@ cdecl wined3d_device_context_set_blend_state(ptr ptr ptr long)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index a60c3691c82..e3c3cde2cdc 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -4735,9 +4735,6 @@ void wined3d_cs_emit_clear_unordered_access_view_uint(struct wined3d_cs *cs,
struct wined3d_unordered_access_view *view, const struct wined3d_uvec4 *clear_value) DECLSPEC_HIDDEN;
void wined3d_cs_emit_copy_uav_counter(struct wined3d_cs *cs, struct wined3d_buffer *dst_buffer,
unsigned int offset, struct wined3d_unordered_access_view *uav) DECLSPEC_HIDDEN;
-void wined3d_cs_emit_draw_indirect(struct wined3d_cs *cs, enum wined3d_primitive_type primitive_type,
- unsigned int patch_vertex_count, struct wined3d_buffer *buffer,
- unsigned int offset, bool indexed) DECLSPEC_HIDDEN;
void wined3d_cs_emit_flush(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_emit_generate_mipmaps(struct wined3d_cs *cs, struct wined3d_shader_resource_view *view) DECLSPEC_HIDDEN;
void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 0ae0929d587..36efb7349dc 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -26,6 +26,7 @@
#ifndef __WINE_WINED3D_H
#define __WINE_WINED3D_H
+#include <stdbool.h>
#include "wine/list.h"
#define WINED3D_OK S_OK
@@ -2563,6 +2564,8 @@ void __cdecl wined3d_device_context_draw(struct wined3d_device_context *context,
unsigned int vertex_count, unsigned int start_instance, unsigned int instance_count);
void __cdecl wined3d_device_context_draw_indexed(struct wined3d_device_context *context, unsigned int base_vertex_index,
unsigned int start_index, unsigned int index_count, unsigned int start_instance, unsigned int instance_count);
+void __cdecl wined3d_device_context_draw_indirect(struct wined3d_device_context *context,
+ struct wined3d_buffer *buffer, unsigned int offset, bool indexed);
void __cdecl wined3d_device_context_set_blend_state(struct wined3d_device_context *context,
struct wined3d_blend_state *state, const struct wined3d_color *blend_factor, unsigned int sample_mask);
void __cdecl wined3d_device_context_set_constant_buffer(struct wined3d_device_context *context,
--
2.30.2
March 31, 2021
[PATCH 3/5] d3d11: Use wined3d_device_context_draw_indexed().
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/d3d11/device.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 4c8aa8c854c..7311f6e4d7b 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -575,14 +575,14 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_VSSetShader(ID3D11DeviceCo
static void STDMETHODCALLTYPE d3d11_immediate_context_DrawIndexed(ID3D11DeviceContext1 *iface,
UINT index_count, UINT start_index_location, INT base_vertex_location)
{
- struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface);
+ struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface);
TRACE("iface %p, index_count %u, start_index_location %u, base_vertex_location %d.\n",
iface, index_count, start_index_location, base_vertex_location);
wined3d_mutex_lock();
- wined3d_device_set_base_vertex_index(device->wined3d_device, base_vertex_location);
- wined3d_device_draw_indexed_primitive(device->wined3d_device, start_index_location, index_count);
+ wined3d_device_context_draw_indexed(context->wined3d_context,
+ base_vertex_location, start_index_location, index_count, 0, 0);
wined3d_mutex_unlock();
}
@@ -703,7 +703,7 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_DrawIndexedInstanced(ID3D1
UINT instance_index_count, UINT instance_count, UINT start_index_location, INT base_vertex_location,
UINT start_instance_location)
{
- struct d3d_device *device = device_from_immediate_ID3D11DeviceContext1(iface);
+ struct d3d11_immediate_context *context = impl_from_ID3D11DeviceContext1(iface);
TRACE("iface %p, instance_index_count %u, instance_count %u, start_index_location %u, "
"base_vertex_location %d, start_instance_location %u.\n",
@@ -711,9 +711,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_DrawIndexedInstanced(ID3D1
base_vertex_location, start_instance_location);
wined3d_mutex_lock();
- wined3d_device_set_base_vertex_index(device->wined3d_device, base_vertex_location);
- wined3d_device_draw_indexed_primitive_instanced(device->wined3d_device, start_index_location,
- instance_index_count, start_instance_location, instance_count);
+ wined3d_device_context_draw_indexed(context->wined3d_context, base_vertex_location,
+ start_index_location, instance_index_count, start_instance_location, instance_count);
wined3d_mutex_unlock();
}
--
2.30.2
March 31, 2021
[PATCH 2/5] wined3d: Introduce wined3d_device_context_draw_indexed().
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/wined3d/device.c | 19 +++++++++++++++----
dlls/wined3d/wined3d.spec | 1 +
include/wine/wined3d.h | 2 ++
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 0389a73b924..c5b3f10bac2 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2409,6 +2409,18 @@ void CDECL wined3d_device_context_draw(struct wined3d_device_context *context, u
0, start_vertex, vertex_count, start_instance, instance_count, false);
}
+void CDECL wined3d_device_context_draw_indexed(struct wined3d_device_context *context, unsigned int base_vertex_index,
+ unsigned int start_index, unsigned int index_count, unsigned int start_instance, unsigned int instance_count)
+{
+ struct wined3d_state *state = context->state;
+
+ TRACE("context %p, base_vertex_index %u, start_index %u, index_count %u, start_instance %u, instance_count %u.\n",
+ context, base_vertex_index, start_index, index_count, start_instance, instance_count);
+
+ wined3d_device_context_emit_draw(context, state->primitive_type, state->patch_vertex_count,
+ base_vertex_index, start_index, index_count, 0, 0, true);
+}
+
void CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader)
{
TRACE("device %p, shader %p.\n", device, shader);
@@ -4486,8 +4498,7 @@ void CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device,
TRACE("device %p, start_idx %u, index_count %u.\n", device, start_idx, index_count);
- wined3d_device_context_emit_draw(&device->cs->c, state->primitive_type, state->patch_vertex_count,
- state->base_vertex_index, start_idx, index_count, 0, 0, true);
+ wined3d_device_context_draw_indexed(&device->cs->c, state->base_vertex_index, start_idx, index_count, 0, 0);
}
void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device *device,
@@ -4498,8 +4509,8 @@ void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device
TRACE("device %p, start_idx %u, index_count %u, start_instance %u, instance_count %u.\n",
device, start_idx, index_count, start_instance, instance_count);
- wined3d_device_context_emit_draw(&device->cs->c, state->primitive_type, state->patch_vertex_count,
- state->base_vertex_index, start_idx, index_count, start_instance, instance_count, true);
+ wined3d_device_context_draw_indexed(&device->cs->c, state->base_vertex_index,
+ start_idx, index_count, start_instance, instance_count);
}
void CDECL wined3d_device_draw_indexed_primitive_instanced_indirect(struct wined3d_device *device,
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 087a6bead13..bae5a6d42f0 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -167,6 +167,7 @@
@ cdecl wined3d_device_validate_device(ptr ptr)
@ cdecl wined3d_device_context_draw(ptr long long long long)
+@ cdecl wined3d_device_context_draw_indexed(ptr long long long long long)
@ cdecl wined3d_device_context_dispatch(ptr long long long)
@ cdecl wined3d_device_context_dispatch_indirect(ptr ptr long)
@ cdecl wined3d_device_context_set_blend_state(ptr ptr ptr long)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index bc6f2e29b7f..0ae0929d587 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2561,6 +2561,8 @@ void __cdecl wined3d_device_context_dispatch_indirect(struct wined3d_device_cont
struct wined3d_buffer *buffer, unsigned int offset);
void __cdecl wined3d_device_context_draw(struct wined3d_device_context *context, unsigned int start_vertex,
unsigned int vertex_count, unsigned int start_instance, unsigned int instance_count);
+void __cdecl wined3d_device_context_draw_indexed(struct wined3d_device_context *context, unsigned int base_vertex_index,
+ unsigned int start_index, unsigned int index_count, unsigned int start_instance, unsigned int instance_count);
void __cdecl wined3d_device_context_set_blend_state(struct wined3d_device_context *context,
struct wined3d_blend_state *state, const struct wined3d_color *blend_factor, unsigned int sample_mask);
void __cdecl wined3d_device_context_set_constant_buffer(struct wined3d_device_context *context,
--
2.30.2
March 31, 2021
[PATCH 1/5] wined3d: Check for a valid index buffer in d3d[89]_device_DrawIndexedPrimitive().
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/d3d8/device.c | 13 +++++++++----
dlls/d3d8/tests/device.c | 2 +-
dlls/d3d9/device.c | 19 +++++++++++--------
dlls/ddraw/device.c | 6 +++---
dlls/wined3d/device.c | 14 +-------------
include/wine/wined3d.h | 2 +-
6 files changed, 26 insertions(+), 30 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index f4bdb748275..f0bfab660a7 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -2518,22 +2518,27 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitive(IDirect3DDevice8 *iface,
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
unsigned int index_count;
int base_vertex_index;
- HRESULT hr;
TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, start_idx %u, primitive_count %u.\n",
iface, primitive_type, min_vertex_idx, vertex_count, start_idx, primitive_count);
index_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
wined3d_mutex_lock();
+ if (!device->stateblock_state->index_buffer)
+ {
+ wined3d_mutex_unlock();
+ WARN("Index buffer not set, returning D3D_OK.\n");
+ return D3D_OK;
+ }
base_vertex_index = device->stateblock_state->base_vertex_index;
d3d8_device_upload_sysmem_vertex_buffers(device, base_vertex_index + min_vertex_idx, vertex_count);
d3d8_device_upload_sysmem_index_buffer(device, start_idx, index_count);
wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0);
wined3d_device_apply_stateblock(device->wined3d_device, device->state);
- hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, start_idx, index_count);
+ wined3d_device_draw_indexed_primitive(device->wined3d_device, start_idx, index_count);
wined3d_mutex_unlock();
- return hr;
+ return D3D_OK;
}
/* The caller is responsible for wined3d locking */
@@ -2752,7 +2757,7 @@ static HRESULT WINAPI d3d8_device_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface
wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0);
wined3d_device_apply_stateblock(device->wined3d_device, device->state);
- hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count);
+ wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count);
wined3d_stateblock_set_stream_source(device->state, 0, NULL, 0, 0);
wined3d_stateblock_set_index_buffer(device->state, NULL, WINED3DFMT_UNKNOWN);
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 4eb1ab65e72..fc94dcaaad7 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -10176,7 +10176,7 @@ static void test_draw_primitive(void)
hr = IDirect3DDevice8_SetIndices(device, NULL, 0);
ok(SUCCEEDED(hr), "SetIndices failed, hr %#x.\n", hr);
hr = IDirect3DDevice8_DrawIndexedPrimitive(device, D3DPT_TRIANGLELIST, 0, 4, 0, 2);
- todo_wine ok(SUCCEEDED(hr), "DrawIndexedPrimitive failed, hr %#x.\n", hr);
+ ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
/* Valid index buffer, NULL stream source. */
hr = IDirect3DDevice8_SetIndices(device, index_buffer, 1);
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 229fc59521c..aa216edfcc0 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -3049,7 +3049,6 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitive(IDirect3DDevice9Ex *iface
{
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
unsigned int index_count;
- HRESULT hr;
TRACE("iface %p, primitive_type %#x, base_vertex_idx %u, min_vertex_idx %u, "
"vertex_count %u, start_idx %u, primitive_count %u.\n",
@@ -3063,6 +3062,12 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitive(IDirect3DDevice9Ex *iface
WARN("Called without a valid vertex declaration set.\n");
return D3DERR_INVALIDCALL;
}
+ if (!device->stateblock_state->index_buffer)
+ {
+ wined3d_mutex_unlock();
+ WARN("Called without a valid index buffer set.\n");
+ return D3DERR_INVALIDCALL;
+ }
index_count = vertex_count_from_primitive_count(primitive_type, primitive_count);
d3d9_device_upload_sysmem_vertex_buffers(device, base_vertex_idx, min_vertex_idx, vertex_count);
d3d9_device_upload_sysmem_index_buffer(device, start_idx, index_count);
@@ -3070,12 +3075,11 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitive(IDirect3DDevice9Ex *iface
wined3d_stateblock_set_base_vertex_index(device->state, base_vertex_idx);
wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0);
wined3d_device_apply_stateblock(device->wined3d_device, device->state);
- hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, start_idx, index_count);
- if (SUCCEEDED(hr))
- d3d9_rts_flag_auto_gen_mipmap(device);
+ wined3d_device_draw_indexed_primitive(device->wined3d_device, start_idx, index_count);
+ d3d9_rts_flag_auto_gen_mipmap(device);
wined3d_mutex_unlock();
- return hr;
+ return D3D_OK;
}
/* The caller is responsible for wined3d locking */
@@ -3322,13 +3326,12 @@ static HRESULT WINAPI d3d9_device_DrawIndexedPrimitiveUP(IDirect3DDevice9Ex *ifa
wined3d_device_apply_stateblock(device->wined3d_device, device->state);
wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_d3d(primitive_type), 0);
- hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count);
+ wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / idx_fmt_size, idx_count);
wined3d_stateblock_set_stream_source(device->state, 0, NULL, 0, 0);
wined3d_stateblock_set_index_buffer(device->state, NULL, WINED3DFMT_UNKNOWN);
- if (SUCCEEDED(hr))
- d3d9_rts_flag_auto_gen_mipmap(device);
+ d3d9_rts_flag_auto_gen_mipmap(device);
done:
wined3d_mutex_unlock();
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index bf2e77e5b71..ce937b0c543 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -3736,7 +3736,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
wined3d_stateblock_set_base_vertex_index(device->state, vb_pos / stride);
wined3d_device_apply_stateblock(device->wined3d_device, device->state);
d3d_device_sync_surfaces(device);
- hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / sizeof(*indices), index_count);
+ wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / sizeof(*indices), index_count);
done:
wined3d_mutex_unlock();
@@ -4200,7 +4200,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveStrided(IDirect3DDevice7 *iface,
wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_ddraw(primitive_type), 0);
wined3d_device_apply_stateblock(device->wined3d_device, device->state);
d3d_device_sync_surfaces(device);
- hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / sizeof(WORD), index_count);
+ wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / sizeof(WORD), index_count);
done:
wined3d_mutex_unlock();
@@ -4478,7 +4478,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
wined3d_device_set_primitive_type(device->wined3d_device, wined3d_primitive_type_from_ddraw(primitive_type), 0);
wined3d_device_apply_stateblock(device->wined3d_device, device->state);
d3d_device_sync_surfaces(device);
- hr = wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / sizeof(WORD), index_count);
+ wined3d_device_draw_indexed_primitive(device->wined3d_device, ib_pos / sizeof(WORD), index_count);
wined3d_mutex_unlock();
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 71ca6740c37..0389a73b924 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4480,26 +4480,14 @@ void CDECL wined3d_device_draw_primitive_instanced_indirect(struct wined3d_devic
state->patch_vertex_count, buffer, offset, false);
}
-HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count)
+void CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count)
{
struct wined3d_state *state = device->cs->c.state;
TRACE("device %p, start_idx %u, index_count %u.\n", device, start_idx, index_count);
- if (!state->index_buffer)
- {
- /* D3D9 returns D3DERR_INVALIDCALL when DrawIndexedPrimitive is called
- * without an index buffer set. (The first time at least...)
- * D3D8 simply dies, but I doubt it can do much harm to return
- * D3DERR_INVALIDCALL there as well. */
- WARN("Called without a valid index buffer set, returning WINED3DERR_INVALIDCALL.\n");
- return WINED3DERR_INVALIDCALL;
- }
-
wined3d_device_context_emit_draw(&device->cs->c, state->primitive_type, state->patch_vertex_count,
state->base_vertex_index, start_idx, index_count, 0, 0, true);
-
- return WINED3D_OK;
}
void CDECL wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device *device,
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 197a56d1952..bc6f2e29b7f 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2372,7 +2372,7 @@ void __cdecl wined3d_device_dispatch_compute(struct wined3d_device *device,
unsigned int group_count_x, unsigned int group_count_y, unsigned int group_count_z);
void __cdecl wined3d_device_dispatch_compute_indirect(struct wined3d_device *device,
struct wined3d_buffer *buffer, unsigned int offset);
-HRESULT __cdecl wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count);
+void __cdecl wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count);
void __cdecl wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device *device,
UINT start_idx, UINT index_count, UINT start_instance, UINT instance_count);
void __cdecl wined3d_device_draw_indexed_primitive_instanced_indirect(struct wined3d_device *device,
--
2.30.2
March 31, 2021
Re: [PATCH 1/8] ntoskrnl/tests: Fix a test failure on LUA Windows.
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=88019
Your paranoid android.
=== w8 (32 bit report) ===
ntoskrnl.exe:
driver.c:272: Test failed: Got unexpected test_load_image_notify_count 0.
March 31, 2021
Re: [PATCH] mscoree: Update Wine Mono to 6.1.1.
by Marvin
Hi,
While running your changed tests, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at:
https://testbot.winehq.org/JobDetails.pl?Key=88017
Your paranoid android.
=== debiant2 (build log) ===
WineRunWineTest.pl:error: The task timed out
=== debiant2 (build log) ===
WineRunWineTest.pl:error: The task timed out
March 31, 2021
Re: [PATCH v3 1/7] d3d11/tests: Don't use all samples for blending in multisample resolve test.
by Henri Verbeet
On Wed, 31 Mar 2021 at 12:28, Jan Sikorski <jsikorski(a)codeweavers.com> wrote:
> ---
> dlls/d3d11/tests/d3d11.c | 42 +++++++++++++++++++++-------------------
> 1 file changed, 22 insertions(+), 20 deletions(-)
>
These (and their d3d10 equivalents) cause failures for me on Windows:
d3d11.c:1477: Adapter: L"AMD Radeon HD 6310 Graphics", 1002:9802.
d3d11.c:1906: Feature level 0xb000.
...
d3d11.c:30452: Test failed: Got 0xff80ff80, expected 0xffbcffbc at
(0, 0, 0), sub-resource 0.
d3d11.c:30452: Test failed: Got 0xfff0dec4, expected 0xfff1e1cf at
(0, 0, 0), sub-resource 0.
d3d11.c:30452: Test failed: Got 0xff80ff80, expected 0xffbcffbc at
(0, 0, 0), sub-resource 0.
d3d11.c:30452: Test failed: Got 0xff80ff80, expected 0xffbcffbc at
(0, 0, 0), sub-resource 0.
d3d11.c:30452: Test failed: Got 0xfff0dec4, expected 0xfff1e1cf at
(0, 0, 0), sub-resource 0.
d3d11.c:30452: Test failed: Got 0xfff0dec4, expected 0xfff1e1cf at
(0, 0, 0), sub-resource 0.
d3d11.c:30452: Test failed: Got 0xff80ff80, expected 0xffbcffbc at
(0, 0, 0), sub-resource 0.
d3d11.c:30452: Test failed: Got 0xfff0dec4, expected 0xfff1e1cf at
(0, 0, 0), sub-resource 0.
d3d11.c:30452: Test failed: Got 0xff80ff80, expected 0xffbcffbc at
(0, 0, 0), sub-resource 0.
d3d11.c:30452: Test failed: Got 0xffdfbf9f, expected 0xffe2cdc0 at
(0, 0, 0), sub-resource 0.
I'd argue those results are broken, so they probably just need a broken().
March 31, 2021
[PATCH 8/8] ntoskrnl/tests: Add a basic PnP test driver.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/ntoskrnl.exe/tests/Makefile.in | 6 +-
dlls/ntoskrnl.exe/tests/driver_pnp.c | 143 ++++++++++++++++
dlls/ntoskrnl.exe/tests/driver_pnp.spec | 1 +
dlls/ntoskrnl.exe/tests/ntoskrnl.c | 209 ++++++++++++++++++++++++
4 files changed, 358 insertions(+), 1 deletion(-)
create mode 100644 dlls/ntoskrnl.exe/tests/driver_pnp.c
create mode 100644 dlls/ntoskrnl.exe/tests/driver_pnp.spec
diff --git a/dlls/ntoskrnl.exe/tests/Makefile.in b/dlls/ntoskrnl.exe/tests/Makefile.in
index 4b2052d43f4..c799dfcaf77 100644
--- a/dlls/ntoskrnl.exe/tests/Makefile.in
+++ b/dlls/ntoskrnl.exe/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = ntoskrnl.exe
-IMPORTS = advapi32 crypt32 wintrust ws2_32
+IMPORTS = advapi32 crypt32 newdev setupapi wintrust ws2_32
driver_IMPORTS = winecrt0 ntoskrnl
driver_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native
@@ -9,6 +9,8 @@ driver3_IMPORTS = winecrt0 ntoskrnl
driver3_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native
driver4_IMPORTS = winecrt0 ntoskrnl netio
driver4_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native
+driver_pnp_IMPORTS = winecrt0 ntoskrnl
+driver_pnp_EXTRADLLFLAGS = -nodefaultlibs -nostartfiles -Wl,--subsystem,native
SOURCES = \
driver.c \
@@ -19,4 +21,6 @@ SOURCES = \
driver3.spec \
driver4.c \
driver4.spec \
+ driver_pnp.c \
+ driver_pnp.spec \
ntoskrnl.c
diff --git a/dlls/ntoskrnl.exe/tests/driver_pnp.c b/dlls/ntoskrnl.exe/tests/driver_pnp.c
new file mode 100644
index 00000000000..53403d2fa7b
--- /dev/null
+++ b/dlls/ntoskrnl.exe/tests/driver_pnp.c
@@ -0,0 +1,143 @@
+/*
+ * ntoskrnl.exe testing framework
+ *
+ * Copyright 2020 Zebediah Figura
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "windef.h"
+#include "winbase.h"
+#include "winternl.h"
+#include "winioctl.h"
+#include "ddk/wdm.h"
+
+#include "driver.h"
+
+static const GUID control_class = {0xdeadbeef, 0x29ef, 0x4538, {0xa5, 0xfd, 0xb6, 0x95, 0x73, 0xa3, 0x62, 0xc0}};
+static UNICODE_STRING control_symlink;
+
+static DEVICE_OBJECT *bus_fdo, *bus_pdo;
+
+static NTSTATUS fdo_pnp(IRP *irp)
+{
+ IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation(irp);
+ NTSTATUS ret;
+
+ switch (stack->MinorFunction)
+ {
+ case IRP_MN_START_DEVICE:
+ irp->IoStatus.Status = IoSetDeviceInterfaceState(&control_symlink, TRUE);
+ break;
+
+ case IRP_MN_SURPRISE_REMOVAL:
+ irp->IoStatus.Status = STATUS_SUCCESS;
+ break;
+
+ case IRP_MN_REMOVE_DEVICE:
+ IoSetDeviceInterfaceState(&control_symlink, FALSE);
+ irp->IoStatus.Status = STATUS_SUCCESS;
+ IoSkipCurrentIrpStackLocation(irp);
+ ret = IoCallDriver(bus_pdo, irp);
+ IoDetachDevice(bus_pdo);
+ IoDeleteDevice(bus_fdo);
+ RtlFreeUnicodeString(&control_symlink);
+ return ret;
+ }
+
+ IoSkipCurrentIrpStackLocation(irp);
+ return IoCallDriver(bus_pdo, irp);
+}
+
+static NTSTATUS pdo_pnp(DEVICE_OBJECT *device_obj, IRP *irp)
+{
+ IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation(irp);
+ NTSTATUS ret = irp->IoStatus.Status;
+
+ switch (stack->MinorFunction)
+ {
+ case IRP_MN_START_DEVICE:
+ ret = STATUS_SUCCESS;
+ break;
+
+ case IRP_MN_QUERY_CAPABILITIES:
+ case IRP_MN_SURPRISE_REMOVAL:
+ ret = STATUS_SUCCESS;
+ break;
+ }
+
+ irp->IoStatus.Status = ret;
+ IoCompleteRequest(irp, IO_NO_INCREMENT);
+ return ret;
+}
+
+static NTSTATUS WINAPI driver_pnp(DEVICE_OBJECT *device, IRP *irp)
+{
+ if (device == bus_fdo)
+ return fdo_pnp(irp);
+ return pdo_pnp(device, irp);
+}
+
+static NTSTATUS WINAPI driver_add_device(DRIVER_OBJECT *driver, DEVICE_OBJECT *pdo)
+{
+ NTSTATUS ret;
+
+ if ((ret = IoCreateDevice(driver, 0, NULL, FILE_DEVICE_BUS_EXTENDER, 0, FALSE, &bus_fdo)))
+ return ret;
+
+ if ((ret = IoRegisterDeviceInterface(pdo, &control_class, NULL, &control_symlink)))
+ {
+ IoDeleteDevice(bus_fdo);
+ return ret;
+ }
+
+ IoAttachDeviceToDeviceStack(bus_fdo, pdo);
+ bus_pdo = pdo;
+ bus_fdo->Flags &= ~DO_DEVICE_INITIALIZING;
+ return STATUS_SUCCESS;
+}
+
+static NTSTATUS WINAPI driver_create(DEVICE_OBJECT *device, IRP *irp)
+{
+ irp->IoStatus.Status = STATUS_SUCCESS;
+ IoCompleteRequest(irp, IO_NO_INCREMENT);
+ return STATUS_SUCCESS;
+}
+
+static NTSTATUS WINAPI driver_close(DEVICE_OBJECT *device, IRP *irp)
+{
+ irp->IoStatus.Status = STATUS_SUCCESS;
+ IoCompleteRequest(irp, IO_NO_INCREMENT);
+ return STATUS_SUCCESS;
+}
+
+static void WINAPI driver_unload(DRIVER_OBJECT *driver)
+{
+}
+
+NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, UNICODE_STRING *registry)
+{
+ driver->DriverExtension->AddDevice = driver_add_device;
+ driver->DriverUnload = driver_unload;
+ driver->MajorFunction[IRP_MJ_PNP] = driver_pnp;
+ driver->MajorFunction[IRP_MJ_CREATE] = driver_create;
+ driver->MajorFunction[IRP_MJ_CLOSE] = driver_close;
+
+ return STATUS_SUCCESS;
+}
diff --git a/dlls/ntoskrnl.exe/tests/driver_pnp.spec b/dlls/ntoskrnl.exe/tests/driver_pnp.spec
new file mode 100644
index 00000000000..ad33444716a
--- /dev/null
+++ b/dlls/ntoskrnl.exe/tests/driver_pnp.spec
@@ -0,0 +1 @@
+# nothing here yet
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
index c3ebe5b8ee1..70398e90627 100644
--- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
@@ -32,12 +32,16 @@
#include "ntsecapi.h"
#include "mscat.h"
#include "mssip.h"
+#include "setupapi.h"
+#include "newdev.h"
#include "wine/test.h"
#include "wine/heap.h"
#include "wine/mssign.h"
#include "driver.h"
+static const GUID GUID_NULL;
+
static HANDLE device;
static BOOL (WINAPI *pRtlDosPathNameToNtPathName_U)(const WCHAR *, UNICODE_STRING *, WCHAR **, CURDIR *);
@@ -934,6 +938,209 @@ static void test_driver4(struct testsign_context *ctx)
ok(ret, "DeleteFile failed: %u\n", GetLastError());
}
+static void add_file_to_catalog(HANDLE catalog, const WCHAR *file)
+{
+ SIP_SUBJECTINFO subject_info = {sizeof(SIP_SUBJECTINFO)};
+ SIP_INDIRECT_DATA *indirect_data;
+ const WCHAR *filepart = file;
+ CRYPTCATMEMBER *member;
+ WCHAR hash_buffer[100];
+ GUID subject_guid;
+ unsigned int i;
+ DWORD size;
+ BOOL ret;
+
+ ret = CryptSIPRetrieveSubjectGuidForCatalogFile(file, NULL, &subject_guid);
+ todo_wine ok(ret, "Failed to get subject guid, error %u\n", GetLastError());
+
+ size = 0;
+ subject_info.pgSubjectType = &subject_guid;
+ subject_info.pwsFileName = file;
+ subject_info.DigestAlgorithm.pszObjId = (char *)szOID_OIWSEC_sha1;
+ subject_info.dwFlags = SPC_INC_PE_RESOURCES_FLAG | SPC_INC_PE_IMPORT_ADDR_TABLE_FLAG | SPC_EXC_PE_PAGE_HASHES_FLAG | 0x10000;
+ ret = CryptSIPCreateIndirectData(&subject_info, &size, NULL);
+ todo_wine ok(ret, "Failed to get indirect data size, error %u\n", GetLastError());
+
+ indirect_data = malloc(size);
+ ret = CryptSIPCreateIndirectData(&subject_info, &size, indirect_data);
+ todo_wine ok(ret, "Failed to get indirect data, error %u\n", GetLastError());
+ if (ret)
+ {
+ memset(hash_buffer, 0, sizeof(hash_buffer));
+ for (i = 0; i < indirect_data->Digest.cbData; ++i)
+ swprintf(&hash_buffer[i * 2], 2, L"%02X", indirect_data->Digest.pbData[i]);
+
+ member = CryptCATPutMemberInfo(catalog, (WCHAR *)file,
+ hash_buffer, &subject_guid, 0, size, (BYTE *)indirect_data);
+ ok(!!member, "Failed to write member, error %u\n", GetLastError());
+
+ if (wcsrchr(file, '\\'))
+ filepart = wcsrchr(file, '\\') + 1;
+
+ ret = !!CryptCATPutAttrInfo(catalog, member, (WCHAR *)L"File",
+ CRYPTCAT_ATTR_NAMEASCII | CRYPTCAT_ATTR_DATAASCII | CRYPTCAT_ATTR_AUTHENTICATED,
+ (wcslen(filepart) + 1) * 2, (BYTE *)filepart);
+ ok(ret, "Failed to write attr, error %u\n", GetLastError());
+
+ ret = !!CryptCATPutAttrInfo(catalog, member, (WCHAR *)L"OSAttr",
+ CRYPTCAT_ATTR_NAMEASCII | CRYPTCAT_ATTR_DATAASCII | CRYPTCAT_ATTR_AUTHENTICATED,
+ sizeof(L"2:6.0"), (BYTE *)L"2:6.0");
+ ok(ret, "Failed to write attr, error %u\n", GetLastError());
+ }
+}
+
+static void test_pnp_driver(struct testsign_context *ctx)
+{
+ static const char hardware_id[] = "test_hardware_id\0";
+ char path[MAX_PATH], dest[MAX_PATH], *filepart;
+ SP_DEVINFO_DATA device = {sizeof(device)};
+ char cwd[MAX_PATH], tempdir[MAX_PATH];
+ WCHAR driver_filename[MAX_PATH];
+ SC_HANDLE manager, service;
+ HANDLE catalog, file;
+ HDEVINFO set;
+ BOOL ret;
+ FILE *f;
+
+ static const char inf_text[] =
+ "[Version]\n"
+ "Signature=$Chicago$\n"
+ "ClassGuid={4d36e97d-e325-11ce-bfc1-08002be10318}\n"
+ "CatalogFile=winetest.cat\n"
+ "DriverVer=09/21/2006,6.0.5736.1\n"
+
+ "[Manufacturer]\n"
+ "Wine=mfg_section,NTamd64\n"
+
+ "[mfg_section.NTamd64]\n"
+ "Wine test root driver=device_section,test_hardware_id\n"
+
+ "[device_section.NTamd64]\n"
+ "CopyFiles=file_section\n"
+
+ "[device_section.NTamd64.Services]\n"
+ "AddService=winetest,0x2,svc_section\n"
+
+ "[file_section]\n"
+ "winetest.sys\n"
+
+ "[SourceDisksFiles]\n"
+ "winetest.sys=1\n"
+
+ "[SourceDisksNames]\n"
+ "1=,winetest.sys\n"
+
+ "[DestinationDirs]\n"
+ "DefaultDestDir=12\n"
+
+ "[svc_section]\n"
+ "ServiceBinary=%12%\\winetest.sys\n"
+ "ServiceType=1\n"
+ "StartType=3\n"
+ "ErrorControl=1\n"
+ "LoadOrderGroup=Extended Base\n"
+ "DisplayName=\"winetest bus driver\"\n"
+ "; they don't sleep anymore, on the beach\n";
+
+ GetCurrentDirectoryA(ARRAY_SIZE(cwd), cwd);
+ GetTempPathA(ARRAY_SIZE(tempdir), tempdir);
+ SetCurrentDirectoryA(tempdir);
+
+ load_resource(L"driver_pnp.dll", driver_filename);
+ ret = MoveFileW(driver_filename, L"winetest.sys");
+ ok(ret, "failed to move file, error %u\n", GetLastError());
+
+ f = fopen("winetest.inf", "w");
+ ok(!!f, "failed to open winetest.inf: %s\n", strerror(errno));
+ fputs(inf_text, f);
+ fclose(f);
+
+ /* Create the catalog file. */
+
+ catalog = CryptCATOpen((WCHAR *)L"winetest.cat", CRYPTCAT_OPEN_CREATENEW, 0, CRYPTCAT_VERSION_1, 0);
+ ok(catalog != INVALID_HANDLE_VALUE, "Failed to create catalog, error %#x\n", GetLastError());
+
+ ret = !!CryptCATPutCatAttrInfo(catalog, (WCHAR *)L"HWID1",
+ CRYPTCAT_ATTR_NAMEASCII | CRYPTCAT_ATTR_DATAASCII | CRYPTCAT_ATTR_AUTHENTICATED,
+ sizeof(L"test_hardware_id"), (BYTE *)L"test_hardware_id");
+ todo_wine ok(ret, "failed to add attribute, error %#x\n", GetLastError());
+
+ ret = !!CryptCATPutCatAttrInfo(catalog, (WCHAR *)L"OS",
+ CRYPTCAT_ATTR_NAMEASCII | CRYPTCAT_ATTR_DATAASCII | CRYPTCAT_ATTR_AUTHENTICATED,
+ sizeof(L"VistaX64"), (BYTE *)L"VistaX64");
+ todo_wine ok(ret, "failed to add attribute, error %#x\n", GetLastError());
+
+ add_file_to_catalog(catalog, L"winetest.sys");
+ add_file_to_catalog(catalog, L"winetest.inf");
+
+ ret = CryptCATPersistStore(catalog);
+ todo_wine ok(ret, "Failed to write catalog, error %u\n", GetLastError());
+
+ ret = CryptCATClose(catalog);
+ ok(ret, "Failed to close catalog, error %u\n", GetLastError());
+
+ testsign_sign(ctx, L"winetest.cat");
+
+ /* Install the driver. */
+
+ set = SetupDiCreateDeviceInfoList(NULL, NULL);
+ ok(set != INVALID_HANDLE_VALUE, "failed to create device list, error %#x\n", GetLastError());
+
+ ret = SetupDiCreateDeviceInfoA(set, "root\\winetest\\0", &GUID_NULL, NULL, NULL, 0, &device);
+ ok(ret, "failed to create device, error %#x\n", GetLastError());
+
+ ret = SetupDiSetDeviceRegistryPropertyA( set, &device, SPDRP_HARDWAREID,
+ (const BYTE *)hardware_id, sizeof(hardware_id) );
+ ok(ret, "failed to create set hardware ID, error %#x\n", GetLastError());
+
+ ret = SetupDiCallClassInstaller(DIF_REGISTERDEVICE, set, &device);
+ ok(ret, "failed to register device, error %#x\n", GetLastError());
+
+ GetFullPathNameA("winetest.inf", sizeof(path), path, NULL);
+ ret = UpdateDriverForPlugAndPlayDevicesA(NULL, hardware_id, path, INSTALLFLAG_FORCE, NULL);
+ ok(ret, "failed to install device, error %#x\n", GetLastError());
+
+ /* Tests. */
+
+ file = CreateFileA("\\\\?\\root#winetest#0#{deadbeef-29ef-4538-a5fd-b69573a362c0}", 0, 0, NULL, OPEN_EXISTING, 0, NULL);
+ ok(file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError());
+ CloseHandle(file);
+
+ /* Clean up. */
+
+ ret = SetupDiCallClassInstaller(DIF_REMOVE, set, &device);
+ ok(ret, "failed to remove device, error %#x\n", GetLastError());
+
+ ret = SetupDiDestroyDeviceInfoList(set);
+ ok(ret, "failed to destroy set, error %#x\n", GetLastError());
+
+ /* Windows stops the service but does not delete it. */
+ manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_CONNECT);
+ ok(!!manager, "failed to open service manager, error %u\n", GetLastError());
+ service = OpenServiceA(manager, "winetest", SERVICE_STOP | DELETE);
+ ok(!!service, "failed to open service, error %u\n", GetLastError());
+ unload_driver(service);
+ CloseServiceHandle(manager);
+
+ GetFullPathNameA("winetest.inf", sizeof(path), path, NULL);
+ ret = SetupCopyOEMInfA(path, NULL, 0, 0, dest, sizeof(dest), NULL, &filepart);
+ ok(ret, "Failed to copy INF, error %#x\n", GetLastError());
+ ret = SetupUninstallOEMInfA(filepart, 0, NULL);
+ ok(ret, "Failed to uninstall INF, error %u\n", GetLastError());
+
+ ret = DeleteFileA("winetest.cat");
+ ok(ret, "Failed to delete file, error %u\n", GetLastError());
+ ret = DeleteFileA("winetest.inf");
+ ok(ret, "Failed to delete file, error %u\n", GetLastError());
+ ret = DeleteFileA("winetest.sys");
+ ok(ret, "Failed to delete file, error %u\n", GetLastError());
+ /* Windows 10 apparently deletes the image in SetupUninstallOEMInf(). */
+ ret = DeleteFileA("C:/windows/system32/drivers/winetest.sys");
+ ok(ret || GetLastError() == ERROR_FILE_NOT_FOUND, "Failed to delete file, error %u\n", GetLastError());
+
+ SetCurrentDirectoryA(cwd);
+}
+
START_TEST(ntoskrnl)
{
WCHAR filename[MAX_PATH], filename2[MAX_PATH];
@@ -1000,5 +1207,7 @@ START_TEST(ntoskrnl)
subtest("driver4");
test_driver4(&ctx);
+ test_pnp_driver(&ctx);
+
testsign_cleanup(&ctx);
}
--
2.30.2
March 31, 2021
[PATCH 7/8] setupapi: Reënumerate root PnP devices in SetupDiRemoveDevice().
by Zebediah Figura
Allow them to be unloaded.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/setupapi/devinst.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 0a396cc8464..8f826c30250 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -19,6 +19,7 @@
*/
#include <stdarg.h>
+#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
@@ -1692,15 +1693,38 @@ BOOL WINAPI SetupDiRegisterDeviceInfo(HDEVINFO devinfo, SP_DEVINFO_DATA *device_
*/
BOOL WINAPI SetupDiRemoveDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
{
+ SC_HANDLE manager = NULL, service = NULL;
struct device *device;
+ WCHAR *service_name;
+ DWORD size;
TRACE("devinfo %p, device_data %p.\n", devinfo, device_data);
if (!(device = get_device(devinfo, device_data)))
return FALSE;
+ if (!(manager = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT)))
+ return FALSE;
+
+ if (!RegGetValueW(device->key, NULL, L"Service", RRF_RT_REG_SZ, NULL, NULL, &size))
+ {
+ service_name = malloc(size);
+ if (!RegGetValueW(device->key, NULL, L"Service", RRF_RT_REG_SZ, NULL, service_name, &size))
+ service = OpenServiceW(manager, service_name, SERVICE_USER_DEFINED_CONTROL);
+ free(service_name);
+ }
+
remove_device(device);
+ if (service)
+ {
+ SERVICE_STATUS status;
+ if (!ControlService(service, SERVICE_CONTROL_REENUMERATE_ROOT_DEVICES, &status))
+ ERR("Failed to control service %s, error %u.\n", debugstr_w(service_name), GetLastError());
+ CloseServiceHandle(service);
+ }
+ CloseServiceHandle(manager);
+
return TRUE;
}
--
2.30.2
March 31, 2021
[PATCH 6/8] setupapi: Reënumerate root PnP devices in SetupDiInstallDevice().
by Zebediah Figura
If the service is already running, starting it has no effect.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/setupapi/devinst.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index de0413e74f5..0a396cc8464 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -104,6 +104,8 @@ static const WCHAR AddInterface[] = {'A','d','d','I','n','t','e','r','f','a','c'
static const WCHAR backslashW[] = {'\\',0};
static const WCHAR emptyW[] = {0};
+#define SERVICE_CONTROL_REENUMERATE_ROOT_DEVICES 128
+
struct driver
{
WCHAR inf_path[MAX_PATH];
@@ -5123,13 +5125,20 @@ BOOL WINAPI SetupDiInstallDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
if (!wcsnicmp(device->instanceId, rootW, lstrlenW(rootW)) && svc_name[0]
&& (manager = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT)))
{
- if ((service = OpenServiceW(manager, svc_name, SERVICE_START)))
+ if ((service = OpenServiceW(manager, svc_name, SERVICE_START | SERVICE_USER_DEFINED_CONTROL)))
{
+ SERVICE_STATUS status;
+
if (!StartServiceW(service, 0, NULL) && GetLastError() != ERROR_SERVICE_ALREADY_RUNNING)
{
ERR("Failed to start service %s for device %s, error %u.\n",
debugstr_w(svc_name), debugstr_w(device->instanceId), GetLastError());
}
+ if (!ControlService(service, SERVICE_CONTROL_REENUMERATE_ROOT_DEVICES, &status))
+ {
+ ERR("Failed to control service %s for device %s, error %u.\n",
+ debugstr_w(svc_name), debugstr_w(device->instanceId), GetLastError());
+ }
CloseServiceHandle(service);
}
else
--
2.30.2
March 31, 2021