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
2f7cc584
Commit
2f7cc584
authored
Mar 27, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use RtlCompareUnicodeStrings() instead of strncmpiW().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4d93bafe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
12 deletions
+20
-12
directory.c
dlls/ntdll/directory.c
+3
-3
env.c
dlls/ntdll/env.c
+12
-6
loader.c
dlls/ntdll/loader.c
+5
-3
No files found.
dlls/ntdll/directory.c
View file @
2f7cc584
...
...
@@ -2102,7 +2102,7 @@ static NTSTATUS find_file_in_dir( char *unix_name, int pos, const WCHAR *name, i
{
ret
=
ntdll_umbstowcs
(
kde
[
1
].
d_name
,
strlen
(
kde
[
1
].
d_name
),
buffer
,
MAX_DIR_ENTRY_LEN
);
if
(
ret
==
length
&&
!
strncmpiW
(
buffer
,
name
,
length
))
if
(
ret
==
length
&&
!
RtlCompareUnicodeStrings
(
buffer
,
ret
,
name
,
ret
,
TRUE
))
{
strcpy
(
unix_name
+
pos
,
kde
[
1
].
d_name
);
RtlLeaveCriticalSection
(
&
dir_section
);
...
...
@@ -2112,7 +2112,7 @@ static NTSTATUS find_file_in_dir( char *unix_name, int pos, const WCHAR *name, i
}
ret
=
ntdll_umbstowcs
(
kde
[
0
].
d_name
,
strlen
(
kde
[
0
].
d_name
),
buffer
,
MAX_DIR_ENTRY_LEN
);
if
(
ret
==
length
&&
!
strncmpiW
(
buffer
,
name
,
length
))
if
(
ret
==
length
&&
!
RtlCompareUnicodeStrings
(
buffer
,
ret
,
name
,
ret
,
TRUE
))
{
strcpy
(
unix_name
+
pos
,
kde
[
1
].
d_name
[
0
]
?
kde
[
1
].
d_name
:
kde
[
0
].
d_name
);
...
...
@@ -2146,7 +2146,7 @@ static NTSTATUS find_file_in_dir( char *unix_name, int pos, const WCHAR *name, i
while
((
de
=
readdir
(
dir
)))
{
ret
=
ntdll_umbstowcs
(
de
->
d_name
,
strlen
(
de
->
d_name
),
buffer
,
MAX_DIR_ENTRY_LEN
);
if
(
ret
==
length
&&
!
strncmpiW
(
buffer
,
name
,
length
))
if
(
ret
==
length
&&
!
RtlCompareUnicodeStrings
(
buffer
,
ret
,
name
,
ret
,
TRUE
))
{
strcpy
(
unix_name
+
pos
,
de
->
d_name
);
closedir
(
dir
);
...
...
dlls/ntdll/env.c
View file @
2f7cc584
...
...
@@ -903,16 +903,20 @@ NTSTATUS WINAPI RtlDestroyEnvironment(PWSTR env)
static
LPCWSTR
ENV_FindVariable
(
PCWSTR
var
,
PCWSTR
name
,
unsigned
namelen
)
{
for
(;
*
var
;
var
+=
strlenW
(
var
)
+
1
)
while
(
*
var
)
{
/* match var names, but avoid setting a var with a name including a '='
* (a starting '=' is valid though)
*/
if
(
strncmpiW
(
var
,
name
,
namelen
)
==
0
&&
var
[
namelen
]
==
'='
&&
strchrW
(
var
+
1
,
'='
)
==
var
+
namelen
)
unsigned
int
len
=
strlenW
(
var
);
if
(
len
>
namelen
&&
var
[
namelen
]
==
'='
&&
!
RtlCompareUnicodeStrings
(
var
,
namelen
,
name
,
namelen
,
TRUE
)
&&
strchrW
(
var
+
1
,
'='
)
==
var
+
namelen
)
{
return
var
+
namelen
+
1
;
}
var
+=
len
+
1
;
}
return
NULL
;
}
...
...
@@ -987,7 +991,7 @@ void WINAPI RtlSetCurrentEnvironment(PWSTR new_env, PWSTR* old_env)
NTSTATUS
WINAPI
RtlSetEnvironmentVariable
(
PWSTR
*
penv
,
PUNICODE_STRING
name
,
PUNICODE_STRING
value
)
{
INT
len
,
old_size
;
INT
varlen
,
len
,
old_size
;
LPWSTR
p
,
env
;
NTSTATUS
nts
=
STATUS_VARIABLE_NOT_FOUND
;
...
...
@@ -1011,9 +1015,11 @@ NTSTATUS WINAPI RtlSetEnvironmentVariable(PWSTR* penv, PUNICODE_STRING name,
old_size
=
get_env_length
(
env
);
/* Find a place to insert the string */
for
(
p
=
env
;
*
p
;
p
+=
strlenW
(
p
)
+
1
)
for
(
p
=
env
;
*
p
;
p
+=
varlen
+
1
)
{
if
(
!
strncmpiW
(
name
->
Buffer
,
p
,
len
)
&&
(
p
[
len
]
==
'='
))
break
;
varlen
=
strlenW
(
p
);
if
(
varlen
>
len
&&
p
[
len
]
==
'='
&&
!
RtlCompareUnicodeStrings
(
name
->
Buffer
,
len
,
p
,
len
,
TRUE
))
break
;
}
if
(
!
value
&&
!*
p
)
goto
done
;
/* Value to remove doesn't exist */
...
...
dlls/ntdll/loader.c
View file @
2f7cc584
...
...
@@ -2768,10 +2768,12 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname )
if
((
p
=
strrchrW
(
info
->
lpAssemblyManifestPath
,
'\\'
)))
{
DWORD
dirlen
=
info
->
ulAssemblyDirectoryNameLength
/
sizeof
(
WCHAR
);
DWORD
len
,
dirlen
=
info
->
ulAssemblyDirectoryNameLength
/
sizeof
(
WCHAR
);
p
++
;
if
(
!
dirlen
||
strncmpiW
(
p
,
info
->
lpAssemblyDirectoryName
,
dirlen
)
||
wcsicmp
(
p
+
dirlen
,
dotManifestW
))
len
=
strlenW
(
p
);
if
(
!
dirlen
||
len
<=
dirlen
||
RtlCompareUnicodeStrings
(
p
,
dirlen
,
info
->
lpAssemblyDirectoryName
,
dirlen
,
TRUE
)
||
wcsicmp
(
p
+
dirlen
,
dotManifestW
))
{
/* manifest name does not match directory name, so it's not a global
* windows/winsxs manifest; use the manifest directory name instead */
...
...
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