diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 22d328b1cec..62b2ca1346a 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -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 * diff --git a/include/wine/debug.h b/include/wine/debug.h index 912d61a90af..e064aaefb8e 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -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++ = '"';