[Dmime Dmloader] Mixed fixes to get ufo unknown running

Peter Berg Larsen pebl at math.ku.dk
Thu Aug 11 05:19:45 CDT 2005


Resent as it didnt showed up in wine-patches.

These fixes are needed to get ufo unknown up and running. The main problem
was to load gm.dls (which wine per default set to
c:/windows/system/drivers/gm.dls, but mine is in /system32/)


Changelog:
	Allow loading of gm.dls: Initialize hFile as it is accessed in Detach.
	Return in SetObject if cannot it find the file. Try harder, readonly, to open the
        file. AddPort with null parameter means default port.

Index: dlls/dmime/performance.c
===================================================================
RCS file: /home/wine/wine/dlls/dmime/performance.c,v
retrieving revision 1.26
diff -u -r1.26 performance.c
--- dlls/dmime/performance.c	21 Jun 2005 09:44:28 -0000	1.26
+++ dlls/dmime/performance.c	12 Jul 2005 21:22:34 -0000
@@ -511,7 +511,10 @@
 static HRESULT WINAPI IDirectMusicPerformance8Impl_AddPort (LPDIRECTMUSICPERFORMANCE8 iface, IDirectMusicPort* pPort) {
 	IDirectMusicPerformance8Impl *This = (IDirectMusicPerformance8Impl *)iface;
 	FIXME("(%p, %p): stub\n", This, pPort);
-	IDirectMusicPort_AddRef (pPort);
+	if (pPort == NULL) {
+		FIXME("Default port selected, but not implemented\n");
+	} else
+		IDirectMusicPort_AddRef (pPort);
 	return S_OK;
 }

Index: dlls/dmloader/loader.c
===================================================================
RCS file: /home/wine/wine/dlls/dmloader/loader.c,v
retrieving revision 1.19
diff -u -r1.19 loader.c
--- dlls/dmloader/loader.c	5 Jul 2005 11:02:54 -0000	1.19
+++ dlls/dmloader/loader.c	12 Jul 2005 21:22:46 -0000
@@ -323,6 +323,7 @@
 	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 @@
 			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, (LPDIRECTMUSICLOADER)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 */
Index: dlls/dmloader/loaderstream.c
===================================================================
RCS file: /home/wine/wine/dlls/dmloader/loaderstream.c,v
retrieving revision 1.17
diff -u -r1.17 loaderstream.c
--- dlls/dmloader/loaderstream.c	14 Jun 2005 11:38:09 -0000	1.17
+++ dlls/dmloader/loaderstream.c	12 Jul 2005 21:22:48 -0000
@@ -62,8 +62,12 @@
     IDirectMusicLoaderFileStream_Detach (iface);
     This->hFile = CreateFileW (wzFile, (GENERIC_READ | GENERIC_WRITE), (FILE_SHARE_READ | FILE_SHARE_WRITE), NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
     if (This->hFile == INVALID_HANDLE_VALUE) {
-        WARN(": failed\n");
-        return DMUS_E_LOADER_FAILEDOPEN;
+        TRACE(": trying read only\n");
+        This->hFile = CreateFileW (wzFile, GENERIC_READ, (FILE_SHARE_READ | FILE_SHARE_WRITE), NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+        if (This->hFile == INVALID_HANDLE_VALUE) {
+            WARN(": failed\n");
+            return DMUS_E_LOADER_FAILEDOPEN;
+	}
     }
     /* create IDirectMusicGetLoader */
     This->pLoader = (LPDIRECTMUSICLOADER8)pLoader;
@@ -73,9 +77,9 @@
 }

 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 +296,7 @@
 	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);
 }





More information about the wine-patches mailing list