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
April 2019
----- 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
803 discussions
Start a n
N
ew thread
Alexandre Julliard : include: Make wine_dbg_log() into an inline function.
by Alexandre Julliard
03 Apr '19
03 Apr '19
Module: wine Branch: master Commit: cf8193df5b4c5a09208e40d8f3183c00187c8bd0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=cf8193df5b4c5a09208e40d8…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Apr 3 19:27:13 2019 +0200 include: Make wine_dbg_log() into an inline function. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/debugtools.c | 32 ++++++++++++++++++++++++++++++++ dlls/ntdll/ntdll.spec | 1 + include/wine/debug.h | 30 +++++++++++++++++++++++++++--- libs/wine/debug.c | 2 ++ 4 files changed, 62 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/debugtools.c b/dlls/ntdll/debugtools.c index 1e4a3a1..94d2de7 100644 --- a/dlls/ntdll/debugtools.c +++ b/dlls/ntdll/debugtools.c @@ -276,6 +276,38 @@ int __cdecl __wine_dbg_output( const char *str ) } /*********************************************************************** + * __wine_dbg_header (NTDLL.@) + */ +int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_channel *channel, + const char *function ) +{ + static const char * const classes[] = { "fixme", "err", "warn", "trace" }; + struct debug_info *info = get_info(); + char buffer[200], *pos = buffer; + + if (!(__wine_dbg_get_channel_flags( channel ) & (1 << cls))) return -1; + + /* only print header if we are at the beginning of the line */ + if (info->out_pos > info->output) return 0; + + if (init_done) + { + if (TRACE_ON(timestamp)) + { + ULONG ticks = NtGetTickCount(); + pos += sprintf( pos, "%3u.%03u:", ticks / 1000, ticks % 1000 ); + } + if (TRACE_ON(pid)) pos += sprintf( pos, "%04x:", GetCurrentProcessId() ); + pos += sprintf( pos, "%04x:", GetCurrentThreadId() ); + } + if (function && cls < ARRAY_SIZE( classes )) + snprintf( pos, sizeof(buffer) - (pos - buffer), "%s:%s:%s ", + classes[cls], channel->name, function ); + + return append_output( info, buffer, strlen( buffer )); +} + +/*********************************************************************** * NTDLL_dbg_vprintf */ static int NTDLL_dbg_vprintf( const char *format, va_list args ) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index b608ab9..292b0f6 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1507,6 +1507,7 @@ # Debugging @ cdecl -norelay __wine_dbg_get_channel_flags(ptr) +@ cdecl -norelay __wine_dbg_header(long long str) @ cdecl -norelay __wine_dbg_output(str) @ cdecl -norelay __wine_dbg_strdup(str) diff --git a/include/wine/debug.h b/include/wine/debug.h index 416b6c8..e95fcfb 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -161,6 +161,8 @@ extern void __wine_dbg_set_functions( const struct __wine_debug_functions *new_f struct __wine_debug_functions *old_funcs, size_t size ); extern const char * __cdecl __wine_dbg_strdup( const char *str ); extern int __cdecl __wine_dbg_output( const char *str ); +extern int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_channel *channel, + const char *function ); /* * Exported definitions and macros @@ -170,9 +172,6 @@ extern int __cdecl __wine_dbg_output( const char *str ); quotes. The string will be valid for some time, but not indefinitely as strings are re-used. */ -extern int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *ch, const char *func, - const char *format, ... ) __WINE_PRINTF_ATTR(4,5); - #if (defined(__x86_64__) || defined(__aarch64__)) && defined(__GNUC__) && defined(__WINE_USE_MSVCRT) # define __wine_dbg_cdecl __cdecl # define __wine_dbg_va_list __builtin_ms_va_list @@ -209,6 +208,31 @@ static inline int __wine_dbg_cdecl wine_dbg_printf( const char *format, ... ) return __wine_dbg_output( buffer ); } +static int __wine_dbg_cdecl wine_dbg_log( enum __wine_debug_class cls, + struct __wine_debug_channel *channel, const char *func, + const char *format, ... ) __WINE_PRINTF_ATTR(4,5); +static inline int __wine_dbg_cdecl wine_dbg_log( enum __wine_debug_class cls, + struct __wine_debug_channel *channel, + const char *function, const char *format, ... ) +{ + char buffer[1024]; + __wine_dbg_va_list args; + int ret; + + if (*format == '\1') /* special magic to avoid standard prefix */ + { + format++; + function = NULL; + } + if ((ret = __wine_dbg_header( cls, channel, function )) == -1) return ret; + + __wine_dbg_va_start( args, format ); + vsnprintf( buffer, sizeof(buffer), format, args ); + __wine_dbg_va_end( args ); + ret += __wine_dbg_output( buffer ); + return ret; +} + static inline const char *wine_dbgstr_an( const char *str, int n ) { static const char hex[16] = "0123456789abcdef"; diff --git a/libs/wine/debug.c b/libs/wine/debug.c index b9c7e0b..b19fefe 100644 --- a/libs/wine/debug.c +++ b/libs/wine/debug.c @@ -33,6 +33,7 @@ #define __wine_dbg_get_channel_flags __wine_dbg_get_channel_flags_inline #define wine_dbg_sprintf wine_dbg_sprintf_inline #define wine_dbg_printf wine_dbg_printf_inline +#define wine_dbg_log wine_dbg_log_inline #define wine_dbgstr_an wine_dbgstr_an_inline #define wine_dbgstr_wn wine_dbgstr_wn_inline #include "wine/debug.h" @@ -252,6 +253,7 @@ const char *wine_dbg_sprintf( const char *format, ... ) /* varargs wrapper for funcs.dbg_vlog */ +#undef wine_dbg_log int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *channel, const char *func, const char *format, ... ) {
1
0
0
0
Alexandre Julliard : ntdll: Export __wine_dbg_get_channel_flags().
by Alexandre Julliard
03 Apr '19
03 Apr '19
Module: wine Branch: master Commit: 9911cfdeae63539110d991a5915b339219d3f0e5 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9911cfdeae63539110d991a5…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Apr 3 19:25:28 2019 +0200 ntdll: Export __wine_dbg_get_channel_flags(). Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/debugtools.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/ntdll.spec | 1 + include/wine/debug.h | 4 +- libs/wine/debug.c | 2 + libs/wine/wine.def | 2 +- 5 files changed, 158 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/debugtools.c b/dlls/ntdll/debugtools.c index 9c3add4..1e4a3a1 100644 --- a/dlls/ntdll/debugtools.c +++ b/dlls/ntdll/debugtools.c @@ -43,6 +43,12 @@ WINE_DECLARE_DEBUG_CHANNEL(timestamp); static BOOL init_done; static struct debug_info initial_info; /* debug info for initial thread */ +static unsigned char default_flags = (1 << __WINE_DBCL_ERR) | (1 << __WINE_DBCL_FIXME); +static int nb_debug_options = -1; +static int options_size; +static struct __wine_debug_channel *debug_options; + +static const char * const debug_classes[] = { "fixme", "err", "warn", "trace" }; /* get the debug info pointer for the current thread */ static inline struct debug_info *get_info(void) @@ -88,6 +94,153 @@ static int append_output( struct debug_info *info, const char *str, size_t len ) return len; } +/* add a new debug option at the end of the option list */ +static void add_option( const char *name, unsigned char set, unsigned char clear ) +{ + int min = 0, max = nb_debug_options - 1, pos, res; + + if (!name[0]) /* "all" option */ + { + default_flags = (default_flags & ~clear) | set; + return; + } + if (strlen(name) >= sizeof(debug_options[0].name)) return; + + while (min <= max) + { + pos = (min + max) / 2; + res = strcmp( name, debug_options[pos].name ); + if (!res) + { + debug_options[pos].flags = (debug_options[pos].flags & ~clear) | set; + return; + } + if (res < 0) max = pos - 1; + else min = pos + 1; + } + if (nb_debug_options >= options_size) + { + options_size = max( options_size * 2, 16 ); + debug_options = realloc( debug_options, options_size * sizeof(debug_options[0]) ); + } + + pos = min; + if (pos < nb_debug_options) memmove( &debug_options[pos + 1], &debug_options[pos], + (nb_debug_options - pos) * sizeof(debug_options[0]) ); + strcpy( debug_options[pos].name, name ); + debug_options[pos].flags = (default_flags & ~clear) | set; + nb_debug_options++; +} + +/* parse a set of debugging option specifications and add them to the option list */ +static void parse_options( const char *str ) +{ + char *opt, *next, *options; + unsigned int i; + + if (!(options = strdup(str))) return; + for (opt = options; opt; opt = next) + { + const char *p; + unsigned char set = 0, clear = 0; + + if ((next = strchr( opt, ',' ))) *next++ = 0; + + p = opt + strcspn( opt, "+-" ); + if (!p[0]) p = opt; /* assume it's a debug channel name */ + + if (p > opt) + { + for (i = 0; i < ARRAY_SIZE(debug_classes); i++) + { + int len = strlen(debug_classes[i]); + if (len != (p - opt)) continue; + if (!memcmp( opt, debug_classes[i], len )) /* found it */ + { + if (*p == '+') set |= 1 << i; + else clear |= 1 << i; + break; + } + } + if (i == ARRAY_SIZE(debug_classes)) /* bad class name, skip it */ + continue; + } + else + { + if (*p == '-') clear = ~0; + else set = ~0; + } + if (*p == '+' || *p == '-') p++; + if (!p[0]) continue; + + if (!strcmp( p, "all" )) + default_flags = (default_flags & ~clear) | set; + else + add_option( p, set, clear ); + } + free( options ); +} + +/* print the usage message */ +static void debug_usage(void) +{ + static const char usage[] = + "Syntax of the WINEDEBUG variable:\n" + " WINEDEBUG=[class]+xxx,[class]-yyy,...\n\n" + "Example: WINEDEBUG=+relay,warn-heap\n" + " turns on relay traces, disable heap warnings\n" + "Available message classes: err, warn, fixme, trace\n"; + write( 2, usage, sizeof(usage) - 1 ); + exit(1); +} + +/* initialize all options at startup */ +static void init_options(void) +{ + char *wine_debug = getenv("WINEDEBUG"); + struct stat st1, st2; + + nb_debug_options = 0; + + /* check for stderr pointing to /dev/null */ + if (!fstat( 2, &st1 ) && S_ISCHR(st1.st_mode) && + !stat( "/dev/null", &st2 ) && S_ISCHR(st2.st_mode) && + st1.st_rdev == st2.st_rdev) + { + default_flags = 0; + return; + } + if (!wine_debug) return; + if (!strcmp( wine_debug, "help" )) debug_usage(); + parse_options( wine_debug ); +} + +/*********************************************************************** + * __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 ) +{ + int min, max, pos, res; + + if (nb_debug_options == -1) init_options(); + + min = 0; + max = nb_debug_options - 1; + while (min <= max) + { + pos = (min + max) / 2; + res = strcmp( channel->name, debug_options[pos].name ); + if (!res) return debug_options[pos].flags; + if (res < 0) max = pos - 1; + else min = pos + 1; + } + /* no option for this channel */ + if (channel->flags & (1 << __WINE_DBCL_INIT)) channel->flags = default_flags; + return default_flags; +} + /*********************************************************************** * __wine_dbg_strdup (NTDLL.@) */ diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 98991ad..b608ab9 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1506,6 +1506,7 @@ @ cdecl __wine_make_process_system() # Debugging +@ cdecl -norelay __wine_dbg_get_channel_flags(ptr) @ cdecl -norelay __wine_dbg_output(str) @ cdecl -norelay __wine_dbg_strdup(str) diff --git a/include/wine/debug.h b/include/wine/debug.h index 2412c2b..416b6c8 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -156,9 +156,7 @@ struct __wine_debug_functions const char *function, const char *format, va_list args ); }; -extern unsigned char __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel ); -extern int __wine_dbg_set_channel_flags( struct __wine_debug_channel *channel, - unsigned char set, unsigned char clear ); +extern unsigned char __cdecl __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel ); extern void __wine_dbg_set_functions( const struct __wine_debug_functions *new_funcs, struct __wine_debug_functions *old_funcs, size_t size ); extern const char * __cdecl __wine_dbg_strdup( const char *str ); diff --git a/libs/wine/debug.c b/libs/wine/debug.c index 2d56b01..b9c7e0b 100644 --- a/libs/wine/debug.c +++ b/libs/wine/debug.c @@ -30,6 +30,7 @@ # include <sys/stat.h> #endif +#define __wine_dbg_get_channel_flags __wine_dbg_get_channel_flags_inline #define wine_dbg_sprintf wine_dbg_sprintf_inline #define wine_dbg_printf wine_dbg_printf_inline #define wine_dbgstr_an wine_dbgstr_an_inline @@ -61,6 +62,7 @@ static int cmp_name( const void *p1, const void *p2 ) } /* get the flags to use for a given channel, possibly setting them too in case of lazy init */ +#undef __wine_dbg_get_channel_flags unsigned char __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel ) { if (nb_debug_options == -1) debug_init(); diff --git a/libs/wine/wine.def b/libs/wine/wine.def index ed315bd..3c88f8a 100644 --- a/libs/wine/wine.def +++ b/libs/wine/wine.def @@ -1,7 +1,7 @@ LIBRARY libwine.dll EXPORTS - __wine_dbg_get_channel_flags + __wine_dbg_get_channel_flags PRIVATE __wine_dbg_set_channel_flags __wine_dbg_set_functions __wine_dll_register
1
0
0
0
Alexandre Julliard : include: Make wine_dbg_printf() into an inline function.
by Alexandre Julliard
03 Apr '19
03 Apr '19
Module: wine Branch: master Commit: ddf1ff2f6ae39e6962441a5a88439755ff72c525 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ddf1ff2f6ae39e6962441a5a…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Apr 3 19:24:39 2019 +0200 include: Make wine_dbg_printf() into an inline function. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/debugtools.c | 34 ++++++++++++++++++++++++++++++++++ dlls/ntdll/ntdll.spec | 1 + include/wine/debug.h | 14 +++++++++++++- libs/wine/debug.c | 2 ++ 4 files changed, 50 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/debugtools.c b/dlls/ntdll/debugtools.c index 42db30a..9c3add4 100644 --- a/dlls/ntdll/debugtools.c +++ b/dlls/ntdll/debugtools.c @@ -74,6 +74,20 @@ static void release_temp_buffer( char *ptr, size_t size ) info->str_pos = ptr + size; } +/* add a string to the output buffer */ +static int append_output( struct debug_info *info, const char *str, size_t len ) +{ + if (len >= sizeof(info->output) - (info->out_pos - info->output)) + { + fprintf( stderr, "wine_dbg_output: debugstr buffer overflow (contents: '%s')\n", info->output ); + info->out_pos = info->output; + abort(); + } + memcpy( info->out_pos, str, len ); + info->out_pos += len; + return len; +} + /*********************************************************************** * __wine_dbg_strdup (NTDLL.@) */ @@ -89,6 +103,26 @@ const char * __cdecl __wine_dbg_strdup( const char *str ) } /*********************************************************************** + * __wine_dbg_output (NTDLL.@) + */ +int __cdecl __wine_dbg_output( const char *str ) +{ + struct debug_info *info = get_info(); + const char *end = strrchr( str, '\n' ); + int ret = 0; + + if (end) + { + ret += append_output( info, str, end + 1 - str ); + write( 2, info->output, info->out_pos - info->output ); + info->out_pos = info->output; + str = end + 1; + } + if (*str) ret += append_output( info, str, strlen( str )); + return ret; +} + +/*********************************************************************** * NTDLL_dbg_vprintf */ static int NTDLL_dbg_vprintf( const char *format, va_list args ) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 7622289..98991ad 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1506,6 +1506,7 @@ @ cdecl __wine_make_process_system() # Debugging +@ cdecl -norelay __wine_dbg_output(str) @ cdecl -norelay __wine_dbg_strdup(str) # Virtual memory diff --git a/include/wine/debug.h b/include/wine/debug.h index fd8e56e..2412c2b 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -162,6 +162,7 @@ extern int __wine_dbg_set_channel_flags( struct __wine_debug_channel *channel, extern void __wine_dbg_set_functions( const struct __wine_debug_functions *new_funcs, struct __wine_debug_functions *old_funcs, size_t size ); extern const char * __cdecl __wine_dbg_strdup( const char *str ); +extern int __cdecl __wine_dbg_output( const char *str ); /* * Exported definitions and macros @@ -171,7 +172,6 @@ extern const char * __cdecl __wine_dbg_strdup( const char *str ); quotes. The string will be valid for some time, but not indefinitely as strings are re-used. */ -extern int wine_dbg_printf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2); extern int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *ch, const char *func, const char *format, ... ) __WINE_PRINTF_ATTR(4,5); @@ -199,6 +199,18 @@ static inline const char * __wine_dbg_cdecl wine_dbg_sprintf( const char *format return __wine_dbg_strdup( buffer ); } +static int __wine_dbg_cdecl wine_dbg_printf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2); +static inline int __wine_dbg_cdecl wine_dbg_printf( const char *format, ... ) +{ + char buffer[1024]; + __wine_dbg_va_list args; + + __wine_dbg_va_start( args, format ); + vsnprintf( buffer, sizeof(buffer), format, args ); + __wine_dbg_va_end( args ); + return __wine_dbg_output( buffer ); +} + static inline const char *wine_dbgstr_an( const char *str, int n ) { static const char hex[16] = "0123456789abcdef"; diff --git a/libs/wine/debug.c b/libs/wine/debug.c index 1bf59dd..2d56b01 100644 --- a/libs/wine/debug.c +++ b/libs/wine/debug.c @@ -31,6 +31,7 @@ #endif #define wine_dbg_sprintf wine_dbg_sprintf_inline +#define wine_dbg_printf wine_dbg_printf_inline #define wine_dbgstr_an wine_dbgstr_an_inline #define wine_dbgstr_wn wine_dbgstr_wn_inline #include "wine/debug.h" @@ -217,6 +218,7 @@ static void debug_init(void) } /* varargs wrapper for funcs.dbg_vprintf */ +#undef wine_dbg_printf int wine_dbg_printf( const char *format, ... ) { int ret;
1
0
0
0
Alexandre Julliard : include: Make wine_dbg_sprintf() into an inline function.
by Alexandre Julliard
03 Apr '19
03 Apr '19
Module: wine Branch: master Commit: f2e6f05fe33a2933e45c0741847bf0dbbf43b940 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f2e6f05fe33a2933e45c0741…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Apr 3 10:02:14 2019 +0200 include: Make wine_dbg_sprintf() into an inline function. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/wine/debug.h | 26 +++++++++++++++++++++++++- libs/wine/debug.c | 2 ++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/include/wine/debug.h b/include/wine/debug.h index 65322d0..fd8e56e 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -22,6 +22,7 @@ #define __WINE_WINE_DEBUG_H #include <stdarg.h> +#include <stdio.h> #include <windef.h> #ifndef _NTSYSTEM_ #include <winbase.h> @@ -169,12 +170,35 @@ extern const char * __cdecl __wine_dbg_strdup( const char *str ); /* These functions return a printable version of a string, including quotes. The string will be valid for some time, but not indefinitely as strings are re-used. */ -extern const char *wine_dbg_sprintf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2); extern int wine_dbg_printf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2); extern int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *ch, const char *func, const char *format, ... ) __WINE_PRINTF_ATTR(4,5); +#if (defined(__x86_64__) || defined(__aarch64__)) && defined(__GNUC__) && defined(__WINE_USE_MSVCRT) +# define __wine_dbg_cdecl __cdecl +# define __wine_dbg_va_list __builtin_ms_va_list +# define __wine_dbg_va_start(list,arg) __builtin_ms_va_start(list,arg) +# define __wine_dbg_va_end(list) __builtin_ms_va_end(list) +#else +# define __wine_dbg_cdecl +# define __wine_dbg_va_list va_list +# define __wine_dbg_va_start(list,arg) va_start(list,arg) +# define __wine_dbg_va_end(list) va_end(list) +#endif + +static const char * __wine_dbg_cdecl wine_dbg_sprintf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2); +static inline const char * __wine_dbg_cdecl wine_dbg_sprintf( const char *format, ... ) +{ + char buffer[200]; + __wine_dbg_va_list args; + + __wine_dbg_va_start( args, format ); + vsnprintf( buffer, sizeof(buffer), format, args ); + __wine_dbg_va_end( args ); + return __wine_dbg_strdup( buffer ); +} + static inline const char *wine_dbgstr_an( const char *str, int n ) { static const char hex[16] = "0123456789abcdef"; diff --git a/libs/wine/debug.c b/libs/wine/debug.c index 0c3b4ef..1bf59dd 100644 --- a/libs/wine/debug.c +++ b/libs/wine/debug.c @@ -30,6 +30,7 @@ # include <sys/stat.h> #endif +#define wine_dbg_sprintf wine_dbg_sprintf_inline #define wine_dbgstr_an wine_dbgstr_an_inline #define wine_dbgstr_wn wine_dbgstr_wn_inline #include "wine/debug.h" @@ -228,6 +229,7 @@ int wine_dbg_printf( const char *format, ... ) } /* printf with temp buffer allocation */ +#undef wine_dbg_sprintf const char *wine_dbg_sprintf( const char *format, ... ) { static const int max_size = 200;
1
0
0
0
Alexandre Julliard : include: Make wine_dbgstr_an()/wine_dbgstr_wn() into inline functions.
by Alexandre Julliard
03 Apr '19
03 Apr '19
Module: wine Branch: master Commit: 9f75f7189935aeec55df79a5abbc3d2691ec5f7e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9f75f7189935aeec55df79a5…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Apr 3 19:23:43 2019 +0200 include: Make wine_dbgstr_an()/wine_dbgstr_wn() into inline functions. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/debugtools.c | 54 ++++++---------------------- dlls/ntdll/ntdll.spec | 3 ++ include/wine/debug.h | 96 +++++++++++++++++++++++++++++++++++++++++++++++-- libs/wine/debug.c | 4 +++ 4 files changed, 111 insertions(+), 46 deletions(-) diff --git a/dlls/ntdll/debugtools.c b/dlls/ntdll/debugtools.c index 4e2fd78..42db30a 100644 --- a/dlls/ntdll/debugtools.c +++ b/dlls/ntdll/debugtools.c @@ -41,8 +41,6 @@ WINE_DECLARE_DEBUG_CHANNEL(pid); WINE_DECLARE_DEBUG_CHANNEL(timestamp); -static struct __wine_debug_functions default_funcs; - static BOOL init_done; static struct debug_info initial_info; /* debug info for initial thread */ @@ -77,49 +75,17 @@ static void release_temp_buffer( char *ptr, size_t size ) } /*********************************************************************** - * NTDLL_dbgstr_an + * __wine_dbg_strdup (NTDLL.@) */ -static const char *NTDLL_dbgstr_an( const char *src, int n ) +const char * __cdecl __wine_dbg_strdup( const char *str ) { - const char *res; struct debug_info *info = get_info(); - /* save current position to restore it on exception */ - char *old_pos = info->str_pos; - - __TRY - { - res = default_funcs.dbgstr_an( src, n ); - } - __EXCEPT_PAGE_FAULT - { - release_temp_buffer( old_pos, 0 ); - return "(invalid)"; - } - __ENDTRY - return res; -} - -/*********************************************************************** - * NTDLL_dbgstr_wn - */ -static const char *NTDLL_dbgstr_wn( const WCHAR *src, int n ) -{ - const char *res; - struct debug_info *info = get_info(); - /* save current position to restore it on exception */ - char *old_pos = info->str_pos; + char *res = info->str_pos; + size_t n = strlen( str ) + 1; - __TRY - { - res = default_funcs.dbgstr_wn( src, n ); - } - __EXCEPT_PAGE_FAULT - { - release_temp_buffer( old_pos, 0 ); - return "(invalid)"; - } - __ENDTRY - return res; + if (res + n > &info->strings[sizeof(info->strings)]) res = info->strings; + info->str_pos = res + n; + return strcpy( res, str ); } /*********************************************************************** @@ -195,8 +161,8 @@ static const struct __wine_debug_functions funcs = { get_temp_buffer, release_temp_buffer, - NTDLL_dbgstr_an, - NTDLL_dbgstr_wn, + wine_dbgstr_an, + wine_dbgstr_wn, NTDLL_dbg_vprintf, NTDLL_dbg_vlog }; @@ -210,5 +176,5 @@ void debug_init(void) if (!initial_info.out_pos) initial_info.out_pos = initial_info.output; ntdll_get_thread_data()->debug_info = &initial_info; init_done = TRUE; - __wine_dbg_set_functions( &funcs, &default_funcs, sizeof(funcs) ); + __wine_dbg_set_functions( &funcs, NULL, sizeof(funcs) ); } diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 233c4ef..7622289 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1505,6 +1505,9 @@ @ cdecl wine_server_send_fd(long) @ cdecl __wine_make_process_system() +# Debugging +@ cdecl -norelay __wine_dbg_strdup(str) + # Virtual memory @ cdecl __wine_locked_recvmsg(long ptr long) diff --git a/include/wine/debug.h b/include/wine/debug.h index 07ac88d..65322d0 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -23,6 +23,9 @@ #include <stdarg.h> #include <windef.h> +#ifndef _NTSYSTEM_ +#include <winbase.h> +#endif #ifndef GUID_DEFINED #include <guiddef.h> #endif @@ -157,6 +160,7 @@ extern int __wine_dbg_set_channel_flags( struct __wine_debug_channel *channel, unsigned char set, unsigned char clear ); extern void __wine_dbg_set_functions( const struct __wine_debug_functions *new_funcs, struct __wine_debug_functions *old_funcs, size_t size ); +extern const char * __cdecl __wine_dbg_strdup( const char *str ); /* * Exported definitions and macros @@ -165,14 +169,102 @@ extern void __wine_dbg_set_functions( const struct __wine_debug_functions *new_f /* These functions return a printable version of a string, including quotes. The string will be valid for some time, but not indefinitely as strings are re-used. */ -extern const char *wine_dbgstr_an( const char * s, int n ); -extern const char *wine_dbgstr_wn( const WCHAR *s, int n ); extern const char *wine_dbg_sprintf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2); extern int wine_dbg_printf( const char *format, ... ) __WINE_PRINTF_ATTR(1,2); extern int wine_dbg_log( enum __wine_debug_class cls, struct __wine_debug_channel *ch, const char *func, const char *format, ... ) __WINE_PRINTF_ATTR(4,5); +static inline const char *wine_dbgstr_an( const char *str, int n ) +{ + static const char hex[16] = "0123456789abcdef"; + char buffer[300], *dst = buffer; + + if (!str) return "(null)"; + if (!((ULONG_PTR)str >> 16)) return wine_dbg_sprintf( "#%04x", LOWORD(str) ); +#ifndef _NTSYSTEM_ + if (IsBadStringPtrA( str, n )) return "(invalid)"; +#endif + if (n == -1) for (n = 0; str[n]; n++) ; + *dst++ = '"'; + while (n-- > 0 && dst <= buffer + sizeof(buffer) - 9) + { + unsigned char c = *str++; + switch (c) + { + case '\n': *dst++ = '\\'; *dst++ = 'n'; break; + case '\r': *dst++ = '\\'; *dst++ = 'r'; break; + case '\t': *dst++ = '\\'; *dst++ = 't'; break; + case '"': *dst++ = '\\'; *dst++ = '"'; break; + case '\\': *dst++ = '\\'; *dst++ = '\\'; break; + default: + if (c < ' ' || c >= 127) + { + *dst++ = '\\'; + *dst++ = 'x'; + *dst++ = hex[(c >> 4) & 0x0f]; + *dst++ = hex[c & 0x0f]; + } + else *dst++ = c; + } + } + *dst++ = '"'; + if (n > 0) + { + *dst++ = '.'; + *dst++ = '.'; + *dst++ = '.'; + } + *dst = 0; + return __wine_dbg_strdup( buffer ); +} + +static inline const char *wine_dbgstr_wn( const WCHAR *str, int n ) +{ + static const char hex[16] = "0123456789abcdef"; + char buffer[300], *dst = buffer; + + if (!str) return "(null)"; + if (!((ULONG_PTR)str >> 16)) return wine_dbg_sprintf( "#%04x", LOWORD(str) ); +#ifndef _NTSYSTEM_ + if (IsBadStringPtrW( str, n )) return "(invalid)"; +#endif + if (n == -1) for (n = 0; str[n]; n++) ; + *dst++ = 'L'; + *dst++ = '"'; + while (n-- > 0 && dst <= buffer + sizeof(buffer) - 10) + { + WCHAR c = *str++; + switch (c) + { + case '\n': *dst++ = '\\'; *dst++ = 'n'; break; + case '\r': *dst++ = '\\'; *dst++ = 'r'; break; + case '\t': *dst++ = '\\'; *dst++ = 't'; break; + case '"': *dst++ = '\\'; *dst++ = '"'; break; + case '\\': *dst++ = '\\'; *dst++ = '\\'; break; + default: + if (c < ' ' || c >= 127) + { + *dst++ = '\\'; + *dst++ = hex[(c >> 12) & 0x0f]; + *dst++ = hex[(c >> 8) & 0x0f]; + *dst++ = hex[(c >> 4) & 0x0f]; + *dst++ = hex[c & 0x0f]; + } + else *dst++ = c; + } + } + *dst++ = '"'; + if (n > 0) + { + *dst++ = '.'; + *dst++ = '.'; + *dst++ = '.'; + } + *dst = 0; + return __wine_dbg_strdup( buffer ); +} + static inline const char *wine_dbgstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); diff --git a/libs/wine/debug.c b/libs/wine/debug.c index ae12356..0c3b4ef 100644 --- a/libs/wine/debug.c +++ b/libs/wine/debug.c @@ -30,6 +30,8 @@ # include <sys/stat.h> #endif +#define wine_dbgstr_an wine_dbgstr_an_inline +#define wine_dbgstr_wn wine_dbgstr_wn_inline #include "wine/debug.h" #include "wine/library.h" @@ -420,11 +422,13 @@ static int default_dbg_vlog( enum __wine_debug_class cls, struct __wine_debug_ch /* wrappers to use the function pointers */ +#undef wine_dbgstr_an const char *wine_dbgstr_an( const char * s, int n ) { return funcs.dbgstr_an(s, n); } +#undef wine_dbgstr_wn const char *wine_dbgstr_wn( const WCHAR *s, int n ) { return funcs.dbgstr_wn(s, n);
1
0
0
0
Alexandre Julliard : ntdll: Use static debug info before initialization is done.
by Alexandre Julliard
03 Apr '19
03 Apr '19
Module: wine Branch: master Commit: b3c8d5d36850e484b5cc84ab818a75db567a06a3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b3c8d5d36850e484b5cc84ab…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Apr 3 09:50:31 2019 +0200 ntdll: Use static debug info before initialization is done. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/debugtools.c | 13 ++++++++++++- dlls/ntdll/thread.c | 5 ----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/debugtools.c b/dlls/ntdll/debugtools.c index 254673b..4e2fd78 100644 --- a/dlls/ntdll/debugtools.c +++ b/dlls/ntdll/debugtools.c @@ -43,11 +43,18 @@ WINE_DECLARE_DEBUG_CHANNEL(timestamp); static struct __wine_debug_functions default_funcs; -/* ---------------------------------------------------------------------- */ +static BOOL init_done; +static struct debug_info initial_info; /* debug info for initial thread */ /* get the debug info pointer for the current thread */ static inline struct debug_info *get_info(void) { + if (!init_done) + { + if (!initial_info.str_pos) initial_info.str_pos = initial_info.strings; + if (!initial_info.out_pos) initial_info.out_pos = initial_info.output; + return &initial_info; + } return ntdll_get_thread_data()->debug_info; } @@ -199,5 +206,9 @@ static const struct __wine_debug_functions funcs = */ void debug_init(void) { + if (!initial_info.str_pos) initial_info.str_pos = initial_info.strings; + if (!initial_info.out_pos) initial_info.out_pos = initial_info.output; + ntdll_get_thread_data()->debug_info = &initial_info; + init_done = TRUE; __wine_dbg_set_functions( &funcs, &default_funcs, sizeof(funcs) ); } diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index 9f4a08f..6445ec6 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -163,7 +163,6 @@ void thread_init(void) LARGE_INTEGER now; NTSTATUS status; struct ntdll_thread_data *thread_data; - static struct debug_info debug_info; /* debug info for initial thread */ virtual_init(); @@ -231,13 +230,9 @@ void thread_init(void) thread_data->reply_fd = -1; thread_data->wait_fd[0] = -1; thread_data->wait_fd[1] = -1; - thread_data->debug_info = &debug_info; signal_init_thread( teb ); virtual_init_threading(); - - debug_info.str_pos = debug_info.strings; - debug_info.out_pos = debug_info.output; debug_init(); /* setup the server connection */
1
0
0
0
Sebastian Lackner : dinput: Do not wait for hook thread startup in IDirectInput8::Initialize.
by Alexandre Julliard
03 Apr '19
03 Apr '19
Module: wine Branch: master Commit: 890d1b812a9477b434486ab503c15dd3fce3e964 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=890d1b812a9477b434486ab5…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Wed Apr 3 11:39:36 2019 +0800 dinput: Do not wait for hook thread startup in IDirectInput8::Initialize. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=21403
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dinput/dinput_main.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c index 54777da..66dc6e3 100644 --- a/dlls/dinput/dinput_main.c +++ b/dlls/dinput/dinput_main.c @@ -1719,7 +1719,7 @@ static DWORD WINAPI hook_thread_proc(void *param) /* Force creation of the message queue */ PeekMessageW( &msg, 0, 0, 0, PM_NOREMOVE ); - SetEvent(*(LPHANDLE)param); + SetEvent(param); while (GetMessageW( &msg, 0, 0, 0 )) { @@ -1785,6 +1785,7 @@ static DWORD WINAPI hook_thread_proc(void *param) } static DWORD hook_thread_id; +static HANDLE hook_thread_event; static CRITICAL_SECTION_DEBUG dinput_critsect_debug = { @@ -1803,24 +1804,21 @@ static BOOL check_hook_thread(void) TRACE("IDirectInputs left: %d\n", list_count(&direct_input_list)); if (!list_empty(&direct_input_list) && !hook_thread) { - HANDLE event; - - event = CreateEventW(NULL, FALSE, FALSE, NULL); - hook_thread = CreateThread(NULL, 0, hook_thread_proc, &event, 0, &hook_thread_id); - if (event && hook_thread) - { - HANDLE handles[2]; - handles[0] = event; - handles[1] = hook_thread; - WaitForMultipleObjects(2, handles, FALSE, INFINITE); - } + hook_thread_event = CreateEventW(NULL, FALSE, FALSE, NULL); + hook_thread = CreateThread(NULL, 0, hook_thread_proc, hook_thread_event, 0, &hook_thread_id); LeaveCriticalSection(&dinput_hook_crit); - CloseHandle(event); } else if (list_empty(&direct_input_list) && hook_thread) { DWORD tid = hook_thread_id; + if (hook_thread_event) /* if thread is not started yet */ + { + WaitForSingleObject(hook_thread_event, INFINITE); + CloseHandle(hook_thread_event); + hook_thread_event = NULL; + } + hook_thread_id = 0; PostThreadMessageW(tid, WM_USER+0x10, 0, 0); LeaveCriticalSection(&dinput_hook_crit); @@ -1861,6 +1859,13 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface) callwndproc_hook = NULL; } + if (hook_thread_event) /* if thread is not started yet */ + { + WaitForSingleObject(hook_thread_event, INFINITE); + CloseHandle(hook_thread_event); + hook_thread_event = NULL; + } + PostThreadMessageW( hook_thread_id, WM_USER+0x10, 1, 0 ); LeaveCriticalSection(&dinput_hook_crit);
1
0
0
0
Austin English : propvarutil.h: Add extern "C" if __cplusplus is defined.
by Alexandre Julliard
03 Apr '19
03 Apr '19
Module: wine Branch: master Commit: da998cb20677d781f643d4984880f17556c423d9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=da998cb20677d781f643d498…
Author: Austin English <austinenglish(a)gmail.com> Date: Wed Apr 3 01:43:54 2019 -0500 propvarutil.h: Add extern "C" if __cplusplus is defined. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=46939
Signed-off-by: Austin English <austinenglish(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/propvarutil.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/propvarutil.h b/include/propvarutil.h index a4eedef..e0a21fa 100644 --- a/include/propvarutil.h +++ b/include/propvarutil.h @@ -22,6 +22,10 @@ #include <shtypes.h> #include <shlwapi.h> +#ifdef __cplusplus +extern "C" { +#endif + enum tagPROPVAR_CHANGE_FLAGS { PVCHF_DEFAULT = 0x00000000, @@ -120,7 +124,12 @@ inline HRESULT InitPropVariantFromInt64(LONGLONG llVal, PROPVARIANT *ppropvar) return S_OK; } -#endif +#endif /* NO_PROPVAR_INLINES */ +#endif /* __cplusplus */ + + +#ifdef __cplusplus +} #endif #endif /* __WINE_PROPVARUTIL_H */
1
0
0
0
Zebediah Figura : quartz/tests: Add tests for VMR7 pin interfaces.
by Alexandre Julliard
03 Apr '19
03 Apr '19
Module: wine Branch: master Commit: a2f60aaa838ab449e4245df6e1406321edd4aec0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a2f60aaa838ab449e4245df6…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Apr 2 20:59:38 2019 -0500 quartz/tests: Add tests for VMR7 pin interfaces. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/quartz/tests/vmr7.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index 918d579..e9efe55 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -187,8 +187,10 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO static void test_interfaces(void) { + WCHAR sink_id[] = {'V','M','R',' ','I','n','p','u','t','0',0}; IBaseFilter *filter = create_vmr7(0); ULONG ref; + IPin *pin; check_interface(filter, &IID_IAMCertifiedOutputProtection, TRUE); check_interface(filter, &IID_IAMFilterMiscFlags, TRUE); @@ -227,6 +229,20 @@ static void test_interfaces(void) check_interface(filter, &IID_IVMRWindowlessControl, FALSE); check_interface(filter, &IID_IVMRWindowlessControl9, FALSE); + IBaseFilter_FindPin(filter, sink_id, &pin); + + check_interface(pin, &IID_IMemInputPin, TRUE); + todo_wine check_interface(pin, &IID_IOverlay, TRUE); + check_interface(pin, &IID_IPin, TRUE); + todo_wine check_interface(pin, &IID_IQualityControl, TRUE); + check_interface(pin, &IID_IUnknown, TRUE); + + check_interface(pin, &IID_IKsPropertySet, FALSE); + check_interface(pin, &IID_IMediaPosition, FALSE); + todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE); + + IPin_Release(pin); + IBaseFilter_Release(filter); filter = create_vmr7(VMRMode_Windowless); @@ -243,6 +259,20 @@ static void test_interfaces(void) todo_wine check_interface(filter, &IID_IVMRMonitorConfig9, FALSE); todo_wine check_interface(filter, &IID_IVMRWindowlessControl9, FALSE); + IBaseFilter_FindPin(filter, sink_id, &pin); + + check_interface(pin, &IID_IMemInputPin, TRUE); + todo_wine check_interface(pin, &IID_IOverlay, TRUE); + check_interface(pin, &IID_IPin, TRUE); + todo_wine check_interface(pin, &IID_IQualityControl, TRUE); + check_interface(pin, &IID_IUnknown, TRUE); + + check_interface(pin, &IID_IKsPropertySet, FALSE); + check_interface(pin, &IID_IMediaPosition, FALSE); + todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE); + + IPin_Release(pin); + IBaseFilter_Release(filter); filter = create_vmr7(VMRMode_Renderless); @@ -258,6 +288,20 @@ static void test_interfaces(void) check_interface(filter, &IID_IVMRWindowlessControl, FALSE); check_interface(filter, &IID_IVMRWindowlessControl9, FALSE); + IBaseFilter_FindPin(filter, sink_id, &pin); + + check_interface(pin, &IID_IMemInputPin, TRUE); + todo_wine check_interface(pin, &IID_IOverlay, TRUE); + check_interface(pin, &IID_IPin, TRUE); + todo_wine check_interface(pin, &IID_IQualityControl, TRUE); + check_interface(pin, &IID_IUnknown, TRUE); + + check_interface(pin, &IID_IKsPropertySet, FALSE); + check_interface(pin, &IID_IMediaPosition, FALSE); + todo_wine check_interface(pin, &IID_IMediaSeeking, FALSE); + + IPin_Release(pin); + ref = IBaseFilter_Release(filter); ok(!ref, "Got outstanding refcount %d.\n", ref); }
1
0
0
0
Zebediah Figura : quartz/tests: Add tests for querying VMR7 pin information.
by Alexandre Julliard
03 Apr '19
03 Apr '19
Module: wine Branch: master Commit: 3fb152ab3905827bfdcf45ad346b22f5315f1ddd URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3fb152ab3905827bfdcf45ad…
Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Apr 2 20:59:37 2019 -0500 quartz/tests: Add tests for querying VMR7 pin information. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/quartz/tests/vmr7.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index d5253f4..918d579 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -459,6 +459,70 @@ static void test_find_pin(void) ok(!ref, "Got outstanding refcount %d.\n", ref); } +static void test_pin_info(void) +{ + WCHAR sink_id[] = {'V','M','R',' ','I','n','p','u','t','0',0}; + IBaseFilter *filter = create_vmr7(0); + PIN_DIRECTION dir; + ULONG count, ref; + PIN_INFO info; + HRESULT hr; + WCHAR *id; + IPin *pin; + + IBaseFilter_FindPin(filter, sink_id, &pin); + hr = IPin_QueryPinInfo(pin, &info); + ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter); + ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir); + ok(!lstrcmpW(info.achName, sink_id), "Got name %s.\n", wine_dbgstr_w(info.achName)); + IBaseFilter_Release(info.pFilter); + + hr = IPin_QueryDirection(pin, &dir); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir); + + hr = IPin_QueryId(pin, &id); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!lstrcmpW(id, sink_id), "Got id %s.\n", wine_dbgstr_w(id)); + CoTaskMemFree(id); + + hr = IPin_QueryInternalConnections(pin, NULL, &count); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + IPin_Release(pin); + + if (SUCCEEDED(set_mixing_mode(filter))) + { + sink_id[9] = '1'; + + IBaseFilter_FindPin(filter, sink_id, &pin); + hr = IPin_QueryPinInfo(pin, &info); + ok(info.pFilter == filter, "Expected filter %p, got %p.\n", filter, info.pFilter); + ok(info.dir == PINDIR_INPUT, "Got direction %d.\n", info.dir); + ok(!lstrcmpW(info.achName, sink_id), "Got name %s.\n", wine_dbgstr_w(info.achName)); + IBaseFilter_Release(info.pFilter); + + hr = IPin_QueryDirection(pin, &dir); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(dir == PINDIR_INPUT, "Got direction %d.\n", dir); + + hr = IPin_QueryId(pin, &id); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!lstrcmpW(id, sink_id), "Got id %s.\n", wine_dbgstr_w(id)); + CoTaskMemFree(id); + + hr = IPin_QueryInternalConnections(pin, NULL, &count); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + + IPin_Release(pin); + } + else + skip("Mixing mode is not supported.\n"); + + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + START_TEST(vmr7) { CoInitialize(NULL); @@ -467,6 +531,7 @@ START_TEST(vmr7) test_interfaces(); test_enum_pins(); test_find_pin(); + test_pin_info(); CoUninitialize(); }
1
0
0
0
← Newer
1
...
67
68
69
70
71
72
73
...
81
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
76
77
78
79
80
81
Results per page:
10
25
50
100
200