libs/vkd3d: Validate signal_event_pfn.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-01-19 17:17:23 +01:00 committed by Alexandre Julliard
parent 6a32ad8913
commit ebca1d3396
2 changed files with 14 additions and 7 deletions

View File

@ -221,6 +221,11 @@ static HRESULT vkd3d_instance_init(struct vkd3d_instance *instance,
VkResult vr;
HRESULT hr;
if (!create_info->signal_event_pfn)
{
ERR("Invalid signal event function pointer.\n");
return E_INVALIDARG;
}
if (!create_info->create_thread_pfn != !create_info->join_thread_pfn)
{
ERR("Invalid create/join thread function pointers.\n");

View File

@ -74,9 +74,7 @@ static void test_create_instance(void)
ULONG refcount;
HRESULT hr;
memset(&create_info, 0, sizeof(create_info));
create_info.wchar_size = sizeof(WCHAR);
create_info = instance_default_create_info;
hr = vkd3d_create_instance(&create_info, &instance);
ok(hr == S_OK, "Failed to create instance, hr %#x.\n", hr);
refcount = vkd3d_instance_incref(instance);
@ -85,11 +83,15 @@ static void test_create_instance(void)
refcount = vkd3d_instance_decref(instance);
ok(!refcount, "Instance has %u references left.\n", refcount);
create_info.signal_event_pfn = signal_event;
create_info = instance_default_create_info;
create_info.wchar_size = 1;
hr = vkd3d_create_instance(&create_info, &instance);
ok(hr == S_OK, "Failed to create instance, hr %#x.\n", hr);
refcount = vkd3d_instance_decref(instance);
ok(!refcount, "Instance has %u references left.\n", refcount);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
create_info = instance_default_create_info;
create_info.signal_event_pfn = NULL;
hr = vkd3d_create_instance(&create_info, &instance);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
}
static void test_create_device(void)