[dmloader] Create and Attach FileStream can fail

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


Changelog:
 	Create and Attach FileStream can fail. If so return
 	with error instead of continueing.


Index: dlls/dmloader/loader.c
===================================================================
RCS file: /home/wine/wine/dlls/dmloader/loader.c,v
retrieving revision 1.20
diff -p -u -r1.20 loader.c
--- dlls/dmloader/loader.c	26 Jul 2005 18:32:54 -0000	1.20
+++ dlls/dmloader/loader.c	17 Oct 2005 22:50:29 -0000
@@ -323,6 +323,7 @@ HRESULT WINAPI IDirectMusicLoaderImpl_ID
  	DMUS_OBJECTDESC Desc;
  	struct list *pEntry;
  	LPWINE_LOADER_ENTRY pObjectEntry, pNewEntry;
+	HRESULT result;

  	TRACE("(%p, %p): pDesc:\n%s\n", This, pDesc, debugstr_DMUS_OBJECTDESC(pDesc));

@@ -344,9 +345,17 @@ HRESULT WINAPI IDirectMusicLoaderImpl_ID
  			strcpyW(p, pDesc->wszFileName);
  		}
  		/* create stream */
-		DMUSIC_CreateDirectMusicLoaderFileStream ((LPVOID*)&pStream);
+		result = DMUSIC_CreateDirectMusicLoaderFileStream ((LPVOID*)&pStream);
+		if (FAILED(result)) {
+			WARN(": could not create loader stream\n");
+			return result;
+		}
  		/* attach stream */
-		IDirectMusicLoaderFileStream_Attach (pStream, wszFileName, iface);
+		result = IDirectMusicLoaderFileStream_Attach (pStream, wszFileName, (LPDIRECTMUSICLOADER)iface);
+		if (FAILED(result)) {
+			WARN(": could not attach to file %s\n",debugstr_w(wszFileName));
+			 return result;
+		}
  	}
  	else if (pDesc->dwValidData & DMUS_OBJ_STREAM) {
  		/* create stream */



More information about the wine-patches mailing list