ntdll: Use wcsrchr() instead of strrchrW().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
667fbe8791
commit
285c5490a4
|
@ -3235,7 +3235,7 @@ static NTSTATUS lookup_winsxs(struct actctx_loader* acl, struct assembly_identit
|
|||
path[path_us.Length/sizeof(WCHAR)] = '\\';
|
||||
wcscpy( path + path_us.Length/sizeof(WCHAR) + 1, file );
|
||||
RtlInitUnicodeString( &path_us, path );
|
||||
*strrchrW(file, '.') = 0; /* remove .manifest extension */
|
||||
*wcsrchr(file, '.') = 0; /* remove .manifest extension */
|
||||
|
||||
if (!open_nt_file( &handle, &path_us ))
|
||||
{
|
||||
|
@ -4998,7 +4998,7 @@ NTSTATUS WINAPI RtlCreateActivationContext( HANDLE *handle, const void *ptr )
|
|||
else module = NtCurrentTeb()->Peb->ImageBaseAddress;
|
||||
|
||||
if ((status = get_module_filename( module, &dir, 0 ))) goto error;
|
||||
if ((p = strrchrW( dir.Buffer, '\\' ))) p[1] = 0;
|
||||
if ((p = wcsrchr( dir.Buffer, '\\' ))) p[1] = 0;
|
||||
actctx->appdir.info = dir.Buffer;
|
||||
}
|
||||
|
||||
|
|
|
@ -1186,7 +1186,7 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name
|
|||
wm->ldr.LoadCount = 1;
|
||||
|
||||
RtlCreateUnicodeString( &wm->ldr.FullDllName, nt_name->Buffer + 4 /* \??\ prefix */ );
|
||||
if ((p = strrchrW( wm->ldr.FullDllName.Buffer, '\\' ))) p++;
|
||||
if ((p = wcsrchr( wm->ldr.FullDllName.Buffer, '\\' ))) p++;
|
||||
else p = wm->ldr.FullDllName.Buffer;
|
||||
RtlInitUnicodeString( &wm->ldr.BaseDllName, p );
|
||||
|
||||
|
@ -1756,7 +1756,7 @@ static BOOL get_builtin_fullname( UNICODE_STRING *nt_name, const UNICODE_STRING
|
|||
ascii_to_unicode( filenameW, filename, len + 1 );
|
||||
|
||||
/* check if path can correspond to the dll we have */
|
||||
if (path && (p = strrchrW( path->Buffer, '\\' )))
|
||||
if (path && (p = wcsrchr( path->Buffer, '\\' )))
|
||||
{
|
||||
p++;
|
||||
if (!wcsnicmp( p, filenameW, len ) && (!p[len] || !wcsicmp( p + len, soW )))
|
||||
|
@ -2101,8 +2101,8 @@ static inline const WCHAR *get_module_path_end( const WCHAR *module )
|
|||
const WCHAR *p;
|
||||
const WCHAR *mod_end = module;
|
||||
|
||||
if ((p = strrchrW( mod_end, '\\' ))) mod_end = p;
|
||||
if ((p = strrchrW( mod_end, '/' ))) mod_end = p;
|
||||
if ((p = wcsrchr( mod_end, '\\' ))) mod_end = p;
|
||||
if ((p = wcsrchr( mod_end, '/' ))) mod_end = p;
|
||||
if (mod_end == module + 2 && module[1] == ':') mod_end++;
|
||||
if (mod_end == module && module[0] && module[1] == ':') mod_end += 2;
|
||||
return mod_end;
|
||||
|
@ -2683,8 +2683,8 @@ static NTSTATUS load_builtin_dll( LPCWSTR load_path, const UNICODE_STRING *nt_na
|
|||
|
||||
/* Fix the name in case we have a full path and extension */
|
||||
name = nt_name->Buffer;
|
||||
if ((p = strrchrW( name, '\\' ))) name = p + 1;
|
||||
if ((p = strrchrW( name, '/' ))) name = p + 1;
|
||||
if ((p = wcsrchr( name, '\\' ))) name = p + 1;
|
||||
if ((p = wcsrchr( name, '/' ))) name = p + 1;
|
||||
|
||||
TRACE("Trying built-in %s\n", debugstr_w(name));
|
||||
|
||||
|
@ -2761,7 +2761,7 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname )
|
|||
goto done;
|
||||
}
|
||||
|
||||
if ((p = strrchrW( info->lpAssemblyManifestPath, '\\' )))
|
||||
if ((p = wcsrchr( info->lpAssemblyManifestPath, '\\' )))
|
||||
{
|
||||
DWORD len, dirlen = info->ulAssemblyDirectoryNameLength / sizeof(WCHAR);
|
||||
p++;
|
||||
|
@ -2890,7 +2890,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, con
|
|||
|
||||
if (default_ext) /* first append default extension */
|
||||
{
|
||||
if (!(ext = strrchrW( libname, '.')) || wcschr( ext, '/' ) || wcschr( ext, '\\'))
|
||||
if (!(ext = wcsrchr( libname, '.')) || wcschr( ext, '/' ) || wcschr( ext, '\\'))
|
||||
{
|
||||
if (!(dllname = RtlAllocateHeap( GetProcessHeap(), 0,
|
||||
(strlenW(libname)+strlenW(default_ext)+1) * sizeof(WCHAR))))
|
||||
|
|
|
@ -79,8 +79,8 @@ static const WCHAR *get_basename( const WCHAR *name )
|
|||
const WCHAR *ptr;
|
||||
|
||||
if (name[0] && name[1] == ':') name += 2; /* strip drive specification */
|
||||
if ((ptr = strrchrW( name, '\\' ))) name = ptr + 1;
|
||||
if ((ptr = strrchrW( name, '/' ))) name = ptr + 1;
|
||||
if ((ptr = wcsrchr( name, '\\' ))) name = ptr + 1;
|
||||
if ((ptr = wcsrchr( name, '/' ))) name = ptr + 1;
|
||||
return name;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ static const WCHAR *get_basename( const WCHAR *name )
|
|||
static inline void remove_dll_ext( WCHAR *name )
|
||||
{
|
||||
static const WCHAR dllW[] = {'.','d','l','l',0};
|
||||
WCHAR *p = strrchrW( name, '.' );
|
||||
WCHAR *p = wcsrchr( name, '.' );
|
||||
|
||||
if (p && !wcsicmp( p, dllW )) *p = 0;
|
||||
}
|
||||
|
|
|
@ -2673,7 +2673,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
|
|||
procname[wine_server_reply_size(reply) / sizeof(WCHAR)] = 0;
|
||||
|
||||
/* Get only the executable name, not the path */
|
||||
if ((exename = strrchrW(procname, '\\')) != NULL) exename++;
|
||||
if ((exename = wcsrchr(procname, '\\')) != NULL) exename++;
|
||||
else exename = procname;
|
||||
|
||||
wlen = (strlenW(exename) + 1) * sizeof(WCHAR);
|
||||
|
|
|
@ -306,6 +306,7 @@ int WINAPIV NTDLL_swprintf( WCHAR *str, const WCHAR *format, ... );
|
|||
#define wcscat(d,s) NTDLL_wcscat(d,s)
|
||||
#define wcschr(s,c) NTDLL_wcschr(s,c)
|
||||
#define wcspbrk(s,a) NTDLL_wcspbrk(s,a)
|
||||
#define wcsrchr(s,c) NTDLL_wcsrchr(s,c)
|
||||
#define wcstoul(s,e,b) NTDLL_wcstoul(s,e,b)
|
||||
|
||||
/* convert from straight ASCII to Unicode without depending on the current codepage */
|
||||
|
|
|
@ -364,7 +364,7 @@ NTSTATUS WINAPI RtlDosPathNameToNtPathName_U_WithStatus(const WCHAR *dos_path, U
|
|||
ntpath->Buffer[1] = '?'; /* change \\?\ to \??\ */
|
||||
if (file_part)
|
||||
{
|
||||
if ((ptr = strrchrW( ntpath->Buffer, '\\' )) && ptr[1]) *file_part = ptr + 1;
|
||||
if ((ptr = wcsrchr( ntpath->Buffer, '\\' )) && ptr[1]) *file_part = ptr + 1;
|
||||
else *file_part = NULL;
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
|
@ -855,7 +855,7 @@ DWORD WINAPI RtlGetFullPathName_U(const WCHAR* name, ULONG size, WCHAR* buffer,
|
|||
}
|
||||
|
||||
/* find file part */
|
||||
if (file_part && (ptr = strrchrW(buffer, '\\')) != NULL && ptr >= buffer + 2 && *++ptr)
|
||||
if (file_part && (ptr = wcsrchr(buffer, '\\')) != NULL && ptr >= buffer + 2 && *++ptr)
|
||||
*file_part = ptr;
|
||||
return reqsize;
|
||||
}
|
||||
|
|
|
@ -1578,7 +1578,7 @@ NTSTATUS restart_process( RTL_USER_PROCESS_PARAMETERS *params, NTSTATUS status )
|
|||
|
||||
/* check for .com or .pif extension */
|
||||
if (status == STATUS_INVALID_IMAGE_NOT_MZ &&
|
||||
(p = strrchrW( params->ImagePathName.Buffer, '.' )) &&
|
||||
(p = wcsrchr( params->ImagePathName.Buffer, '.' )) &&
|
||||
(!wcsicmp( p, comW ) || !wcsicmp( p, pifW )))
|
||||
status = STATUS_INVALID_IMAGE_WIN_16;
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ static BOOL check_list( const WCHAR *module, int ordinal, const char *func, cons
|
|||
sprintf( ord_str, "%d", ordinal );
|
||||
for(; *list; list++)
|
||||
{
|
||||
const WCHAR *p = strrchrW( *list, '.' );
|
||||
const WCHAR *p = wcsrchr( *list, '.' );
|
||||
if (p && p > *list) /* check module and function */
|
||||
{
|
||||
int len = p - *list;
|
||||
|
|
|
@ -501,8 +501,8 @@ void version_init(void)
|
|||
|
||||
/* open AppDefaults\\appname key */
|
||||
|
||||
if ((p = strrchrW( appname, '/' ))) appname = p + 1;
|
||||
if ((p = strrchrW( appname, '\\' ))) appname = p + 1;
|
||||
if ((p = wcsrchr( appname, '/' ))) appname = p + 1;
|
||||
if ((p = wcsrchr( appname, '\\' ))) appname = p + 1;
|
||||
|
||||
wcscpy( appversion, appdefaultsW );
|
||||
wcscat( appversion, appname );
|
||||
|
|
Loading…
Reference in New Issue