[Scummvm-cvs-logs] SF.net SVN: scummvm: [29299] scummvm/trunk/backends/plugins/win32/ win32-provider.cpp

knakos at users.sourceforge.net knakos at users.sourceforge.net
Sun Oct 28 18:53:53 CET 2007


Revision: 29299
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29299&view=rev
Author:   knakos
Date:     2007-10-28 10:53:52 -0700 (Sun, 28 Oct 2007)

Log Message:
-----------
unicod-ify syscalls for ce backend

Modified Paths:
--------------
    scummvm/trunk/backends/plugins/win32/win32-provider.cpp

Modified: scummvm/trunk/backends/plugins/win32/win32-provider.cpp
===================================================================
--- scummvm/trunk/backends/plugins/win32/win32-provider.cpp	2007-10-28 17:50:08 UTC (rev 29298)
+++ scummvm/trunk/backends/plugins/win32/win32-provider.cpp	2007-10-28 17:53:52 UTC (rev 29299)
@@ -37,12 +37,28 @@
 
 
 class Win32Plugin : public DynamicPlugin {
+private:
+	static const TCHAR* toUnicode(const char *x) {
+	#ifndef _WIN32_WCE
+		return (const TCHAR *)x;
+	#else
+		static TCHAR unicodeString[MAX_PATH];
+		MultiByteToWideChar(CP_ACP, 0, x, strlen(x) + 1, unicodeString, sizeof(unicodeString) / sizeof(TCHAR));
+		return unicodeString;
+	#endif
+	}
+
+
 protected:
 	void *_dlHandle;
 	Common::String _filename;
 
 	virtual VoidFunc findSymbol(const char *symbol) {
+		#ifndef _WIN32_WCE
 		void *func = (void *)GetProcAddress((HMODULE)_dlHandle, symbol);
+		#else
+		void *func = (void *)GetProcAddress((HMODULE)_dlHandle, toUnicode(symbol));
+		#endif
 		if (!func)
 			warning("Failed loading symbol '%s' from plugin '%s'", symbol, _filename.c_str());
 	
@@ -62,10 +78,14 @@
 
 	bool loadPlugin() {
 		assert(!_dlHandle);
+		#ifndef _WIN32_WCE
 		_dlHandle = LoadLibrary(_filename.c_str());
+		#else
+		_dlHandle = LoadLibrary(toUnicode(_filename.c_str()));
+		#endif
 	
 		if (!_dlHandle) {
-			warning("Failed loading plugin '%s'", _filename.c_str());
+			warning("Failed loading plugin '%s' (error code %d)", _filename.c_str(), GetLastError());
 			return false;
 		}
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list