[PATCH] Implement the missing process_extensions() function. This fixes bug #7879 - Mono (D3D Game) dies with an error about sound

Peter Dons Tychsen (none) donpedro at dhcppc4.
Tue Jan 1 19:50:54 CST 2008


---
 dlls/quartz/filesource.c |   53 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c
index 73c92b2..95410bb 100644
--- a/dlls/quartz/filesource.c
+++ b/dlls/quartz/filesource.c
@@ -64,8 +64,57 @@ static inline AsyncReader *impl_from_IFileSourceFilter( IFileSourceFilter *iface
 
 static HRESULT process_extensions(HKEY hkeyExtensions, LPCOLESTR pszFileName, GUID * majorType, GUID * minorType)
 {
-    /* FIXME: implement */
-    return E_NOTIMPL;
+    DWORD indexExt;
+    WCHAR keyName[0xFF];
+    WCHAR keyValue[0xFF];
+    DWORD keyLen = 0xFF;
+    WCHAR *ext;
+    HRESULT hr;
+
+    /* Start by getting the extension from the file name */
+    ext = strrchrW(pszFileName, '.');
+    if(!ext)
+    {
+        return E_FAIL; 
+    }
+
+    /* Now enumerate thru the extension keys */
+    for(indexExt=0;;indexExt++)
+    {
+        if((hr = RegEnumKeyExW(hkeyExtensions, indexExt, keyName, &keyLen, NULL, NULL, NULL, NULL)) != ERROR_SUCCESS)
+        {
+            ERR("Key open failed with %04X\n", hr);
+            break;
+        }
+
+        /* Check for match */
+        if(!strcmpW(keyName, ext))
+        {
+    	   static const WCHAR wszMediaType[] = {'M','e','d','i','a',' ','T','y','p','e',0};
+           static const WCHAR wszSubType[] = {'S','u','b','T','y','p','e',0};
+           keyLen = CHARS_IN_GUID * sizeof(WCHAR);    
+
+           /* Get the media major */
+           if((hr = RegGetValueW(hkeyExtensions, keyName, wszMediaType, RRF_RT_REG_SZ, NULL, keyValue, &keyLen)) != ERROR_SUCCESS)
+           {
+               ERR("Getting major failed with %04X\n", hr);
+               break;
+           }
+           CLSIDFromString(keyValue, majorType);
+           
+           /* Get the media minor */
+           if((hr = RegGetValueW(hkeyExtensions, keyName, wszSubType, RRF_RT_REG_SZ, NULL, keyValue, &keyLen)) != ERROR_SUCCESS)
+           {
+               ERR("Getting minor failed with %04X\n", hr);
+               break;
+           }
+           CLSIDFromString(keyValue, minorType);
+
+           return S_OK;
+        }
+    }
+
+    return E_FAIL;
 }
 
 static unsigned char byte_from_hex_char(WCHAR wHex)
-- 
1.5.3.6


--=-OKsHQNvncv6OG/X1dN8m--




More information about the wine-patches mailing list