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
daeccba7
Commit
daeccba7
authored
Nov 11, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved the exec_wine_binary function to the wine library, and use it to
exec the wineserver too.
parent
dfe1df64
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
73 additions
and
81 deletions
+73
-81
Makefile.in
dlls/kernel/Makefile.in
+1
-1
process.c
dlls/kernel/process.c
+8
-50
Makefile.in
dlls/ntdll/Makefile.in
+1
-1
server.c
dlls/ntdll/server.c
+6
-18
library.h
include/wine/library.h
+2
-1
Makefile.in
libs/wine/Makefile.in
+1
-1
config.c
libs/wine/config.c
+51
-5
loader.c
libs/wine/loader.c
+1
-3
wine.def
libs/wine/wine.def
+2
-1
No files found.
dlls/kernel/Makefile.in
View file @
daeccba7
EXTRADEFS
=
-D_KERNEL32_
-D
BINDIR
=
"
\"
$(bindir)
\"
"
-D
ETCDIR
=
"
\"
$(sysconfdir)
\"
"
EXTRADEFS
=
-D_KERNEL32_
-DETCDIR
=
"
\"
$(sysconfdir)
\"
"
TOPSRCDIR
=
@top_srcdir@
TOPOBJDIR
=
../..
SRCDIR
=
@srcdir@
...
...
dlls/kernel/process.c
View file @
daeccba7
...
...
@@ -1065,54 +1065,6 @@ static char **build_envp( const WCHAR *envW, const WCHAR *extra_envW )
/***********************************************************************
* exec_wine_binary
*
* Locate the Wine binary to exec for a new Win32 process.
*/
static
void
exec_wine_binary
(
char
**
argv
,
char
**
envp
)
{
const
char
*
path
,
*
pos
,
*
ptr
;
/* first, try for a WINELOADER environment variable */
argv
[
0
]
=
getenv
(
"WINELOADER"
);
if
(
argv
[
0
])
execve
(
argv
[
0
],
argv
,
envp
);
/* next, try bin directory */
argv
[
0
]
=
BINDIR
"/wine"
;
execve
(
argv
[
0
],
argv
,
envp
);
/* now try the path of argv0 of the current binary */
if
((
path
=
wine_get_argv0_path
()))
{
if
(
!
(
argv
[
0
]
=
malloc
(
strlen
(
path
)
+
sizeof
(
"wine"
)
)))
return
;
strcpy
(
argv
[
0
],
path
);
strcat
(
argv
[
0
],
"wine"
);
execve
(
argv
[
0
],
argv
,
envp
);
free
(
argv
[
0
]
);
}
/* now search in the Unix path */
if
((
path
=
getenv
(
"PATH"
)))
{
if
(
!
(
argv
[
0
]
=
malloc
(
strlen
(
path
)
+
6
)))
return
;
pos
=
path
;
for
(;;)
{
while
(
*
pos
==
':'
)
pos
++
;
if
(
!*
pos
)
break
;
if
(
!
(
ptr
=
strchr
(
pos
,
':'
)))
ptr
=
pos
+
strlen
(
pos
);
memcpy
(
argv
[
0
],
pos
,
ptr
-
pos
);
strcpy
(
argv
[
0
]
+
(
ptr
-
pos
),
"/wine"
);
execve
(
argv
[
0
],
argv
,
envp
);
pos
=
ptr
;
}
}
free
(
argv
[
0
]
);
}
/***********************************************************************
* fork_and_exec
*
* Fork and exec a new Unix binary, checking for errors.
...
...
@@ -1280,8 +1232,14 @@ static BOOL create_process( HANDLE hFile, LPCWSTR filename, LPWSTR cmd_line, LPW
if
(
unixdir
)
chdir
(
unixdir
);
if
(
argv
&&
envp
)
exec_wine_binary
(
argv
,
envp
);
if
(
argv
&&
envp
)
{
/* first, try for a WINELOADER environment variable */
argv
[
0
]
=
getenv
(
"WINELOADER"
);
if
(
argv
[
0
])
execve
(
argv
[
0
],
argv
,
envp
);
/* now use the standard search strategy */
wine_exec_wine_binary
(
NULL
,
argv
,
envp
);
}
err
=
errno
;
write
(
execfd
[
1
],
&
err
,
sizeof
(
err
)
);
_exit
(
1
);
...
...
dlls/ntdll/Makefile.in
View file @
daeccba7
EXTRADEFS
=
-D_NTSYSTEM_
-DBINDIR
=
"
\"
$(bindir)
\"
"
EXTRADEFS
=
-D_NTSYSTEM_
TOPSRCDIR
=
@top_srcdir@
TOPOBJDIR
=
../..
SRCDIR
=
@srcdir@
...
...
dlls/ntdll/server.c
View file @
daeccba7
...
...
@@ -466,7 +466,8 @@ static void start_server( const char *oldcwd )
{
static
int
started
;
/* we only try once */
char
*
path
,
*
p
;
const
char
*
argv0_path
;
char
*
argv
[
2
];
if
(
!
started
)
{
int
status
;
...
...
@@ -488,23 +489,10 @@ static void start_server( const char *oldcwd )
fatal_perror
(
"could not exec the server '%s'
\n
"
" specified in the WINESERVER environment variable"
,
p
);
}
/* first try the installation dir */
execl
(
BINDIR
"/wineserver"
,
"wineserver"
,
NULL
);
/* now try the dir we were launched from */
if
((
argv0_path
=
wine_get_argv0_path
()))
{
if
(
!
(
path
=
malloc
(
strlen
(
argv0_path
)
+
sizeof
(
"wineserver"
)
)))
fatal_error
(
"out of memory
\n
"
);
strcpy
(
path
,
argv0_path
);
strcat
(
path
,
"wineserver"
);
execl
(
path
,
path
,
NULL
);
free
(
path
);
}
/* finally try the path */
execlp
(
"wineserver"
,
"wineserver"
,
NULL
);
/* now use the standard search strategy */
argv
[
0
]
=
"wineserver"
;
argv
[
1
]
=
NULL
;
wine_exec_wine_binary
(
"wineserver"
,
argv
,
NULL
);
fatal_error
(
"could not exec wineserver
\n
"
);
}
waitpid
(
pid
,
&
status
,
0
);
...
...
include/wine/library.h
View file @
daeccba7
...
...
@@ -32,7 +32,8 @@
extern
const
char
*
wine_get_config_dir
(
void
);
extern
const
char
*
wine_get_server_dir
(
void
);
extern
const
char
*
wine_get_user_name
(
void
);
extern
const
char
*
wine_get_argv0_path
(
void
);
extern
void
wine_init_argv0_path
(
const
char
*
argv0
);
extern
void
wine_exec_wine_binary
(
const
char
*
name
,
char
**
argv
,
char
**
envp
);
/* dll loading */
...
...
libs/wine/Makefile.in
View file @
daeccba7
...
...
@@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH
=
@srcdir@
LIBRARY
=
wine
SOVERSION
=
1
EXTRADEFS
=
-D__WINESRC__
-DDLLDIR
=
"
\"
$(dlldir)
\"
"
EXTRADEFS
=
-D__WINESRC__
-D
BINDIR
=
"
\"
$(bindir)
\"
"
-D
DLLDIR
=
"
\"
$(dlldir)
\"
"
EXTRALIBS
=
$(LIBPORT)
@DLLIBS@ @CRTLIBS@
C_SRCS
=
\
...
...
libs/wine/config.c
View file @
daeccba7
...
...
@@ -42,6 +42,7 @@ static char *config_dir;
static
char
*
server_dir
;
static
char
*
user_name
;
static
char
*
argv0_path
;
static
char
*
argv0_name
;
#ifdef __GNUC__
static
void
fatal_error
(
const
char
*
err
,
...
)
__attribute__
((
noreturn
,
format
(
printf
,
1
,
2
)));
...
...
@@ -181,14 +182,18 @@ static void init_paths(void)
}
/* initialize the argv0 path */
void
init_argv0_path
(
const
char
*
argv0
)
void
wine_
init_argv0_path
(
const
char
*
argv0
)
{
size_t
size
,
len
;
const
char
*
p
;
char
*
cwd
;
if
(
!
(
p
=
strrchr
(
argv0
,
'/'
)))
return
;
/* if argv0 doesn't contain a path, don't do anything */
{
argv0_name
=
xstrdup
(
argv0
);
return
;
/* if argv0 doesn't contain a path, don't store any path */
}
else
argv0_name
=
xstrdup
(
p
+
1
);
len
=
p
-
argv0
+
1
;
if
(
argv0
[
0
]
==
'/'
)
/* absolute path */
...
...
@@ -238,8 +243,49 @@ const char *wine_get_user_name(void)
return
user_name
;
}
/* return the path of argv[0], including a trailing slash */
const
char
*
wine_get_argv0_path
(
void
)
/* exec a wine internal binary (either the wine loader or the wine server) */
/* if name is null, default to the name of the current binary */
void
wine_exec_wine_binary
(
const
char
*
name
,
char
**
argv
,
char
**
envp
)
{
return
argv0_path
;
const
char
*
path
,
*
pos
,
*
ptr
;
extern
char
**
environ
;
if
(
!
envp
)
envp
=
environ
;
if
(
!
name
)
name
=
argv0_name
;
/* first, try bin directory */
argv
[
0
]
=
xmalloc
(
sizeof
(
BINDIR
"/"
)
+
strlen
(
name
)
);
strcpy
(
argv
[
0
],
BINDIR
"/"
);
strcat
(
argv
[
0
],
name
);
execve
(
argv
[
0
],
argv
,
envp
);
free
(
argv
[
0
]
);
/* now try the path of argv0 of the current binary */
if
(
argv0_path
)
{
argv
[
0
]
=
xmalloc
(
strlen
(
argv0_path
)
+
strlen
(
name
)
+
1
);
strcpy
(
argv
[
0
],
argv0_path
);
strcat
(
argv
[
0
],
name
);
execve
(
argv
[
0
],
argv
,
envp
);
free
(
argv
[
0
]
);
}
/* now search in the Unix path */
if
((
path
=
getenv
(
"PATH"
)))
{
argv
[
0
]
=
xmalloc
(
strlen
(
path
)
+
strlen
(
name
)
+
2
);
pos
=
path
;
for
(;;)
{
while
(
*
pos
==
':'
)
pos
++
;
if
(
!*
pos
)
break
;
if
(
!
(
ptr
=
strchr
(
pos
,
':'
)))
ptr
=
pos
+
strlen
(
pos
);
memcpy
(
argv
[
0
],
pos
,
ptr
-
pos
);
strcpy
(
argv
[
0
]
+
(
ptr
-
pos
),
"/"
);
strcat
(
argv
[
0
]
+
(
ptr
-
pos
),
name
);
execve
(
argv
[
0
],
argv
,
envp
);
pos
=
ptr
;
}
free
(
argv
[
0
]
);
}
}
libs/wine/loader.c
View file @
daeccba7
...
...
@@ -47,8 +47,6 @@ char **__wine_main_argv = NULL;
WCHAR
**
__wine_main_wargv
=
NULL
;
char
**
__wine_main_environ
=
NULL
;
extern
void
init_argv0_path
(
const
char
*
argv0
);
/* config.c */
#define MAX_DLLS 100
static
struct
...
...
@@ -426,7 +424,7 @@ void wine_init( int argc, char *argv[], char *error, int error_size )
void
(
*
init_func
)(
void
);
build_dll_path
();
init_argv0_path
(
argv
[
0
]
);
wine_
init_argv0_path
(
argv
[
0
]
);
__wine_main_argc
=
argc
;
__wine_main_argv
=
argv
;
__wine_main_environ
=
environ
;
...
...
libs/wine/wine.def
View file @
daeccba7
...
...
@@ -30,7 +30,7 @@ EXPORTS
wine_dll_unload
wine_dlopen
wine_dlsym
wine_
get_argv0_path
wine_
exec_wine_binary
wine_get_config_dir
wine_get_cs
wine_get_ds
...
...
@@ -41,6 +41,7 @@ EXPORTS
wine_get_ss
wine_get_user_name
wine_init
wine_init_argv0_path
wine_ldt_alloc_entries
wine_ldt_alloc_fs
wine_ldt_copy
...
...
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