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
5721d5f8
Commit
5721d5f8
authored
Mar 24, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Add a helper function for case-insensitive Unicode string comparisons.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
faaea5cd
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
13 deletions
+27
-13
atom.c
server/atom.c
+1
-1
object.c
server/object.c
+1
-1
registry.c
server/registry.c
+9
-11
unicode.c
server/unicode.c
+15
-0
unicode.h
server/unicode.h
+1
-0
No files found.
server/atom.c
View file @
5721d5f8
...
...
@@ -214,7 +214,7 @@ static struct atom_entry *find_atom_entry( struct atom_table *table, const struc
struct
atom_entry
*
entry
=
table
->
entries
[
hash
];
while
(
entry
)
{
if
(
entry
->
len
==
str
->
len
&&
!
memicmp
W
(
entry
->
str
,
str
->
str
,
str
->
len
/
sizeof
(
WCHAR
)
))
break
;
if
(
entry
->
len
==
str
->
len
&&
!
memicmp
_strW
(
entry
->
str
,
str
->
str
,
str
->
len
))
break
;
entry
=
entry
->
next
;
}
return
entry
;
...
...
server/object.c
View file @
5721d5f8
...
...
@@ -457,7 +457,7 @@ struct object *find_object( const struct namespace *namespace, const struct unic
if
(
ptr
->
len
!=
name
->
len
)
continue
;
if
(
attributes
&
OBJ_CASE_INSENSITIVE
)
{
if
(
!
strncmpiW
(
ptr
->
name
,
name
->
str
,
name
->
len
/
sizeof
(
WCHAR
)
))
if
(
!
memicmp_strW
(
ptr
->
name
,
name
->
str
,
name
->
len
))
return
grab_object
(
ptr
->
obj
);
}
else
...
...
server/registry.c
View file @
5721d5f8
...
...
@@ -177,8 +177,7 @@ static const struct object_ops key_ops =
static
inline
int
is_wow6432node
(
const
WCHAR
*
name
,
unsigned
int
len
)
{
return
(
len
==
sizeof
(
wow6432node
)
&&
!
memicmpW
(
name
,
wow6432node
,
ARRAY_SIZE
(
wow6432node
)));
return
(
len
==
sizeof
(
wow6432node
)
&&
!
memicmp_strW
(
name
,
wow6432node
,
sizeof
(
wow6432node
)));
}
/*
...
...
@@ -438,8 +437,7 @@ static inline void get_req_path( struct unicode_str *str, int skip_root )
str
->
str
=
get_req_data
();
str
->
len
=
(
get_req_data_size
()
/
sizeof
(
WCHAR
))
*
sizeof
(
WCHAR
);
if
(
skip_root
&&
str
->
len
>=
sizeof
(
root_name
)
&&
!
memicmpW
(
str
->
str
,
root_name
,
ARRAY_SIZE
(
root_name
)))
if
(
skip_root
&&
str
->
len
>=
sizeof
(
root_name
)
&&
!
memicmp_strW
(
str
->
str
,
root_name
,
sizeof
(
root_name
)
))
{
str
->
str
+=
ARRAY_SIZE
(
root_name
);
str
->
len
-=
sizeof
(
root_name
);
...
...
@@ -647,7 +645,7 @@ static struct key *find_subkey( const struct key *key, const struct unicode_str
{
i
=
(
min
+
max
)
/
2
;
len
=
min
(
key
->
subkeys
[
i
]
->
namelen
,
name
->
len
);
res
=
memicmp
W
(
key
->
subkeys
[
i
]
->
name
,
name
->
str
,
len
/
sizeof
(
WCHAR
)
);
res
=
memicmp
_strW
(
key
->
subkeys
[
i
]
->
name
,
name
->
str
,
len
);
if
(
!
res
)
res
=
key
->
subkeys
[
i
]
->
namelen
-
name
->
len
;
if
(
!
res
)
{
...
...
@@ -691,7 +689,7 @@ static struct key *follow_symlink( struct key *key, int iteration )
path
.
str
=
value
->
data
;
path
.
len
=
(
value
->
len
/
sizeof
(
WCHAR
))
*
sizeof
(
WCHAR
);
if
(
path
.
len
<=
sizeof
(
root_name
))
return
NULL
;
if
(
memicmp
W
(
path
.
str
,
root_name
,
ARRAY_SIZE
(
root_name
)
))
return
NULL
;
if
(
memicmp
_strW
(
path
.
str
,
root_name
,
sizeof
(
root_name
)
))
return
NULL
;
path
.
str
+=
ARRAY_SIZE
(
root_name
);
path
.
len
-=
sizeof
(
root_name
);
...
...
@@ -1054,7 +1052,7 @@ static struct key_value *find_value( const struct key *key, const struct unicode
{
i
=
(
min
+
max
)
/
2
;
len
=
min
(
key
->
values
[
i
].
namelen
,
name
->
len
);
res
=
memicmp
W
(
key
->
values
[
i
].
name
,
name
->
str
,
len
/
sizeof
(
WCHAR
)
);
res
=
memicmp
_strW
(
key
->
values
[
i
].
name
,
name
->
str
,
len
);
if
(
!
res
)
res
=
key
->
values
[
i
].
namelen
-
name
->
len
;
if
(
!
res
)
{
...
...
@@ -1116,7 +1114,7 @@ static void set_value( struct key *key, const struct unicode_str *name,
if
(
key
->
flags
&
KEY_SYMLINK
)
{
if
(
type
!=
REG_LINK
||
name
->
len
!=
symlink_str
.
len
||
memicmp
W
(
name
->
str
,
symlink_str
.
str
,
name
->
len
/
sizeof
(
WCHAR
)
))
memicmp
_strW
(
name
->
str
,
symlink_str
.
str
,
name
->
len
))
{
set_error
(
STATUS_ACCESS_DENIED
);
return
;
...
...
@@ -1614,7 +1612,7 @@ static int get_prefix_len( struct key *key, const char *name, struct file_load_i
len
=
(
p
-
info
->
tmp
)
*
sizeof
(
WCHAR
);
for
(
res
=
1
;
key
!=
root_key
;
res
++
)
{
if
(
len
==
key
->
namelen
&&
!
memicmp
W
(
info
->
tmp
,
key
->
name
,
len
/
sizeof
(
WCHAR
)
))
break
;
if
(
len
==
key
->
namelen
&&
!
memicmp
_strW
(
info
->
tmp
,
key
->
name
,
len
))
break
;
key
=
key
->
parent
;
}
if
(
key
==
root_key
)
res
=
0
;
/* no matching name */
...
...
@@ -2051,7 +2049,7 @@ DECL_HANDLER(create_key)
class
.
len
=
(
class
.
len
/
sizeof
(
WCHAR
))
*
sizeof
(
WCHAR
);
if
(
!
objattr
->
rootdir
&&
name
.
len
>=
sizeof
(
root_name
)
&&
!
memicmp
W
(
name
.
str
,
root_name
,
ARRAY_SIZE
(
root_name
)
))
!
memicmp
_strW
(
name
.
str
,
root_name
,
sizeof
(
root_name
)
))
{
name
.
str
+=
ARRAY_SIZE
(
root_name
);
name
.
len
-=
sizeof
(
root_name
);
...
...
@@ -2209,7 +2207,7 @@ DECL_HANDLER(load_registry)
}
if
(
!
objattr
->
rootdir
&&
name
.
len
>=
sizeof
(
root_name
)
&&
!
memicmp
W
(
name
.
str
,
root_name
,
ARRAY_SIZE
(
root_name
)
))
!
memicmp
_strW
(
name
.
str
,
root_name
,
sizeof
(
root_name
)
))
{
name
.
str
+=
ARRAY_SIZE
(
root_name
);
name
.
len
-=
sizeof
(
root_name
);
...
...
server/unicode.c
View file @
5721d5f8
...
...
@@ -51,6 +51,21 @@ static inline char to_hex( char ch )
return
tolower
(
ch
)
-
'a'
+
10
;
}
static
inline
WCHAR
to_lower
(
WCHAR
ch
)
{
extern
const
WCHAR
wine_casemap_lower
[];
return
ch
+
wine_casemap_lower
[
wine_casemap_lower
[
ch
>>
8
]
+
(
ch
&
0xff
)];
}
int
memicmp_strW
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
,
data_size_t
len
)
{
int
ret
=
0
;
for
(
len
/=
sizeof
(
WCHAR
);
len
;
str1
++
,
str2
++
,
len
--
)
if
((
ret
=
to_lower
(
*
str1
)
-
to_lower
(
*
str2
)))
break
;
return
ret
;
}
WCHAR
*
ascii_to_unicode_str
(
const
char
*
str
,
struct
unicode_str
*
ret
)
{
data_size_t
i
,
len
=
strlen
(
str
);
...
...
server/unicode.h
View file @
5721d5f8
...
...
@@ -27,6 +27,7 @@
#include "wine/unicode.h"
#include "object.h"
extern
int
memicmp_strW
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
,
data_size_t
len
);
extern
WCHAR
*
ascii_to_unicode_str
(
const
char
*
str
,
struct
unicode_str
*
ret
);
extern
int
parse_strW
(
WCHAR
*
buffer
,
data_size_t
*
len
,
const
char
*
src
,
char
endchar
);
extern
int
dump_strW
(
const
WCHAR
*
str
,
data_size_t
len
,
FILE
*
f
,
const
char
escape
[
2
]
);
...
...
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