On 2020/9/10 11:12, Ziqing Hui wrote:
Signed-off-by: Ziqing Hui <zhui@codeweavers.com>
---
dlls/d3dx10_43/d3dx10_43_main.c | 13 +++++++++++--
dlls/d3dx10_43/tests/d3dx10.c | 4 +---
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/dlls/d3dx10_43/d3dx10_43_main.c b/dlls/d3dx10_43/d3dx10_43_main.c
index 3356ebd8b5..235c735a38 100644
--- a/dlls/d3dx10_43/d3dx10_43_main.c
+++ b/dlls/d3dx10_43/d3dx10_43_main.c
@@ -337,9 +337,18 @@ HRESULT WINAPI D3DX10GetFeatureLevel1(ID3D10Device *device, ID3D10Device1 **devi
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[MAX_PATH];
+ int str_len;
- return E_NOTIMPL;
+ TRACE("src_file %s, pump %p, info %p, result %p.\n", debugstr_a(src_file), pump, info, result);
+
+ if(!src_file) return E_FAIL;
Please add a space after 'if' and a new line before 'return E_FAIL'
+
+ str_len = MultiByteToWideChar(CP_ACP, 0, src_file, -1, buffer, ARRAY_SIZE(buffer));
You should dynamically allocate memory for 'buffer'. The file path
may be longer than MAX_PATH.
+ if (!str_len)
+ return HRESULT_FROM_WIN32(GetLastError());
+
+ return D3DX10GetImageInfoFromFileW(buffer, NULL, info, NULL);
Shouldn't you pass 'pump' and 'result' to
D3DX10GetImageInfoFromFileW?
It would be nice to have some tests for the 'result' parameter, it
looks like a return parameter that should be set.
}
HRESULT WINAPI D3DX10GetImageInfoFromFileW(const WCHAR *src_file, ID3DX10ThreadPump *pump, D3DX10_IMAGE_INFO *info,
diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c
index aca01fe847..6a4c92f100 100644
--- a/dlls/d3dx10_43/tests/d3dx10.c
+++ b/dlls/d3dx10_43/tests/d3dx10.c
@@ -1408,12 +1408,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)
{
@@ -1426,7 +1424,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__);