Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
e003b988
Commit
e003b988
authored
Mar 31, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use wcslen() instead of strlenW().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4b5cd5e6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
82 additions
and
90 deletions
+82
-90
actctx.c
dlls/ntdll/actctx.c
+0
-0
atom.c
dlls/ntdll/atom.c
+2
-3
directory.c
dlls/ntdll/directory.c
+6
-6
env.c
dlls/ntdll/env.c
+14
-15
loader.c
dlls/ntdll/loader.c
+13
-14
loadorder.c
dlls/ntdll/loadorder.c
+5
-5
locale.c
dlls/ntdll/locale.c
+11
-11
nt.c
dlls/ntdll/nt.c
+1
-2
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+1
-0
path.c
dlls/ntdll/path.c
+11
-12
printf.c
dlls/ntdll/printf.c
+2
-3
process.c
dlls/ntdll/process.c
+6
-6
reg.c
dlls/ntdll/reg.c
+3
-4
relay.c
dlls/ntdll/relay.c
+2
-3
resource.c
dlls/ntdll/resource.c
+1
-1
rtlstr.c
dlls/ntdll/rtlstr.c
+4
-5
No files found.
dlls/ntdll/actctx.c
View file @
e003b988
This diff is collapsed.
Click to expand it.
dlls/ntdll/atom.c
View file @
e003b988
...
...
@@ -33,7 +33,6 @@
#include "windef.h"
#include "wine/server.h"
#include "wine/unicode.h"
#include "ntdll_misc.h"
#include "wine/debug.h"
...
...
@@ -213,7 +212,7 @@ NTSTATUS WINAPI RtlAddAtomToAtomTable( RTL_ATOM_TABLE table, const WCHAR* name,
if
(
!
table
)
status
=
STATUS_INVALID_PARAMETER
;
else
{
size_t
len
=
IS_INTATOM
(
name
)
?
0
:
strlenW
(
name
);
size_t
len
=
IS_INTATOM
(
name
)
?
0
:
wcslen
(
name
);
status
=
is_integral_atom
(
name
,
len
,
atom
);
if
(
status
==
STATUS_MORE_ENTRIES
)
{
...
...
@@ -243,7 +242,7 @@ NTSTATUS WINAPI RtlLookupAtomInAtomTable( RTL_ATOM_TABLE table, const WCHAR* nam
if
(
!
table
)
status
=
STATUS_INVALID_PARAMETER
;
else
{
size_t
len
=
IS_INTATOM
(
name
)
?
0
:
strlenW
(
name
);
size_t
len
=
IS_INTATOM
(
name
)
?
0
:
wcslen
(
name
);
status
=
is_integral_atom
(
name
,
len
,
atom
);
if
(
status
==
STATUS_MORE_ENTRIES
)
{
...
...
dlls/ntdll/directory.c
View file @
e003b988
...
...
@@ -347,7 +347,7 @@ static const char *add_dir_data_nameA( struct dir_data *data, const char *name )
/* add a Unicode string to the directory data buffer */
static
const
WCHAR
*
add_dir_data_nameW
(
struct
dir_data
*
data
,
const
WCHAR
*
name
)
{
WCHAR
*
ptr
=
get_dir_data_space
(
data
,
(
strlenW
(
name
)
+
1
)
*
sizeof
(
WCHAR
)
);
WCHAR
*
ptr
=
get_dir_data_space
(
data
,
(
wcslen
(
name
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
ptr
)
wcscpy
(
ptr
,
name
);
return
ptr
;
}
...
...
@@ -1522,7 +1522,7 @@ static NTSTATUS get_dir_data_entry( struct dir_data *dir_data, void *info_ptr, I
if
(
start
+
dir_size
>
max_length
)
return
STATUS_MORE_ENTRIES
;
max_length
-=
start
+
dir_size
;
name_len
=
strlenW
(
names
->
long_name
)
*
sizeof
(
WCHAR
);
name_len
=
wcslen
(
names
->
long_name
)
*
sizeof
(
WCHAR
);
/* if this is not the first entry, fail; the first entry is always returned (but truncated) */
if
(
*
last_info
&&
name_len
>
max_length
)
return
STATUS_MORE_ENTRIES
;
...
...
@@ -1560,14 +1560,14 @@ static NTSTATUS get_dir_data_entry( struct dir_data *dir_data, void *info_ptr, I
case
FileBothDirectoryInformation
:
info
->
both
.
EaSize
=
0
;
/* FIXME */
info
->
both
.
ShortNameLength
=
strlenW
(
names
->
short_name
)
*
sizeof
(
WCHAR
);
info
->
both
.
ShortNameLength
=
wcslen
(
names
->
short_name
)
*
sizeof
(
WCHAR
);
memcpy
(
info
->
both
.
ShortName
,
names
->
short_name
,
info
->
both
.
ShortNameLength
);
info
->
both
.
FileNameLength
=
name_len
;
break
;
case
FileIdBothDirectoryInformation
:
info
->
id_both
.
EaSize
=
0
;
/* FIXME */
info
->
id_both
.
ShortNameLength
=
strlenW
(
names
->
short_name
)
*
sizeof
(
WCHAR
);
info
->
id_both
.
ShortNameLength
=
wcslen
(
names
->
short_name
)
*
sizeof
(
WCHAR
);
memcpy
(
info
->
id_both
.
ShortName
,
names
->
short_name
,
info
->
id_both
.
ShortNameLength
);
info
->
id_both
.
FileNameLength
=
name_len
;
break
;
...
...
@@ -1818,8 +1818,8 @@ static int name_compare( const void *a, const void *b )
{
const
struct
dir_data_names
*
file_a
=
(
const
struct
dir_data_names
*
)
a
;
const
struct
dir_data_names
*
file_b
=
(
const
struct
dir_data_names
*
)
b
;
int
ret
=
RtlCompareUnicodeStrings
(
file_a
->
long_name
,
strlenW
(
file_a
->
long_name
),
file_b
->
long_name
,
strlenW
(
file_b
->
long_name
),
TRUE
);
int
ret
=
RtlCompareUnicodeStrings
(
file_a
->
long_name
,
wcslen
(
file_a
->
long_name
),
file_b
->
long_name
,
wcslen
(
file_b
->
long_name
),
TRUE
);
if
(
!
ret
)
ret
=
strcmpW
(
file_a
->
long_name
,
file_b
->
long_name
);
return
ret
;
}
...
...
dlls/ntdll/env.c
View file @
e003b988
...
...
@@ -36,7 +36,6 @@
#include "windef.h"
#include "winternl.h"
#include "wine/library.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "ntdll_misc.h"
#include "winnt.h"
...
...
@@ -56,7 +55,7 @@ static BOOL first_prefix_start; /* first ever process start in this prefix? */
static
inline
SIZE_T
get_env_length
(
const
WCHAR
*
env
)
{
const
WCHAR
*
end
=
env
;
while
(
*
end
)
end
+=
strlenW
(
end
)
+
1
;
while
(
*
end
)
end
+=
wcslen
(
end
)
+
1
;
return
end
+
1
-
env
;
}
...
...
@@ -499,7 +498,7 @@ static WCHAR *build_initial_environment( char **env )
else
if
(
is_special_env_var
(
str
))
continue
;
/* skip it */
ntdll_umbstowcs
(
str
,
strlen
(
str
)
+
1
,
p
,
size
-
(
p
-
ptr
)
);
p
+=
strlenW
(
p
)
+
1
;
p
+=
wcslen
(
p
)
+
1
;
}
*
p
=
0
;
first_prefix_start
=
set_registry_environment
(
&
ptr
,
TRUE
);
...
...
@@ -640,7 +639,7 @@ static void get_current_directory( UNICODE_STRING *dir )
{
MESSAGE
(
"Warning: could not find DOS drive for current working directory '%s', "
"starting in the Windows directory.
\n
"
,
cwd
?
cwd
:
""
);
dir
->
Length
=
strlenW
(
windows_dir
)
*
sizeof
(
WCHAR
);
dir
->
Length
=
wcslen
(
windows_dir
)
*
sizeof
(
WCHAR
);
memcpy
(
dir
->
Buffer
,
windows_dir
,
dir
->
Length
);
}
RtlFreeHeap
(
GetProcessHeap
(),
0
,
cwd
);
...
...
@@ -660,7 +659,7 @@ static void get_current_directory( UNICODE_STRING *dir )
*/
static
inline
BOOL
is_path_prefix
(
const
WCHAR
*
prefix
,
const
WCHAR
*
path
,
const
WCHAR
*
file
)
{
DWORD
len
=
strlenW
(
prefix
);
DWORD
len
=
wcslen
(
prefix
);
if
(
wcsnicmp
(
path
,
prefix
,
len
))
return
FALSE
;
while
(
path
[
len
]
==
'\\'
)
len
++
;
...
...
@@ -707,8 +706,8 @@ static void get_image_path( const char *argv0, UNICODE_STRING *path )
if
(
!
len
||
len
>
sizeof
(
full_name
))
{
/* build builtin path inside system directory */
len
=
strlenW
(
system_dir
);
if
(
strlenW
(
name
)
>=
MAX_PATH
-
4
-
len
)
goto
failed
;
len
=
wcslen
(
system_dir
);
if
(
wcslen
(
name
)
>=
MAX_PATH
-
4
-
len
)
goto
failed
;
wcscpy
(
full_name
,
system_dir
);
wcscat
(
full_name
,
name
);
if
(
!
wcschr
(
name
,
'.'
))
wcscat
(
full_name
,
exeW
);
...
...
@@ -796,7 +795,7 @@ static void build_command_line( WCHAR **argv, UNICODE_STRING *cmdline )
LPWSTR
p
;
len
=
1
;
for
(
arg
=
argv
;
*
arg
;
arg
++
)
len
+=
3
+
2
*
strlenW
(
*
arg
);
for
(
arg
=
argv
;
*
arg
;
arg
++
)
len
+=
3
+
2
*
wcslen
(
*
arg
);
cmdline
->
MaximumLength
=
len
*
sizeof
(
WCHAR
);
if
(
!
(
cmdline
->
Buffer
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
cmdline
->
MaximumLength
)))
return
;
...
...
@@ -832,7 +831,7 @@ static void build_command_line( WCHAR **argv, UNICODE_STRING *cmdline )
else
{
wcscpy
(
p
,
*
arg
);
p
+=
strlenW
(
p
);
p
+=
wcslen
(
p
);
}
if
(
has_space
)
{
...
...
@@ -908,7 +907,7 @@ static LPCWSTR ENV_FindVariable(PCWSTR var, PCWSTR name, unsigned namelen)
/* match var names, but avoid setting a var with a name including a '='
* (a starting '=' is valid though)
*/
unsigned
int
len
=
strlenW
(
var
);
unsigned
int
len
=
wcslen
(
var
);
if
(
len
>
namelen
&&
var
[
namelen
]
==
'='
&&
!
RtlCompareUnicodeStrings
(
var
,
namelen
,
name
,
namelen
,
TRUE
)
&&
...
...
@@ -953,7 +952,7 @@ NTSTATUS WINAPI RtlQueryEnvironmentVariable_U(PWSTR env,
var
=
ENV_FindVariable
(
var
,
name
->
Buffer
,
namelen
);
if
(
var
!=
NULL
)
{
value
->
Length
=
strlenW
(
var
)
*
sizeof
(
WCHAR
);
value
->
Length
=
wcslen
(
var
)
*
sizeof
(
WCHAR
);
if
(
value
->
Length
<=
value
->
MaximumLength
)
{
...
...
@@ -1017,7 +1016,7 @@ NTSTATUS WINAPI RtlSetEnvironmentVariable(PWSTR* penv, PUNICODE_STRING name,
/* Find a place to insert the string */
for
(
p
=
env
;
*
p
;
p
+=
varlen
+
1
)
{
varlen
=
strlenW
(
p
);
varlen
=
wcslen
(
p
);
if
(
varlen
>
len
&&
p
[
len
]
==
'='
&&
!
RtlCompareUnicodeStrings
(
name
->
Buffer
,
len
,
p
,
len
,
TRUE
))
break
;
}
...
...
@@ -1025,11 +1024,11 @@ NTSTATUS WINAPI RtlSetEnvironmentVariable(PWSTR* penv, PUNICODE_STRING name,
/* Realloc the buffer */
len
=
value
?
len
+
value
->
Length
/
sizeof
(
WCHAR
)
+
2
:
0
;
if
(
*
p
)
len
-=
strlenW
(
p
)
+
1
;
/* The name already exists */
if
(
*
p
)
len
-=
wcslen
(
p
)
+
1
;
/* The name already exists */
if
(
len
<
0
)
{
LPWSTR
next
=
p
+
strlenW
(
p
)
+
1
;
/* We know there is a next one */
LPWSTR
next
=
p
+
wcslen
(
p
)
+
1
;
/* We know there is a next one */
memmove
(
next
+
len
,
next
,
(
old_size
-
(
next
-
env
))
*
sizeof
(
WCHAR
));
}
...
...
@@ -1108,7 +1107,7 @@ NTSTATUS WINAPI RtlExpandEnvironmentStrings( const WCHAR *renv, WCHAR *src, SIZE
{
src
+=
len
+
1
;
/* Skip the variable name */
src_len
-=
len
+
1
;
len
=
strlenW
(
var
);
len
=
wcslen
(
var
);
}
else
{
...
...
dlls/ntdll/loader.c
View file @
e003b988
...
...
@@ -38,7 +38,6 @@
#include "wine/exception.h"
#include "wine/library.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/list.h"
#include "wine/server.h"
...
...
@@ -1772,7 +1771,7 @@ static BOOL get_builtin_fullname( UNICODE_STRING *nt_name, const UNICODE_STRING
}
if
(
!
(
fullname
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
strlenW
(
system_dir
)
+
len
+
5
)
*
sizeof
(
WCHAR
)
)))
(
wcslen
(
system_dir
)
+
len
+
5
)
*
sizeof
(
WCHAR
)
)))
return
FALSE
;
wcscpy
(
fullname
,
nt_prefixW
);
wcscat
(
fullname
,
system_dir
);
...
...
@@ -2116,7 +2115,7 @@ static inline const WCHAR *get_module_path_end( const WCHAR *module )
*/
static
inline
WCHAR
*
append_path
(
WCHAR
*
p
,
const
WCHAR
*
str
,
int
len
)
{
if
(
len
==
-
1
)
len
=
strlenW
(
str
);
if
(
len
==
-
1
)
len
=
wcslen
(
str
);
if
(
!
len
)
return
p
;
memcpy
(
p
,
str
,
len
*
sizeof
(
WCHAR
)
);
p
[
len
]
=
';'
;
...
...
@@ -2149,7 +2148,7 @@ static NTSTATUS get_dll_load_path( LPCWSTR module, LPCWSTR dll_dir, ULONG safe_m
if
(
RtlQueryEnvironmentVariable_U
(
NULL
,
&
name
,
&
value
)
==
STATUS_BUFFER_TOO_SMALL
)
path_len
=
value
.
Length
;
if
(
dll_dir
)
len
+=
strlenW
(
dll_dir
)
+
1
;
if
(
dll_dir
)
len
+=
wcslen
(
dll_dir
)
+
1
;
else
len
+=
2
;
/* current directory */
if
(
!
(
p
=
ret
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
path_len
+
len
*
sizeof
(
WCHAR
)
)))
return
STATUS_NO_MEMORY
;
...
...
@@ -2219,11 +2218,11 @@ static NTSTATUS get_dll_load_path_search_flags( LPCWSTR module, DWORD flags, WCH
if
(
flags
&
LOAD_LIBRARY_SEARCH_USER_DIRS
)
{
LIST_FOR_EACH_ENTRY
(
dir
,
&
dll_dir_list
,
struct
dll_dir_entry
,
entry
)
len
+=
strlenW
(
dir
->
dir
+
4
/* \??\ */
)
+
1
;
len
+=
wcslen
(
dir
->
dir
+
4
/* \??\ */
)
+
1
;
if
(
dll_directory
.
Length
)
len
+=
dll_directory
.
Length
/
sizeof
(
WCHAR
)
+
1
;
}
if
(
flags
&
LOAD_LIBRARY_SEARCH_SYSTEM32
)
len
+=
strlenW
(
system_dir
);
if
(
flags
&
LOAD_LIBRARY_SEARCH_SYSTEM32
)
len
+=
wcslen
(
system_dir
);
if
((
p
=
ret
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
{
...
...
@@ -2529,7 +2528,7 @@ static NTSTATUS find_builtin_dll( const WCHAR *name, WINE_MODREF **pwm,
NTSTATUS
status
=
STATUS_DLL_NOT_FOUND
;
BOOL
found_image
=
FALSE
;
len
=
strlenW
(
name
);
len
=
wcslen
(
name
);
if
(
build_dir
)
maxlen
=
strlen
(
build_dir
)
+
sizeof
(
"/programs/"
)
+
len
;
for
(
i
=
0
;
(
path
=
wine_dll_enum_load_path
(
i
));
i
++
)
maxlen
=
max
(
maxlen
,
strlen
(
path
)
+
1
);
maxlen
+=
len
+
sizeof
(
".so"
);
...
...
@@ -2765,7 +2764,7 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname )
{
DWORD
len
,
dirlen
=
info
->
ulAssemblyDirectoryNameLength
/
sizeof
(
WCHAR
);
p
++
;
len
=
strlenW
(
p
);
len
=
wcslen
(
p
);
if
(
!
dirlen
||
len
<=
dirlen
||
RtlCompareUnicodeStrings
(
p
,
dirlen
,
info
->
lpAssemblyDirectoryName
,
dirlen
,
TRUE
)
||
wcsicmp
(
p
+
dirlen
,
dotManifestW
))
...
...
@@ -2792,7 +2791,7 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname )
goto
done
;
}
needed
=
(
strlenW
(
user_shared_data
->
NtSystemRoot
)
*
sizeof
(
WCHAR
)
+
needed
=
(
wcslen
(
user_shared_data
->
NtSystemRoot
)
*
sizeof
(
WCHAR
)
+
sizeof
(
winsxsW
)
+
info
->
ulAssemblyDirectoryNameLength
+
nameW
.
Length
+
2
*
sizeof
(
WCHAR
));
if
(
!
(
*
fullname
=
p
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
needed
)))
...
...
@@ -2801,7 +2800,7 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname )
goto
done
;
}
wcscpy
(
p
,
user_shared_data
->
NtSystemRoot
);
p
+=
strlenW
(
p
);
p
+=
wcslen
(
p
);
memcpy
(
p
,
winsxsW
,
sizeof
(
winsxsW
)
);
p
+=
ARRAY_SIZE
(
winsxsW
);
memcpy
(
p
,
info
->
lpAssemblyDirectoryName
,
info
->
ulAssemblyDirectoryNameLength
);
...
...
@@ -2827,10 +2826,10 @@ static NTSTATUS search_dll_file( LPCWSTR paths, LPCWSTR search, UNICODE_STRING *
WCHAR
*
name
;
BOOL
found_image
=
FALSE
;
NTSTATUS
status
=
STATUS_DLL_NOT_FOUND
;
ULONG
len
=
strlenW
(
paths
);
ULONG
len
=
wcslen
(
paths
);
if
(
len
<
strlenW
(
system_dir
))
len
=
strlenW
(
system_dir
);
len
+=
strlenW
(
search
)
+
2
;
if
(
len
<
wcslen
(
system_dir
))
len
=
wcslen
(
system_dir
);
len
+=
wcslen
(
search
)
+
2
;
if
(
!
(
name
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
return
STATUS_NO_MEMORY
;
...
...
@@ -2893,7 +2892,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, con
if
(
!
(
ext
=
wcsrchr
(
libname
,
'.'
))
||
wcschr
(
ext
,
'/'
)
||
wcschr
(
ext
,
'\\'
))
{
if
(
!
(
dllname
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
strlenW
(
libname
)
+
strlenW
(
default_ext
)
+
1
)
*
sizeof
(
WCHAR
))))
(
wcslen
(
libname
)
+
wcslen
(
default_ext
)
+
1
)
*
sizeof
(
WCHAR
))))
return
STATUS_NO_MEMORY
;
wcscpy
(
dllname
,
libname
);
wcscat
(
dllname
,
default_ext
);
...
...
dlls/ntdll/loadorder.c
View file @
e003b988
...
...
@@ -255,7 +255,7 @@ static void init_load_order(void)
if
(
!*
entry
)
break
;
next
=
wcschr
(
entry
,
';'
);
if
(
next
)
*
next
++
=
0
;
else
next
=
entry
+
strlenW
(
entry
);
else
next
=
entry
+
wcslen
(
entry
);
add_load_order_set
(
entry
);
entry
=
next
;
}
...
...
@@ -341,7 +341,7 @@ static HANDLE get_app_key( const WCHAR *app_name )
str
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
AppDefaultsW
)
+
sizeof
(
DllOverridesW
)
+
strlenW
(
app_name
)
*
sizeof
(
WCHAR
)
);
wcslen
(
app_name
)
*
sizeof
(
WCHAR
)
);
if
(
!
str
)
return
0
;
wcscpy
(
str
,
AppDefaultsW
);
wcscat
(
str
,
app_name
);
...
...
@@ -445,14 +445,14 @@ enum loadorder get_load_order( const WCHAR *app_name, const UNICODE_STRING *nt_n
/* Strip path information if the module resides in the system directory
*/
if
(
!
wcsnicmp
(
system_dir
,
path
,
strlenW
(
system_dir
)))
if
(
!
wcsnicmp
(
system_dir
,
path
,
wcslen
(
system_dir
)))
{
const
WCHAR
*
p
=
path
+
strlenW
(
system_dir
);
const
WCHAR
*
p
=
path
+
wcslen
(
system_dir
);
while
(
*
p
==
'\\'
||
*
p
==
'/'
)
p
++
;
if
(
!
wcschr
(
p
,
'\\'
)
&&
!
wcschr
(
p
,
'/'
))
path
=
p
;
}
if
(
!
(
len
=
strlenW
(
path
)))
return
ret
;
if
(
!
(
len
=
wcslen
(
path
)))
return
ret
;
if
(
!
(
module
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
len
+
2
)
*
sizeof
(
WCHAR
)
)))
return
ret
;
wcscpy
(
module
+
1
,
path
);
/* reserve module[0] for the wildcard char */
remove_dll_ext
(
module
+
1
);
...
...
dlls/ntdll/locale.c
View file @
e003b988
...
...
@@ -654,7 +654,7 @@ static NTSTATUS open_nls_data_file( ULONG type, ULONG id, HANDLE *file )
/* try to open file in system dir */
valueW
.
MaximumLength
=
(
strlenW
(
name
)
+
strlenW
(
dir
)
+
5
)
*
sizeof
(
WCHAR
);
valueW
.
MaximumLength
=
(
wcslen
(
name
)
+
wcslen
(
dir
)
+
5
)
*
sizeof
(
WCHAR
);
if
(
!
(
valueW
.
Buffer
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
valueW
.
MaximumLength
)))
return
STATUS_NO_MEMORY
;
valueW
.
Length
=
NTDLL_swprintf
(
valueW
.
Buffer
,
pathfmtW
,
dir
,
name
)
*
sizeof
(
WCHAR
);
...
...
@@ -674,14 +674,14 @@ static NTSTATUS open_nls_data_file( ULONG type, ULONG id, HANDLE *file )
if
(
RtlQueryEnvironmentVariable_U
(
NULL
,
&
nameW
,
&
valueW
)
!=
STATUS_BUFFER_TOO_SMALL
)
return
status
;
}
valueW
.
MaximumLength
=
valueW
.
Length
+
sizeof
(
dataprefixW
)
+
strlenW
(
name
)
*
sizeof
(
WCHAR
);
valueW
.
MaximumLength
=
valueW
.
Length
+
sizeof
(
dataprefixW
)
+
wcslen
(
name
)
*
sizeof
(
WCHAR
);
if
(
!
(
valueW
.
Buffer
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
valueW
.
MaximumLength
)))
return
STATUS_NO_MEMORY
;
if
(
!
RtlQueryEnvironmentVariable_U
(
NULL
,
&
nameW
,
&
valueW
))
{
wcscat
(
valueW
.
Buffer
,
dataprefixW
);
wcscat
(
valueW
.
Buffer
,
name
);
valueW
.
Length
=
strlenW
(
valueW
.
Buffer
)
*
sizeof
(
WCHAR
);
valueW
.
Length
=
wcslen
(
valueW
.
Buffer
)
*
sizeof
(
WCHAR
);
InitializeObjectAttributes
(
&
attr
,
&
valueW
,
0
,
0
,
NULL
);
status
=
NtOpenFile
(
file
,
GENERIC_READ
,
&
attr
,
&
io
,
FILE_SHARE_READ
,
FILE_SYNCHRONOUS_IO_ALERT
);
if
(
!
status
)
TRACE
(
"found %s
\n
"
,
debugstr_w
(
valueW
.
Buffer
));
...
...
@@ -883,7 +883,7 @@ static LCID unix_locale_to_lcid( const char *unix_name )
}
if
(
country
)
{
p
=
win_name
+
strlenW
(
win_name
);
p
=
win_name
+
wcslen
(
win_name
);
*
p
++
=
'-'
;
wcscpy
(
p
,
country
);
}
...
...
@@ -1671,7 +1671,7 @@ NTSTATUS WINAPI RtlLocaleNameToLcid( const WCHAR *name, LCID *lcid, ULONG flags
*
lcid
=
LANG_INVARIANT
;
goto
found
;
}
if
(
strlenW
(
name
)
>=
LOCALE_NAME_MAX_LENGTH
)
return
STATUS_INVALID_PARAMETER_1
;
if
(
wcslen
(
name
)
>=
LOCALE_NAME_MAX_LENGTH
)
return
STATUS_INVALID_PARAMETER_1
;
wcscpy
(
lang
,
name
);
if
((
p
=
wcspbrk
(
lang
,
sepW
))
&&
*
p
==
'-'
)
...
...
@@ -1687,7 +1687,7 @@ NTSTATUS WINAPI RtlLocaleNameToLcid( const WCHAR *name, LCID *lcid, ULONG flags
}
if
(
p
)
*
p
=
0
;
/* FIXME: modifier is ignored */
/* second value can be script or country, check length to resolve the ambiguity */
if
(
!
script
&&
strlenW
(
country
)
==
4
)
if
(
!
script
&&
wcslen
(
country
)
==
4
)
{
script
=
country
;
country
=
NULL
;
...
...
@@ -1717,7 +1717,7 @@ NTSTATUS WINAPI RtlLocaleNameToLcid( const WCHAR *name, LCID *lcid, ULONG flags
if
(
script
)
{
unsigned
int
len
=
strlenW
(
script
);
unsigned
int
len
=
wcslen
(
script
);
if
(
load_string
(
LOCALE_SSCRIPTS
,
id
,
buf
,
ARRAY_SIZE
(
buf
)
))
continue
;
p
=
buf
;
while
(
*
p
)
...
...
@@ -1981,7 +1981,7 @@ NTSTATUS WINAPI RtlIsNormalizedString( ULONG form, const WCHAR *str, INT len, BO
if
((
status
=
load_norm_table
(
form
,
&
info
)))
return
status
;
if
(
len
==
-
1
)
len
=
strlenW
(
str
);
if
(
len
==
-
1
)
len
=
wcslen
(
str
);
for
(
i
=
0
;
i
<
len
&&
result
;
i
+=
r
)
{
...
...
@@ -2054,7 +2054,7 @@ NTSTATUS WINAPI RtlNormalizeString( ULONG form, const WCHAR *src, INT src_len, W
if
((
status
=
load_norm_table
(
form
,
&
info
)))
return
status
;
if
(
src_len
==
-
1
)
src_len
=
strlenW
(
src
)
+
1
;
if
(
src_len
==
-
1
)
src_len
=
wcslen
(
src
)
+
1
;
if
(
!*
dst_len
)
{
...
...
@@ -2258,7 +2258,7 @@ NTSTATUS WINAPI RtlIdnToNameprepUnicode( DWORD flags, const WCHAR *src, INT srcl
if
((
status
=
load_norm_table
(
13
,
&
info
)))
return
status
;
if
(
srclen
==
-
1
)
srclen
=
strlenW
(
src
)
+
1
;
if
(
srclen
==
-
1
)
srclen
=
wcslen
(
src
)
+
1
;
for
(
i
=
0
;
i
<
srclen
;
i
++
)
if
(
src
[
i
]
<
0x20
||
src
[
i
]
>=
0x7f
)
break
;
...
...
@@ -2325,7 +2325,7 @@ NTSTATUS WINAPI RtlIdnToUnicode( DWORD flags, const WCHAR *src, INT srclen, WCHA
WCHAR
ch
;
if
(
!
src
||
srclen
<
-
1
)
return
STATUS_INVALID_PARAMETER
;
if
(
srclen
==
-
1
)
srclen
=
strlenW
(
src
)
+
1
;
if
(
srclen
==
-
1
)
srclen
=
wcslen
(
src
)
+
1
;
TRACE
(
"%x %s %p %d
\n
"
,
flags
,
debugstr_wn
(
src
,
srclen
),
dst
,
*
dstlen
);
...
...
dlls/ntdll/nt.c
View file @
e003b988
...
...
@@ -71,7 +71,6 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "wine/debug.h"
#include "wine/unicode.h"
#include "windef.h"
#include "winternl.h"
#include "ntdll_misc.h"
...
...
@@ -2676,7 +2675,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
if
((
exename
=
wcsrchr
(
procname
,
'\\'
))
!=
NULL
)
exename
++
;
else
exename
=
procname
;
wlen
=
(
strlenW
(
exename
)
+
1
)
*
sizeof
(
WCHAR
);
wlen
=
(
wcslen
(
exename
)
+
1
)
*
sizeof
(
WCHAR
);
procstructlen
=
sizeof
(
*
spi
)
+
wlen
+
((
reply
->
threads
-
1
)
*
sizeof
(
SYSTEM_THREAD_INFORMATION
));
...
...
dlls/ntdll/ntdll_misc.h
View file @
e003b988
...
...
@@ -308,6 +308,7 @@ int WINAPIV NTDLL_swprintf( WCHAR *str, const WCHAR *format, ... );
#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)
#define wcslen(s) NTDLL_wcslen(s)
/* 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
)
...
...
dlls/ntdll/path.c
View file @
e003b988
...
...
@@ -36,7 +36,6 @@
#define WIN32_NO_STATUS
#include "windef.h"
#include "winioctl.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/library.h"
#include "ntdll_misc.h"
...
...
@@ -196,7 +195,7 @@ static int find_drive_rootW( LPCWSTR *ppath )
if
(
!
DIR_get_drives_info
(
info
))
return
-
1
;
/* strip off trailing slashes */
lenW
=
strlenW
(
path
);
lenW
=
wcslen
(
path
);
while
(
lenW
>
1
&&
IS_SEPARATOR
(
path
[
lenW
-
1
]))
lenW
--
;
/* convert path to Unix encoding */
...
...
@@ -356,7 +355,7 @@ NTSTATUS WINAPI RtlDosPathNameToNtPathName_U_WithStatus(const WCHAR *dos_path, U
if
(
!
memcmp
(
dos_path
,
global_prefix
,
sizeof
(
global_prefix
))
||
(
!
memcmp
(
dos_path
,
global_prefix2
,
sizeof
(
global_prefix2
))
&&
dos_path
[
4
]))
{
ntpath
->
Length
=
strlenW
(
dos_path
)
*
sizeof
(
WCHAR
);
ntpath
->
Length
=
wcslen
(
dos_path
)
*
sizeof
(
WCHAR
);
ntpath
->
MaximumLength
=
ntpath
->
Length
+
sizeof
(
WCHAR
);
ntpath
->
Buffer
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
ntpath
->
MaximumLength
);
if
(
!
ntpath
->
Buffer
)
return
STATUS_NO_MEMORY
;
...
...
@@ -410,10 +409,10 @@ NTSTATUS WINAPI RtlDosPathNameToNtPathName_U_WithStatus(const WCHAR *dos_path, U
}
wcscat
(
ntpath
->
Buffer
,
ptr
+
offset
);
ntpath
->
Length
=
strlenW
(
ntpath
->
Buffer
)
*
sizeof
(
WCHAR
);
ntpath
->
Length
=
wcslen
(
ntpath
->
Buffer
)
*
sizeof
(
WCHAR
);
if
(
file_part
&&
*
file_part
)
*
file_part
=
ntpath
->
Buffer
+
ntpath
->
Length
/
sizeof
(
WCHAR
)
-
strlenW
(
*
file_part
);
*
file_part
=
ntpath
->
Buffer
+
ntpath
->
Length
/
sizeof
(
WCHAR
)
-
wcslen
(
*
file_part
);
/* FIXME: cd filling */
...
...
@@ -485,11 +484,11 @@ ULONG WINAPI RtlDosSearchPath_U(LPCWSTR paths, LPCWSTR search, LPCWSTR ext,
ULONG
allocated
=
0
,
needed
,
filelen
;
WCHAR
*
name
=
NULL
;
filelen
=
1
/* for \ */
+
strlenW
(
search
)
+
1
/* \0 */
;
filelen
=
1
/* for \ */
+
wcslen
(
search
)
+
1
/* \0 */
;
/* Windows only checks for '.' without worrying about path components */
if
(
wcschr
(
search
,
'.'
))
ext
=
NULL
;
if
(
ext
!=
NULL
)
filelen
+=
strlenW
(
ext
);
if
(
ext
!=
NULL
)
filelen
+=
wcslen
(
ext
);
while
(
*
paths
)
{
...
...
@@ -560,7 +559,7 @@ static inline void collapse_path( WCHAR *path, UINT mark )
{
case
'\\'
:
/* .\ component */
next
=
p
+
2
;
memmove
(
p
,
next
,
(
strlenW
(
next
)
+
1
)
*
sizeof
(
WCHAR
)
);
memmove
(
p
,
next
,
(
wcslen
(
next
)
+
1
)
*
sizeof
(
WCHAR
)
);
continue
;
case
0
:
/* final . */
if
(
p
>
path
+
mark
)
p
--
;
...
...
@@ -575,7 +574,7 @@ static inline void collapse_path( WCHAR *path, UINT mark )
p
--
;
while
(
p
>
path
+
mark
&&
p
[
-
1
]
!=
'\\'
)
p
--
;
}
memmove
(
p
,
next
,
(
strlenW
(
next
)
+
1
)
*
sizeof
(
WCHAR
)
);
memmove
(
p
,
next
,
(
wcslen
(
next
)
+
1
)
*
sizeof
(
WCHAR
)
);
continue
;
}
else
if
(
!
p
[
2
])
/* final .. */
...
...
@@ -597,7 +596,7 @@ static inline void collapse_path( WCHAR *path, UINT mark )
if
(
*
p
==
'\\'
)
{
/* remove last dot in previous dir name */
if
(
p
>
path
+
mark
&&
p
[
-
1
]
==
'.'
)
memmove
(
p
-
1
,
p
,
(
strlenW
(
p
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
p
>
path
+
mark
&&
p
[
-
1
]
==
'.'
)
memmove
(
p
-
1
,
p
,
(
wcslen
(
p
)
+
1
)
*
sizeof
(
WCHAR
)
);
else
p
++
;
}
}
...
...
@@ -778,7 +777,7 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
}
/* enough space ? */
deplen
=
strlenW
(
name
+
dep
)
*
sizeof
(
WCHAR
);
deplen
=
wcslen
(
name
+
dep
)
*
sizeof
(
WCHAR
);
if
(
reqsize
+
deplen
+
sizeof
(
WCHAR
)
>
size
)
{
/* not enough space, return need size (including terminating '\0') */
...
...
@@ -793,7 +792,7 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
RtlFreeHeap
(
GetProcessHeap
(),
0
,
ins_str
);
collapse_path
(
buffer
,
mark
);
reqsize
=
strlenW
(
buffer
)
*
sizeof
(
WCHAR
);
reqsize
=
wcslen
(
buffer
)
*
sizeof
(
WCHAR
);
done:
RtlReleasePebLock
();
...
...
dlls/ntdll/printf.c
View file @
e003b988
...
...
@@ -32,7 +32,6 @@
#include "windef.h"
#include "winternl.h"
#include "ntdll_misc.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
ntdll
);
...
...
@@ -71,7 +70,7 @@ static inline int pf_output_stringW( pf_output *out, LPCWSTR str, int len )
SIZE_T
space
=
out
->
len
-
out
->
used
;
if
(
len
<
0
)
len
=
strlenW
(
str
);
len
=
wcslen
(
str
);
if
(
out
->
unicode
)
{
LPWSTR
p
=
out
->
buf
.
W
+
out
->
used
;
...
...
@@ -213,7 +212,7 @@ static inline int pf_output_format_W( pf_output *out, LPCWSTR str,
int
r
=
0
;
if
(
len
<
0
)
len
=
strlenW
(
str
);
len
=
wcslen
(
str
);
if
(
flags
->
Precision
>=
0
&&
flags
->
Precision
<
len
)
len
=
flags
->
Precision
;
...
...
dlls/ntdll/process.c
View file @
e003b988
...
...
@@ -1436,11 +1436,11 @@ static ULONG get_env_size( const RTL_USER_PROCESS_PARAMETERS *params, char **win
static
const
WCHAR
WINEDEBUG
[]
=
{
'W'
,
'I'
,
'N'
,
'E'
,
'D'
,
'E'
,
'B'
,
'U'
,
'G'
,
'='
,
0
};
if
(
!*
winedebug
&&
!
strncmpW
(
ptr
,
WINEDEBUG
,
ARRAY_SIZE
(
WINEDEBUG
)
-
1
))
{
DWORD
len
=
strlenW
(
ptr
)
*
3
+
1
;
DWORD
len
=
wcslen
(
ptr
)
*
3
+
1
;
if
((
*
winedebug
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
len
)))
ntdll_wcstoumbs
(
ptr
,
strlenW
(
ptr
)
+
1
,
*
winedebug
,
len
,
FALSE
);
ntdll_wcstoumbs
(
ptr
,
wcslen
(
ptr
)
+
1
,
*
winedebug
,
len
,
FALSE
);
}
ptr
+=
strlenW
(
ptr
)
+
1
;
ptr
+=
wcslen
(
ptr
)
+
1
;
}
ptr
++
;
return
(
ptr
-
params
->
Environment
)
*
sizeof
(
WCHAR
);
...
...
@@ -1601,9 +1601,9 @@ NTSTATUS restart_process( RTL_USER_PROCESS_PARAMETERS *params, NTSTATUS status )
case
STATUS_INVALID_IMAGE_NE_FORMAT
:
case
STATUS_INVALID_IMAGE_PROTECT
:
cmdline
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
strlenW
(
system_dir
)
+
strlenW
(
winevdm
)
+
16
+
strlenW
(
params
->
ImagePathName
.
Buffer
)
+
strlenW
(
params
->
CommandLine
.
Buffer
))
*
sizeof
(
WCHAR
));
(
wcslen
(
system_dir
)
+
wcslen
(
winevdm
)
+
16
+
wcslen
(
params
->
ImagePathName
.
Buffer
)
+
wcslen
(
params
->
CommandLine
.
Buffer
))
*
sizeof
(
WCHAR
));
if
(
!
cmdline
)
return
STATUS_NO_MEMORY
;
NTDLL_swprintf
(
cmdline
,
argsW
,
(
is_win64
||
is_wow64
)
?
syswow64_dir
:
system_dir
,
winevdm
,
params
->
ImagePathName
.
Buffer
,
params
->
CommandLine
.
Buffer
);
...
...
dlls/ntdll/reg.c
View file @
e003b988
...
...
@@ -38,7 +38,6 @@
#include "wine/library.h"
#include "ntdll_misc.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
reg
);
...
...
@@ -1099,7 +1098,7 @@ static NTSTATUS RTL_ReportRegistryValue(PKEY_VALUE_FULL_INFORMATION pInfo,
for
(
offset
=
0
;
offset
<=
pInfo
->
DataLength
;
offset
+=
len
+
sizeof
(
WCHAR
))
{
wstr
=
(
WCHAR
*
)(((
CHAR
*
)
pInfo
)
+
offset
);
len
=
strlenW
(
wstr
)
*
sizeof
(
WCHAR
);
len
=
wcslen
(
wstr
)
*
sizeof
(
WCHAR
);
status
=
pQuery
->
QueryRoutine
(
pQuery
->
Name
,
pInfo
->
Type
,
wstr
,
len
,
pContext
,
pQuery
->
EntryContext
);
if
(
status
!=
STATUS_SUCCESS
&&
status
!=
STATUS_BUFFER_TOO_SMALL
)
...
...
@@ -1111,7 +1110,7 @@ static NTSTATUS RTL_ReportRegistryValue(PKEY_VALUE_FULL_INFORMATION pInfo,
while
(
count
<=
pInfo
->
DataLength
)
{
String
=
(
WCHAR
*
)(((
CHAR
*
)
pInfo
)
+
pInfo
->
DataOffset
)
+
count
;
count
+=
strlenW
(
String
)
+
1
;
count
+=
wcslen
(
String
)
+
1
;
RtlInitUnicodeString
(
&
src
,
(
WCHAR
*
)(((
CHAR
*
)
pInfo
)
+
pInfo
->
DataOffset
));
res
=
0
;
dst
.
MaximumLength
=
0
;
...
...
@@ -1187,7 +1186,7 @@ static NTSTATUS RTL_KeyHandleCreateObject(ULONG RelativeTo, PCWSTR Path, POBJECT
return
STATUS_INVALID_PARAMETER
;
}
len
=
(
strlenW
(
base
)
+
strlenW
(
Path
)
+
1
)
*
sizeof
(
WCHAR
);
len
=
(
wcslen
(
base
)
+
wcslen
(
Path
)
+
1
)
*
sizeof
(
WCHAR
);
str
->
Buffer
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
len
);
if
(
str
->
Buffer
==
NULL
)
return
STATUS_NO_MEMORY
;
...
...
dlls/ntdll/relay.c
View file @
e003b988
...
...
@@ -33,7 +33,6 @@
#include "winternl.h"
#include "wine/exception.h"
#include "ntdll_misc.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
relay
);
...
...
@@ -111,7 +110,7 @@ static const WCHAR **build_list( const WCHAR *buffer )
}
/* allocate count+1 pointers, plus the space for a copy of the string */
if
((
ret
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
count
+
1
)
*
sizeof
(
WCHAR
*
)
+
(
strlenW
(
buffer
)
+
1
)
*
sizeof
(
WCHAR
)
)))
(
count
+
1
)
*
sizeof
(
WCHAR
*
)
+
(
wcslen
(
buffer
)
+
1
)
*
sizeof
(
WCHAR
)
)))
{
WCHAR
*
str
=
(
WCHAR
*
)(
ret
+
count
+
1
);
WCHAR
*
q
=
str
;
...
...
@@ -284,7 +283,7 @@ static BOOL check_from_module( const WCHAR **includelist, const WCHAR **excludel
int
len
;
if
(
!
wcsicmp
(
*
listitem
,
module
))
return
!
show
;
len
=
strlenW
(
*
listitem
);
len
=
wcslen
(
*
listitem
);
if
(
!
wcsnicmp
(
*
listitem
,
module
,
len
)
&&
!
wcsicmp
(
module
+
len
,
dllW
))
return
!
show
;
}
...
...
dlls/ntdll/resource.c
View file @
e003b988
...
...
@@ -145,7 +145,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_name( const IMAGE_RESOURCE_
if
(
IS_INTRESOURCE
(
name
))
return
find_entry_by_id
(
dir
,
LOWORD
(
name
),
root
,
want_dir
);
entry
=
(
const
IMAGE_RESOURCE_DIRECTORY_ENTRY
*
)(
dir
+
1
);
namelen
=
strlenW
(
name
);
namelen
=
wcslen
(
name
);
min
=
0
;
max
=
dir
->
NumberOfNamedEntries
-
1
;
while
(
min
<=
max
)
...
...
dlls/ntdll/rtlstr.c
View file @
e003b988
...
...
@@ -32,7 +32,6 @@
#include "windef.h"
#include "winnt.h"
#include "winternl.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "ntdll_misc.h"
...
...
@@ -177,7 +176,7 @@ void WINAPI RtlInitUnicodeString(
{
if
((
target
->
Buffer
=
(
PWSTR
)
source
))
{
unsigned
int
length
=
strlenW
(
source
)
*
sizeof
(
WCHAR
);
unsigned
int
length
=
wcslen
(
source
)
*
sizeof
(
WCHAR
);
if
(
length
>
0xfffc
)
length
=
0xfffc
;
target
->
Length
=
length
;
...
...
@@ -206,7 +205,7 @@ NTSTATUS WINAPI RtlInitUnicodeStringEx(
PCWSTR
source
)
/* [I] '\0' terminated unicode string used to initialize target */
{
if
(
source
!=
NULL
)
{
unsigned
int
len
=
strlenW
(
source
)
*
sizeof
(
WCHAR
);
unsigned
int
len
=
wcslen
(
source
)
*
sizeof
(
WCHAR
);
if
(
len
>
0xFFFC
)
{
return
STATUS_NAME_TOO_LONG
;
...
...
@@ -235,7 +234,7 @@ NTSTATUS WINAPI RtlInitUnicodeStringEx(
*/
BOOLEAN
WINAPI
RtlCreateUnicodeString
(
PUNICODE_STRING
target
,
LPCWSTR
src
)
{
int
len
=
(
strlenW
(
src
)
+
1
)
*
sizeof
(
WCHAR
);
int
len
=
(
wcslen
(
src
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
!
(
target
->
Buffer
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
len
)))
return
FALSE
;
memcpy
(
target
->
Buffer
,
src
,
len
);
target
->
MaximumLength
=
len
;
...
...
@@ -1013,7 +1012,7 @@ NTSTATUS WINAPI RtlAppendUnicodeToString(
LPCWSTR
src
)
/* [I] '\0' terminated unicode string to be concatenated */
{
if
(
src
!=
NULL
)
{
unsigned
int
src_len
=
strlenW
(
src
)
*
sizeof
(
WCHAR
);
unsigned
int
src_len
=
wcslen
(
src
)
*
sizeof
(
WCHAR
);
unsigned
int
dest_len
=
src_len
+
dest
->
Length
;
if
(
dest_len
>
dest
->
MaximumLength
)
return
STATUS_BUFFER_TOO_SMALL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment