include: Don't use IsBadStringPtr in debug functions for Unix libraries.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-09-18 15:13:19 +02:00
parent 0b9c7eb295
commit 2eed0cdb8f
2 changed files with 4 additions and 44 deletions

View file

@ -3201,50 +3201,6 @@ BOOL virtual_check_buffer_for_write( void *ptr, SIZE_T size )
}
/*************************************************************
* IsBadStringPtrA
*
* IsBadStringPtrA replacement for ntdll, to catch exception in debug traces.
*/
BOOL WINAPI IsBadStringPtrA( LPCSTR str, UINT_PTR max )
{
if (!str) return TRUE;
__TRY
{
volatile const char *p = str;
while (p != str + max) if (!*p++) break;
}
__EXCEPT_SYSCALL
{
return TRUE;
}
__ENDTRY
return FALSE;
}
/*************************************************************
* IsBadStringPtrW
*
* IsBadStringPtrW replacement for ntdll, to catch exception in debug traces.
*/
BOOL WINAPI IsBadStringPtrW( LPCWSTR str, UINT_PTR max )
{
if (!str) return TRUE;
__TRY
{
volatile const WCHAR *p = str;
while (p != str + max) if (!*p++) break;
}
__EXCEPT_SYSCALL
{
return TRUE;
}
__ENDTRY
return FALSE;
}
/***********************************************************************
* virtual_uninterrupted_read_memory
*

View file

@ -225,7 +225,9 @@ static inline const char *wine_dbgstr_an( const char *str, int n )
if (!str) return "(null)";
if (!((ULONG_PTR)str >> 16)) return wine_dbg_sprintf( "#%04x", LOWORD(str) );
#ifndef WINE_UNIX_LIB
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)
@ -267,7 +269,9 @@ static inline const char *wine_dbgstr_wn( const WCHAR *str, int n )
if (!str) return "(null)";
if (!((ULONG_PTR)str >> 16)) return wine_dbg_sprintf( "#%04x", LOWORD(str) );
#ifndef WINE_UNIX_LIB
if (IsBadStringPtrW( str, n )) return "(invalid)";
#endif
if (n == -1) for (n = 0; str[n]; n++) ;
*dst++ = 'L';
*dst++ = '"';