advapi32/tests: Use the global wine_dbgstr_w instead of a local variant.

oldstable
Alexandre Julliard 2009-08-19 13:36:17 +02:00
parent ee868cce5b
commit 825487b1eb
1 changed files with 2 additions and 53 deletions

View File

@ -111,57 +111,6 @@ static const char *wine_debugstr_an( const char *str, int n )
return res;
}
static const char *wine_debugstr_wn( const WCHAR *str, int n )
{
char *dst, *res;
size_t size;
if (!HIWORD(str))
{
if (!str) return "(null)";
res = get_temp_buffer( 6 );
sprintf( res, "#%04x", LOWORD(str) );
return res;
}
if (n == -1) n = lstrlenW(str);
if (n < 0) n = 0;
size = 12 + min( 300, n * 5);
dst = res = get_temp_buffer( n * 5 + 7 );
*dst++ = 'L';
*dst++ = '"';
while (n-- > 0 && dst <= res + size - 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 <= 126)
*dst++ = (char)c;
else
{
*dst++ = '\\';
sprintf(dst,"%04x",c);
dst+=4;
}
}
}
*dst++ = '"';
if (n > 0)
{
*dst++ = '.';
*dst++ = '.';
*dst++ = '.';
}
*dst = 0;
return res;
}
#define ADVAPI32_GET_PROC(func) \
p ## func = (void*)GetProcAddress(hadvapi32, #func);
@ -288,8 +237,8 @@ static void _test_hkey_main_Value_W(int line, LPCWSTR name, LPCWSTR string,
if (string)
{
lok(memcmp(value, string, cbData) == 0, "RegQueryValueExW failed: %s/%d != %s/%d\n",
wine_debugstr_wn((WCHAR*)value, cbData / sizeof(WCHAR)), cbData,
wine_debugstr_wn(string, full_byte_len / sizeof(WCHAR)), full_byte_len);
wine_dbgstr_wn((WCHAR*)value, cbData / sizeof(WCHAR)), cbData,
wine_dbgstr_wn(string, full_byte_len / sizeof(WCHAR)), full_byte_len);
}
/* This implies that when cbData == 0, RegQueryValueExW() should not modify the buffer */
lok(*(value+cbData) == 0xbd, "RegQueryValueExW/2 overflowed at %u: %02x != bd\n", cbData, *(value+cbData));