Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
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
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
147 additions
and
155 deletions
+147
-155
actctx.c
dlls/ntdll/actctx.c
+65
-65
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
...
...
@@ -735,7 +735,7 @@ static WCHAR *strdupW(const WCHAR* str)
{
WCHAR
*
ptr
;
if
(
!
(
ptr
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
strlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
))))
if
(
!
(
ptr
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
wcslen
(
str
)
+
1
)
*
sizeof
(
WCHAR
))))
return
NULL
;
return
wcscpy
(
ptr
,
str
);
}
...
...
@@ -1002,7 +1002,7 @@ static void free_entity_array(struct entity_array *array)
static
BOOL
is_matching_string
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
)
{
if
(
!
str1
)
return
!
str2
;
return
str2
&&
!
RtlCompareUnicodeStrings
(
str1
,
strlenW
(
str1
),
str2
,
strlenW
(
str2
),
TRUE
);
return
str2
&&
!
RtlCompareUnicodeStrings
(
str1
,
wcslen
(
str1
),
str2
,
wcslen
(
str2
),
TRUE
);
}
static
BOOL
is_matching_identity
(
const
struct
assembly_identity
*
id1
,
...
...
@@ -1092,8 +1092,8 @@ static WCHAR *build_assembly_dir(struct assembly_identity* ai)
const
WCHAR
*
key
=
ai
->
public_key
?
ai
->
public_key
:
noneW
;
const
WCHAR
*
lang
=
ai
->
language
?
ai
->
language
:
noneW
;
const
WCHAR
*
name
=
ai
->
name
?
ai
->
name
:
noneW
;
SIZE_T
size
=
(
strlenW
(
arch
)
+
1
+
strlenW
(
name
)
+
1
+
strlenW
(
key
)
+
24
+
1
+
strlenW
(
lang
)
+
1
)
*
sizeof
(
WCHAR
)
+
sizeof
(
mskeyW
);
SIZE_T
size
=
(
wcslen
(
arch
)
+
1
+
wcslen
(
name
)
+
1
+
wcslen
(
key
)
+
24
+
1
+
wcslen
(
lang
)
+
1
)
*
sizeof
(
WCHAR
)
+
sizeof
(
mskeyW
);
WCHAR
*
ret
;
if
(
!
(
ret
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
size
)))
return
NULL
;
...
...
@@ -1104,7 +1104,7 @@ static WCHAR *build_assembly_dir(struct assembly_identity* ai)
wcscat
(
ret
,
undW
);
wcscat
(
ret
,
key
);
wcscat
(
ret
,
undW
);
NTDLL_swprintf
(
ret
+
strlenW
(
ret
),
version_formatW
,
NTDLL_swprintf
(
ret
+
wcslen
(
ret
),
version_formatW
,
ai
->
version
.
major
,
ai
->
version
.
minor
,
ai
->
version
.
build
,
ai
->
version
.
revision
);
wcscat
(
ret
,
undW
);
wcscat
(
ret
,
lang
);
...
...
@@ -1119,10 +1119,10 @@ static inline void append_string( WCHAR *buffer, const WCHAR *prefix, const WCHA
if
(
!
str
)
return
;
wcscat
(
buffer
,
prefix
);
p
+=
strlenW
(
p
);
p
+=
wcslen
(
p
);
*
p
++
=
'"'
;
wcscpy
(
p
,
str
);
p
+=
strlenW
(
p
);
p
+=
wcslen
(
p
);
*
p
++
=
'"'
;
*
p
=
0
;
}
...
...
@@ -1143,11 +1143,11 @@ static WCHAR *build_assembly_id( const struct assembly_identity *ai )
NTDLL_swprintf
(
version
,
version_formatW
,
ai
->
version
.
major
,
ai
->
version
.
minor
,
ai
->
version
.
build
,
ai
->
version
.
revision
);
if
(
ai
->
name
)
size
+=
strlenW
(
ai
->
name
)
*
sizeof
(
WCHAR
);
if
(
ai
->
arch
)
size
+=
strlenW
(
archW
)
+
strlenW
(
ai
->
arch
)
+
2
;
if
(
ai
->
public_key
)
size
+=
strlenW
(
public_keyW
)
+
strlenW
(
ai
->
public_key
)
+
2
;
if
(
ai
->
type
)
size
+=
strlenW
(
typeW
)
+
strlenW
(
ai
->
type
)
+
2
;
size
+=
strlenW
(
versionW
)
+
strlenW
(
version
)
+
2
;
if
(
ai
->
name
)
size
+=
wcslen
(
ai
->
name
)
*
sizeof
(
WCHAR
);
if
(
ai
->
arch
)
size
+=
wcslen
(
archW
)
+
wcslen
(
ai
->
arch
)
+
2
;
if
(
ai
->
public_key
)
size
+=
wcslen
(
public_keyW
)
+
wcslen
(
ai
->
public_key
)
+
2
;
if
(
ai
->
type
)
size
+=
wcslen
(
typeW
)
+
wcslen
(
ai
->
type
)
+
2
;
size
+=
wcslen
(
versionW
)
+
wcslen
(
version
)
+
2
;
if
(
!
(
ret
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
size
+
1
)
*
sizeof
(
WCHAR
)
)))
return
NULL
;
...
...
@@ -1228,7 +1228,7 @@ static BOOL set_error( xmlbuf_t *xmlbuf )
static
BOOL
is_xmlns_attr
(
const
struct
xml_attr
*
attr
)
{
const
int
len
=
strlenW
(
xmlnsW
);
const
int
len
=
wcslen
(
xmlnsW
);
if
(
attr
->
name
.
len
<
len
)
return
FALSE
;
if
(
strncmpW
(
attr
->
name
.
ptr
,
xmlnsW
,
len
))
return
FALSE
;
return
(
attr
->
name
.
len
==
len
||
attr
->
name
.
ptr
[
len
]
==
':'
);
...
...
@@ -1236,7 +1236,7 @@ static BOOL is_xmlns_attr( const struct xml_attr *attr )
static
void
push_xmlns
(
xmlbuf_t
*
xmlbuf
,
const
struct
xml_attr
*
attr
)
{
const
int
len
=
strlenW
(
xmlnsW
);
const
int
len
=
wcslen
(
xmlnsW
);
struct
xml_attr
*
ns
;
if
(
xmlbuf
->
ns_pos
==
MAX_NAMESPACES
-
1
)
...
...
@@ -3061,7 +3061,7 @@ static NTSTATUS get_manifest_in_associated_manifest( struct actctx_loader* acl,
if
(
!
(
status
=
get_module_filename
(
module
,
&
name
,
sizeof
(
dotManifestW
)
+
10
*
sizeof
(
WCHAR
)
)))
{
if
(
resid
!=
1
)
NTDLL_swprintf
(
name
.
Buffer
+
strlenW
(
name
.
Buffer
),
fmtW
,
resid
);
if
(
resid
!=
1
)
NTDLL_swprintf
(
name
.
Buffer
+
wcslen
(
name
.
Buffer
),
fmtW
,
resid
);
wcscat
(
name
.
Buffer
,
dotManifestW
);
if
(
!
RtlDosPathNameToNtPathName_U
(
name
.
Buffer
,
&
nameW
,
NULL
,
NULL
))
status
=
STATUS_RESOURCE_DATA_NOT_FOUND
;
...
...
@@ -3072,10 +3072,10 @@ static NTSTATUS get_manifest_in_associated_manifest( struct actctx_loader* acl,
else
{
if
(
!
(
buffer
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
strlenW
(
filename
)
+
10
)
*
sizeof
(
WCHAR
)
+
sizeof
(
dotManifestW
)
)))
(
wcslen
(
filename
)
+
10
)
*
sizeof
(
WCHAR
)
+
sizeof
(
dotManifestW
)
)))
return
STATUS_NO_MEMORY
;
wcscpy
(
buffer
,
filename
);
if
(
resid
!=
1
)
NTDLL_swprintf
(
buffer
+
strlenW
(
buffer
),
fmtW
,
resid
);
if
(
resid
!=
1
)
NTDLL_swprintf
(
buffer
+
wcslen
(
buffer
),
fmtW
,
resid
);
wcscat
(
buffer
,
dotManifestW
);
RtlInitUnicodeString
(
&
nameW
,
buffer
);
}
...
...
@@ -3107,8 +3107,8 @@ static WCHAR *lookup_manifest_file( HANDLE dir, struct assembly_identity *ai )
if
(
!
lang
||
!
wcsicmp
(
lang
,
neutralW
))
lang
=
wildcardW
;
if
(
!
(
lookup
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
strlenW
(
ai
->
arch
)
+
strlenW
(
ai
->
name
)
+
strlenW
(
ai
->
public_key
)
+
strlenW
(
lang
)
+
20
)
*
sizeof
(
WCHAR
)
(
wcslen
(
ai
->
arch
)
+
wcslen
(
ai
->
name
)
+
wcslen
(
ai
->
public_key
)
+
wcslen
(
lang
)
+
20
)
*
sizeof
(
WCHAR
)
+
sizeof
(
lookup_fmtW
)
)))
return
NULL
;
NTDLL_swprintf
(
lookup
,
lookup_fmtW
,
ai
->
arch
,
ai
->
name
,
ai
->
public_key
,
...
...
@@ -3190,11 +3190,11 @@ static NTSTATUS lookup_winsxs(struct actctx_loader* acl, struct assembly_identit
if
(
!
ai
->
arch
||
!
ai
->
name
||
!
ai
->
public_key
)
return
STATUS_NO_SUCH_FILE
;
if
(
!
(
path
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
manifest_dirW
)
+
strlenW
(
user_shared_data
->
NtSystemRoot
)
*
sizeof
(
WCHAR
)
)))
wcslen
(
user_shared_data
->
NtSystemRoot
)
*
sizeof
(
WCHAR
)
)))
return
STATUS_NO_MEMORY
;
wcscpy
(
path
,
user_shared_data
->
NtSystemRoot
);
memcpy
(
path
+
strlenW
(
path
),
manifest_dirW
,
sizeof
(
manifest_dirW
)
);
memcpy
(
path
+
wcslen
(
path
),
manifest_dirW
,
sizeof
(
manifest_dirW
)
);
if
(
!
RtlDosPathNameToNtPathName_U
(
path
,
&
path_us
,
NULL
,
NULL
))
{
...
...
@@ -3225,7 +3225,7 @@ static NTSTATUS lookup_winsxs(struct actctx_loader* acl, struct assembly_identit
/* append file name to directory path */
if
(
!
(
path
=
RtlReAllocateHeap
(
GetProcessHeap
(),
0
,
path_us
.
Buffer
,
path_us
.
Length
+
(
strlenW
(
file
)
+
2
)
*
sizeof
(
WCHAR
)
)))
path_us
.
Length
+
(
wcslen
(
file
)
+
2
)
*
sizeof
(
WCHAR
)
)))
{
RtlFreeHeap
(
GetProcessHeap
(),
0
,
file
);
RtlFreeUnicodeString
(
&
path_us
);
...
...
@@ -3268,11 +3268,11 @@ static NTSTATUS lookup_assembly(struct actctx_loader* acl,
/* FIXME: add support for language specific lookup */
len
=
max
(
RtlGetFullPathName_U
(
acl
->
actctx
->
assemblies
->
manifest
.
info
,
0
,
NULL
,
NULL
)
/
sizeof
(
WCHAR
),
strlenW
(
acl
->
actctx
->
appdir
.
info
));
wcslen
(
acl
->
actctx
->
appdir
.
info
));
nameW
.
Buffer
=
NULL
;
if
(
!
(
buffer
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
len
+
2
*
strlenW
(
ai
->
name
)
+
2
)
*
sizeof
(
WCHAR
)
+
sizeof
(
dotManifestW
)
)))
(
len
+
2
*
wcslen
(
ai
->
name
)
+
2
)
*
sizeof
(
WCHAR
)
+
sizeof
(
dotManifestW
)
)))
return
STATUS_NO_MEMORY
;
if
(
!
(
directory
=
build_assembly_dir
(
ai
)))
...
...
@@ -3290,7 +3290,7 @@ static NTSTATUS lookup_assembly(struct actctx_loader* acl,
* it tries application manifest file path.
*/
wcscpy
(
buffer
,
acl
->
actctx
->
appdir
.
info
);
p
=
buffer
+
strlenW
(
buffer
);
p
=
buffer
+
wcslen
(
buffer
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
if
(
i
==
2
)
...
...
@@ -3301,7 +3301,7 @@ static NTSTATUS lookup_assembly(struct actctx_loader* acl,
else
*
p
++
=
'\\'
;
wcscpy
(
p
,
ai
->
name
);
p
+=
strlenW
(
p
);
p
+=
wcslen
(
p
);
wcscpy
(
p
,
dotDllW
);
if
(
RtlDosPathNameToNtPathName_U
(
buffer
,
&
nameW
,
NULL
,
NULL
))
...
...
@@ -3416,7 +3416,7 @@ static NTSTATUS build_dllredirect_section(ACTIVATION_CONTEXT* actctx, struct str
/* each entry needs index, data and string data */
total_len
+=
sizeof
(
*
index
);
total_len
+=
sizeof
(
*
data
);
total_len
+=
aligned_string_len
((
strlenW
(
dll
->
name
)
+
1
)
*
sizeof
(
WCHAR
));
total_len
+=
aligned_string_len
((
wcslen
(
dll
->
name
)
+
1
)
*
sizeof
(
WCHAR
));
}
dll_count
+=
assembly
->
num_dlls
;
...
...
@@ -3446,7 +3446,7 @@ static NTSTATUS build_dllredirect_section(ACTIVATION_CONTEXT* actctx, struct str
/* setup new index entry */
str
.
Buffer
=
dll
->
name
;
str
.
Length
=
strlenW
(
dll
->
name
)
*
sizeof
(
WCHAR
);
str
.
Length
=
wcslen
(
dll
->
name
)
*
sizeof
(
WCHAR
);
str
.
MaximumLength
=
str
.
Length
+
sizeof
(
WCHAR
);
/* hash original class name */
RtlHashUnicodeString
(
&
str
,
TRUE
,
HASH_STRING_ALGORITHM_X65599
,
&
index
->
hash
);
...
...
@@ -3605,7 +3605,7 @@ static NTSTATUS build_wndclass_section(ACTIVATION_CONTEXT* actctx, struct strsec
struct
entity
*
entity
=
&
dll
->
entities
.
base
[
k
];
if
(
entity
->
kind
==
ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION
)
{
int
class_len
=
strlenW
(
entity
->
u
.
class
.
name
)
+
1
;
int
class_len
=
wcslen
(
entity
->
u
.
class
.
name
)
+
1
;
int
len
;
/* each class entry needs index, data and string data */
...
...
@@ -3618,7 +3618,7 @@ static NTSTATUS build_wndclass_section(ACTIVATION_CONTEXT* actctx, struct strsec
len
=
get_assembly_version
(
assembly
,
NULL
)
+
class_len
+
1
/* '!' separator */
;
else
len
=
class_len
;
len
+=
strlenW
(
dll
->
name
)
+
1
;
len
+=
wcslen
(
dll
->
name
)
+
1
;
total_len
+=
aligned_string_len
(
len
*
sizeof
(
WCHAR
));
class_count
++
;
...
...
@@ -3658,7 +3658,7 @@ static NTSTATUS build_wndclass_section(ACTIVATION_CONTEXT* actctx, struct strsec
/* setup new index entry */
str
.
Buffer
=
entity
->
u
.
class
.
name
;
str
.
Length
=
strlenW
(
entity
->
u
.
class
.
name
)
*
sizeof
(
WCHAR
);
str
.
Length
=
wcslen
(
entity
->
u
.
class
.
name
)
*
sizeof
(
WCHAR
);
str
.
MaximumLength
=
str
.
Length
+
sizeof
(
WCHAR
);
/* hash original class name */
RtlHashUnicodeString
(
&
str
,
TRUE
,
HASH_STRING_ALGORITHM_X65599
,
&
index
->
hash
);
...
...
@@ -3668,7 +3668,7 @@ static NTSTATUS build_wndclass_section(ACTIVATION_CONTEXT* actctx, struct strsec
versioned_len
=
(
get_assembly_version
(
assembly
,
NULL
)
+
1
)
*
sizeof
(
WCHAR
)
+
str
.
Length
;
else
versioned_len
=
str
.
Length
;
module_len
=
strlenW
(
dll
->
name
)
*
sizeof
(
WCHAR
);
module_len
=
wcslen
(
dll
->
name
)
*
sizeof
(
WCHAR
);
index
->
name_offset
=
name_offset
;
index
->
name_len
=
str
.
Length
;
...
...
@@ -3814,10 +3814,10 @@ static NTSTATUS build_tlib_section(ACTIVATION_CONTEXT* actctx, struct guidsectio
total_len
+=
sizeof
(
*
data
);
/* help string is stored separately */
if
(
*
entity
->
u
.
typelib
.
helpdir
)
total_len
+=
aligned_string_len
((
strlenW
(
entity
->
u
.
typelib
.
helpdir
)
+
1
)
*
sizeof
(
WCHAR
));
total_len
+=
aligned_string_len
((
wcslen
(
entity
->
u
.
typelib
.
helpdir
)
+
1
)
*
sizeof
(
WCHAR
));
/* module names are packed one after another */
names_len
+=
(
strlenW
(
dll
->
name
)
+
1
)
*
sizeof
(
WCHAR
);
names_len
+=
(
wcslen
(
dll
->
name
)
+
1
)
*
sizeof
(
WCHAR
);
tlib_count
++
;
}
...
...
@@ -3856,11 +3856,11 @@ static NTSTATUS build_tlib_section(ACTIVATION_CONTEXT* actctx, struct guidsectio
WCHAR
*
ptrW
;
if
(
*
entity
->
u
.
typelib
.
helpdir
)
help_len
=
strlenW
(
entity
->
u
.
typelib
.
helpdir
)
*
sizeof
(
WCHAR
);
help_len
=
wcslen
(
entity
->
u
.
typelib
.
helpdir
)
*
sizeof
(
WCHAR
);
else
help_len
=
0
;
module_len
=
strlenW
(
dll
->
name
)
*
sizeof
(
WCHAR
);
module_len
=
wcslen
(
dll
->
name
)
*
sizeof
(
WCHAR
);
/* setup new index entry */
RtlInitUnicodeString
(
&
str
,
entity
->
u
.
typelib
.
tlbid
);
...
...
@@ -3994,11 +3994,11 @@ static void get_comserver_datalen(const struct entity_array *entities, const str
unsigned
int
str_len
;
/* all string data is stored together in aligned block */
str_len
=
strlenW
(
entity
->
u
.
comclass
.
name
)
+
1
;
str_len
=
wcslen
(
entity
->
u
.
comclass
.
name
)
+
1
;
if
(
entity
->
u
.
comclass
.
progid
)
str_len
+=
strlenW
(
entity
->
u
.
comclass
.
progid
)
+
1
;
str_len
+=
wcslen
(
entity
->
u
.
comclass
.
progid
)
+
1
;
if
(
entity
->
u
.
comclass
.
version
)
str_len
+=
strlenW
(
entity
->
u
.
comclass
.
version
)
+
1
;
str_len
+=
wcslen
(
entity
->
u
.
comclass
.
version
)
+
1
;
*
len
+=
sizeof
(
struct
clrclass_data
);
*
len
+=
aligned_string_len
(
str_len
*
sizeof
(
WCHAR
));
...
...
@@ -4010,9 +4010,9 @@ static void get_comserver_datalen(const struct entity_array *entities, const str
{
/* progid string is stored separately */
if
(
entity
->
u
.
comclass
.
progid
)
*
len
+=
aligned_string_len
((
strlenW
(
entity
->
u
.
comclass
.
progid
)
+
1
)
*
sizeof
(
WCHAR
));
*
len
+=
aligned_string_len
((
wcslen
(
entity
->
u
.
comclass
.
progid
)
+
1
)
*
sizeof
(
WCHAR
));
*
module_len
+=
(
strlenW
(
dll
->
name
)
+
1
)
*
sizeof
(
WCHAR
);
*
module_len
+=
(
wcslen
(
dll
->
name
)
+
1
)
*
sizeof
(
WCHAR
);
}
*
count
+=
1
;
...
...
@@ -4039,11 +4039,11 @@ static void add_comserver_record(const struct guidsection_header *section, const
WCHAR
*
ptrW
;
if
(
entity
->
u
.
comclass
.
progid
)
progid_len
=
strlenW
(
entity
->
u
.
comclass
.
progid
)
*
sizeof
(
WCHAR
);
progid_len
=
wcslen
(
entity
->
u
.
comclass
.
progid
)
*
sizeof
(
WCHAR
);
else
progid_len
=
0
;
module_len
=
dll
?
strlenW
(
dll
->
name
)
*
sizeof
(
WCHAR
)
:
strlenW
(
mscoreeW
)
*
sizeof
(
WCHAR
);
module_len
=
dll
?
wcslen
(
dll
->
name
)
*
sizeof
(
WCHAR
)
:
wcslen
(
mscoreeW
)
*
sizeof
(
WCHAR
);
/* setup new index entry */
RtlInitUnicodeString
(
&
str
,
entity
->
u
.
comclass
.
clsid
);
...
...
@@ -4111,11 +4111,11 @@ static void add_comserver_record(const struct guidsection_header *section, const
clrdata
->
size
=
sizeof
(
*
clrdata
);
clrdata
->
res
[
0
]
=
0
;
clrdata
->
res
[
1
]
=
2
;
/* FIXME: unknown field */
clrdata
->
module_len
=
strlenW
(
mscoreeW
)
*
sizeof
(
WCHAR
);
clrdata
->
module_len
=
wcslen
(
mscoreeW
)
*
sizeof
(
WCHAR
);
clrdata
->
module_offset
=
*
module_offset
+
data
->
name_len
+
sizeof
(
WCHAR
);
clrdata
->
name_len
=
strlenW
(
entity
->
u
.
comclass
.
name
)
*
sizeof
(
WCHAR
);
clrdata
->
name_len
=
wcslen
(
entity
->
u
.
comclass
.
name
)
*
sizeof
(
WCHAR
);
clrdata
->
name_offset
=
clrdata
->
size
;
clrdata
->
version_len
=
entity
->
u
.
comclass
.
version
?
strlenW
(
entity
->
u
.
comclass
.
version
)
*
sizeof
(
WCHAR
)
:
0
;
clrdata
->
version_len
=
entity
->
u
.
comclass
.
version
?
wcslen
(
entity
->
u
.
comclass
.
version
)
*
sizeof
(
WCHAR
)
:
0
;
clrdata
->
version_offset
=
clrdata
->
version_len
?
clrdata
->
name_offset
+
clrdata
->
name_len
+
sizeof
(
WCHAR
)
:
0
;
clrdata
->
res2
[
0
]
=
0
;
clrdata
->
res2
[
1
]
=
0
;
...
...
@@ -4304,7 +4304,7 @@ static void get_ifaceps_datalen(const struct entity_array *entities, unsigned in
{
*
len
+=
sizeof
(
struct
guid_index
)
+
sizeof
(
struct
ifacepsredirect_data
);
if
(
entity
->
u
.
ifaceps
.
name
)
*
len
+=
aligned_string_len
((
strlenW
(
entity
->
u
.
ifaceps
.
name
)
+
1
)
*
sizeof
(
WCHAR
));
*
len
+=
aligned_string_len
((
wcslen
(
entity
->
u
.
ifaceps
.
name
)
+
1
)
*
sizeof
(
WCHAR
));
*
count
+=
1
;
}
}
...
...
@@ -4325,7 +4325,7 @@ static void add_ifaceps_record(struct guidsection_header *section, struct entity
ULONG
name_len
;
if
(
entity
->
u
.
ifaceps
.
name
)
name_len
=
strlenW
(
entity
->
u
.
ifaceps
.
name
)
*
sizeof
(
WCHAR
);
name_len
=
wcslen
(
entity
->
u
.
ifaceps
.
name
)
*
sizeof
(
WCHAR
);
else
name_len
=
0
;
...
...
@@ -4501,9 +4501,9 @@ static NTSTATUS build_clr_surrogate_section(ACTIVATION_CONTEXT* actctx, struct g
ULONG
len
;
total_len
+=
sizeof
(
*
index
)
+
sizeof
(
*
data
);
len
=
strlenW
(
entity
->
u
.
clrsurrogate
.
name
)
+
1
;
len
=
wcslen
(
entity
->
u
.
clrsurrogate
.
name
)
+
1
;
if
(
entity
->
u
.
clrsurrogate
.
version
)
len
+=
strlenW
(
entity
->
u
.
clrsurrogate
.
version
)
+
1
;
len
+=
wcslen
(
entity
->
u
.
clrsurrogate
.
version
)
+
1
;
total_len
+=
aligned_string_len
(
len
*
sizeof
(
WCHAR
));
count
++
;
...
...
@@ -4537,10 +4537,10 @@ static NTSTATUS build_clr_surrogate_section(ACTIVATION_CONTEXT* actctx, struct g
WCHAR
*
ptrW
;
if
(
entity
->
u
.
clrsurrogate
.
version
)
version_len
=
strlenW
(
entity
->
u
.
clrsurrogate
.
version
)
*
sizeof
(
WCHAR
);
version_len
=
wcslen
(
entity
->
u
.
clrsurrogate
.
version
)
*
sizeof
(
WCHAR
);
else
version_len
=
0
;
name_len
=
strlenW
(
entity
->
u
.
clrsurrogate
.
name
)
*
sizeof
(
WCHAR
);
name_len
=
wcslen
(
entity
->
u
.
clrsurrogate
.
name
)
*
sizeof
(
WCHAR
);
/* setup new index entry */
RtlInitUnicodeString
(
&
str
,
entity
->
u
.
clrsurrogate
.
clsid
);
...
...
@@ -4645,12 +4645,12 @@ static void get_progid_datalen(struct entity_array *entities, unsigned int *coun
{
if
(
entity
->
u
.
comclass
.
progid
)
{
*
total_len
+=
single_len
+
aligned_string_len
((
strlenW
(
entity
->
u
.
comclass
.
progid
)
+
1
)
*
sizeof
(
WCHAR
));
*
total_len
+=
single_len
+
aligned_string_len
((
wcslen
(
entity
->
u
.
comclass
.
progid
)
+
1
)
*
sizeof
(
WCHAR
));
*
count
+=
1
;
}
for
(
j
=
0
;
j
<
entity
->
u
.
comclass
.
progids
.
num
;
j
++
)
*
total_len
+=
aligned_string_len
((
strlenW
(
entity
->
u
.
comclass
.
progids
.
progids
[
j
])
+
1
)
*
sizeof
(
WCHAR
));
*
total_len
+=
aligned_string_len
((
wcslen
(
entity
->
u
.
comclass
.
progids
.
progids
[
j
])
+
1
)
*
sizeof
(
WCHAR
));
*
total_len
+=
single_len
*
entity
->
u
.
comclass
.
progids
.
num
;
*
count
+=
entity
->
u
.
comclass
.
progids
.
num
;
...
...
@@ -5016,8 +5016,8 @@ NTSTATUS WINAPI RtlCreateActivationContext( HANDLE *handle, const void *ptr )
{
DWORD
dir_len
,
source_len
;
dir_len
=
strlenW
(
pActCtx
->
lpAssemblyDirectory
);
source_len
=
strlenW
(
pActCtx
->
lpSource
);
dir_len
=
wcslen
(
pActCtx
->
lpAssemblyDirectory
);
source_len
=
wcslen
(
pActCtx
->
lpSource
);
if
(
!
(
source
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
dir_len
+
source_len
+
2
)
*
sizeof
(
WCHAR
))))
{
status
=
STATUS_NO_MEMORY
;
...
...
@@ -5277,9 +5277,9 @@ NTSTATUS WINAPI RtlQueryInformationActivationContext( ULONG flags, HANDLE handle
if
(
actctx
->
num_assemblies
)
assembly
=
actctx
->
assemblies
;
if
(
assembly
&&
assembly
->
manifest
.
info
)
manifest_len
=
strlenW
(
assembly
->
manifest
.
info
)
+
1
;
if
(
actctx
->
config
.
info
)
config_len
=
strlenW
(
actctx
->
config
.
info
)
+
1
;
if
(
actctx
->
appdir
.
info
)
appdir_len
=
strlenW
(
actctx
->
appdir
.
info
)
+
1
;
manifest_len
=
wcslen
(
assembly
->
manifest
.
info
)
+
1
;
if
(
actctx
->
config
.
info
)
config_len
=
wcslen
(
actctx
->
config
.
info
)
+
1
;
if
(
actctx
->
appdir
.
info
)
appdir_len
=
wcslen
(
actctx
->
appdir
.
info
)
+
1
;
len
=
sizeof
(
*
acdi
)
+
(
manifest_len
+
config_len
+
appdir_len
)
*
sizeof
(
WCHAR
);
if
(
retlen
)
*
retlen
=
len
;
...
...
@@ -5336,12 +5336,12 @@ NTSTATUS WINAPI RtlQueryInformationActivationContext( ULONG flags, HANDLE handle
assembly
=
&
actctx
->
assemblies
[
index
-
1
];
if
(
!
(
assembly_id
=
build_assembly_id
(
&
assembly
->
id
)))
return
STATUS_NO_MEMORY
;
id_len
=
strlenW
(
assembly_id
)
+
1
;
if
(
assembly
->
directory
)
ad_len
=
strlenW
(
assembly
->
directory
)
+
1
;
id_len
=
wcslen
(
assembly_id
)
+
1
;
if
(
assembly
->
directory
)
ad_len
=
wcslen
(
assembly
->
directory
)
+
1
;
if
(
assembly
->
manifest
.
info
&&
(
assembly
->
type
==
ASSEMBLY_MANIFEST
||
assembly
->
type
==
ASSEMBLY_SHARED_MANIFEST
))
path_len
=
strlenW
(
assembly
->
manifest
.
info
)
+
1
;
path_len
=
wcslen
(
assembly
->
manifest
.
info
)
+
1
;
len
=
sizeof
(
*
afdi
)
+
(
id_len
+
ad_len
+
path_len
)
*
sizeof
(
WCHAR
);
...
...
@@ -5407,7 +5407,7 @@ NTSTATUS WINAPI RtlQueryInformationActivationContext( ULONG flags, HANDLE handle
return
STATUS_INVALID_PARAMETER
;
dll
=
&
assembly
->
dlls
[
acqi
->
ulFileIndexInAssembly
];
if
(
dll
->
name
)
dll_len
=
strlenW
(
dll
->
name
)
+
1
;
if
(
dll
->
name
)
dll_len
=
wcslen
(
dll
->
name
)
+
1
;
len
=
sizeof
(
*
afdi
)
+
dll_len
*
sizeof
(
WCHAR
);
if
(
!
buffer
||
bufsize
<
len
)
...
...
@@ -5602,8 +5602,8 @@ NTSTATUS WINAPI RtlQueryActivationContextApplicationSettings( DWORD flags, HANDL
if
(
!
(
res
=
find_app_settings
(
actctx
,
settings
,
ns
)))
return
STATUS_SXS_KEY_NOT_FOUND
;
if
(
written
)
*
written
=
strlenW
(
res
)
+
1
;
if
(
size
<
strlenW
(
res
))
return
STATUS_BUFFER_TOO_SMALL
;
if
(
written
)
*
written
=
wcslen
(
res
)
+
1
;
if
(
size
<
wcslen
(
res
))
return
STATUS_BUFFER_TOO_SMALL
;
wcscpy
(
buffer
,
res
);
return
STATUS_SUCCESS
;
}
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