2002-01-22 01:55:18 +01:00
|
|
|
/*
|
|
|
|
* Wine debugging interface
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* Copyright 1999 Patrik Stridvall
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-01-22 01:55:18 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WINE_WINE_DEBUG_H
|
|
|
|
#define __WINE_WINE_DEBUG_H
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2019-04-03 10:02:14 +02:00
|
|
|
#include <stdio.h>
|
2003-08-28 23:43:34 +02:00
|
|
|
#include <windef.h>
|
2019-04-03 19:23:43 +02:00
|
|
|
#include <winbase.h>
|
2003-01-03 04:12:58 +01:00
|
|
|
#ifndef GUID_DEFINED
|
2003-08-28 23:43:34 +02:00
|
|
|
#include <guiddef.h>
|
2003-01-03 04:12:58 +01:00
|
|
|
#endif
|
2002-01-22 01:55:18 +01:00
|
|
|
|
2006-05-25 20:07:57 +02:00
|
|
|
#ifdef __WINE_WINE_TEST_H
|
|
|
|
#error This file should not be used in Wine tests
|
|
|
|
#endif
|
|
|
|
|
2002-01-22 01:55:18 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct _GUID;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Internal definitions (do not use these directly)
|
|
|
|
*/
|
|
|
|
|
2005-09-23 12:52:07 +02:00
|
|
|
enum __wine_debug_class
|
|
|
|
{
|
2002-01-22 01:55:18 +01:00
|
|
|
__WINE_DBCL_FIXME,
|
|
|
|
__WINE_DBCL_ERR,
|
|
|
|
__WINE_DBCL_WARN,
|
|
|
|
__WINE_DBCL_TRACE,
|
2005-09-28 17:21:48 +02:00
|
|
|
|
|
|
|
__WINE_DBCL_INIT = 7 /* lazy init flag */
|
2002-01-22 01:55:18 +01:00
|
|
|
};
|
|
|
|
|
2005-09-23 12:52:07 +02:00
|
|
|
struct __wine_debug_channel
|
|
|
|
{
|
|
|
|
unsigned char flags;
|
|
|
|
char name[15];
|
|
|
|
};
|
|
|
|
|
2004-10-20 01:06:11 +02:00
|
|
|
#ifndef WINE_NO_TRACE_MSGS
|
2005-09-23 12:52:07 +02:00
|
|
|
# define __WINE_GET_DEBUGGING_TRACE(dbch) ((dbch)->flags & (1 << __WINE_DBCL_TRACE))
|
2002-01-22 01:55:18 +01:00
|
|
|
#else
|
|
|
|
# define __WINE_GET_DEBUGGING_TRACE(dbch) 0
|
|
|
|
#endif
|
|
|
|
|
2004-10-20 01:06:11 +02:00
|
|
|
#ifndef WINE_NO_DEBUG_MSGS
|
2005-09-23 12:52:07 +02:00
|
|
|
# define __WINE_GET_DEBUGGING_WARN(dbch) ((dbch)->flags & (1 << __WINE_DBCL_WARN))
|
|
|
|
# define __WINE_GET_DEBUGGING_FIXME(dbch) ((dbch)->flags & (1 << __WINE_DBCL_FIXME))
|
2002-01-22 01:55:18 +01:00
|
|
|
#else
|
|
|
|
# define __WINE_GET_DEBUGGING_WARN(dbch) 0
|
|
|
|
# define __WINE_GET_DEBUGGING_FIXME(dbch) 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* define error macro regardless of what is configured */
|
2005-09-23 12:52:07 +02:00
|
|
|
#define __WINE_GET_DEBUGGING_ERR(dbch) ((dbch)->flags & (1 << __WINE_DBCL_ERR))
|
2002-01-22 01:55:18 +01:00
|
|
|
|
|
|
|
#define __WINE_GET_DEBUGGING(dbcl,dbch) __WINE_GET_DEBUGGING##dbcl(dbch)
|
2005-09-28 17:21:48 +02:00
|
|
|
|
|
|
|
#define __WINE_IS_DEBUG_ON(dbcl,dbch) \
|
2005-09-29 13:16:52 +02:00
|
|
|
(__WINE_GET_DEBUGGING##dbcl(dbch) && (__wine_dbg_get_channel_flags(dbch) & (1 << __WINE_DBCL##dbcl)))
|
2002-01-22 01:55:18 +01:00
|
|
|
|
|
|
|
#ifdef __GNUC__
|
|
|
|
|
|
|
|
#define __WINE_DPRINTF(dbcl,dbch) \
|
|
|
|
do { if(__WINE_GET_DEBUGGING(dbcl,(dbch))) { \
|
2005-09-23 12:52:07 +02:00
|
|
|
struct __wine_debug_channel * const __dbch = (dbch); \
|
|
|
|
const enum __wine_debug_class __dbcl = __WINE_DBCL##dbcl; \
|
2002-01-22 01:55:18 +01:00
|
|
|
__WINE_DBG_LOG
|
|
|
|
|
|
|
|
#define __WINE_DBG_LOG(args...) \
|
|
|
|
wine_dbg_log( __dbcl, __dbch, __FUNCTION__, args); } } while(0)
|
|
|
|
|
|
|
|
#define __WINE_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
|
|
|
|
|
2003-03-15 20:39:37 +01:00
|
|
|
|
2004-10-20 01:06:11 +02:00
|
|
|
#ifdef WINE_NO_TRACE_MSGS
|
2003-04-14 23:42:57 +02:00
|
|
|
#define WINE_TRACE(args...) do { } while(0)
|
2003-03-15 20:39:37 +01:00
|
|
|
#define WINE_TRACE_(ch) WINE_TRACE
|
|
|
|
#endif
|
|
|
|
|
2004-10-20 01:06:11 +02:00
|
|
|
#ifdef WINE_NO_DEBUG_MSGS
|
2003-04-14 23:42:57 +02:00
|
|
|
#define WINE_WARN(args...) do { } while(0)
|
2003-03-15 20:39:37 +01:00
|
|
|
#define WINE_WARN_(ch) WINE_WARN
|
2003-04-14 23:42:57 +02:00
|
|
|
#define WINE_FIXME(args...) do { } while(0)
|
2003-03-15 20:39:37 +01:00
|
|
|
#define WINE_FIXME_(ch) WINE_FIXME
|
|
|
|
#endif
|
|
|
|
|
2002-07-05 23:22:09 +02:00
|
|
|
#elif defined(__SUNPRO_C)
|
|
|
|
|
|
|
|
#define __WINE_DPRINTF(dbcl,dbch) \
|
|
|
|
do { if(__WINE_GET_DEBUGGING(dbcl,(dbch))) { \
|
2005-09-23 12:52:07 +02:00
|
|
|
struct __wine_debug_channel * const __dbch = (dbch); \
|
2002-07-05 23:22:09 +02:00
|
|
|
const enum __WINE_DEBUG_CLASS __dbcl = __WINE_DBCL##dbcl; \
|
|
|
|
__WINE_DBG_LOG
|
|
|
|
|
|
|
|
#define __WINE_DBG_LOG(...) \
|
|
|
|
wine_dbg_log( __dbcl, __dbch, __func__, __VA_ARGS__); } } while(0)
|
|
|
|
|
|
|
|
#define __WINE_PRINTF_ATTR(fmt,args)
|
|
|
|
|
2004-10-20 01:06:11 +02:00
|
|
|
#ifdef WINE_NO_TRACE_MSGS
|
2003-03-15 20:39:37 +01:00
|
|
|
#define WINE_TRACE(...) do { } while(0)
|
|
|
|
#define WINE_TRACE_(ch) WINE_TRACE
|
|
|
|
#endif
|
|
|
|
|
2004-10-20 01:06:11 +02:00
|
|
|
#ifdef WINE_NO_DEBUG_MSGS
|
2003-03-15 20:39:37 +01:00
|
|
|
#define WINE_WARN(...) do { } while(0)
|
|
|
|
#define WINE_WARN_(ch) WINE_WARN
|
|
|
|
#define WINE_FIXME(...) do { } while(0)
|
|
|
|
#define WINE_FIXME_(ch) WINE_FIXME
|
|
|
|
#endif
|
|
|
|
|
2002-07-05 23:22:09 +02:00
|
|
|
#else /* !__GNUC__ && !__SUNPRO_C */
|
2002-01-22 01:55:18 +01:00
|
|
|
|
|
|
|
#define __WINE_DPRINTF(dbcl,dbch) \
|
|
|
|
(!__WINE_GET_DEBUGGING(dbcl,(dbch)) || \
|
2005-09-28 17:21:48 +02:00
|
|
|
(wine_dbg_log(__WINE_DBCL##dbcl,(dbch),__FILE__,"%d: ",__LINE__) == -1)) ? \
|
2002-01-22 01:55:18 +01:00
|
|
|
(void)0 : (void)wine_dbg_printf
|
|
|
|
|
|
|
|
#define __WINE_PRINTF_ATTR(fmt, args)
|
|
|
|
|
2002-07-05 23:22:09 +02:00
|
|
|
#endif /* !__GNUC__ && !__SUNPRO_C */
|
2002-01-22 01:55:18 +01:00
|
|
|
|
2019-04-03 19:25:28 +02:00
|
|
|
extern unsigned char __cdecl __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel );
|
2019-04-03 19:23:43 +02:00
|
|
|
extern const char * __cdecl __wine_dbg_strdup( const char *str );
|
2019-04-03 19:24:39 +02:00
|
|
|
extern int __cdecl __wine_dbg_output( const char *str );
|
2019-04-03 19:27:13 +02:00
|
|
|
extern int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_channel *channel,
|
|
|
|
const char *function );
|
2002-01-22 01:55:18 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Exported definitions and macros
|
|
|
|
*/
|
|
|
|
|
2007-01-18 11:35:50 +01:00
|
|
|
/* These functions return a printable version of a string, including
|
2002-01-22 01:55:18 +01:00
|
|
|
quotes. The string will be valid for some time, but not indefinitely
|
|
|
|
as strings are re-used. */
|
|
|
|
|
2019-04-03 10:02:14 +02:00
|
|
|
#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 );
|
|
|
|
}
|
|
|
|
|
2019-04-03 19:24:39 +02:00
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
2019-04-03 19:27:13 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2019-04-03 19:23:43 +02:00
|
|
|
static inline const char *wine_dbgstr_an( const char *str, int n )
|
|
|
|
{
|
2019-05-19 23:19:19 +02:00
|
|
|
static const char hex[16] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
|
2019-04-03 19:23:43 +02:00
|
|
|
char buffer[300], *dst = buffer;
|
|
|
|
|
|
|
|
if (!str) return "(null)";
|
|
|
|
if (!((ULONG_PTR)str >> 16)) return wine_dbg_sprintf( "#%04x", LOWORD(str) );
|
|
|
|
if (IsBadStringPtrA( str, n )) return "(invalid)";
|
|
|
|
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 )
|
|
|
|
{
|
2019-05-19 23:19:19 +02:00
|
|
|
static const char hex[16] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
|
2019-04-03 19:23:43 +02:00
|
|
|
char buffer[300], *dst = buffer;
|
|
|
|
|
|
|
|
if (!str) return "(null)";
|
|
|
|
if (!((ULONG_PTR)str >> 16)) return wine_dbg_sprintf( "#%04x", LOWORD(str) );
|
|
|
|
if (IsBadStringPtrW( str, n )) return "(invalid)";
|
|
|
|
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];
|
|
|
|
}
|
2019-04-11 09:18:46 +02:00
|
|
|
else *dst++ = (char)c;
|
2019-04-03 19:23:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
*dst++ = '"';
|
|
|
|
if (n > 0)
|
|
|
|
{
|
|
|
|
*dst++ = '.';
|
|
|
|
*dst++ = '.';
|
|
|
|
*dst++ = '.';
|
|
|
|
}
|
|
|
|
*dst = 0;
|
|
|
|
return __wine_dbg_strdup( buffer );
|
|
|
|
}
|
|
|
|
|
2005-09-29 13:16:52 +02:00
|
|
|
static inline const char *wine_dbgstr_a( const char *s )
|
2005-09-23 12:52:07 +02:00
|
|
|
{
|
|
|
|
return wine_dbgstr_an( s, -1 );
|
|
|
|
}
|
|
|
|
|
2005-09-29 13:16:52 +02:00
|
|
|
static inline const char *wine_dbgstr_w( const WCHAR *s )
|
2005-09-23 12:52:07 +02:00
|
|
|
{
|
|
|
|
return wine_dbgstr_wn( s, -1 );
|
|
|
|
}
|
|
|
|
|
2003-01-03 04:12:58 +01:00
|
|
|
static inline const char *wine_dbgstr_guid( const GUID *id )
|
|
|
|
{
|
|
|
|
if (!id) return "(null)";
|
2008-12-09 17:56:16 +01:00
|
|
|
if (!((ULONG_PTR)id >> 16)) return wine_dbg_sprintf( "<guid-0x%04hx>", (WORD)(ULONG_PTR)id );
|
2006-10-15 12:27:34 +02:00
|
|
|
return wine_dbg_sprintf( "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
2003-01-03 04:12:58 +01:00
|
|
|
id->Data1, id->Data2, id->Data3,
|
|
|
|
id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
|
|
|
|
id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] );
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline const char *wine_dbgstr_point( const POINT *pt )
|
|
|
|
{
|
|
|
|
if (!pt) return "(null)";
|
2006-09-29 01:18:51 +02:00
|
|
|
return wine_dbg_sprintf( "(%d,%d)", pt->x, pt->y );
|
2003-01-03 04:12:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline const char *wine_dbgstr_rect( const RECT *rect )
|
|
|
|
{
|
|
|
|
if (!rect) return "(null)";
|
2006-09-29 01:18:51 +02:00
|
|
|
return wine_dbg_sprintf( "(%d,%d)-(%d,%d)", rect->left, rect->top,
|
|
|
|
rect->right, rect->bottom );
|
2003-01-03 04:12:58 +01:00
|
|
|
}
|
|
|
|
|
2003-11-18 21:47:48 +01:00
|
|
|
static inline const char *wine_dbgstr_longlong( ULONGLONG ll )
|
|
|
|
{
|
2005-09-23 12:52:07 +02:00
|
|
|
if (sizeof(ll) > sizeof(unsigned long) && ll >> 32)
|
|
|
|
return wine_dbg_sprintf( "%lx%08lx", (unsigned long)(ll >> 32), (unsigned long)ll );
|
2003-11-18 21:47:48 +01:00
|
|
|
else return wine_dbg_sprintf( "%lx", (unsigned long)ll );
|
|
|
|
}
|
|
|
|
|
2014-07-24 16:26:02 +02:00
|
|
|
#if defined(__oaidl_h__) && defined(V_VT)
|
|
|
|
|
|
|
|
static inline const char *wine_dbgstr_vt( VARTYPE vt )
|
|
|
|
{
|
|
|
|
static const char *const variant_types[] =
|
|
|
|
{
|
|
|
|
"VT_EMPTY","VT_NULL","VT_I2","VT_I4","VT_R4","VT_R8","VT_CY","VT_DATE",
|
|
|
|
"VT_BSTR","VT_DISPATCH","VT_ERROR","VT_BOOL","VT_VARIANT","VT_UNKNOWN",
|
|
|
|
"VT_DECIMAL","15","VT_I1","VT_UI1","VT_UI2","VT_UI4","VT_I8","VT_UI8",
|
|
|
|
"VT_INT","VT_UINT","VT_VOID","VT_HRESULT","VT_PTR","VT_SAFEARRAY",
|
|
|
|
"VT_CARRAY","VT_USERDEFINED","VT_LPSTR","VT_LPWSTR","32","33","34","35",
|
|
|
|
"VT_RECORD","VT_INT_PTR","VT_UINT_PTR","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","VT_FILETIME","VT_BLOB","VT_STREAM","VT_STORAGE",
|
|
|
|
"VT_STREAMED_OBJECT","VT_STORED_OBJECT","VT_BLOB_OBJECT","VT_CF","VT_CLSID",
|
|
|
|
"VT_VERSIONED_STREAM"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *const variant_flags[16] =
|
|
|
|
{
|
|
|
|
"",
|
|
|
|
"|VT_VECTOR",
|
|
|
|
"|VT_ARRAY",
|
|
|
|
"|VT_VECTOR|VT_ARRAY",
|
|
|
|
"|VT_BYREF",
|
2015-09-01 14:59:38 +02:00
|
|
|
"|VT_VECTOR|VT_BYREF",
|
2014-07-24 16:26:02 +02:00
|
|
|
"|VT_ARRAY|VT_BYREF",
|
|
|
|
"|VT_VECTOR|VT_ARRAY|VT_BYREF",
|
|
|
|
"|VT_RESERVED",
|
|
|
|
"|VT_VECTOR|VT_RESERVED",
|
|
|
|
"|VT_ARRAY|VT_RESERVED",
|
|
|
|
"|VT_VECTOR|VT_ARRAY|VT_RESERVED",
|
|
|
|
"|VT_BYREF|VT_RESERVED",
|
2015-09-01 14:59:38 +02:00
|
|
|
"|VT_VECTOR|VT_BYREF|VT_RESERVED",
|
2014-07-24 16:26:02 +02:00
|
|
|
"|VT_ARRAY|VT_BYREF|VT_RESERVED",
|
|
|
|
"|VT_VECTOR|VT_ARRAY|VT_BYREF|VT_RESERVED",
|
|
|
|
};
|
|
|
|
|
|
|
|
if (vt & ~VT_TYPEMASK)
|
|
|
|
return wine_dbg_sprintf( "%s%s", wine_dbgstr_vt(vt&VT_TYPEMASK), variant_flags[vt>>12] );
|
|
|
|
|
2018-11-18 18:26:21 +01:00
|
|
|
if (vt < sizeof(variant_types)/sizeof(*variant_types))
|
2014-07-24 16:26:02 +02:00
|
|
|
return variant_types[vt];
|
|
|
|
|
|
|
|
if (vt == VT_BSTR_BLOB)
|
|
|
|
return "VT_BSTR_BLOB";
|
|
|
|
|
|
|
|
return wine_dbg_sprintf( "vt(invalid %x)", vt );
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline const char *wine_dbgstr_variant( const VARIANT *v )
|
|
|
|
{
|
|
|
|
if (!v)
|
|
|
|
return "(null)";
|
|
|
|
|
|
|
|
if (V_VT(v) & VT_BYREF) {
|
|
|
|
if (V_VT(v) == (VT_VARIANT|VT_BYREF))
|
|
|
|
return wine_dbg_sprintf( "%p {VT_VARIANT|VT_BYREF: %s}", v, wine_dbgstr_variant(V_VARIANTREF(v)) );
|
2015-02-27 12:38:31 +01:00
|
|
|
if (V_VT(v) == (VT_BSTR|VT_BYREF))
|
2015-03-03 06:13:29 +01:00
|
|
|
return wine_dbg_sprintf( "%p {VT_BSTR|VT_BYREF: %s}", v, V_BSTRREF(v) ? wine_dbgstr_w(*V_BSTRREF(v)) : "(none)" );
|
2014-07-24 16:26:02 +02:00
|
|
|
return wine_dbg_sprintf( "%p {%s %p}", v, wine_dbgstr_vt(V_VT(v)), V_BYREF(v) );
|
|
|
|
}
|
|
|
|
|
|
|
|
if (V_ISARRAY(v) || V_ISVECTOR(v))
|
|
|
|
return wine_dbg_sprintf( "%p {%s %p}", v, wine_dbgstr_vt(V_VT(v)), V_ARRAY(v) );
|
|
|
|
|
|
|
|
switch(V_VT(v)) {
|
|
|
|
case VT_EMPTY:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_EMPTY}", v );
|
|
|
|
case VT_NULL:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_NULL}", v );
|
|
|
|
case VT_I2:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_I2: %d}", v, V_I2(v) );
|
|
|
|
case VT_I4:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_I4: %d}", v, V_I4(v) );
|
|
|
|
case VT_R4:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_R4: %f}", v, V_R4(v) );
|
|
|
|
case VT_R8:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_R8: %lf}", v, V_R8(v) );
|
|
|
|
case VT_CY:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_CY: %s}", v, wine_dbgstr_longlong(V_CY(v).int64) );
|
|
|
|
case VT_DATE:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_DATE: %lf}", v, V_DATE(v) );
|
2017-06-20 06:37:31 +02:00
|
|
|
case VT_LPSTR:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_LPSTR: %s}", v, wine_dbgstr_a((const char *)V_BSTR(v)) );
|
|
|
|
case VT_LPWSTR:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_LPWSTR: %s}", v, wine_dbgstr_w(V_BSTR(v)) );
|
2014-07-24 16:26:02 +02:00
|
|
|
case VT_BSTR:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_BSTR: %s}", v, wine_dbgstr_w(V_BSTR(v)) );
|
|
|
|
case VT_DISPATCH:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_DISPATCH: %p}", v, V_DISPATCH(v) );
|
|
|
|
case VT_ERROR:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_ERROR: %08x}", v, V_ERROR(v) );
|
|
|
|
case VT_BOOL:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_BOOL: %x}", v, V_BOOL(v) );
|
|
|
|
case VT_UNKNOWN:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_UNKNOWN: %p}", v, V_UNKNOWN(v) );
|
|
|
|
case VT_I1:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_I1: %d}", v, V_I1(v) );
|
|
|
|
case VT_UI1:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_UI1: %u}", v, V_UI1(v) );
|
|
|
|
case VT_UI2:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_UI2: %d}", v, V_UI2(v) );
|
|
|
|
case VT_UI4:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_UI4: %d}", v, V_UI4(v) );
|
|
|
|
case VT_I8:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_I8: %s}", v, wine_dbgstr_longlong(V_I8(v)) );
|
|
|
|
case VT_UI8:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_UI8: %s}", v, wine_dbgstr_longlong(V_UI8(v)) );
|
|
|
|
case VT_INT:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_INT: %d}", v, V_INT(v) );
|
|
|
|
case VT_UINT:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_UINT: %u}", v, V_UINT(v) );
|
|
|
|
case VT_VOID:
|
|
|
|
return wine_dbg_sprintf( "%p {VT_VOID}", v );
|
|
|
|
case VT_RECORD:
|
2015-10-27 11:58:14 +01:00
|
|
|
return wine_dbg_sprintf( "%p {VT_RECORD: %p %p}", v, V_RECORD(v), V_RECORDINFO(v) );
|
2014-07-24 16:26:02 +02:00
|
|
|
default:
|
|
|
|
return wine_dbg_sprintf( "%p {vt %s}", v, wine_dbgstr_vt(V_VT(v)) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* defined(__oaidl_h__) && defined(V_VT) */
|
|
|
|
|
2003-03-15 20:39:37 +01:00
|
|
|
#ifndef WINE_TRACE
|
2002-01-22 01:55:18 +01:00
|
|
|
#define WINE_TRACE __WINE_DPRINTF(_TRACE,__wine_dbch___default)
|
2005-09-23 12:52:07 +02:00
|
|
|
#define WINE_TRACE_(ch) __WINE_DPRINTF(_TRACE,&__wine_dbch_##ch)
|
2003-03-15 20:39:37 +01:00
|
|
|
#endif
|
2005-09-28 17:21:48 +02:00
|
|
|
#define WINE_TRACE_ON(ch) __WINE_IS_DEBUG_ON(_TRACE,&__wine_dbch_##ch)
|
2002-01-22 01:55:18 +01:00
|
|
|
|
2003-03-15 20:39:37 +01:00
|
|
|
#ifndef WINE_WARN
|
2002-01-22 01:55:18 +01:00
|
|
|
#define WINE_WARN __WINE_DPRINTF(_WARN,__wine_dbch___default)
|
2005-09-23 12:52:07 +02:00
|
|
|
#define WINE_WARN_(ch) __WINE_DPRINTF(_WARN,&__wine_dbch_##ch)
|
2003-03-15 20:39:37 +01:00
|
|
|
#endif
|
2005-09-28 17:21:48 +02:00
|
|
|
#define WINE_WARN_ON(ch) __WINE_IS_DEBUG_ON(_WARN,&__wine_dbch_##ch)
|
2002-01-22 01:55:18 +01:00
|
|
|
|
2003-03-15 20:39:37 +01:00
|
|
|
#ifndef WINE_FIXME
|
2002-01-22 01:55:18 +01:00
|
|
|
#define WINE_FIXME __WINE_DPRINTF(_FIXME,__wine_dbch___default)
|
2005-09-23 12:52:07 +02:00
|
|
|
#define WINE_FIXME_(ch) __WINE_DPRINTF(_FIXME,&__wine_dbch_##ch)
|
2003-03-15 20:39:37 +01:00
|
|
|
#endif
|
2005-09-28 17:21:48 +02:00
|
|
|
#define WINE_FIXME_ON(ch) __WINE_IS_DEBUG_ON(_FIXME,&__wine_dbch_##ch)
|
2002-01-22 01:55:18 +01:00
|
|
|
|
|
|
|
#define WINE_ERR __WINE_DPRINTF(_ERR,__wine_dbch___default)
|
2005-09-23 12:52:07 +02:00
|
|
|
#define WINE_ERR_(ch) __WINE_DPRINTF(_ERR,&__wine_dbch_##ch)
|
2005-09-28 17:21:48 +02:00
|
|
|
#define WINE_ERR_ON(ch) __WINE_IS_DEBUG_ON(_ERR,&__wine_dbch_##ch)
|
2002-01-22 01:55:18 +01:00
|
|
|
|
|
|
|
#define WINE_DECLARE_DEBUG_CHANNEL(ch) \
|
2019-01-08 19:45:24 +01:00
|
|
|
static struct __wine_debug_channel __wine_dbch_##ch = { 0xff, #ch }
|
2002-01-22 01:55:18 +01:00
|
|
|
#define WINE_DEFAULT_DEBUG_CHANNEL(ch) \
|
2019-01-08 19:45:24 +01:00
|
|
|
static struct __wine_debug_channel __wine_dbch_##ch = { 0xff, #ch }; \
|
2005-09-23 12:52:07 +02:00
|
|
|
static struct __wine_debug_channel * const __wine_dbch___default = &__wine_dbch_##ch
|
2002-01-22 01:55:18 +01:00
|
|
|
|
|
|
|
#define WINE_MESSAGE wine_dbg_printf
|
|
|
|
|
2003-01-04 01:52:18 +01:00
|
|
|
#ifdef __WINESRC__
|
2002-01-22 01:55:18 +01:00
|
|
|
/* Wine uses shorter names that are very likely to conflict with other software */
|
|
|
|
|
2007-03-26 21:26:29 +02:00
|
|
|
static inline const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); }
|
|
|
|
static inline const char *debugstr_wn( const WCHAR *s, int n ) { return wine_dbgstr_wn( s, n ); }
|
|
|
|
static inline const char *debugstr_guid( const struct _GUID *id ) { return wine_dbgstr_guid(id); }
|
|
|
|
static inline const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); }
|
|
|
|
static inline const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); }
|
2002-01-22 01:55:18 +01:00
|
|
|
|
2014-07-24 16:26:23 +02:00
|
|
|
#if defined(__oaidl_h__) && defined(V_VT)
|
|
|
|
static inline const char *debugstr_vt( VARTYPE vt ) { return wine_dbgstr_vt( vt ); }
|
|
|
|
static inline const char *debugstr_variant( const VARIANT *v ) { return wine_dbgstr_variant( v ); }
|
|
|
|
#endif
|
|
|
|
|
2002-01-22 01:55:18 +01:00
|
|
|
#define TRACE WINE_TRACE
|
|
|
|
#define TRACE_(ch) WINE_TRACE_(ch)
|
|
|
|
#define TRACE_ON(ch) WINE_TRACE_ON(ch)
|
|
|
|
|
|
|
|
#define WARN WINE_WARN
|
|
|
|
#define WARN_(ch) WINE_WARN_(ch)
|
|
|
|
#define WARN_ON(ch) WINE_WARN_ON(ch)
|
|
|
|
|
|
|
|
#define FIXME WINE_FIXME
|
|
|
|
#define FIXME_(ch) WINE_FIXME_(ch)
|
|
|
|
#define FIXME_ON(ch) WINE_FIXME_ON(ch)
|
|
|
|
|
|
|
|
#undef ERR /* Solaris got an 'ERR' define in <sys/reg.h> */
|
|
|
|
#define ERR WINE_ERR
|
|
|
|
#define ERR_(ch) WINE_ERR_(ch)
|
|
|
|
#define ERR_ON(ch) WINE_ERR_ON(ch)
|
|
|
|
|
|
|
|
#define MESSAGE WINE_MESSAGE
|
|
|
|
|
2003-01-04 01:52:18 +01:00
|
|
|
#endif /* __WINESRC__ */
|
2002-01-22 01:55:18 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __WINE_WINE_DEBUG_H */
|