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
faaea5cd
Commit
faaea5cd
authored
Mar 24, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Add a helper function for creating a Unicode string.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7b41b751
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
25 deletions
+22
-25
directory.c
server/directory.c
+5
-5
registry.c
server/registry.c
+5
-14
unicode.c
server/unicode.c
+11
-0
unicode.h
server/unicode.h
+1
-6
No files found.
server/directory.c
View file @
faaea5cd
...
...
@@ -270,12 +270,12 @@ static void create_session( unsigned int id )
static
const
struct
unicode_str
link_local_str
=
{
link_localW
,
sizeof
(
link_localW
)};
static
const
struct
unicode_str
link_session_str
=
{
link_sessionW
,
sizeof
(
link_sessionW
)};
static
const
WCHAR
fmt_u
[]
=
{
'%'
,
'u'
,
0
};
static
struct
directory
*
dir_bno_global
,
*
dir_sessions
,
*
dir_bnolinks
;
struct
directory
*
dir_id
,
*
dir_bno
,
*
dir_dosdevices
,
*
dir_windows
,
*
dir_winstation
;
struct
object
*
link_global
,
*
link_local
,
*
link_session
,
*
link_bno
,
*
link_windows
;
struct
unicode_str
id_str
;
WCHAR
id_strW
[
10
];
char
id_strA
[
10
];
WCHAR
*
id_strW
;
if
(
!
id
)
{
...
...
@@ -287,9 +287,8 @@ static void create_session( unsigned int id )
make_object_static
(
(
struct
object
*
)
dir_sessions
);
}
sprintfW
(
id_strW
,
fmt_u
,
id
);
id_str
.
str
=
id_strW
;
id_str
.
len
=
strlenW
(
id_strW
)
*
sizeof
(
WCHAR
);
sprintf
(
id_strA
,
"%u"
,
id
);
id_strW
=
ascii_to_unicode_str
(
id_strA
,
&
id_str
);
dir_id
=
create_directory
(
&
dir_sessions
->
obj
,
&
id_str
,
0
,
HASH_SIZE
,
NULL
);
dir_dosdevices
=
create_directory
(
&
dir_id
->
obj
,
&
dir_dosdevices_str
,
0
,
HASH_SIZE
,
NULL
);
...
...
@@ -325,6 +324,7 @@ static void create_session( unsigned int id )
release_object
(
dir_windows
);
release_object
(
dir_bno
);
release_object
(
dir_id
);
free
(
id_strW
);
}
void
init_directories
(
void
)
...
...
server/registry.c
View file @
faaea5cd
...
...
@@ -1740,25 +1740,16 @@ static int load_init_registry_from_file( const char *filename, struct key *key )
static
WCHAR
*
format_user_registry_path
(
const
SID
*
sid
,
struct
unicode_str
*
path
)
{
static
const
WCHAR
prefixW
[]
=
{
'U'
,
's'
,
'e'
,
'r'
,
'\\'
,
'S'
,
0
};
static
const
WCHAR
formatW
[]
=
{
'-'
,
'%'
,
'u'
,
0
};
WCHAR
buffer
[
7
+
10
+
10
+
10
*
SID_MAX_SUB_AUTHORITIES
];
WCHAR
*
p
=
buffer
;
char
buffer
[
7
+
11
+
11
+
11
*
SID_MAX_SUB_AUTHORITIES
],
*
p
=
buffer
;
unsigned
int
i
;
strcpyW
(
p
,
prefixW
);
p
+=
strlenW
(
prefixW
);
p
+=
sprintfW
(
p
,
formatW
,
sid
->
Revision
);
p
+=
sprintfW
(
p
,
formatW
,
MAKELONG
(
MAKEWORD
(
sid
->
IdentifierAuthority
.
Value
[
5
],
p
+=
sprintf
(
p
,
"User
\\
S-%u-%u"
,
sid
->
Revision
,
MAKELONG
(
MAKEWORD
(
sid
->
IdentifierAuthority
.
Value
[
5
],
sid
->
IdentifierAuthority
.
Value
[
4
]
),
MAKEWORD
(
sid
->
IdentifierAuthority
.
Value
[
3
],
sid
->
IdentifierAuthority
.
Value
[
2
]
)));
for
(
i
=
0
;
i
<
sid
->
SubAuthorityCount
;
i
++
)
p
+=
sprintfW
(
p
,
formatW
,
sid
->
SubAuthority
[
i
]
);
path
->
len
=
(
p
-
buffer
)
*
sizeof
(
WCHAR
);
path
->
str
=
p
=
memdup
(
buffer
,
path
->
len
);
return
p
;
for
(
i
=
0
;
i
<
sid
->
SubAuthorityCount
;
i
++
)
p
+=
sprintf
(
p
,
"-%u"
,
sid
->
SubAuthority
[
i
]
);
return
ascii_to_unicode_str
(
buffer
,
path
);
}
/* get the cpu architectures that can be supported in the current prefix */
...
...
server/unicode.c
View file @
faaea5cd
...
...
@@ -51,6 +51,17 @@ static inline char to_hex( char ch )
return
tolower
(
ch
)
-
'a'
+
10
;
}
WCHAR
*
ascii_to_unicode_str
(
const
char
*
str
,
struct
unicode_str
*
ret
)
{
data_size_t
i
,
len
=
strlen
(
str
);
WCHAR
*
p
;
ret
->
len
=
len
*
sizeof
(
WCHAR
);
ret
->
str
=
p
=
mem_alloc
(
ret
->
len
);
if
(
p
)
for
(
i
=
0
;
i
<
len
;
i
++
)
p
[
i
]
=
(
unsigned
char
)
str
[
i
];
return
p
;
}
/* parse an escaped string back into Unicode */
/* return the number of chars read from the input, or -1 on output overflow */
int
parse_strW
(
WCHAR
*
buffer
,
data_size_t
*
len
,
const
char
*
src
,
char
endchar
)
...
...
server/unicode.h
View file @
faaea5cd
...
...
@@ -27,12 +27,7 @@
#include "wine/unicode.h"
#include "object.h"
static
inline
WCHAR
*
strdupW
(
const
WCHAR
*
str
)
{
size_t
len
=
(
strlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
return
memdup
(
str
,
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