[PATCH 1/4] quartz: Pass a preferred allocator to IAsyncReader_RequestAllocator().

Eduard - Gabriel Munteanu eduard.munteanu at linux360.ro
Thu Aug 27 14:13:52 CDT 2009


This fixes a bug in Fallout 3 which prevents music from being played.
The game erroneously expects the passed preferred allocator to be
non-NULL (even though the specification allows it to be NULL). We fix it
by passing a StdMemAllocator() as the preferred one.

Many thanks to Chris Robinson <chris.kcat at gmail.com> for working with me
to track this down.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munteanu at linux360.ro>
---
 dlls/quartz/pin.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/dlls/quartz/pin.c b/dlls/quartz/pin.c
index 2e24d52..1947cc5 100644
--- a/dlls/quartz/pin.c
+++ b/dlls/quartz/pin.c
@@ -1121,6 +1121,7 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const
     PIN_DIRECTION pindirReceive;
     HRESULT hr = S_OK;
     PullPin *This = (PullPin *)iface;
+    IMemAllocator *prefAlloc;
 
     TRACE("(%p/%p)->(%p, %p)\n", This, iface, pReceivePin, pmt);
     dump_AM_MEDIA_TYPE(pmt);
@@ -1164,7 +1165,17 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const
 
         if (SUCCEEDED(hr))
         {
-            hr = IAsyncReader_RequestAllocator(This->pReader, NULL, &props, &This->pAlloc);
+            hr = StdMemAllocator_create(NULL, (LPVOID *) &prefAlloc);
+        }
+
+        if (SUCCEEDED(hr))
+        {
+            /*
+             * Some applications (e.g. Fallout 3) erroneously
+             * expect a non-NULL preferred allocator, so we'll pass one.
+             */
+            hr = IAsyncReader_RequestAllocator(This->pReader, prefAlloc, &props, &This->pAlloc);
+            IMemAllocator_Release(prefAlloc);
         }
 
         if (SUCCEEDED(hr))
-- 
1.6.0.6




More information about the wine-patches mailing list