Commit 0aa28b5b authored by Alexandre Julliard's avatar Alexandre Julliard

Export the debugging API from libwine instead of ntdll.

Removed debugres_[aw].
parent dff78edb
...@@ -4086,7 +4086,7 @@ HMENU16 WINAPI LoadMenu16( HINSTANCE16 instance, LPCSTR name ) ...@@ -4086,7 +4086,7 @@ HMENU16 WINAPI LoadMenu16( HINSTANCE16 instance, LPCSTR name )
HGLOBAL16 handle; HGLOBAL16 handle;
HMENU16 hMenu; HMENU16 hMenu;
TRACE("(%04x,%s)\n", instance, debugres_a(name) ); TRACE("(%04x,%s)\n", instance, debugstr_a(name) );
if (HIWORD(name)) if (HIWORD(name))
{ {
......
...@@ -63,7 +63,7 @@ static char * GPA_string = "Failed to get entry point %s for hinst = 0x%08x\n"; ...@@ -63,7 +63,7 @@ static char * GPA_string = "Failed to get entry point %s for hinst = 0x%08x\n";
#define GPA(dest, hinst, name) \ #define GPA(dest, hinst, name) \
if(!(dest = (void*)GetProcAddress(hinst,name)))\ if(!(dest = (void*)GetProcAddress(hinst,name)))\
{ \ { \
ERR(GPA_string, debugres_a(name), hinst); \ ERR(GPA_string, debugstr_a(name), hinst); \
return FALSE; \ return FALSE; \
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/exception.h" #include "wine/exception.h"
#include "wine/unicode.h"
#include "thread.h" #include "thread.h"
#include "winbase.h" #include "winbase.h"
#include "winnt.h" #include "winnt.h"
...@@ -92,11 +93,12 @@ inline static char *put_string_a( const char *src, int n ) ...@@ -92,11 +93,12 @@ inline static char *put_string_a( const char *src, int n )
{ {
char *dst, *res; char *dst, *res;
if (n == -1) n = strlen(src);
if (n < 0) n = 0; if (n < 0) n = 0;
else if (n > 200) n = 200; else if (n > 200) n = 200;
dst = res = gimme1 (n * 4 + 6); dst = res = gimme1 (n * 4 + 6);
*dst++ = '"'; *dst++ = '"';
while (n-- > 0 && *src) while (n-- > 0)
{ {
unsigned char c = *src++; unsigned char c = *src++;
switch (c) switch (c)
...@@ -135,12 +137,13 @@ inline static char *put_string_w( const WCHAR *src, int n ) ...@@ -135,12 +137,13 @@ inline static char *put_string_w( const WCHAR *src, int n )
{ {
char *dst, *res; char *dst, *res;
if (n == -1) n = strlenW(src);
if (n < 0) n = 0; if (n < 0) n = 0;
else if (n > 200) n = 200; else if (n > 200) n = 200;
dst = res = gimme1 (n * 5 + 7); dst = res = gimme1 (n * 5 + 7);
*dst++ = 'L'; *dst++ = 'L';
*dst++ = '"'; *dst++ = '"';
while (n-- > 0 && *src) while (n-- > 0)
{ {
WCHAR c = *src++; WCHAR c = *src++;
switch (c) switch (c)
...@@ -174,9 +177,9 @@ inline static char *put_string_w( const WCHAR *src, int n ) ...@@ -174,9 +177,9 @@ inline static char *put_string_w( const WCHAR *src, int n )
} }
/*********************************************************************** /***********************************************************************
* wine_dbgstr_an (NTDLL.@) * NTDLL_dbgstr_an
*/ */
const char *wine_dbgstr_an( const char *src, int n ) static const char *NTDLL_dbgstr_an( const char *src, int n )
{ {
char *res, *old_pos; char *res, *old_pos;
struct debug_info *info = get_info(); struct debug_info *info = get_info();
...@@ -204,9 +207,9 @@ const char *wine_dbgstr_an( const char *src, int n ) ...@@ -204,9 +207,9 @@ const char *wine_dbgstr_an( const char *src, int n )
} }
/*********************************************************************** /***********************************************************************
* wine_dbgstr_wn (NTDLL.@) * NTDLL_dbgstr_wn
*/ */
const char *wine_dbgstr_wn( const WCHAR *src, int n ) static const char *NTDLL_dbgstr_wn( const WCHAR *src, int n )
{ {
char *res, *old_pos; char *res, *old_pos;
struct debug_info *info = get_info(); struct debug_info *info = get_info();
...@@ -235,9 +238,9 @@ const char *wine_dbgstr_wn( const WCHAR *src, int n ) ...@@ -235,9 +238,9 @@ const char *wine_dbgstr_wn( const WCHAR *src, int n )
} }
/*********************************************************************** /***********************************************************************
* wine_dbgstr_guid (NTDLL.@) * NTDLL_dbgstr_guid
*/ */
const char *wine_dbgstr_guid( const GUID *id ) static const char *NTDLL_dbgstr_guid( const GUID *id )
{ {
char *str; char *str;
...@@ -259,9 +262,9 @@ const char *wine_dbgstr_guid( const GUID *id ) ...@@ -259,9 +262,9 @@ const char *wine_dbgstr_guid( const GUID *id )
} }
/*********************************************************************** /***********************************************************************
* wine_dbg_vprintf (NTDLL.@) * NTDLL_dbg_vprintf
*/ */
int wine_dbg_vprintf( const char *format, va_list args ) static int NTDLL_dbg_vprintf( const char *format, va_list args )
{ {
struct debug_info *info = get_info(); struct debug_info *info = get_info();
char *p; char *p;
...@@ -296,36 +299,31 @@ int wine_dbg_vprintf( const char *format, va_list args ) ...@@ -296,36 +299,31 @@ int wine_dbg_vprintf( const char *format, va_list args )
} }
/*********************************************************************** /***********************************************************************
* wine_dbg_printf (NTDLL.@) * NTDLL_dbg_vlog
*/ */
int wine_dbg_printf(const char *format, ...) static int NTDLL_dbg_vlog( int cls, const char *channel,
const char *function, const char *format, va_list args )
{ {
int ret; static const char *classes[] = { "fixme", "err", "warn", "trace" };
va_list valist;
va_start(valist, format);
ret = wine_dbg_vprintf( format, valist );
va_end(valist);
return ret;
}
/***********************************************************************
* wine_dbg_log (NTDLL.@)
*/
int wine_dbg_log(enum __WINE_DEBUG_CLASS cls, const char *channel,
const char *function, const char *format, ... )
{
static const char *classes[__WINE_DBCL_COUNT] = { "fixme", "err", "warn", "trace" };
va_list valist;
int ret = 0; int ret = 0;
va_start(valist, format);
if (TRACE_ON(tid)) if (TRACE_ON(tid))
ret = wine_dbg_printf( "%08lx:", (DWORD)NtCurrentTeb()->tid ); ret = wine_dbg_printf( "%08lx:", (DWORD)NtCurrentTeb()->tid );
if (cls < __WINE_DBCL_COUNT) if (cls < sizeof(classes)/sizeof(classes[0]))
ret += wine_dbg_printf( "%s:%s:%s ", classes[cls], channel + 1, function ); ret += wine_dbg_printf( "%s:%s:%s ", classes[cls], channel + 1, function );
if (format) if (format)
ret += wine_dbg_vprintf( format, valist ); ret += NTDLL_dbg_vprintf( format, args );
va_end(valist);
return ret; return ret;
} }
/***********************************************************************
* debug_init
*/
DECL_GLOBAL_CONSTRUCTOR(debug_init)
{
__wine_dbgstr_an = NTDLL_dbgstr_an;
__wine_dbgstr_wn = NTDLL_dbgstr_wn;
__wine_dbgstr_guid = NTDLL_dbgstr_guid;
__wine_dbg_vprintf = NTDLL_dbg_vprintf;
__wine_dbg_vlog = NTDLL_dbg_vlog;
}
...@@ -1021,14 +1021,6 @@ name ntdll ...@@ -1021,14 +1021,6 @@ name ntdll
# Relays # Relays
@ cdecl -norelay -i386 __wine_call_from_32_regs() __wine_call_from_32_regs @ cdecl -norelay -i386 __wine_call_from_32_regs() __wine_call_from_32_regs
# Debugging interface
@ cdecl -norelay wine_dbgstr_an(str long) wine_dbgstr_an
@ cdecl -norelay wine_dbgstr_wn(str long) wine_dbgstr_wn
@ cdecl -norelay wine_dbgstr_guid(ptr) wine_dbgstr_guid
@ cdecl -norelay wine_dbg_vprintf(str ptr) wine_dbg_vprintf
@ varargs wine_dbg_printf(str) wine_dbg_printf
@ varargs wine_dbg_log(long str str str) wine_dbg_log
# Server interface # Server interface
@ cdecl -norelay wine_server_call(ptr) wine_server_call @ cdecl -norelay wine_server_call(ptr) wine_server_call
@ cdecl wine_server_handle_to_fd(long long ptr ptr ptr) wine_server_handle_to_fd @ cdecl wine_server_handle_to_fd(long long ptr ptr ptr) wine_server_handle_to_fd
......
...@@ -47,7 +47,7 @@ HACCEL16 WINAPI LoadAccelerators16(HINSTANCE16 instance, LPCSTR lpTableName) ...@@ -47,7 +47,7 @@ HACCEL16 WINAPI LoadAccelerators16(HINSTANCE16 instance, LPCSTR lpTableName)
{ {
HRSRC16 hRsrc; HRSRC16 hRsrc;
TRACE_(accel)("%04x %s\n", instance, debugres_a(lpTableName) ); TRACE_(accel)("%04x %s\n", instance, debugstr_a(lpTableName) );
if (!(hRsrc = FindResource16( instance, lpTableName, RT_ACCELERATORA ))) { if (!(hRsrc = FindResource16( instance, lpTableName, RT_ACCELERATORA ))) {
WARN_(accel)("couldn't find accelerator table resource\n"); WARN_(accel)("couldn't find accelerator table resource\n");
......
...@@ -248,12 +248,12 @@ void RELAY_DebugCallFrom16( CONTEXT86 *context ) ...@@ -248,12 +248,12 @@ void RELAY_DebugCallFrom16( CONTEXT86 *context )
break; break;
case ARG_STR: case ARG_STR:
DPRINTF( "%08x %s", *(int *)args16, DPRINTF( "%08x %s", *(int *)args16,
debugres_a( MapSL(*(SEGPTR *)args16 ))); debugstr_a( MapSL(*(SEGPTR *)args16 )));
args16 += sizeof(int); args16 += sizeof(int);
break; break;
case ARG_SEGSTR: case ARG_SEGSTR:
DPRINTF( "%04x:%04x %s", *(WORD *)(args16+2), *(WORD *)args16, DPRINTF( "%04x:%04x %s", *(WORD *)(args16+2), *(WORD *)args16,
debugres_a( MapSL(*(SEGPTR *)args16 )) ); debugstr_a( MapSL(*(SEGPTR *)args16 )) );
args16 += sizeof(SEGPTR); args16 += sizeof(SEGPTR);
break; break;
default: default:
...@@ -289,12 +289,12 @@ void RELAY_DebugCallFrom16( CONTEXT86 *context ) ...@@ -289,12 +289,12 @@ void RELAY_DebugCallFrom16( CONTEXT86 *context )
case ARG_STR: case ARG_STR:
args16 -= sizeof(int); args16 -= sizeof(int);
DPRINTF( "%08x %s", *(int *)args16, DPRINTF( "%08x %s", *(int *)args16,
debugres_a( MapSL(*(SEGPTR *)args16 ))); debugstr_a( MapSL(*(SEGPTR *)args16 )));
break; break;
case ARG_SEGSTR: case ARG_SEGSTR:
args16 -= sizeof(SEGPTR); args16 -= sizeof(SEGPTR);
DPRINTF( "%04x:%04x %s", *(WORD *)(args16+2), *(WORD *)args16, DPRINTF( "%04x:%04x %s", *(WORD *)(args16+2), *(WORD *)args16,
debugres_a( MapSL(*(SEGPTR *)args16 )) ); debugstr_a( MapSL(*(SEGPTR *)args16 )) );
break; break;
default: default:
break; break;
......
...@@ -87,6 +87,13 @@ enum __WINE_DEBUG_CLASS { ...@@ -87,6 +87,13 @@ enum __WINE_DEBUG_CLASS {
#endif /* __GNUC__ */ #endif /* __GNUC__ */
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_dbgstr_guid)( const struct _GUID *id );
extern int (*__wine_dbg_vprintf)( const char *format, va_list args );
extern int (*__wine_dbg_vlog)( int cls, const char *channel,
const char *function, const char *format, va_list args );
/* /*
* Exported definitions and macros * Exported definitions and macros
...@@ -95,17 +102,15 @@ enum __WINE_DEBUG_CLASS { ...@@ -95,17 +102,15 @@ enum __WINE_DEBUG_CLASS {
/* These function return a printable version of a string, including /* These function return a printable version of a string, including
quotes. The string will be valid for some time, but not indefinitely quotes. The string will be valid for some time, but not indefinitely
as strings are re-used. */ as strings are re-used. */
extern const char *wine_dbgstr_an( const char * s, int n ); inline static const char *wine_dbgstr_guid( const struct _GUID *id ) { return __wine_dbgstr_guid(id); }
extern const char *wine_dbgstr_wn( const WCHAR *s, int n ); inline static const char *wine_dbgstr_an( const char * s, int n ) { return __wine_dbgstr_an(s, n); }
extern const char *wine_dbgstr_guid( const struct _GUID *id ); inline static const char *wine_dbgstr_wn( const WCHAR *s, int n ) { return __wine_dbgstr_wn(s, n); }
inline static const char *wine_dbgstr_a( const char *s ) { return __wine_dbgstr_an( s, -1 ); }
inline static const char *wine_dbgstr_w( const WCHAR *s ) { return __wine_dbgstr_wn( s, -1 ); }
extern int wine_dbg_vprintf( const char *format, va_list args ) __WINE_PRINTF_ATTR(1,0);
extern int wine_dbg_printf( 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, const char *ch, extern int wine_dbg_log( int cls, const char *ch, const char *func,
const char *func, const char *format, ... ) __WINE_PRINTF_ATTR(4,5); const char *format, ... ) __WINE_PRINTF_ATTR(4,5);
inline static const char *wine_dbgstr_a( const char *s ) { return wine_dbgstr_an( s, 80 ); }
inline static const char *wine_dbgstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, 80 ); }
#define WINE_TRACE __WINE_DPRINTF(_TRACE,__wine_dbch___default) #define WINE_TRACE __WINE_DPRINTF(_TRACE,__wine_dbch___default)
#define WINE_TRACE_(ch) __WINE_DPRINTF(_TRACE,__wine_dbch_##ch) #define WINE_TRACE_(ch) __WINE_DPRINTF(_TRACE,__wine_dbch_##ch)
...@@ -135,13 +140,11 @@ inline static const char *wine_dbgstr_w( const WCHAR *s ) { return wine_dbgstr_w ...@@ -135,13 +140,11 @@ inline static const char *wine_dbgstr_w( const WCHAR *s ) { return wine_dbgstr_w
#ifdef __WINE__ #ifdef __WINE__
/* Wine uses shorter names that are very likely to conflict with other software */ /* Wine uses shorter names that are very likely to conflict with other software */
inline static const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); } inline static const char *debugstr_an( const char * s, int n ) { return __wine_dbgstr_an( s, n ); }
inline static const char *debugstr_wn( const WCHAR *s, int n ) { return wine_dbgstr_wn( s, n ); } inline static const char *debugstr_wn( const WCHAR *s, int n ) { return __wine_dbgstr_wn( s, n ); }
inline static const char *debugstr_guid( const struct _GUID *id ) { return wine_dbgstr_guid(id); } inline static const char *debugstr_guid( const struct _GUID *id ) { return __wine_dbgstr_guid(id); }
inline static const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, 80 ); } inline static const char *debugstr_a( const char *s ) { return __wine_dbgstr_an( s, -1 ); }
inline static const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, 80 ); } inline static const char *debugstr_w( const WCHAR *s ) { return __wine_dbgstr_wn( s, -1 ); }
inline static const char *debugres_a( const char *s ) { return wine_dbgstr_an( s, 80 ); }
inline static const char *debugres_w( const WCHAR *s ) { return wine_dbgstr_wn( s, 80 ); }
#define TRACE WINE_TRACE #define TRACE WINE_TRACE
#define TRACE_(ch) WINE_TRACE_(ch) #define TRACE_(ch) WINE_TRACE_(ch)
......
...@@ -18,11 +18,20 @@ ...@@ -18,11 +18,20 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <ctype.h> #include <ctype.h>
#include "wine/debug.h"
#include "wine/library.h"
#include "wine/unicode.h"
struct dll struct dll
{ {
struct dll *next; /* linked list of dlls */ struct dll *next; /* linked list of dlls */
...@@ -130,3 +139,187 @@ void wine_dbg_add_option( const char *name, unsigned char set, unsigned char cle ...@@ -130,3 +139,187 @@ void wine_dbg_add_option( const char *name, unsigned char set, unsigned char cle
dll = dll->next; dll = dll->next;
} }
} }
/* varargs wrapper for __wine_dbg_vprintf */
int wine_dbg_printf( const char *format, ... )
{
int ret;
va_list valist;
va_start(valist, format);
ret = __wine_dbg_vprintf( format, valist );
va_end(valist);
return ret;
}
/* varargs wrapper for __wine_dbg_vlog */
int wine_dbg_log( int cls, const char *channel, const char *func, const char *format, ... )
{
int ret;
va_list valist;
va_start(valist, format);
ret = __wine_dbg_vlog( cls, channel, func, format, valist );
va_end(valist);
return ret;
}
/* allocate some tmp string space */
/* FIXME: this is not 100% thread-safe */
static char *get_tmp_space( int size )
{
static char *list[32];
static long pos;
char *ret;
int idx;
idx = interlocked_xchg_add( &pos, 1 ) % (sizeof(list)/sizeof(list[0]));
if ((ret = realloc( list[idx], size ))) list[idx] = ret;
return ret;
}
/* default implementation of wine_dbgstr_an */
static const char *default_dbgstr_an( const char *str, int n )
{
char *dst, *res;
if (n == -1) n = strlen(str);
if (n < 0) n = 0;
else if (n > 200) n = 200;
dst = res = get_tmp_space( n * 4 + 6 );
*dst++ = '"';
while (n-- > 0)
{
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 <= 126)
*dst++ = c;
else
{
*dst++ = '\\';
*dst++ = '0' + ((c >> 6) & 7);
*dst++ = '0' + ((c >> 3) & 7);
*dst++ = '0' + ((c >> 0) & 7);
}
}
}
*dst++ = '"';
if (*str)
{
*dst++ = '.';
*dst++ = '.';
*dst++ = '.';
}
*dst = 0;
return res;
}
/* default implementation of wine_dbgstr_wn */
static const char *default_dbgstr_wn( const WCHAR *str, int n )
{
char *dst, *res;
if (n == -1) n = strlenW(str);
if (n < 0) n = 0;
else if (n > 200) n = 200;
dst = res = get_tmp_space( n * 5 + 7 );
*dst++ = 'L';
*dst++ = '"';
while (n-- > 0)
{
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 <= 126)
*dst++ = c;
else
{
*dst++ = '\\';
sprintf(dst,"%04x",c);
dst+=4;
}
}
}
*dst++ = '"';
if (*str)
{
*dst++ = '.';
*dst++ = '.';
*dst++ = '.';
}
*dst = 0;
return res;
}
/* default implementation of wine_dbgstr_guid */
static const char *default_dbgstr_guid( const struct _GUID *id )
{
char *str;
if (!id) return "(null)";
if (!((int)id >> 16))
{
str = get_tmp_space( 12 );
sprintf( str, "<guid-0x%04x>", (int)id & 0xffff );
}
else
{
str = get_tmp_space( 40 );
sprintf( str, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
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] );
}
return str;
}
/* default implementation of wine_dbg_vprintf */
static int default_dbg_vprintf( const char *format, va_list args )
{
return vfprintf( stderr, format, args );
}
/* default implementation of wine_dbg_vlog */
static int default_dbg_vlog( int cls, const char *channel, const char *func,
const char *format, va_list args )
{
static const char * const classes[] = { "fixme", "err", "warn", "trace" };
int ret = 0;
if (cls < sizeof(classes)/sizeof(classes[0]))
ret += wine_dbg_printf( "%s:%s:%s ", classes[cls], channel + 1, func );
if (format)
ret += __wine_dbg_vprintf( format, args );
return ret;
}
/* exported function pointers so that debugging functions can be redirected at run-time */
const char * (*__wine_dbgstr_an)( const char * s, int n ) = default_dbgstr_an;
const char * (*__wine_dbgstr_wn)( const WCHAR *s, int n ) = default_dbgstr_wn;
const char * (*__wine_dbgstr_guid)( const struct _GUID *id ) = default_dbgstr_guid;
int (*__wine_dbg_vprintf)( const char *format, va_list args ) = default_dbg_vprintf;
int (*__wine_dbg_vlog)( int cls, const char *channel, const char *function,
const char *format, va_list args ) = default_dbg_vlog;
...@@ -294,7 +294,7 @@ FARPROC16 WINAPI SetResourceHandler16( HMODULE16 hModule, LPCSTR typeId, ...@@ -294,7 +294,7 @@ FARPROC16 WINAPI SetResourceHandler16( HMODULE16 hModule, LPCSTR typeId,
if (!pModule || !pModule->res_table) return NULL; if (!pModule || !pModule->res_table) return NULL;
TRACE("module=%04x type=%s\n", hModule, debugres_a(typeId) ); TRACE("module=%04x type=%s\n", hModule, debugstr_a(typeId) );
for (;;) for (;;)
{ {
...@@ -319,7 +319,7 @@ HRSRC16 NE_FindResource( NE_MODULE *pModule, LPCSTR name, LPCSTR type ) ...@@ -319,7 +319,7 @@ HRSRC16 NE_FindResource( NE_MODULE *pModule, LPCSTR name, LPCSTR type )
if (!pModule || !pModule->res_table) return 0; if (!pModule || !pModule->res_table) return 0;
TRACE("module=%04x name=%s type=%s\n", pModule->self, debugres_a(name), debugres_a(type) ); TRACE("module=%04x name=%s type=%s\n", pModule->self, debugstr_a(name), debugstr_a(type) );
if (HIWORD(name)) /* Check for '#xxx' name */ if (HIWORD(name)) /* Check for '#xxx' name */
{ {
......
...@@ -354,7 +354,7 @@ ATOM WINAPI FindAtom16( LPCSTR str ) ...@@ -354,7 +354,7 @@ ATOM WINAPI FindAtom16( LPCSTR str )
if (CURRENT_DS == ATOM_UserDS) return GlobalFindAtomA( str ); if (CURRENT_DS == ATOM_UserDS) return GlobalFindAtomA( str );
TRACE("%s\n",debugres_a(str)); TRACE("%s\n",debugstr_a(str));
if (ATOM_IsIntAtomA( str, &iatom )) return iatom; if (ATOM_IsIntAtomA( str, &iatom )) return iatom;
if ((len = strlen( str )) > 255) len = 255; if ((len = strlen( str )) > 255) len = 255;
...@@ -451,7 +451,7 @@ static ATOM ATOM_AddAtomA( LPCSTR str, BOOL local ) ...@@ -451,7 +451,7 @@ static ATOM ATOM_AddAtomA( LPCSTR str, BOOL local )
} }
SERVER_END_REQ; SERVER_END_REQ;
} }
TRACE( "(%s) %s -> %x\n", local ? "local" : "global", debugres_a(str), atom ); TRACE( "(%s) %s -> %x\n", local ? "local" : "global", debugstr_a(str), atom );
return atom; return atom;
} }
...@@ -506,7 +506,7 @@ static ATOM ATOM_AddAtomW( LPCWSTR str, BOOL local ) ...@@ -506,7 +506,7 @@ static ATOM ATOM_AddAtomW( LPCWSTR str, BOOL local )
} }
SERVER_END_REQ; SERVER_END_REQ;
} }
TRACE( "(%s) %s -> %x\n", local ? "local" : "global", debugres_w(str), atom ); TRACE( "(%s) %s -> %x\n", local ? "local" : "global", debugstr_w(str), atom );
return atom; return atom;
} }
...@@ -598,7 +598,7 @@ static ATOM ATOM_FindAtomA( LPCSTR str, BOOL local ) ...@@ -598,7 +598,7 @@ static ATOM ATOM_FindAtomA( LPCSTR str, BOOL local )
} }
SERVER_END_REQ; SERVER_END_REQ;
} }
TRACE( "(%s) %s -> %x\n", local ? "local" : "global", debugres_a(str), atom ); TRACE( "(%s) %s -> %x\n", local ? "local" : "global", debugstr_a(str), atom );
return atom; return atom;
} }
...@@ -652,7 +652,7 @@ static ATOM ATOM_FindAtomW( LPCWSTR str, BOOL local ) ...@@ -652,7 +652,7 @@ static ATOM ATOM_FindAtomW( LPCWSTR str, BOOL local )
} }
SERVER_END_REQ; SERVER_END_REQ;
} }
TRACE( "(%s) %s -> %x\n", local ? "local" : "global", debugres_w(str), atom ); TRACE( "(%s) %s -> %x\n", local ? "local" : "global", debugstr_w(str), atom );
return atom; return atom;
} }
......
...@@ -2290,7 +2290,7 @@ INT16 WINAPI AddFontResource16( LPCSTR filename ) ...@@ -2290,7 +2290,7 @@ INT16 WINAPI AddFontResource16( LPCSTR filename )
INT WINAPI AddFontResourceA( LPCSTR str ) INT WINAPI AddFontResourceA( LPCSTR str )
{ {
FIXME("(%s): stub! Read the Wine User Guide on how to install " FIXME("(%s): stub! Read the Wine User Guide on how to install "
"this font manually.\n", debugres_a(str)); "this font manually.\n", debugstr_a(str));
return 1; return 1;
} }
...@@ -2301,7 +2301,7 @@ INT WINAPI AddFontResourceA( LPCSTR str ) ...@@ -2301,7 +2301,7 @@ INT WINAPI AddFontResourceA( LPCSTR str )
INT WINAPI AddFontResourceW( LPCWSTR str ) INT WINAPI AddFontResourceW( LPCWSTR str )
{ {
FIXME("(%s): stub! Read the Wine User Guide on how to install " FIXME("(%s): stub! Read the Wine User Guide on how to install "
"this font manually.\n", debugres_w(str)); "this font manually.\n", debugstr_w(str));
return 1; return 1;
} }
...@@ -2310,7 +2310,7 @@ INT WINAPI AddFontResourceW( LPCWSTR str ) ...@@ -2310,7 +2310,7 @@ INT WINAPI AddFontResourceW( LPCWSTR str )
*/ */
BOOL16 WINAPI RemoveFontResource16( LPCSTR str ) BOOL16 WINAPI RemoveFontResource16( LPCSTR str )
{ {
FIXME("(%s): stub\n", debugres_a(str)); FIXME("(%s): stub\n", debugstr_a(str));
return TRUE; return TRUE;
} }
...@@ -2342,7 +2342,7 @@ BOOL WINAPI RemoveFontResourceA( LPCSTR str ) ...@@ -2342,7 +2342,7 @@ BOOL WINAPI RemoveFontResourceA( LPCSTR str )
LeaveCriticalSection( &crtsc_fonts_X11 ); LeaveCriticalSection( &crtsc_fonts_X11 );
return retVal; return retVal;
*/ */
FIXME("(%s): stub\n", debugres_a(str)); FIXME("(%s): stub\n", debugstr_a(str));
return TRUE; return TRUE;
} }
...@@ -2352,6 +2352,6 @@ BOOL WINAPI RemoveFontResourceA( LPCSTR str ) ...@@ -2352,6 +2352,6 @@ BOOL WINAPI RemoveFontResourceA( LPCSTR str )
*/ */
BOOL WINAPI RemoveFontResourceW( LPCWSTR str ) BOOL WINAPI RemoveFontResourceW( LPCWSTR str )
{ {
FIXME("(%s): stub\n", debugres_w(str) ); FIXME("(%s): stub\n", debugstr_w(str) );
return TRUE; return TRUE;
} }
...@@ -229,17 +229,14 @@ SNOOP_GetProcAddress(HMODULE hmod,LPCSTR name,DWORD ordinal,FARPROC origfun) { ...@@ -229,17 +229,14 @@ SNOOP_GetProcAddress(HMODULE hmod,LPCSTR name,DWORD ordinal,FARPROC origfun) {
return (FARPROC)&(fun->lcall); return (FARPROC)&(fun->lcall);
} }
static char* static void SNOOP_PrintArg(DWORD x)
SNOOP_PrintArg(DWORD x) { {
static char buf[200];
int i,nostring; int i,nostring;
char * volatile ret=0;
if ( !HIWORD(x) ) { /* trivial reject to avoid faults */ DPRINTF("%08lx",x);
sprintf(buf,"%08lx",x); if ( !HIWORD(x) ) return; /* trivial reject to avoid faults */
return buf; __TRY
} {
__TRY{
LPBYTE s=(LPBYTE)x; LPBYTE s=(LPBYTE)x;
i=0;nostring=0; i=0;nostring=0;
while (i<80) { while (i<80) {
...@@ -248,18 +245,10 @@ SNOOP_PrintArg(DWORD x) { ...@@ -248,18 +245,10 @@ SNOOP_PrintArg(DWORD x) {
if (s[i]>=0x80) {nostring=1;break;} if (s[i]>=0x80) {nostring=1;break;}
i++; i++;
} }
if (!nostring) { if (!nostring && i > 5)
if (i>5) { DPRINTF(" %s",debugstr_an((LPSTR)x,i));
snprintf(buf,sizeof(buf),"%08lx %s",x,debugstr_an((LPSTR)x,sizeof(buf)-10)); else /* try unicode */
ret=buf; {
}
}
}
__EXCEPT(page_fault){}
__ENDTRY
if (ret)
return ret;
__TRY{
LPWSTR s=(LPWSTR)x; LPWSTR s=(LPWSTR)x;
i=0;nostring=0; i=0;nostring=0;
while (i<80) { while (i<80) {
...@@ -268,19 +257,13 @@ SNOOP_PrintArg(DWORD x) { ...@@ -268,19 +257,13 @@ SNOOP_PrintArg(DWORD x) {
if (s[i]>0x100) {nostring=1;break;} if (s[i]>0x100) {nostring=1;break;}
i++; i++;
} }
if (!nostring) { if (!nostring && i > 5) DPRINTF(" %s",debugstr_wn((LPWSTR)x,i));
if (i>5) {
snprintf(buf,sizeof(buf),"%08lx %s",x,debugstr_wn((LPWSTR)x,sizeof(buf)-10));
ret=buf;
} }
} }
__EXCEPT(page_fault)
{
} }
__EXCEPT(page_fault){}
__ENDTRY __ENDTRY
if (ret)
return ret;
sprintf(buf,"%08lx",x);
return buf;
} }
#define CALLER1REF (*(DWORD*)context->Esp) #define CALLER1REF (*(DWORD*)context->Esp)
...@@ -354,7 +337,10 @@ void WINAPI SNOOP_DoEntry( CONTEXT86 *context ) ...@@ -354,7 +337,10 @@ void WINAPI SNOOP_DoEntry( CONTEXT86 *context )
if (fun->nrofargs>0) { if (fun->nrofargs>0) {
max = fun->nrofargs; if (max>16) max=16; max = fun->nrofargs; if (max>16) max=16;
for (i=0;i<max;i++) for (i=0;i<max;i++)
DPRINTF("%s%s",SNOOP_PrintArg(*(DWORD*)(context->Esp + 4 + sizeof(DWORD)*i)),(i<fun->nrofargs-1)?",":""); {
SNOOP_PrintArg(*(DWORD*)(context->Esp + 4 + sizeof(DWORD)*i));
if (i<fun->nrofargs-1) DPRINTF(",");
}
if (max!=fun->nrofargs) if (max!=fun->nrofargs)
DPRINTF(" ..."); DPRINTF(" ...");
} else if (fun->nrofargs<0) { } else if (fun->nrofargs<0) {
...@@ -388,7 +374,10 @@ void WINAPI SNOOP_DoReturn( CONTEXT86 *context ) ...@@ -388,7 +374,10 @@ void WINAPI SNOOP_DoReturn( CONTEXT86 *context )
if (max>16) max=16; if (max>16) max=16;
for (i=0;i<max;i++) for (i=0;i<max;i++)
DPRINTF("%s%s",SNOOP_PrintArg(ret->args[i]),(i<max-1)?",":""); {
SNOOP_PrintArg(ret->args[i]);
if (i<max-1) DPRINTF(",");
}
DPRINTF(") retval = %08lx ret=%08lx\n", DPRINTF(") retval = %08lx ret=%08lx\n",
context->Eax,(DWORD)ret->origreturn ); context->Eax,(DWORD)ret->origreturn );
HeapFree(GetProcessHeap(),0,ret->args); HeapFree(GetProcessHeap(),0,ret->args);
......
...@@ -766,7 +766,7 @@ BOOL16 WINAPI UnregisterClass16( LPCSTR className, HINSTANCE16 hInstance ) ...@@ -766,7 +766,7 @@ BOOL16 WINAPI UnregisterClass16( LPCSTR className, HINSTANCE16 hInstance )
*/ */
BOOL WINAPI UnregisterClassA( LPCSTR className, HINSTANCE hInstance ) BOOL WINAPI UnregisterClassA( LPCSTR className, HINSTANCE hInstance )
{ {
TRACE("%s %x\n",debugres_a(className), hInstance); TRACE("%s %x\n",debugstr_a(className), hInstance);
return CLASS_UnregisterClass( GlobalFindAtomA( className ), hInstance ); return CLASS_UnregisterClass( GlobalFindAtomA( className ), hInstance );
} }
...@@ -775,7 +775,7 @@ BOOL WINAPI UnregisterClassA( LPCSTR className, HINSTANCE hInstance ) ...@@ -775,7 +775,7 @@ BOOL WINAPI UnregisterClassA( LPCSTR className, HINSTANCE hInstance )
*/ */
BOOL WINAPI UnregisterClassW( LPCWSTR className, HINSTANCE hInstance ) BOOL WINAPI UnregisterClassW( LPCWSTR className, HINSTANCE hInstance )
{ {
TRACE("%s %x\n",debugres_w(className), hInstance); TRACE("%s %x\n",debugstr_w(className), hInstance);
return CLASS_UnregisterClass( GlobalFindAtomW( className ), hInstance ); return CLASS_UnregisterClass( GlobalFindAtomW( className ), hInstance );
} }
...@@ -1111,7 +1111,7 @@ BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASS16 *wc ...@@ -1111,7 +1111,7 @@ BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASS16 *wc
ATOM atom; ATOM atom;
CLASS *classPtr; CLASS *classPtr;
TRACE("%x %s %p\n",hInstance, debugres_a(MapSL(name)), wc); TRACE("%x %s %p\n",hInstance, debugstr_a(MapSL(name)), wc);
hInstance = GetExePtr( hInstance ); hInstance = GetExePtr( hInstance );
if (!(atom = GlobalFindAtomA( MapSL(name) )) || if (!(atom = GlobalFindAtomA( MapSL(name) )) ||
...@@ -1223,7 +1223,7 @@ BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASSEX16 ...@@ -1223,7 +1223,7 @@ BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASSEX16
ATOM atom; ATOM atom;
CLASS *classPtr; CLASS *classPtr;
TRACE("%x %s %p\n",hInstance,debugres_a( MapSL(name) ), wc); TRACE("%x %s %p\n",hInstance,debugstr_a( MapSL(name) ), wc);
hInstance = GetExePtr( hInstance ); hInstance = GetExePtr( hInstance );
if (!(atom = GlobalFindAtomA( MapSL(name) )) || if (!(atom = GlobalFindAtomA( MapSL(name) )) ||
......
...@@ -379,7 +379,7 @@ static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info, ...@@ -379,7 +379,7 @@ static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info,
TRACE(" %s %s %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n", TRACE(" %s %s %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n",
debugstr_w( (LPCWSTR)info->className ), debugstr_w( (LPCWSTR)info->className ),
debugres_w( (LPCWSTR)info->windowName ), debugstr_w( (LPCWSTR)info->windowName ),
info->id, info->x, info->y, info->cx, info->cy, info->id, info->x, info->y, info->cx, info->cy,
info->style, info->exStyle, info->helpId ); info->style, info->exStyle, info->helpId );
...@@ -913,7 +913,7 @@ HWND16 WINAPI CreateDialogParam16( HINSTANCE16 hInst, LPCSTR dlgTemplate, ...@@ -913,7 +913,7 @@ HWND16 WINAPI CreateDialogParam16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
LPCVOID data; LPCVOID data;
TRACE("%04x,%s,%04x,%08lx,%ld\n", TRACE("%04x,%s,%04x,%08lx,%ld\n",
hInst, debugres_a(dlgTemplate), owner, (DWORD)dlgProc, param ); hInst, debugstr_a(dlgTemplate), owner, (DWORD)dlgProc, param );
if (!(hRsrc = FindResource16( hInst, dlgTemplate, RT_DIALOGA ))) return 0; if (!(hRsrc = FindResource16( hInst, dlgTemplate, RT_DIALOGA ))) return 0;
if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0; if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0;
......
...@@ -999,8 +999,8 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom, ...@@ -999,8 +999,8 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, ATOM classAtom,
BOOL unicode = (type == WIN_PROC_32W); BOOL unicode = (type == WIN_PROC_32W);
TRACE("%s %s ex=%08lx style=%08lx %d,%d %dx%d parent=%04x menu=%04x inst=%08x params=%p\n", TRACE("%s %s ex=%08lx style=%08lx %d,%d %dx%d parent=%04x menu=%04x inst=%08x params=%p\n",
(type == WIN_PROC_32W) ? debugres_w((LPWSTR)cs->lpszName) : debugres_a(cs->lpszName), (type == WIN_PROC_32W) ? debugstr_w((LPWSTR)cs->lpszName) : debugstr_a(cs->lpszName),
(type == WIN_PROC_32W) ? debugres_w((LPWSTR)cs->lpszClass) : debugres_a(cs->lpszClass), (type == WIN_PROC_32W) ? debugstr_w((LPWSTR)cs->lpszClass) : debugstr_a(cs->lpszClass),
cs->dwExStyle, cs->style, cs->x, cs->y, cs->cx, cs->cy, cs->dwExStyle, cs->style, cs->x, cs->y, cs->cx, cs->cy,
cs->hwndParent, cs->hMenu, cs->hInstance, cs->lpCreateParams ); cs->hwndParent, cs->hMenu, cs->hInstance, cs->lpCreateParams );
...@@ -1209,7 +1209,7 @@ HWND16 WINAPI CreateWindowEx16( DWORD exStyle, LPCSTR className, ...@@ -1209,7 +1209,7 @@ HWND16 WINAPI CreateWindowEx16( DWORD exStyle, LPCSTR className,
{ {
if (!(classAtom = GlobalFindAtomA( className ))) if (!(classAtom = GlobalFindAtomA( className )))
{ {
ERR( "bad class name %s\n", debugres_a(className) ); ERR( "bad class name %s\n", debugstr_a(className) );
return 0; return 0;
} }
} }
...@@ -1271,7 +1271,7 @@ HWND WINAPI CreateWindowExA( DWORD exStyle, LPCSTR className, ...@@ -1271,7 +1271,7 @@ HWND WINAPI CreateWindowExA( DWORD exStyle, LPCSTR className,
{ {
if (!(classAtom = GlobalFindAtomA( className ))) if (!(classAtom = GlobalFindAtomA( className )))
{ {
ERR( "bad class name %s\n", debugres_a(className) ); ERR( "bad class name %s\n", debugstr_a(className) );
return 0; return 0;
} }
} }
...@@ -1330,7 +1330,7 @@ HWND WINAPI CreateWindowExW( DWORD exStyle, LPCWSTR className, ...@@ -1330,7 +1330,7 @@ HWND WINAPI CreateWindowExW( DWORD exStyle, LPCWSTR className,
{ {
if (!(classAtom = GlobalFindAtomW( className ))) if (!(classAtom = GlobalFindAtomW( className )))
{ {
ERR( "bad class name %s\n", debugres_w(className) ); ERR( "bad class name %s\n", debugstr_w(className) );
return 0; return 0;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment