[vlc-devel] libvlc os-specific path discovery

Geoffroy Couprie geo.couprie at gmail.com
Thu Jan 21 17:07:40 CET 2010


Hello,

On Thu, Jan 21, 2010 at 4:52 PM, Luca Barbato <lu_zero at gentoo.org> wrote:
> I updated the patch to get the right libvlc path in macosx and win32 to
> reside in the specific.c files.
>
> Please test them.
>

     wchar_t psz_wpath[MAX_PATH];
-    if( GetModuleFileName( NULL, psz_wpath, MAX_PATH ) )
+    if( VirtualQuery(system_Init, &mbi, sizeof(mbi) ) )
     {
-        WideCharToMultiByte( CP_UTF8, 0, psz_wpath, -1,
-                             psz_path, MAX_PATH, NULL, NULL );
+        HMODULE hMod = (HMODULE) mbi.AllocationBase;
+        if( GetModuleFileName( hMod, psz_wpath, MAX_PATH ) )

Why don't you use GetModuleHandle("libvlc.dll"), or GetModuleHandleEx
with GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS ? It would be more
readable that way.



More information about the vlc-devel mailing list