Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/wmphoto/Makefile.in | 5 ++- dlls/wmphoto/jxrlib.c | 68 ++++++++++++++++++++++++++++++++++ dlls/wmphoto/main.c | 17 +++++++-- dlls/wmphoto/wmphoto_private.h | 31 ++++++++++++++++ 4 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 dlls/wmphoto/jxrlib.c create mode 100644 dlls/wmphoto/wmphoto_private.h
diff --git a/dlls/wmphoto/Makefile.in b/dlls/wmphoto/Makefile.in index 21dfce04fa6..37c879aed49 100644 --- a/dlls/wmphoto/Makefile.in +++ b/dlls/wmphoto/Makefile.in @@ -3,7 +3,10 @@ IMPORTS = windowscodecs uuid kernelbase PARENTSRC = ../windowscodecs
EXTRADLLFLAGS = -mno-cygwin +EXTRAINCL = $(JXRLIB_CFLAGS)
-C_SRCS = main.c +C_SRCS = \ + jxrlib.c \ + main.c
IDL_SRCS = wmphoto.idl diff --git a/dlls/wmphoto/jxrlib.c b/dlls/wmphoto/jxrlib.c new file mode 100644 index 00000000000..3fc78bee9de --- /dev/null +++ b/dlls/wmphoto/jxrlib.c @@ -0,0 +1,68 @@ +/* + * Copyright 2020 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "config.h" +#include "wine/port.h" + +#include <assert.h> +#include <stdarg.h> +#include <string.h> +#include <stdlib.h> + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "winternl.h" + +#include "wine/debug.h" + +#include "wmphoto_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wincodecs); + +#ifdef SONAME_LIBJXRGLUE +static void *libjxrglue; +#endif + +static const struct jxrlib_funcs jxrlib_funcs = +{ +}; + +NTSTATUS CDECL __wine_init_unix_lib(HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out) +{ + TRACE("module %p, reason %d, ptr_in %p, ptr_out %p\n", module, reason, ptr_in, ptr_out); + + if (reason != DLL_PROCESS_ATTACH) return STATUS_SUCCESS; + +#ifdef SONAME_LIBJXRGLUE + if (!(libjxrglue = dlopen(SONAME_LIBJXRGLUE, RTLD_NOW))) + { + WARN("failed to load %s\n", SONAME_LIBJXRGLUE); + return STATUS_DLL_NOT_FOUND; + } +#endif + + *(const struct jxrlib_funcs **)ptr_out = &jxrlib_funcs; + return STATUS_SUCCESS; +} diff --git a/dlls/wmphoto/main.c b/dlls/wmphoto/main.c index 5715d1676ae..83b5627f1af 100644 --- a/dlls/wmphoto/main.c +++ b/dlls/wmphoto/main.c @@ -26,14 +26,19 @@
#include "windef.h" #include "winbase.h" +#include "winternl.h" #include "objbase.h" #include "rpcproxy.h" #include "wincodecsdk.h"
#include "wine/debug.h"
+#include "wmphoto_private.h" + WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
+static const struct jxrlib_funcs *jxrlib_funcs; + struct wmp_decoder { IWICBitmapDecoder IWICBitmapDecoder_iface; @@ -292,13 +297,17 @@ static struct class_factory wmp_decoder_cf = {{&class_factory_vtbl}, wmp_decoder
static HINSTANCE WMPHOTO_hInstance;
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) { - switch (fdwReason) + TRACE("instance %p, reason %d, reserved %p\n", instance, reason, reserved); + + if (FAILED(__wine_init_unix_lib(instance, reason, NULL, &jxrlib_funcs))) return FALSE; + + switch (reason) { case DLL_PROCESS_ATTACH: - WMPHOTO_hInstance = hinstDLL; - DisableThreadLibraryCalls(hinstDLL); + WMPHOTO_hInstance = instance; + DisableThreadLibraryCalls(instance); break; case DLL_WINE_PREATTACH: return FALSE; /* prefer native version */ diff --git a/dlls/wmphoto/wmphoto_private.h b/dlls/wmphoto/wmphoto_private.h new file mode 100644 index 00000000000..dce7f018039 --- /dev/null +++ b/dlls/wmphoto/wmphoto_private.h @@ -0,0 +1,31 @@ +/* + * Copyright 2020 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef WMPHOTO_PRIVATE_H +#define WMPHOTO_PRIVATE_H + +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" + +struct jxrlib_funcs +{ +}; + +#endif /* WMPHOTO_PRIVATE_H */