ntdll: Use the ascii_to_unicode() helper to compare relay module names.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2f7cc584ce
commit
0d3ba59e13
|
@ -185,12 +185,6 @@ static inline BOOL contains_path( LPCWSTR name )
|
|||
return ((*name && (name[1] == ':')) || strchrW(name, '/') || strchrW(name, '\\'));
|
||||
}
|
||||
|
||||
/* convert from straight ASCII to Unicode without depending on the current codepage */
|
||||
static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
|
||||
{
|
||||
while (len--) *dst++ = (unsigned char)*src++;
|
||||
}
|
||||
|
||||
#define RTL_UNLOAD_EVENT_TRACE_NUMBER 64
|
||||
|
||||
typedef struct _RTL_UNLOAD_EVENT_TRACE
|
||||
|
|
|
@ -299,4 +299,10 @@ ULONG __cdecl NTDLL_wcstoul( LPCWSTR s, LPWSTR *end, INT base );
|
|||
#define wcsicmp(s1,s2) NTDLL__wcsicmp(s1,s2)
|
||||
#define wcsnicmp(s1,s2,n) NTDLL__wcsnicmp(s1,s2,n)
|
||||
|
||||
/* convert from straight ASCII to Unicode without depending on the current codepage */
|
||||
static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
|
||||
{
|
||||
while (len--) *dst++ = (unsigned char)*src++;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -93,15 +93,6 @@ static inline int strcmpAW( const char *strA, const WCHAR *strW )
|
|||
return (unsigned char)*strA - *strW;
|
||||
}
|
||||
|
||||
/* compare an ASCII and a Unicode string without depending on the current codepage */
|
||||
static inline int strncmpiAW( const char *strA, const WCHAR *strW, int n )
|
||||
{
|
||||
int ret = 0;
|
||||
for ( ; n > 0; n--, strA++, strW++)
|
||||
if ((ret = toupperW((unsigned char)*strA) - toupperW(*strW)) || !*strA) break;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* build_list
|
||||
*
|
||||
|
@ -225,7 +216,7 @@ static DWORD WINAPI init_debug_lists( RTL_RUN_ONCE *once, void *param, void **co
|
|||
*
|
||||
* Check if a given module and function is in the list.
|
||||
*/
|
||||
static BOOL check_list( const char *module, int ordinal, const char *func, const WCHAR *const *list )
|
||||
static BOOL check_list( const WCHAR *module, int ordinal, const char *func, const WCHAR *const *list )
|
||||
{
|
||||
char ord_str[10];
|
||||
|
||||
|
@ -236,7 +227,7 @@ static BOOL check_list( const char *module, int ordinal, const char *func, const
|
|||
if (p && p > *list) /* check module and function */
|
||||
{
|
||||
int len = p - *list;
|
||||
if (strncmpiAW( module, *list, len-1 ) || module[len]) continue;
|
||||
if (wcsnicmp( module, *list, len - 1 ) || module[len]) continue;
|
||||
if (p[1] == '*' && !p[2]) return TRUE;
|
||||
if (!strcmpAW( ord_str, p + 1 )) return TRUE;
|
||||
if (func && !strcmpAW( func, p + 1 )) return TRUE;
|
||||
|
@ -255,7 +246,7 @@ static BOOL check_list( const char *module, int ordinal, const char *func, const
|
|||
*
|
||||
* Check if a given function must be included in the relay output.
|
||||
*/
|
||||
static BOOL check_relay_include( const char *module, int ordinal, const char *func )
|
||||
static BOOL check_relay_include( const WCHAR *module, int ordinal, const char *func )
|
||||
{
|
||||
if (debug_relay_excludelist && check_list( module, ordinal, func, debug_relay_excludelist ))
|
||||
return FALSE;
|
||||
|
@ -898,6 +889,7 @@ void RELAY_SetupDLL( HMODULE module )
|
|||
DWORD size, entry_point_rva, old_prot;
|
||||
struct relay_descr *descr;
|
||||
struct relay_private_data *data;
|
||||
WCHAR dllnameW[sizeof(data->dllname)];
|
||||
const WORD *ordptr;
|
||||
void *func_base;
|
||||
SIZE_T func_size;
|
||||
|
@ -923,6 +915,7 @@ void RELAY_SetupDLL( HMODULE module )
|
|||
len = min( len, sizeof(data->dllname) - 1 );
|
||||
memcpy( data->dllname, (char *)module + exports->Name, len );
|
||||
data->dllname[len] = 0;
|
||||
ascii_to_unicode( dllnameW, data->dllname, len + 1 );
|
||||
|
||||
/* fetch name pointer for all entry points and store them in the private structure */
|
||||
|
||||
|
@ -944,7 +937,7 @@ void RELAY_SetupDLL( HMODULE module )
|
|||
for (i = 0; i < exports->NumberOfFunctions; i++, funcs++)
|
||||
{
|
||||
if (!descr->entry_point_offsets[i]) continue; /* not a normal function */
|
||||
if (!check_relay_include( data->dllname, i + exports->Base, data->entry_points[i].name ))
|
||||
if (!check_relay_include( dllnameW, i + exports->Base, data->entry_points[i].name ))
|
||||
continue; /* don't include this entry point */
|
||||
|
||||
data->entry_points[i].orig_func = (char *)module + *funcs;
|
||||
|
@ -1035,9 +1028,14 @@ static SNOOP_RETURNENTRIES *firstrets;
|
|||
*/
|
||||
static BOOL SNOOP_ShowDebugmsgSnoop(const char *module, int ordinal, const char *func)
|
||||
{
|
||||
if (debug_snoop_excludelist && check_list( module, ordinal, func, debug_snoop_excludelist ))
|
||||
WCHAR moduleW[40];
|
||||
int len = strlen(module);
|
||||
|
||||
if (len >= ARRAY_SIZE( moduleW )) return FALSE;
|
||||
ascii_to_unicode( moduleW, module, len + 1 );
|
||||
if (debug_snoop_excludelist && check_list( moduleW, ordinal, func, debug_snoop_excludelist ))
|
||||
return FALSE;
|
||||
if (debug_snoop_includelist && !check_list( module, ordinal, func, debug_snoop_includelist ))
|
||||
if (debug_snoop_includelist && !check_list( moduleW, ordinal, func, debug_snoop_includelist ))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue