Message ID | CAHVN4mibLC4_r0YPZTfMR4tCZhs-ohCEsMu=QScQEVZ4PU9uwg@mail.gmail.com |
---|---|
State | Accepted |
Headers | show |
On Sat, Jul 1, 2017 at 3:18 PM, Matt Oliver <protogonoi@gmail.com> wrote: > This only enables dlls that are packaged with the application to be > loaded. Due to the limitations of WinRT/UWP it is not allowed to load > external/system dlls so this cannot be used as a complete replacement > for normal win32 dll loading. Most of the things we do load are system libraries, so does it really make sense to pretend it works? - Hendrik
On 2 July 2017 at 00:14, Hendrik Leppkes <h.leppkes@gmail.com> wrote: > On Sat, Jul 1, 2017 at 3:18 PM, Matt Oliver <protogonoi@gmail.com> wrote: > > This only enables dlls that are packaged with the application to be > > loaded. Due to the limitations of WinRT/UWP it is not allowed to load > > external/system dlls so this cannot be used as a complete replacement > > for normal win32 dll loading. > > Most of the things we do load are system libraries, so does it really > make sense to pretend it works? > No, but this was in response to a previous patch posted to the mailing list that just set the return to null. Its mainly just to prevent build errors when including the header and I figured that at least a function that works would be better than just returning null as this may be of use in the future. Of course all code we have wont work and should be handled specifically (like the recent dx lib linking) but i figured this was better than nothing.
On 2 July 2017 at 00:29, Matt Oliver <protogonoi@gmail.com> wrote: > On 2 July 2017 at 00:14, Hendrik Leppkes <h.leppkes@gmail.com> wrote: > >> On Sat, Jul 1, 2017 at 3:18 PM, Matt Oliver <protogonoi@gmail.com> wrote: >> > This only enables dlls that are packaged with the application to be >> > loaded. Due to the limitations of WinRT/UWP it is not allowed to load >> > external/system dlls so this cannot be used as a complete replacement >> > for normal win32 dll loading. >> >> Most of the things we do load are system libraries, so does it really >> make sense to pretend it works? >> > > No, but this was in response to a previous patch posted to the mailing > list that just set the return to null. Its mainly just to prevent build > errors when including the header and I figured that at least a function > that works would be better than just returning null as this may be of use > in the future. > Of course all code we have wont work and should be handled specifically > (like the recent dx lib linking) but i figured this was better than nothing. > Does anyone have any issue with me applying this?
On Sat, 1 Jul 2017 23:18:25 +1000 Matt Oliver <protogonoi@gmail.com> wrote: > This only enables dlls that are packaged with the application to be > loaded. Due to the limitations of WinRT/UWP it is not allowed to load > external/system dlls so this cannot be used as a complete replacement > for normal win32 dll loading. > --- > compat/w32dlfcn.h | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/compat/w32dlfcn.h b/compat/w32dlfcn.h > index bc9bb8c9f5..eeabfe4ee0 100644 > --- a/compat/w32dlfcn.h > +++ b/compat/w32dlfcn.h > @@ -21,7 +21,7 @@ > > #ifdef _WIN32 > #include <windows.h> > -#if _WIN32_WINNT < 0x0602 > +#if (_WIN32_WINNT < 0x0602) || HAVE_WINRT > #include "libavutil/wchar_filename.h" > #endif > /** > @@ -71,7 +71,14 @@ exit: > #ifndef LOAD_LIBRARY_SEARCH_SYSTEM32 > # define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800 > #endif > +#if !HAVE_WINRT Why not remove the ! and swap the if/else? > return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR > | LOAD_LIBRARY_SEARCH_SYSTEM32); > +#else > + wchar_t *name_w = NULL; > + if (utf8towchar(name, &name_w)) > + return NULL; > + return LoadPackagedLibrary(name_w, 0); Leaks memory? > +#endif > } > #define dlopen(name, flags) win32_dlopen(name) > #define dlclose FreeLibrary > --
On 12 July 2017 at 20:31, wm4 <nfxjfg@googlemail.com> wrote: > On Sat, 1 Jul 2017 23:18:25 +1000 > Matt Oliver <protogonoi@gmail.com> wrote: > > > This only enables dlls that are packaged with the application to be > > loaded. Due to the limitations of WinRT/UWP it is not allowed to load > > external/system dlls so this cannot be used as a complete replacement > > for normal win32 dll loading. > > --- > > compat/w32dlfcn.h | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/compat/w32dlfcn.h b/compat/w32dlfcn.h > > index bc9bb8c9f5..eeabfe4ee0 100644 > > --- a/compat/w32dlfcn.h > > +++ b/compat/w32dlfcn.h > > @@ -21,7 +21,7 @@ > > > > #ifdef _WIN32 > > #include <windows.h> > > -#if _WIN32_WINNT < 0x0602 > > +#if (_WIN32_WINNT < 0x0602) || HAVE_WINRT > > #include "libavutil/wchar_filename.h" > > #endif > > /** > > @@ -71,7 +71,14 @@ exit: > > #ifndef LOAD_LIBRARY_SEARCH_SYSTEM32 > > # define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800 > > #endif > > +#if !HAVE_WINRT > > Why not remove the ! and swap the if/else? > > > return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_ > APPLICATION_DIR > > | LOAD_LIBRARY_SEARCH_SYSTEM32); > > +#else > > + wchar_t *name_w = NULL; > > + if (utf8towchar(name, &name_w)) > > + return NULL; > > + return LoadPackagedLibrary(name_w, 0); > > Leaks memory? Your correct, thanks. New patch attached.
diff --git a/compat/w32dlfcn.h b/compat/w32dlfcn.h index bc9bb8c9f5..eeabfe4ee0 100644 --- a/compat/w32dlfcn.h +++ b/compat/w32dlfcn.h @@ -21,7 +21,7 @@ #ifdef _WIN32 #include <windows.h> -#if _WIN32_WINNT < 0x0602 +#if (_WIN32_WINNT < 0x0602) || HAVE_WINRT #include "libavutil/wchar_filename.h" #endif /** @@ -71,7 +71,14 @@ exit: #ifndef LOAD_LIBRARY_SEARCH_SYSTEM32 # define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800 #endif +#if !HAVE_WINRT return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32); +#else + wchar_t *name_w = NULL; + if (utf8towchar(name, &name_w)) + return NULL; + return LoadPackagedLibrary(name_w, 0); +#endif } #define dlopen(name, flags) win32_dlopen(name)