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
1a561b64
Commit
1a561b64
authored
Oct 24, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Use the Unicode string length to build the argv array.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
33c3cee8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
process.c
dlls/kernel32/process.c
+10
-7
No files found.
dlls/kernel32/process.c
View file @
1a561b64
...
...
@@ -1483,16 +1483,19 @@ void CDECL __wine_kernel_init(void)
* Build an argv array from a command-line.
* 'reserved' is the number of args to reserve before the first one.
*/
static
char
**
build_argv
(
const
WCHAR
*
cmdlineW
,
int
reserved
)
static
char
**
build_argv
(
const
UNICODE_STRING
*
cmdlineW
,
int
reserved
)
{
int
argc
;
char
**
argv
;
char
*
arg
,
*
s
,
*
d
,
*
cmdline
;
int
in_quotes
,
bcount
,
len
;
len
=
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
cmdlineW
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
!
(
cmdline
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
)))
return
NULL
;
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
cmdlineW
,
-
1
,
cmdline
,
len
,
NULL
,
NULL
);
len
=
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
cmdlineW
->
Buffer
,
cmdlineW
->
Length
/
sizeof
(
WCHAR
),
NULL
,
0
,
NULL
,
NULL
);
if
(
!
(
cmdline
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
+
1
)))
return
NULL
;
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
cmdlineW
->
Buffer
,
cmdlineW
->
Length
/
sizeof
(
WCHAR
),
cmdline
,
len
,
NULL
,
NULL
);
cmdline
[
len
++
]
=
0
;
argc
=
reserved
+
1
;
bcount
=
0
;
...
...
@@ -1689,7 +1692,7 @@ static int fork_and_exec( const RTL_USER_PROCESS_PARAMETERS *params, const char
wine_server_handle_to_fd
(
params
->
hStdOutput
,
FILE_WRITE_DATA
,
&
stdout_fd
,
NULL
);
wine_server_handle_to_fd
(
params
->
hStdError
,
FILE_WRITE_DATA
,
&
stderr_fd
,
NULL
);
argv
=
build_argv
(
params
->
CommandLine
.
Buffer
,
0
);
argv
=
build_argv
(
&
params
->
CommandLine
,
0
);
envp
=
build_envp
(
params
->
Environment
);
if
(
!
(
pid
=
fork
()))
/* child */
...
...
@@ -2045,7 +2048,7 @@ static pid_t spawn_loader( const RTL_USER_PROCESS_PARAMETERS *params, int socket
const
char
*
loader
=
NULL
;
char
**
argv
;
argv
=
build_argv
(
params
->
CommandLine
.
Buffer
,
1
);
argv
=
build_argv
(
&
params
->
CommandLine
,
1
);
if
(
!
is_win64
^
!
is_64bit_arch
(
pe_info
->
cpu
))
loader
=
get_alternate_loader
(
&
wineloader
);
...
...
@@ -2132,7 +2135,7 @@ static NTSTATUS exec_loader( const RTL_USER_PROCESS_PARAMETERS *params, int sock
ULONGLONG
res_start
=
pe_info
->
base
;
ULONGLONG
res_end
=
pe_info
->
base
+
pe_info
->
map_size
;
if
(
!
(
argv
=
build_argv
(
params
->
CommandLine
.
Buffer
,
1
)))
return
STATUS_NO_MEMORY
;
if
(
!
(
argv
=
build_argv
(
&
params
->
CommandLine
,
1
)))
return
STATUS_NO_MEMORY
;
if
(
!
is_win64
^
!
is_64bit_arch
(
pe_info
->
cpu
))
loader
=
get_alternate_loader
(
&
wineloader
);
...
...
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