[PATCH 3/3] d3dx10: Implement D3DX10GetImageInfoFromFileA().

Matteo Bruni mbruni at codeweavers.com
Wed Sep 30 05:53:48 CDT 2020


From: Ziqing Hui <zhui at codeweavers.com>

Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
 dlls/d3dx10_43/tests/d3dx10.c |  4 +---
 dlls/d3dx10_43/texture.c      | 24 ++++++++++++++++++++++--
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c
index 02de73865f5e..897c54249b39 100644
--- a/dlls/d3dx10_43/tests/d3dx10.c
+++ b/dlls/d3dx10_43/tests/d3dx10.c
@@ -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__);
diff --git a/dlls/d3dx10_43/texture.c b/dlls/d3dx10_43/texture.c
index b87134514814..23d7b93e649c 100644
--- a/dlls/d3dx10_43/texture.c
+++ b/dlls/d3dx10_43/texture.c
@@ -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,
-- 
2.26.2




More information about the wine-devel mailing list