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
1c936548
Commit
1c936548
authored
Oct 24, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Oct 24, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start: Try cycling through extensions if original path failed to execute.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
dd7230d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
1 deletion
+49
-1
start.c
programs/start/start.c
+49
-1
No files found.
programs/start/start.c
View file @
1c936548
...
@@ -403,7 +403,55 @@ int wmain (int argc, WCHAR *argv[])
...
@@ -403,7 +403,55 @@ int wmain (int argc, WCHAR *argv[])
}
}
if
(
!
ShellExecuteExW
(
&
sei
))
if
(
!
ShellExecuteExW
(
&
sei
))
fatal_string_error
(
STRING_EXECFAIL
,
GetLastError
(),
sei
.
lpFile
);
{
static
const
WCHAR
pathextW
[]
=
{
'P'
,
'A'
,
'T'
,
'H'
,
'E'
,
'X'
,
'T'
,
0
};
const
WCHAR
*
filename
=
sei
.
lpFile
;
DWORD
size
,
filename_len
;
WCHAR
*
name
,
*
env
;
size
=
GetEnvironmentVariableW
(
pathextW
,
NULL
,
0
);
if
(
size
)
{
WCHAR
*
start
,
*
ptr
;
env
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
WCHAR
));
if
(
!
env
)
fatal_string_error
(
STRING_EXECFAIL
,
ERROR_OUTOFMEMORY
,
sei
.
lpFile
);
GetEnvironmentVariableW
(
pathextW
,
env
,
size
);
filename_len
=
strlenW
(
filename
);
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
filename_len
+
size
)
*
sizeof
(
WCHAR
));
if
(
!
name
)
fatal_string_error
(
STRING_EXECFAIL
,
ERROR_OUTOFMEMORY
,
sei
.
lpFile
);
sei
.
lpFile
=
name
;
start
=
env
;
while
((
ptr
=
strchrW
(
start
,
';'
)))
{
if
(
start
==
ptr
)
{
start
=
ptr
+
1
;
continue
;
}
strcpyW
(
name
,
filename
);
memcpy
(
&
name
[
filename_len
],
start
,
(
ptr
-
start
)
*
sizeof
(
WCHAR
));
name
[
filename_len
+
(
ptr
-
start
)]
=
0
;
if
(
ShellExecuteExW
(
&
sei
))
{
HeapFree
(
GetProcessHeap
(),
0
,
name
);
HeapFree
(
GetProcessHeap
(),
0
,
env
);
goto
done
;
}
start
=
ptr
+
1
;
}
}
fatal_string_error
(
STRING_EXECFAIL
,
GetLastError
(),
filename
);
}
done:
done:
HeapFree
(
GetProcessHeap
(),
0
,
args
);
HeapFree
(
GetProcessHeap
(),
0
,
args
);
...
...
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