<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <br>
    <br>
    <div class="moz-cite-prefix">On 2020/9/10 11:11, Ziqing Hui wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:a13bbc8d-3d1e-5f09-84fe-2c6bf267cfcf@codeweavers.com">
      <pre class="moz-quote-pre" wrap="">
Signed-off-by: Ziqing Hui <a class="moz-txt-link-rfc2396E" href="mailto:zhui@codeweavers.com"><zhui@codeweavers.com></a>
---
 dlls/d3dx10_43/d3dx10_43_main.c | 56 +++++++++++++++++++++++++++++++--
 dlls/d3dx10_43/tests/d3dx10.c   |  6 ++--
 2 files changed, 57 insertions(+), 5 deletions(-)


</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"><legend
          class="mimeAttachmentHeaderName">0001-d3dx10-Implement-D3DX10GetImageInfoFromFileW.patch</legend></fieldset>
      <pre class="moz-quote-pre" wrap="">diff --git a/dlls/d3dx10_43/d3dx10_43_main.c b/dlls/d3dx10_43/d3dx10_43_main.c
index 32d69ff8af..3356ebd8b5 100644
--- a/dlls/d3dx10_43/d3dx10_43_main.c
+++ b/dlls/d3dx10_43/d3dx10_43_main.c
@@ -106,6 +106,43 @@ static DXGI_FORMAT get_d3dx10_dds_format(DXGI_FORMAT format)
     return format;
 }
 
+static HRESULT map_file(const WCHAR *filename, void **buffer, DWORD *size)
+{
+    HANDLE file, mapping = NULL;
+    HRESULT hr = E_FAIL;
+
+    file = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
+    if(file == INVALID_HANDLE_VALUE)</pre>
    </blockquote>
    Space after 'if', you're using both styles in this function.<br>
    <br>
    <blockquote type="cite"
      cite="mid:a13bbc8d-3d1e-5f09-84fe-2c6bf267cfcf@codeweavers.com">
      <pre class="moz-quote-pre" wrap="">
+        goto end;
+
+    *size = GetFileSize(file, NULL);
+    if(*size == INVALID_FILE_SIZE)
+        goto end;
+
+    mapping = CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, NULL);
+    if(!mapping)
+        goto end;
+
+    *buffer = MapViewOfFile(mapping, FILE_MAP_READ, 0, 0, 0);
+    if(*buffer == NULL)
+        goto end;
+
+    hr = S_OK;
+
+end:
+    CloseHandle(mapping);
+    CloseHandle(file);
+
+    if (hr != S_OK)
+        hr = HRESULT_FROM_WIN32(GetLastError());
+    return hr;
+}
+
+static BOOL unmap_file(void *buffer)
+{
+    return UnmapViewOfFile(buffer);
+}
+
 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 {
     switch (fdwReason)
@@ -308,9 +345,24 @@ HRESULT WINAPI D3DX10GetImageInfoFromFileA(const char *src_file, ID3DX10ThreadPu
 HRESULT WINAPI D3DX10GetImageInfoFromFileW(const WCHAR *src_file, ID3DX10ThreadPump *pump, D3DX10_IMAGE_INFO *info,
         HRESULT *result)
 {
-    FIXME("src_file %s, pump %p, info %p, result %p\n", debugstr_w(src_file), pump, info, result);
+    DWORD size = 0;
+    void *buffer;
+    HRESULT hr;
 
-    return E_NOTIMPL;
+    TRACE("src_file %s, pump %p, info %p, result %p.\n", debugstr_w(src_file), pump, info, result);
+
+    if (!src_file)
+        return E_FAIL;
+
+    hr = map_file(src_file, &buffer, &size);
+    if (FAILED(hr))
+        return D3D10_ERROR_FILE_NOT_FOUND;
+
+    hr = D3DX10GetImageInfoFromMemory(buffer, size, NULL, info, NULL);
+
+    unmap_file(buffer);
+
+    return hr;
 }
 
 HRESULT WINAPI D3DX10GetImageInfoFromResourceA(HMODULE module, const char *resource, ID3DX10ThreadPump *pump,
diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c
index 640e83fcd0..a4b7360fa1 100644
--- a/dlls/d3dx10_43/tests/d3dx10.c
+++ b/dlls/d3dx10_43/tests/d3dx10.c
@@ -1383,12 +1383,12 @@ static void test_get_image_info(void)
         check_image_info(&image_info, i, __LINE__);
     }
 
-    todo_wine {
+    /* D3DX10GetImageInfoFromFile tests */
+
     hr = D3DX10GetImageInfoFromFileW(NULL, NULL, &image_info, NULL);
     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);
-    }
 
     for (i = 0; i < ARRAY_SIZE(test_image); ++i)
     {
@@ -1396,7 +1396,7 @@ static void test_get_image_info(void)
         hr = D3DX10GetImageInfoFromFileW(path, NULL, &image_info, NULL);
         delete_file(test_filename);
 
-        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)
             continue;

</pre>
    </blockquote>
    <br>
  </body>
</html>