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
7c777af4
Commit
7c777af4
authored
Dec 06, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add a helper to build a path and exec it.
parent
26f11bdf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
loader.c
dlls/ntdll/unix/loader.c
+21
-21
No files found.
dlls/ntdll/unix/loader.c
View file @
7c777af4
...
...
@@ -297,14 +297,26 @@ static char *build_path( const char *dir, const char *name )
size_t
len
=
strlen
(
dir
);
char
*
ret
=
malloc
(
len
+
strlen
(
name
)
+
2
);
memcpy
(
ret
,
dir
,
len
);
if
(
len
&&
ret
[
len
-
1
]
!=
'/'
)
ret
[
len
++
]
=
'/'
;
if
(
name
[
0
]
==
'/'
)
name
++
;
if
(
len
)
{
memcpy
(
ret
,
dir
,
len
);
if
(
ret
[
len
-
1
]
!=
'/'
)
ret
[
len
++
]
=
'/'
;
if
(
name
[
0
]
==
'/'
)
name
++
;
}
strcpy
(
ret
+
len
,
name
);
return
ret
;
}
/* build a path to a binary and exec it */
static
void
build_path_and_exec
(
const
char
*
dir
,
const
char
*
name
,
char
**
argv
)
{
argv
[
0
]
=
build_path
(
dir
,
name
);
execv
(
argv
[
0
],
argv
);
free
(
argv
[
0
]
);
}
static
const
char
*
get_pe_dir
(
WORD
machine
)
{
if
(
!
machine
)
machine
=
current_machine
;
...
...
@@ -564,34 +576,22 @@ static void exec_wineserver( char **argv )
if
(
!
is_win64
)
/* look for 64-bit server */
{
char
*
loader
=
realpath_dirname
(
build_path
(
build_dir
,
"loader/wine64"
));
if
(
loader
)
{
argv
[
0
]
=
build_path
(
loader
,
"../server/wineserver"
);
execv
(
argv
[
0
],
argv
);
}
if
(
loader
)
build_path_and_exec
(
loader
,
"../server/wineserver"
,
argv
);
}
argv
[
0
]
=
build_path
(
build_dir
,
"server/wineserver"
);
execv
(
argv
[
0
],
argv
);
build_path_and_exec
(
build_dir
,
"server/wineserver"
,
argv
);
return
;
}
argv
[
0
]
=
build_path
(
bin_dir
,
"wineserver"
);
execv
(
argv
[
0
],
argv
);
build_path_and_exec
(
bin_dir
,
"wineserver"
,
argv
);
argv
[
0
]
=
getenv
(
"WINESERVER"
);
if
(
argv
[
0
])
execv
(
argv
[
0
],
argv
);
if
((
path
=
getenv
(
"WINESERVER"
)))
build_path_and_exec
(
""
,
path
,
argv
);
if
((
path
=
getenv
(
"PATH"
)))
{
for
(
path
=
strtok
(
strdup
(
path
),
":"
);
path
;
path
=
strtok
(
NULL
,
":"
))
{
argv
[
0
]
=
build_path
(
path
,
"wineserver"
);
execvp
(
argv
[
0
],
argv
);
}
build_path_and_exec
(
path
,
"wineserver"
,
argv
);
}
argv
[
0
]
=
build_path
(
BINDIR
,
"wineserver"
);
execv
(
argv
[
0
],
argv
);
build_path_and_exec
(
BINDIR
,
"wineserver"
,
argv
);
}
...
...
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