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
7b41b751
Commit
7b41b751
authored
Mar 24, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Add a helper function for splitting a path into individual elements.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2a5160c4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
17 deletions
+24
-17
directory.c
server/directory.c
+12
-14
object.c
server/object.c
+9
-0
object.h
server/object.h
+1
-0
winstation.c
server/winstation.c
+2
-3
No files found.
server/directory.c
View file @
7b41b751
...
...
@@ -142,30 +142,28 @@ static struct object *directory_lookup_name( struct object *obj, struct unicode_
struct
directory
*
dir
=
(
struct
directory
*
)
obj
;
struct
object
*
found
;
struct
unicode_str
tmp
;
const
WCHAR
*
p
;
assert
(
obj
->
ops
==
&
directory_ops
);
if
(
!
name
)
return
NULL
;
/* open the directory itself */
if
(
!
(
p
=
memchrW
(
name
->
str
,
'\\'
,
name
->
len
/
sizeof
(
WCHAR
)
)))
/* Last element in the path name */
tmp
.
len
=
name
->
len
;
else
tmp
.
len
=
(
p
-
name
->
str
)
*
sizeof
(
WCHAR
);
tmp
.
str
=
name
->
str
;
tmp
.
len
=
get_path_element
(
name
->
str
,
name
->
len
);
if
((
found
=
find_object
(
dir
->
entries
,
&
tmp
,
attr
)))
{
/* Skip trailing \\ */
if
(
p
)
/* Skip trailing \\
and move to the next element
*/
if
(
tmp
.
len
<
name
->
len
)
{
p
++
;
tmp
.
len
+=
sizeof
(
WCHAR
);
name
->
str
+=
tmp
.
len
/
sizeof
(
WCHAR
);
name
->
len
-=
tmp
.
len
;
}
else
{
name
->
str
=
NULL
;
name
->
len
=
0
;
}
/* Move to the next element*/
name
->
str
=
p
;
name
->
len
-=
tmp
.
len
;
return
found
;
}
...
...
@@ -173,7 +171,7 @@ static struct object *directory_lookup_name( struct object *obj, struct unicode_
{
if
(
tmp
.
len
==
0
)
/* Double backslash */
set_error
(
STATUS_OBJECT_NAME_INVALID
);
else
if
(
p
)
/* Path still has backslashes */
else
if
(
tmp
.
len
<
name
->
len
)
/* Path still has backslashes */
set_error
(
STATUS_OBJECT_PATH_NOT_FOUND
);
}
return
NULL
;
...
...
server/object.c
View file @
7b41b751
...
...
@@ -276,6 +276,15 @@ struct object *lookup_named_object( struct object *root, const struct unicode_st
return
parent
;
}
/* return length of first path element in name */
data_size_t
get_path_element
(
const
WCHAR
*
name
,
data_size_t
len
)
{
data_size_t
i
;
for
(
i
=
0
;
i
<
len
/
sizeof
(
WCHAR
);
i
++
)
if
(
name
[
i
]
==
'\\'
)
break
;
return
i
*
sizeof
(
WCHAR
);
}
static
struct
object
*
create_object
(
struct
object
*
parent
,
const
struct
object_ops
*
ops
,
const
struct
unicode_str
*
name
,
const
struct
security_descriptor
*
sd
)
{
...
...
server/object.h
View file @
7b41b751
...
...
@@ -135,6 +135,7 @@ extern WCHAR *get_object_full_name( struct object *obj, data_size_t *ret_len );
extern
void
dump_object_name
(
struct
object
*
obj
);
extern
struct
object
*
lookup_named_object
(
struct
object
*
root
,
const
struct
unicode_str
*
name
,
unsigned
int
attr
,
struct
unicode_str
*
name_left
);
extern
data_size_t
get_path_element
(
const
WCHAR
*
name
,
data_size_t
len
);
extern
void
*
create_named_object
(
struct
object
*
parent
,
const
struct
object_ops
*
ops
,
const
struct
unicode_str
*
name
,
unsigned
int
attributes
,
const
struct
security_descriptor
*
sd
);
...
...
server/winstation.c
View file @
7b41b751
...
...
@@ -38,7 +38,6 @@
#include "user.h"
#include "file.h"
#include "security.h"
#include "wine/unicode.h"
static
struct
list
winstation_list
=
LIST_INIT
(
winstation_list
);
...
...
@@ -163,7 +162,7 @@ static struct object *winstation_lookup_name( struct object *obj, struct unicode
if
(
!
name
)
return
NULL
;
/* open the winstation itself */
if
(
memchrW
(
name
->
str
,
'\\'
,
name
->
len
/
sizeof
(
WCHAR
)
)
)
/* no backslash allowed in name */
if
(
get_path_element
(
name
->
str
,
name
->
len
)
<
name
->
len
)
/* no backslash allowed in name */
{
set_error
(
STATUS_OBJECT_PATH_SYNTAX_BAD
);
return
NULL
;
...
...
@@ -262,7 +261,7 @@ static int desktop_link_name( struct object *obj, struct object_name *name, stru
set_error
(
STATUS_OBJECT_TYPE_MISMATCH
);
return
0
;
}
if
(
memchrW
(
name
->
name
,
'\\'
,
name
->
len
/
sizeof
(
WCHAR
)
)
)
/* no backslash allowed in name */
if
(
get_path_element
(
name
->
name
,
name
->
len
)
<
name
->
len
)
/* no backslash allowed in name */
{
set_error
(
STATUS_OBJECT_PATH_SYNTAX_BAD
);
return
0
;
...
...
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