winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
May 2020
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
743 discussions
Start a n
N
ew thread
Alexandre Julliard : ntdll: Do the pre-exec checks in the Unix library.
by Alexandre Julliard
18 May '20
18 May '20
Module: wine Branch: master Commit: 50134cce826de71afeb1d30a366364f57ec9769a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=50134cce826de71afeb1d30a…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sun May 17 11:11:28 2020 +0200 ntdll: Do the pre-exec checks in the Unix library. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/loader.c | 134 +++++++++++++++++++++++++++++++++++++++++++++++ loader/main.c | 16 +++--- 2 files changed, 142 insertions(+), 8 deletions(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index a8e7530c0c..73dfb7b6c7 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -26,11 +26,15 @@ #include "wine/port.h" #include <assert.h> +#include <errno.h> #include <stdarg.h> #include <stdio.h> #ifdef HAVE_SYS_MMAN_H # include <sys/mman.h> #endif +#ifdef HAVE_SYS_RESOURCE_H +# include <sys/resource.h> +#endif #ifdef HAVE_SYS_UTSNAME_H #include <sys/utsname.h> #endif @@ -558,6 +562,121 @@ static void apple_main_thread(void) } #endif /* __APPLE__ */ + +#ifdef __ANDROID__ + +static int pre_exec(void) +{ +#if defined(__i386__) || defined(__x86_64__) + return 1; /* we have a preloader */ +#else + return 0; /* no exec needed */ +#endif +} + +#elif defined(__linux__) && (defined(__i386__) || defined(__arm__)) + +static void check_vmsplit( void *stack ) +{ + if (stack < (void *)0x80000000) + { + /* if the stack is below 0x80000000, assume we can safely try a munmap there */ + if (munmap( (void *)0x80000000, 1 ) == -1 && errno == EINVAL) + ERR( "Warning: memory above 0x80000000 doesn't seem to be accessible.\n" + "Wine requires a 3G/1G user/kernel memory split to work properly.\n" ); + } +} + +static void set_max_limit( int limit ) +{ + struct rlimit rlimit; + + if (!getrlimit( limit, &rlimit )) + { + rlimit.rlim_cur = rlimit.rlim_max; + setrlimit( limit, &rlimit ); + } +} + +static int pre_exec(void) +{ + int temp; + + check_vmsplit( &temp ); + set_max_limit( RLIMIT_AS ); +#ifdef __i386__ + return 1; /* we have a preloader on x86 */ +#else + return 0; +#endif +} + +#elif defined(__linux__) && (defined(__x86_64__) || defined(__aarch64__)) + +static int pre_exec(void) +{ + return 1; /* we have a preloader on x86-64/arm64 */ +} + +#elif defined(__APPLE__) && (defined(__i386__) || defined(__x86_64__)) + +static int pre_exec(void) +{ + return 1; /* we have a preloader */ +} + +#elif (defined(__FreeBSD__) || defined (__FreeBSD_kernel__) || defined(__DragonFly__)) + +static int pre_exec(void) +{ + struct rlimit rl; + + rl.rlim_cur = 0x02000000; + rl.rlim_max = 0x02000000; + setrlimit( RLIMIT_DATA, &rl ); + return 1; +} + +#else + +static int pre_exec(void) +{ + return 0; /* no exec needed */ +} + +#endif + + +/*********************************************************************** + * check_command_line + * + * Check if command line is one that needs to be handled specially. + */ +static void check_command_line( int argc, char *argv[] ) +{ + static const char usage[] = + "Usage: wine PROGRAM [ARGUMENTS...] Run the specified program\n" + " wine --help Display this help and exit\n" + " wine --version Output version information and exit"; + + if (argc <= 1) + { + fprintf( stderr, "%s\n", usage ); + exit(1); + } + if (!strcmp( argv[1], "--help" )) + { + printf( "%s\n", usage ); + exit(0); + } + if (!strcmp( argv[1], "--version" )) + { + printf( "%s\n", get_build_id() ); + exit(0); + } +} + + /*********************************************************************** * __wine_main * @@ -571,6 +690,21 @@ void __wine_main( int argc, char *argv[], char *envp[] ) HMODULE module; wine_init_argv0_path( argv[0] ); + + if (!getenv( "WINELOADERNOEXEC" )) /* first time around */ + { + static char noexec[] = "WINELOADERNOEXEC=1"; + + putenv( noexec ); + check_command_line( argc, argv ); + if (pre_exec()) + { + wine_exec_wine_binary( NULL, argv, getenv( "WINELOADER" )); + ERR( "could not exec the wine loader\n" ); + exit(1); + } + } + __wine_main_argc = argc; __wine_main_argv = argv; __wine_main_environ = envp; diff --git a/loader/main.c b/loader/main.c index 9f9165ff93..0e6b6f66b5 100644 --- a/loader/main.c +++ b/loader/main.c @@ -279,6 +279,14 @@ int main( int argc, char *argv[] ) int i; void *handle; + if ((handle = load_ntdll( argv[0] ))) + { + void (*init_func)(int, char **, char **) = dlsym( handle, "__wine_main" ); + if (init_func) init_func( argc, argv, environ ); + fprintf( stderr, "wine: __wine_main function not found in ntdll.so\n" ); + exit(1); + } + if (!getenv( "WINELOADERNOEXEC" )) /* first time around */ { static char noexec[] = "WINELOADERNOEXEC=1"; @@ -294,14 +302,6 @@ int main( int argc, char *argv[] ) } } - if ((handle = load_ntdll( argv[0] ))) - { - void (*init_func)(int, char **, char **) = dlsym( handle, "__wine_main" ); - if (init_func) init_func( argc, argv, environ ); - fprintf( stderr, "wine: __wine_main function not found in ntdll.so\n" ); - exit(1); - } - if (wine_main_preload_info) { for (i = 0; wine_main_preload_info[i].size; i++)
1
0
0
0
Alexandre Julliard : ntdll: Move the Wine version functions to the Unix library.
by Alexandre Julliard
18 May '20
18 May '20
Module: wine Branch: master Commit: 9b8afa0f83f2fc576723a0262ee17f32055b25d2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9b8afa0f83f2fc576723a026…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sun May 17 11:09:30 2020 +0200 ntdll: Move the Wine version functions to the Unix library. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/Makefile.in | 8 ++++++++ dlls/ntdll/misc.c | 24 +++--------------------- dlls/ntdll/unix/loader.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/unixlib.h | 5 +++++ tools/makedep.c | 5 ++++- 5 files changed, 68 insertions(+), 22 deletions(-) diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in index f1ecb395e3..ebf607e9d4 100644 --- a/dlls/ntdll/Makefile.in +++ b/dlls/ntdll/Makefile.in @@ -59,9 +59,17 @@ C_SRCS = \ RC_SRCS = version.rc +EXTRA_OBJS = unix/version.o + server_EXTRADEFS = \ -DBINDIR=\"${bindir}\" \ -DDLLDIR=\"${dlldir}\" \ -DBIN_TO_DLLDIR=\"`$(MAKEDEP) -R ${bindir} ${dlldir}`\" \ -DDLL_TO_BINDIR=\"`$(MAKEDEP) -R ${dlldir} ${bindir}`\" \ -DBIN_TO_DATADIR=\"`$(MAKEDEP) -R ${bindir} ${datadir}/wine`\" + +unix/version.c: dummy + version=`(GIT_DIR=$(top_srcdir)/.git git describe HEAD 2>/dev/null || echo "wine-$(PACKAGE_VERSION)") | sed -n -e '$$s/\(.*\)/const char wine_build[] = "\1";/p'` && (echo $$version | cmp -s - $@) || echo $$version >$@ || (rm -f $@ && exit 1) + +dummy: +.PHONY: dummy diff --git a/dlls/ntdll/misc.c b/dlls/ntdll/misc.c index c29a1c26c2..fd9ba49113 100644 --- a/dlls/ntdll/misc.c +++ b/dlls/ntdll/misc.c @@ -23,13 +23,9 @@ #include <time.h> #include <math.h> -#ifdef HAVE_SYS_UTSNAME_H -#include <sys/utsname.h> -#endif #include "ntstatus.h" #define WIN32_NO_STATUS -#include "wine/library.h" #include "wine/debug.h" #include "ntdll_misc.h" #include "wmistr.h" @@ -57,7 +53,7 @@ LPCSTR debugstr_us( const UNICODE_STRING *us ) */ const char * CDECL NTDLL_wine_get_version(void) { - return wine_get_version(); + return unix_funcs->get_version(); } /********************************************************************* @@ -65,7 +61,7 @@ const char * CDECL NTDLL_wine_get_version(void) */ const char * CDECL NTDLL_wine_get_build_id(void) { - return wine_get_build_id(); + return unix_funcs->get_build_id(); } /********************************************************************* @@ -73,21 +69,7 @@ const char * CDECL NTDLL_wine_get_build_id(void) */ void CDECL NTDLL_wine_get_host_version( const char **sysname, const char **release ) { -#ifdef HAVE_SYS_UTSNAME_H - static struct utsname buf; - static BOOL init_done; - - if (!init_done) - { - uname( &buf ); - init_done = TRUE; - } - if (sysname) *sysname = buf.sysname; - if (release) *release = buf.release; -#else - if (sysname) *sysname = ""; - if (release) *release = ""; -#endif + return unix_funcs->get_host_version( sysname, release ); } /********************************************************************* diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index fdcca55beb..a8e7530c0c 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -31,6 +31,9 @@ #ifdef HAVE_SYS_MMAN_H # include <sys/mman.h> #endif +#ifdef HAVE_SYS_UTSNAME_H +#include <sys/utsname.h> +#endif #ifdef __APPLE__ # include <CoreFoundation/CoreFoundation.h> # define LoadResource MacLoadResource @@ -101,6 +104,48 @@ static void fixup_so_resources( IMAGE_RESOURCE_DIRECTORY *dir, BYTE *root, int d } +/********************************************************************* + * get_version + */ +const char * CDECL get_version(void) +{ + return PACKAGE_VERSION; +} + + +/********************************************************************* + * get_build_id + */ +const char * CDECL get_build_id(void) +{ + extern const char wine_build[]; + return wine_build; +} + + +/********************************************************************* + * get_host_version + */ +void CDECL get_host_version( const char **sysname, const char **release ) +{ +#ifdef HAVE_SYS_UTSNAME_H + static struct utsname buf; + static BOOL init_done; + + if (!init_done) + { + uname( &buf ); + init_done = TRUE; + } + if (sysname) *sysname = buf.sysname; + if (release) *release = buf.release; +#else + if (sysname) *sysname = ""; + if (release) *release = ""; +#endif +} + + /************************************************************************* * map_so_dll * @@ -379,6 +424,9 @@ static HMODULE load_ntdll(void) */ static struct unix_funcs unix_funcs = { + get_version, + get_build_id, + get_host_version, map_so_dll, mmap_add_reserved_area, mmap_remove_reserved_area, diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index 753dea6acc..62ba2615ba 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -28,6 +28,11 @@ struct unix_funcs { + /* environment functions */ + const char * (CDECL *get_version)(void); + const char * (CDECL *get_build_id)(void); + void (CDECL *get_host_version)( const char **sysname, const char **release ); + /* virtual memory functions */ NTSTATUS (CDECL *map_so_dll)( const IMAGE_NT_HEADERS *nt_descr, HMODULE module ); void (CDECL *mmap_add_reserved_area)( void *addr, SIZE_T size ); diff --git a/tools/makedep.c b/tools/makedep.c index 193de2d4d8..cde07f669c 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -1969,7 +1969,10 @@ static void add_generated_sources( struct makefile *make ) { /* default to .c for unknown extra object files */ if (strendswith( objs.str[i], ".o" )) - add_generated_source( make, objs.str[i], replace_extension( objs.str[i], ".o", ".c" )); + { + file = add_generated_source( make, objs.str[i], replace_extension( objs.str[i], ".o", ".c" )); + if (make->module || make->staticlib) file->file->flags |= FLAG_C_UNIX; + } else if (strendswith( objs.str[i], ".res" )) add_generated_source( make, replace_extension( objs.str[i], ".res", ".rc" ), NULL ); else
1
0
0
0
Alexandre Julliard : ntdll: Move the debug functions to the Unix library.
by Alexandre Julliard
18 May '20
18 May '20
Module: wine Branch: master Commit: 2424742d0711914f02864bcfb945605825b199a3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2424742d0711914f02864bcf…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sun May 17 11:07:02 2020 +0200 ntdll: Move the debug functions to the Unix library. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/Makefile.in | 2 +- dlls/ntdll/thread.c | 37 ++++++++++++++++++++++++++++++- dlls/ntdll/{debugtools.c => unix/debug.c} | 8 +++++-- dlls/ntdll/unix/loader.c | 18 ++++++++++----- dlls/ntdll/unix/unix_private.h | 2 ++ dlls/ntdll/unixlib.h | 12 +++++++++- 6 files changed, 69 insertions(+), 10 deletions(-) diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in index 699c97a1ce..f1ecb395e3 100644 --- a/dlls/ntdll/Makefile.in +++ b/dlls/ntdll/Makefile.in @@ -13,7 +13,6 @@ C_SRCS = \ critsection.c \ crypt.c \ debugbuffer.c \ - debugtools.c \ directory.c \ env.c \ error.c \ @@ -51,6 +50,7 @@ C_SRCS = \ thread.c \ threadpool.c \ time.c \ + unix/debug.c \ unix/loader.c \ unix/virtual.c \ version.c \ diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index 0fc8aa9e92..2de2804f8c 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -152,6 +152,41 @@ static ULONG_PTR get_image_addr(void) #endif +/*********************************************************************** + * __wine_dbg_get_channel_flags (NTDLL.@) + * + * Get the flags to use for a given channel, possibly setting them too in case of lazy init + */ +unsigned char __cdecl __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel ) +{ + return unix_funcs->dbg_get_channel_flags( channel ); +} + +/*********************************************************************** + * __wine_dbg_strdup (NTDLL.@) + */ +const char * __cdecl __wine_dbg_strdup( const char *str ) +{ + return unix_funcs->dbg_strdup( str ); +} + +/*********************************************************************** + * __wine_dbg_header (NTDLL.@) + */ +int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_channel *channel, + const char *function ) +{ + return unix_funcs->dbg_header( cls, channel, function ); +} + +/*********************************************************************** + * __wine_dbg_output (NTDLL.@) + */ +int __cdecl __wine_dbg_output( const char *str ) +{ + return unix_funcs->dbg_output( str ); +} + /*********************************************************************** * set_process_name * @@ -345,7 +380,7 @@ TEB *thread_init(void) thread_data->wait_fd[0] = -1; thread_data->wait_fd[1] = -1; - debug_init(); + unix_funcs->dbg_init(); init_paths(); set_process_name( __wine_main_argc, __wine_main_argv ); diff --git a/dlls/ntdll/debugtools.c b/dlls/ntdll/unix/debug.c similarity index 99% rename from dlls/ntdll/debugtools.c rename to dlls/ntdll/unix/debug.c index 546d527323..7bc7787c9d 100644 --- a/dlls/ntdll/debugtools.c +++ b/dlls/ntdll/unix/debug.c @@ -18,6 +18,10 @@ * 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" @@ -280,9 +284,9 @@ int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_ } /*********************************************************************** - * debug_init + * dbg_init */ -void debug_init(void) +void CDECL dbg_init(void) { setbuf( stdout, NULL ); setbuf( stderr, NULL ); diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index c974f526a1..fdcca55beb 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -51,6 +51,9 @@ #include "winternl.h" #include "unix_private.h" #include "wine/library.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(ntdll); extern IMAGE_NT_HEADERS __wine_spec_nt_header; extern void CDECL __wine_set_unix_funcs( int version, const struct unix_funcs *funcs ); @@ -319,13 +322,13 @@ static void fixup_ntdll_imports( const IMAGE_NT_HEADERS *nt, HMODULE ntdll_modul { int ordinal = IMAGE_ORDINAL( import_list->u1.Ordinal ) - ntdll_exports->Base; thunk_list->u1.Function = find_ordinal_export( ntdll_module, ntdll_exports, ordinal ); - if (!thunk_list->u1.Function) fprintf( stderr, "ntdll: ordinal %u not found\n", ordinal ); + if (!thunk_list->u1.Function) ERR( "ordinal %u not found\n", ordinal ); } else /* import by name */ { IMAGE_IMPORT_BY_NAME *pe_name = get_rva( nt, import_list->u1.AddressOfData ); thunk_list->u1.Function = find_named_export( ntdll_module, ntdll_exports, pe_name ); - if (!thunk_list->u1.Function) fprintf( stderr, "ntdll: %s not found\n", pe_name->Name ); + if (!thunk_list->u1.Function) ERR( "%s not found\n", pe_name->Name ); } import_list++; thunk_list++; @@ -348,7 +351,7 @@ static HMODULE load_ntdll(void) if (!dladdr( load_ntdll, &info )) { - fprintf( stderr, "cannot get path to ntdll.so\n" ); + ERR( "cannot get path to ntdll.so\n" ); exit(1); } name = malloc( strlen(info.dli_fname) + 5 ); @@ -356,12 +359,12 @@ static HMODULE load_ntdll(void) strcpy( name + strlen(info.dli_fname) - 3, ".dll.so" ); if (!(handle = dlopen( name, RTLD_NOW ))) { - fprintf( stderr, "failed to load %s: %s\n", name, dlerror() ); + ERR( "failed to load %s: %s\n", name, dlerror() ); exit(1); } if (!(nt = dlsym( handle, "__wine_spec_nt_header" ))) { - fprintf( stderr, "NT header not found in %s (too old?)\n", name ); + ERR( "NT header not found in %s (too old?)\n", name ); exit(1); } free( name ); @@ -381,6 +384,11 @@ static struct unix_funcs unix_funcs = mmap_remove_reserved_area, mmap_is_in_reserved_area, mmap_enum_reserved_areas, + dbg_init, + __wine_dbg_get_channel_flags, + __wine_dbg_strdup, + __wine_dbg_output, + __wine_dbg_header, }; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index d7f5778902..663036a699 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -31,4 +31,6 @@ int CDECL mmap_enum_reserved_areas( int (CDECL *enum_func)(void *base, SIZE_T s extern void virtual_init(void) DECLSPEC_HIDDEN; +extern void CDECL dbg_init(void) DECLSPEC_HIDDEN; + #endif /* __NTDLL_UNIX_PRIVATE_H */ diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index 54eedc1a25..753dea6acc 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -21,8 +21,10 @@ #ifndef __NTDLL_UNIXLIB_H #define __NTDLL_UNIXLIB_H +#include "wine/debug.h" + /* increment this when you change the function table */ -#define NTDLL_UNIXLIB_VERSION 2 +#define NTDLL_UNIXLIB_VERSION 3 struct unix_funcs { @@ -33,6 +35,14 @@ struct unix_funcs int (CDECL *mmap_is_in_reserved_area)( void *addr, SIZE_T size ); int (CDECL *mmap_enum_reserved_areas)( int (CDECL *enum_func)(void *base, SIZE_T size, void *arg), void *arg, int top_down ); + + /* debugging functions */ + void (CDECL *dbg_init)(void); + unsigned char (CDECL *dbg_get_channel_flags)( struct __wine_debug_channel *channel ); + const char * (CDECL *dbg_strdup)( const char *str ); + int (CDECL *dbg_output)( const char *str ); + int (CDECL *dbg_header)( enum __wine_debug_class cls, struct __wine_debug_channel *channel, + const char *function ); }; #endif /* __NTDLL_UNIXLIB_H */
1
0
0
0
Alexandre Julliard : ntdll: Store reserved areas in the Unix library.
by Alexandre Julliard
18 May '20
18 May '20
Module: wine Branch: master Commit: aaa654abd678ce06ce34ca260425d0b79e223b2e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=aaa654abd678ce06ce34ca26…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sun May 17 11:05:02 2020 +0200 ntdll: Store reserved areas in the Unix library. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/loader.c | 8 +++ dlls/ntdll/unix/virtual.c | 160 +++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 151 insertions(+), 17 deletions(-) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 0591c77434..c974f526a1 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -528,6 +528,13 @@ void __wine_main( int argc, char *argv[], char *envp[] ) __wine_set_unix_funcs( NTDLL_UNIXLIB_VERSION, &unix_funcs ); } + +static int add_area( void *base, size_t size, void *arg ) +{ + mmap_add_reserved_area( base, size ); + return 0; +} + /*********************************************************************** * __wine_init_unix_lib * @@ -540,6 +547,7 @@ NTSTATUS __cdecl __wine_init_unix_lib( HMODULE module, const void *ptr_in, void map_so_dll( nt, module ); fixup_ntdll_imports( &__wine_spec_nt_header, module ); *(struct unix_funcs **)ptr_out = &unix_funcs; + wine_mmap_enum_reserved_areas( add_area, NULL, 0 ); return STATUS_SUCCESS; } diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 972cbfdca8..88cd1eb1cf 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -45,7 +45,7 @@ #include "winnt.h" #include "winternl.h" #include "unix_private.h" -#include "wine/library.h" +#include "wine/list.h" struct preload_info { @@ -53,6 +53,15 @@ struct preload_info size_t size; }; +struct reserved_area +{ + struct list entry; + void *base; + size_t size; +}; + +static struct list reserved_areas = LIST_INIT(reserved_areas); + static const unsigned int granularity_mask = 0xffff; /* reserved areas have 64k granularity */ extern IMAGE_NT_HEADERS __wine_spec_nt_header; @@ -202,36 +211,153 @@ static void mmap_init( const struct preload_info *preload_info ) void CDECL mmap_add_reserved_area( void *addr, SIZE_T size ) { - wine_mmap_add_reserved_area( addr, size ); + struct reserved_area *area; + struct list *ptr; + + if (!((char *)addr + size)) size--; /* avoid wrap-around */ + + LIST_FOR_EACH( ptr, &reserved_areas ) + { + area = LIST_ENTRY( ptr, struct reserved_area, entry ); + if (area->base > addr) + { + /* try to merge with the next one */ + if ((char *)addr + size == (char *)area->base) + { + area->base = addr; + area->size += size; + return; + } + break; + } + else if ((char *)area->base + area->size == (char *)addr) + { + /* merge with the previous one */ + area->size += size; + + /* try to merge with the next one too */ + if ((ptr = list_next( &reserved_areas, ptr ))) + { + struct reserved_area *next = LIST_ENTRY( ptr, struct reserved_area, entry ); + if ((char *)addr + size == (char *)next->base) + { + area->size += next->size; + list_remove( &next->entry ); + free( next ); + } + } + return; + } + } + + if ((area = malloc( sizeof(*area) ))) + { + area->base = addr; + area->size = size; + list_add_before( ptr, &area->entry ); + } } void CDECL mmap_remove_reserved_area( void *addr, SIZE_T size ) { - wine_mmap_remove_reserved_area( addr, size, 0 ); -} + struct reserved_area *area; + struct list *ptr; -int CDECL mmap_is_in_reserved_area( void *addr, SIZE_T size ) -{ - return wine_mmap_is_in_reserved_area( addr, size ); + if (!((char *)addr + size)) size--; /* avoid wrap-around */ + + ptr = list_head( &reserved_areas ); + /* find the first area covering address */ + while (ptr) + { + area = LIST_ENTRY( ptr, struct reserved_area, entry ); + if ((char *)area->base >= (char *)addr + size) break; /* outside the range */ + if ((char *)area->base + area->size > (char *)addr) /* overlaps range */ + { + if (area->base >= addr) + { + if ((char *)area->base + area->size > (char *)addr + size) + { + /* range overlaps beginning of area only -> shrink area */ + area->size -= (char *)addr + size - (char *)area->base; + area->base = (char *)addr + size; + break; + } + else + { + /* range contains the whole area -> remove area completely */ + ptr = list_next( &reserved_areas, ptr ); + list_remove( &area->entry ); + free( area ); + continue; + } + } + else + { + if ((char *)area->base + area->size > (char *)addr + size) + { + /* range is in the middle of area -> split area in two */ + struct reserved_area *new_area = malloc( sizeof(*new_area) ); + if (new_area) + { + new_area->base = (char *)addr + size; + new_area->size = (char *)area->base + area->size - (char *)new_area->base; + list_add_after( ptr, &new_area->entry ); + } + else size = (char *)area->base + area->size - (char *)addr; + area->size = (char *)addr - (char *)area->base; + break; + } + else + { + /* range overlaps end of area only -> shrink area */ + area->size = (char *)addr - (char *)area->base; + } + } + } + ptr = list_next( &reserved_areas, ptr ); + } } -struct enum_data +int CDECL mmap_is_in_reserved_area( void *addr, SIZE_T size ) { - int (CDECL *enum_func)( void *base, SIZE_T size, void *arg ); - void *arg; -}; + struct reserved_area *area; + struct list *ptr; -static int enum_wrapper( void *base, size_t size, void *arg ) -{ - struct enum_data *data = arg; - return data->enum_func( base, size, data->arg ); + LIST_FOR_EACH( ptr, &reserved_areas ) + { + area = LIST_ENTRY( ptr, struct reserved_area, entry ); + if (area->base > addr) break; + if ((char *)area->base + area->size <= (char *)addr) continue; + /* area must contain block completely */ + if ((char *)area->base + area->size < (char *)addr + size) return -1; + return 1; + } + return 0; } int CDECL mmap_enum_reserved_areas( int (CDECL *enum_func)(void *base, SIZE_T size, void *arg), void *arg, int top_down ) { - struct enum_data data = { enum_func, arg }; - return wine_mmap_enum_reserved_areas( enum_wrapper, &data, top_down ); + int ret = 0; + struct list *ptr; + + if (top_down) + { + for (ptr = reserved_areas.prev; ptr != &reserved_areas; ptr = ptr->prev) + { + struct reserved_area *area = LIST_ENTRY( ptr, struct reserved_area, entry ); + if ((ret = enum_func( area->base, area->size, arg ))) break; + } + } + else + { + for (ptr = reserved_areas.next; ptr != &reserved_areas; ptr = ptr->next) + { + struct reserved_area *area = LIST_ENTRY( ptr, struct reserved_area, entry ); + if ((ret = enum_func( area->base, area->size, arg ))) break; + } + } + return ret; } void virtual_init(void)
1
0
0
0
Alexandre Julliard : ntdll: Move the mmap reserved area functions to the Unix library.
by Alexandre Julliard
18 May '20
18 May '20
Module: wine Branch: master Commit: 625209433fa82e233a828329e9e109602f9c0ef0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=625209433fa82e233a828329…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sun May 17 11:04:47 2020 +0200 ntdll: Move the mmap reserved area functions to the Unix library. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/unix/loader.c | 12 +++++++---- dlls/ntdll/unix/unix_private.h | 6 ++++++ dlls/ntdll/unix/virtual.c | 42 ++++++++++++++++++++++++++++++++---- dlls/ntdll/unixlib.h | 10 +++++++-- dlls/ntdll/virtual.c | 48 +++++++++++++++++++++--------------------- 5 files changed, 84 insertions(+), 34 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=625209433fa82e233a82…
1
0
0
0
Zebediah Figura : quartz/tests: Test enumerating DMOs.
by Alexandre Julliard
15 May '20
15 May '20
Module: wine Branch: master Commit: 9e26bc811656ad8eb901bffa5528b9ce25d44bc3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9e26bc811656ad8eb901bffa…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Fri May 15 16:09:20 2020 -0500 quartz/tests: Test enumerating DMOs. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/quartz/tests/Makefile.in | 2 +- dlls/quartz/tests/filtermapper.c | 72 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 72 insertions(+), 2 deletions(-) diff --git a/dlls/quartz/tests/Makefile.in b/dlls/quartz/tests/Makefile.in index 7609f4db6c..7652baf274 100644 --- a/dlls/quartz/tests/Makefile.in +++ b/dlls/quartz/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = quartz.dll -IMPORTS = strmbase advapi32 d3d9 msvfw32 ole32 oleaut32 user32 uuid +IMPORTS = strmbase advapi32 d3d9 msdmo msvfw32 ole32 oleaut32 user32 uuid C_SRCS = \ acmwrapper.c \ diff --git a/dlls/quartz/tests/filtermapper.c b/dlls/quartz/tests/filtermapper.c index 62a632f580..41b933275d 100644 --- a/dlls/quartz/tests/filtermapper.c +++ b/dlls/quartz/tests/filtermapper.c @@ -23,10 +23,13 @@ #include "wine/test.h" #include "winbase.h" #include "dshow.h" -#include "winternl.h" +#include "mediaobj.h" #include "initguid.h" +#include "dmo.h" #include "wine/fil_data.h" +static const GUID testclsid = {0x77777777}; + static IFilterMapper3 *create_mapper(void) { IFilterMapper3 *ret; @@ -662,6 +665,72 @@ static void test_aggregation(void) ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref); } +static void test_dmo(void) +{ + DMO_PARTIAL_MEDIATYPE mt = {MEDIATYPE_Audio, MEDIASUBTYPE_PCM}; + IEnumRegFilters *enumerator1; + IEnumMoniker *enumerator; + IFilterMapper3 *mapper; + IFilterMapper *mapper1; + REGFILTER *regfilter; + IMoniker *moniker; + WCHAR *name; + HRESULT hr; + BOOL found; + ULONG ref; + + hr = DMORegister(L"dmo test", &testclsid, &DMOCATEGORY_AUDIO_DECODER, 0, 1, &mt, 1, &mt); + if (hr == E_FAIL) + { + skip("Not enough permissions to register DMOs.\n"); + return; + } + ok(hr == S_OK, "Got hr %#x.\n", hr); + + mapper = create_mapper(); + IFilterMapper3_QueryInterface(mapper, &IID_IFilterMapper, (void **)&mapper1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IFilterMapper3_EnumMatchingFilters(mapper, &enumerator, 0, FALSE, 0, + FALSE, 0, NULL, NULL, NULL, FALSE, FALSE, 0, NULL, NULL, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + found = FALSE; + while (IEnumMoniker_Next(enumerator, 1, &moniker, NULL) == S_OK) + { + hr = IMoniker_GetDisplayName(moniker, NULL, NULL, &name); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + if (!wcscmp(name, L"@device:dmo:{77777777-0000-0000-0000-000000000000}{57F2DB8B-E6BB-4513-9D43-DCD2A6593125}")) + found = TRUE; + + CoTaskMemFree(name); + IMoniker_Release(moniker); + } + IEnumMoniker_Release(enumerator); + ok(found, "DMO should be enumerated.\n"); + + /* DMOs lack a CLSID property and are therefore not enumerated by IFilterMapper. */ + + hr = IFilterMapper_EnumMatchingFilters(mapper1, &enumerator1, 0, FALSE, + GUID_NULL, GUID_NULL, FALSE, FALSE, GUID_NULL, GUID_NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + while (IEnumRegFilters_Next(enumerator1, 1, ®filter, NULL) == S_OK) + { + ok(!IsEqualGUID(®filter->Clsid, &testclsid), "DMO should not be enumerated.\n"); + ok(wcscmp(regfilter->Name, L"dmo test"), "DMO should not be enumerated.\n"); + } + IEnumRegFilters_Release(enumerator1); + + IFilterMapper_Release(mapper1); + ref = IFilterMapper3_Release(mapper); + ok(!ref, "Got outstanding refcount %d.\n", ref); + + hr = DMOUnregister(&testclsid, &DMOCATEGORY_AUDIO_DECODER); + ok(hr == S_OK, "Got hr %#x.\n", hr); +} + START_TEST(filtermapper) { CoInitialize(NULL); @@ -673,6 +742,7 @@ START_TEST(filtermapper) test_register_filter_with_null_clsMinorType(); test_parse_filter_data(); test_aggregation(); + test_dmo(); CoUninitialize(); }
1
0
0
0
Zebediah Figura : devenum: Return filter data for DMO monikers.
by Alexandre Julliard
15 May '20
15 May '20
Module: wine Branch: master Commit: 2f2ac792427348b9172a8d269780002a484ab16e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2f2ac792427348b9172a8d26…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Fri May 15 16:09:19 2020 -0500 devenum: Return filter data for DMO monikers. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/devenum/createdevenum.c | 48 ++++++++++++---------- dlls/devenum/devenum_private.h | 1 + dlls/devenum/mediacatenum.c | 93 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 22 deletions(-) diff --git a/dlls/devenum/createdevenum.c b/dlls/devenum/createdevenum.c index a3b9447144..c72bb683f9 100644 --- a/dlls/devenum/createdevenum.c +++ b/dlls/devenum/createdevenum.c @@ -351,40 +351,44 @@ static void free_regfilter2(REGFILTER2 *rgf) } } -static void write_filter_data(IPropertyBag *prop_bag, REGFILTER2 *rgf) +HRESULT create_filter_data(VARIANT *var, REGFILTER2 *rgf) { - BYTE *data = NULL, *array; IAMFilterData *fildata; - SAFEARRAYBOUND sabound; - VARIANT var = {}; + BYTE *data = NULL; ULONG size; HRESULT hr; hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC, &IID_IAMFilterData, (void **)&fildata); - if (FAILED(hr)) goto cleanup; + if (FAILED(hr)) + return hr; hr = IAMFilterData_CreateFilterData(fildata, rgf, &data, &size); - if (FAILED(hr)) goto cleanup; + IAMFilterData_Release(fildata); + if (FAILED(hr)) + return hr; - V_VT(&var) = VT_ARRAY | VT_UI1; - sabound.lLbound = 0; - sabound.cElements = size; - if (!(V_ARRAY(&var) = SafeArrayCreate(VT_UI1, 1, &sabound))) - goto cleanup; - hr = SafeArrayAccessData(V_ARRAY(&var), (void *)&array); - if (FAILED(hr)) goto cleanup; + V_VT(var) = VT_ARRAY | VT_UI1; + if (!(V_ARRAY(var) = SafeArrayCreateVector(VT_UI1, 1, size))) + { + VariantClear(var); + CoTaskMemFree(data); + return E_OUTOFMEMORY; + } - memcpy(array, data, size); - hr = SafeArrayUnaccessData(V_ARRAY(&var)); - if (FAILED(hr)) goto cleanup; + memcpy(V_ARRAY(var)->pvData, data, size); + CoTaskMemFree(data); + return S_OK; +} - hr = IPropertyBag_Write(prop_bag, L"FilterData", &var); - if (FAILED(hr)) goto cleanup; +static void write_filter_data(IPropertyBag *prop_bag, REGFILTER2 *rgf) +{ + VARIANT var; -cleanup: - VariantClear(&var); - CoTaskMemFree(data); - IAMFilterData_Release(fildata); + if (SUCCEEDED(create_filter_data(&var, rgf))) + { + IPropertyBag_Write(prop_bag, L"FilterData", &var); + VariantClear(&var); + } } static void register_legacy_filters(void) diff --git a/dlls/devenum/devenum_private.h b/dlls/devenum/devenum_private.h index bd018a42a0..15c41afd57 100644 --- a/dlls/devenum/devenum_private.h +++ b/dlls/devenum/devenum_private.h @@ -54,6 +54,7 @@ struct moniker IPropertyBag IPropertyBag_iface; }; +HRESULT create_filter_data(VARIANT *var, REGFILTER2 *rgf) DECLSPEC_HIDDEN; struct moniker *dmo_moniker_create(const GUID class, const GUID clsid) DECLSPEC_HIDDEN; struct moniker *codec_moniker_create(const GUID *class, const WCHAR *name) DECLSPEC_HIDDEN; struct moniker *filter_moniker_create(const GUID *class, const WCHAR *name) DECLSPEC_HIDDEN; diff --git a/dlls/devenum/mediacatenum.c b/dlls/devenum/mediacatenum.c index 85634ead1a..16b729ab1f 100644 --- a/dlls/devenum/mediacatenum.c +++ b/dlls/devenum/mediacatenum.c @@ -28,6 +28,35 @@ WINE_DEFAULT_DEBUG_CHANNEL(devenum); +BOOL array_reserve(void **elements, unsigned int *capacity, unsigned int count, unsigned int size) +{ + unsigned int max_capacity, new_capacity; + void *new_elements; + + if (count <= *capacity) + return TRUE; + + max_capacity = ~0u / size; + if (count > max_capacity) + return FALSE; + + new_capacity = max(8, *capacity); + while (new_capacity < count && new_capacity <= max_capacity / 2) + new_capacity *= 2; + if (new_capacity < count) + new_capacity = count; + + if (!(new_elements = realloc(*elements, new_capacity * size))) + { + ERR("Failed to allocate memory.\n"); + return FALSE; + } + + *elements = new_elements; + *capacity = new_capacity; + return TRUE; +} + typedef struct { IEnumMoniker IEnumMoniker_iface; @@ -106,6 +135,70 @@ static HRESULT WINAPI property_bag_Read(IPropertyBag *iface, } return hr; } + else if (!wcscmp(name, L"FilterData")) + { + REGFILTERPINS2 reg_pins[2] = {{0}}; + REGFILTER2 reg_filter = + { + .dwVersion = 2, + .dwMerit = MERIT_NORMAL + 0x800, + .cPins2 = 2, + .rgPins2 = reg_pins, + }; + + unsigned int count = 1, input_count, output_count, i; + DMO_PARTIAL_MEDIATYPE *types = NULL; + REGPINTYPES *reg_types; + HRESULT hr; + + if (!(types = malloc(2 * count * sizeof(*types)))) + return E_OUTOFMEMORY; + + while ((hr = DMOGetTypes(&moniker->clsid, count, &input_count, types, + count, &output_count, types + count)) == S_FALSE) + { + count *= 2; + if (!(types = realloc(types, count * sizeof(*types)))) + { + free(types); + return E_OUTOFMEMORY; + } + } + if (hr != S_OK) + { + free(types); + return hr; + } + + if (!(reg_types = malloc(2 * count * sizeof(*reg_types)))) + { + free(types); + return hr; + } + + for (i = 0; i < input_count; ++i) + { + reg_types[i].clsMajorType = &types[i].type; + reg_types[i].clsMinorType = &types[i].subtype; + } + for (i = 0; i < output_count; ++i) + { + reg_types[count + i].clsMajorType = &types[count + i].type; + reg_types[count + i].clsMinorType = &types[count + i].subtype; + } + reg_pins[0].cInstances = 1; + reg_pins[0].nMediaTypes = input_count; + reg_pins[0].lpMediaType = reg_types; + reg_pins[1].dwFlags = REG_PINFLAG_B_OUTPUT; + reg_pins[1].cInstances = 1; + reg_pins[1].nMediaTypes = output_count; + reg_pins[1].lpMediaType = reg_types + count; + + hr = create_filter_data(var, ®_filter); + free(reg_types); + free(types); + return hr; + } return HRESULT_FROM_WIN32(ERROR_NOT_FOUND); }
1
0
0
0
Zebediah Figura : quartz: Pass the matching filter count to IEnumRegFiltersImpl_Construct().
by Alexandre Julliard
15 May '20
15 May '20
Module: wine Branch: master Commit: d83167f75ca29a4d51ba31960bcb6a70ea213377 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d83167f75ca29a4d51ba3196…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Fri May 15 16:09:18 2020 -0500 quartz: Pass the matching filter count to IEnumRegFiltersImpl_Construct(). Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/quartz/filtermapper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/quartz/filtermapper.c b/dlls/quartz/filtermapper.c index db162c0133..2068131b9e 100644 --- a/dlls/quartz/filtermapper.c +++ b/dlls/quartz/filtermapper.c @@ -1087,7 +1087,7 @@ static HRESULT WINAPI FilterMapper_EnumMatchingFilters( if (SUCCEEDED(hr)) { - hr = IEnumRegFiltersImpl_Construct(regfilters, nb_mon, ppEnum); + hr = IEnumRegFiltersImpl_Construct(regfilters, idx, ppEnum); } for (idx = 0; idx < nb_mon; idx++)
1
0
0
0
Zebediah Figura : quartz/tests: Fix a leak in test_fm2_enummatchingfilters().
by Alexandre Julliard
15 May '20
15 May '20
Module: wine Branch: master Commit: 87e1df02afa3382fd1150fd4bd536d63fb6dcab2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=87e1df02afa3382fd1150fd4…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Fri May 15 16:09:17 2020 -0500 quartz/tests: Fix a leak in test_fm2_enummatchingfilters(). Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/quartz/tests/filtermapper.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/quartz/tests/filtermapper.c b/dlls/quartz/tests/filtermapper.c index cdfe964b98..62a632f580 100644 --- a/dlls/quartz/tests/filtermapper.c +++ b/dlls/quartz/tests/filtermapper.c @@ -119,7 +119,7 @@ static void test_fm2_enummatchingfilters(void) IEnumMoniker *pEnum = NULL; BOOL found, registered = TRUE; REGFILTER *regfilter; - ULONG count; + ULONG count, ref; ZeroMemory(&rgf2, sizeof(rgf2)); @@ -227,6 +227,8 @@ static void test_fm2_enummatchingfilters(void) } IEnumRegFilters_Release(enum_reg); ok(found, "IFilterMapper didn't find filter\n"); + + IFilterMapper_Release(mapper); } if (pEnum) IEnumMoniker_Release(pEnum); @@ -256,7 +258,8 @@ static void test_fm2_enummatchingfilters(void) out: if (pEnum) IEnumMoniker_Release(pEnum); - if (pMapper) IFilterMapper2_Release(pMapper); + ref = IFilterMapper2_Release(pMapper); + ok(!ref, "Got outstanding refcount %d.\n", ref); } static void test_legacy_filter_registration(void)
1
0
0
0
Zebediah Figura : quartz/tests: Test filter mapper interfaces.
by Alexandre Julliard
15 May '20
15 May '20
Module: wine Branch: master Commit: e1c57c27cd8d91d8ee4ca733056a813a6e91cd52 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e1c57c27cd8d91d8ee4ca733…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Fri May 15 16:09:16 2020 -0500 quartz/tests: Test filter mapper interfaces. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/quartz/tests/filtermapper.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/dlls/quartz/tests/filtermapper.c b/dlls/quartz/tests/filtermapper.c index 923257bed1..cdfe964b98 100644 --- a/dlls/quartz/tests/filtermapper.c +++ b/dlls/quartz/tests/filtermapper.c @@ -27,6 +27,15 @@ #include "initguid.h" #include "wine/fil_data.h" +static IFilterMapper3 *create_mapper(void) +{ + IFilterMapper3 *ret; + HRESULT hr; + hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, &IID_IFilterMapper3, (void **)&ret); + ok(hr == S_OK, "Failed to create filter mapper, hr %#x.\n", hr); + return ret; +} + static ULONG get_refcount(void *iface) { IUnknown *unknown = iface; @@ -34,6 +43,36 @@ static ULONG get_refcount(void *iface) return IUnknown_Release(unknown); } +#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) +static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) +{ + IUnknown *iface = iface_ptr; + HRESULT hr, expected_hr; + IUnknown *unk; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + + hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + +static void test_interfaces(void) +{ + IFilterMapper3 *mapper = create_mapper(); + + check_interface(mapper, &IID_IAMFilterData, TRUE); + check_interface(mapper, &IID_IFilterMapper, TRUE); + check_interface(mapper, &IID_IFilterMapper2, TRUE); + check_interface(mapper, &IID_IFilterMapper3, TRUE); + check_interface(mapper, &IID_IUnknown, TRUE); + + check_interface(mapper, &IID_IFilterGraph, FALSE); + + IFilterMapper3_Release(mapper); +} + /* Helper function, checks if filter with given name was enumerated. */ static BOOL enum_find_filter(const WCHAR *wszFilterName, IEnumMoniker *pEnum) { @@ -624,6 +663,7 @@ START_TEST(filtermapper) { CoInitialize(NULL); + test_interfaces(); test_fm2_enummatchingfilters(); test_legacy_filter_registration(); test_ifiltermapper_from_filtergraph();
1
0
0
0
← Newer
1
...
36
37
38
39
40
41
42
...
75
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Results per page:
10
25
50
100
200