DMUSIC: fix in dmloader's behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



WB Raphael :)

I didn't have time to check it with Unreal2 demo (slow connection...),
but it should fix it.

ChangeLog:
 - fix dmloader's behavior to be more MS compliant

-- 
Rok Mandeljc <rok.mandeljc@gimb.org>

"Hold your position! Leave doubt for the dying!"
-- Tahngarth of the Weatherlight
diff -Nru Original/wine/dlls/dmloader/loader.c wine/dlls/dmloader/loader.c
--- Original/wine/dlls/dmloader/loader.c	2003-10-27 20:14:30.000000000 +0100
+++ wine/dlls/dmloader/loader.c	2003-10-27 19:41:04.000000000 +0100
@@ -312,14 +312,33 @@
 {
 	ICOM_THIS(IDirectMusicLoader8Impl,iface);
 	DMUS_OBJECTDESC ObjDesc;
+	WCHAR wzRealFilePath[MAX_PATH];
+	LPWSTR pwzRealFileName; /* dummy */
 	
 	TRACE("(%p, %s, %s, %s, %p): wrapping to IDirectMusicLoader8Impl_GetObject\n", This, debugstr_guid(rguidClassID), debugstr_guid(iidInterfaceID), debugstr_w(pwzFilePath), ppObject);
 	
 	ObjDesc.dwSize = sizeof(DMUS_OBJECTDESC);
 	ObjDesc.dwValidData = DMUS_OBJ_FILENAME | DMUS_OBJ_FULLPATH | DMUS_OBJ_CLASS; /* I believe I've read somewhere in MSDN that this function requires either full path or relative path */
 	ObjDesc.guidClass = *rguidClassID;
-	strncpyW (ObjDesc.wszFileName, pwzFilePath, MAX_PATH);
-
+	/* OK, MSDN says that search order is the following:
+	    - current directory (DONE)
+	    - windows search path (FIXME: how do I get that?)
+	    - loader's search path (DONE)
+	*/
+	if (SearchPathW (NULL, pwzFilePath, NULL, MAX_PATH, wzRealFilePath, &pwzRealFileName)) {
+		/* search in current directory */
+		strncpyW (ObjDesc.wszFileName, wzRealFilePath, MAX_PATH);
+	} else if (SearchPathW (This->wzSearchPath, pwzFilePath, NULL, MAX_PATH, wzRealFilePath, &pwzRealFileName)) {
+		/* search in loader's search path */
+		strncpyW (ObjDesc.wszFileName, wzRealFilePath, MAX_PATH);		
+	} else {
+		/* cannot find file */
+		TRACE("cannot find file\n");
+		return DMUS_E_LOADER_FAILEDOPEN;
+	}
+	
+	TRACE("full file path = %s\n", debugstr_w (ObjDesc.wszFileName));
+	
 	return IDirectMusicLoader8Impl_GetObject (iface, &ObjDesc, iidInterfaceID, ppObject);
 }
 
@@ -358,6 +377,7 @@
 		}
 		dmloader->lpVtbl = &DirectMusicLoader8_Vtbl;
 		dmloader->ref = 1;
+		MultiByteToWideChar (CP_ACP, 0, ".\\", -1, dmloader->wzSearchPath, MAX_PATH);
 		list_init (&dmloader->CacheList);
 		*ppDMLoad = (LPDIRECTMUSICLOADER8)dmloader;
 		return S_OK;

Attachment: signature.asc
Description: To je digitalno podpisan del =?iso-8859-2?Q?sporo=E8ila?=


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux