d3dx10: Implement D3DX10GetImageInfoFromFileA().

Signed-off-by: Ziqing Hui <zhui@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ziqing Hui 2020-09-30 12:53:48 +02:00 committed by Alexandre Julliard
parent a0fa7810e1
commit 937b585996
2 changed files with 23 additions and 5 deletions

View File

@ -1395,12 +1395,10 @@ static void test_get_image_info(void)
ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
hr = D3DX10GetImageInfoFromFileW(L"deadbeaf", NULL, &image_info, NULL);
ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Got unexpected hr %#x.\n", hr);
todo_wine {
hr = D3DX10GetImageInfoFromFileA(NULL, NULL, &image_info, NULL);
ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
hr = D3DX10GetImageInfoFromFileA("deadbeaf", NULL, &image_info, NULL);
ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Got unexpected hr %#x.\n", hr);
}
for (i = 0; i < ARRAY_SIZE(test_image); ++i)
{
@ -1413,7 +1411,7 @@ static void test_get_image_info(void)
check_image_info(&image_info, i, __LINE__);
hr = D3DX10GetImageInfoFromFileA(get_str_a(path), NULL, &image_info, NULL);
todo_wine
todo_wine_if(test_image[i].expected.ImageFileFormat == D3DX10_IFF_WMP)
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
if (hr == S_OK)
check_image_info(&image_info, i, __LINE__);

View File

@ -151,9 +151,29 @@ done:
HRESULT WINAPI D3DX10GetImageInfoFromFileA(const char *src_file, ID3DX10ThreadPump *pump, D3DX10_IMAGE_INFO *info,
HRESULT *result)
{
FIXME("src_file %s, pump %p, info %p, result %p\n", debugstr_a(src_file), pump, info, result);
WCHAR *buffer;
int str_len;
HRESULT hr;
return E_NOTIMPL;
TRACE("src_file %s, pump %p, info %p, result %p.\n", debugstr_a(src_file), pump, info, result);
if (!src_file || !info)
return E_FAIL;
str_len = MultiByteToWideChar(CP_ACP, 0, src_file, -1, NULL, 0);
if (!str_len)
return HRESULT_FROM_WIN32(GetLastError());
buffer = heap_alloc(str_len * sizeof(*buffer));
if (!buffer)
return E_OUTOFMEMORY;
MultiByteToWideChar(CP_ACP, 0, src_file, -1, buffer, str_len);
hr = D3DX10GetImageInfoFromFileW(buffer, pump, info, result);
heap_free(buffer);
return hr;
}
HRESULT WINAPI D3DX10GetImageInfoFromFileW(const WCHAR *src_file, ID3DX10ThreadPump *pump, D3DX10_IMAGE_INFO *info,