[dmloader] Init hFile/pStream in creation

Peter Berg Larsen pebl at math.ku.dk
Mon Oct 17 18:48:40 CDT 2005


Changelog:
 	Init hFile/pStream in creation, as detach checks this variable.
         Happens because IDirectMusicLoader_GetObject calls create and then
 	attach, which calls detach as the first thing.


Index: dlls/dmloader/loaderstream.c
===================================================================
RCS file: /home/wine/wine/dlls/dmloader/loaderstream.c,v
retrieving revision 1.18
diff -p -u -r1.18 loaderstream.c
--- dlls/dmloader/loaderstream.c	26 Jul 2005 18:32:54 -0000	1.18
+++ dlls/dmloader/loaderstream.c	17 Oct 2005 23:45:51 -0000
@@ -73,9 +73,9 @@ HRESULT WINAPI IDirectMusicLoaderFileStr
  }

  void WINAPI IDirectMusicLoaderFileStream_Detach (LPSTREAM iface) {
-	ICOM_THIS_MULTI(IDirectMusicLoaderFileStream, StreamVtbl, iface);
-	TRACE("(%p)\n", This);
-	if (This->hFile != INVALID_HANDLE_VALUE) {
+    ICOM_THIS_MULTI(IDirectMusicLoaderFileStream, StreamVtbl, iface);
+    TRACE("(%p)\n", This);
+    if (This->hFile != INVALID_HANDLE_VALUE) {
          CloseHandle(This->hFile);
      }
      This->wzFileName[0] = (L'\0');
@@ -292,6 +292,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicL
  	obj->StreamVtbl = &DirectMusicLoaderFileStream_Stream_Vtbl;
  	obj->GetLoaderVtbl = &DirectMusicLoaderFileStream_GetLoader_Vtbl;
  	obj->dwRef = 0; /* will be inited with QueryInterface */
+	obj->hFile = INVALID_HANDLE_VALUE;

  	return IDirectMusicLoaderFileStream_IStream_QueryInterface ((LPSTREAM)&obj->StreamVtbl, &IID_IStream, ppobj);
  }
@@ -816,6 +817,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicL
  	obj->StreamVtbl = &DirectMusicLoaderGenericStream_Stream_Vtbl;
  	obj->GetLoaderVtbl = &DirectMusicLoaderGenericStream_GetLoader_Vtbl;
  	obj->dwRef = 0; /* will be inited with QueryInterface */
+	obj->pStream = NULL;

  	return IDirectMusicLoaderGenericStream_IStream_QueryInterface ((LPSTREAM)&obj->StreamVtbl, &IID_IStream, ppobj);
  }



More information about the wine-patches mailing list