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
a3e0cfc5
Commit
a3e0cfc5
authored
Jul 16, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get full path of argv[0] before we change directories.
Make sure process names are long path names. Cleaned up initialisation a bit.
parent
56adb25f
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
40 additions
and
25 deletions
+40
-25
main.h
include/main.h
+1
-1
options.h
include/options.h
+1
-0
process.h
include/process.h
+0
-1
module.c
loader/dos/module.c
+1
-1
main.c
loader/main.c
+1
-9
options.c
misc/options.c
+2
-1
client.c
scheduler/client.c
+14
-0
process.c
scheduler/process.c
+20
-12
No files found.
include/main.h
View file @
a3e0cfc5
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
#include "windef.h"
#include "windef.h"
extern
BOOL
MAIN_MainInit
(
char
*
argv
[]
);
extern
BOOL
MAIN_MainInit
(
void
);
extern
void
MAIN_WineInit
(
void
);
extern
void
MAIN_WineInit
(
void
);
extern
int
MAIN_GetLanguageID
(
char
*
lang
,
char
*
country
,
char
*
charset
,
char
*
dialect
);
extern
int
MAIN_GetLanguageID
(
char
*
lang
,
char
*
country
,
char
*
charset
,
char
*
dialect
);
extern
void
MAIN_ParseDebugOptions
(
const
char
*
options
);
extern
void
MAIN_ParseDebugOptions
(
const
char
*
options
);
...
...
include/options.h
View file @
a3e0cfc5
...
@@ -21,6 +21,7 @@ struct options
...
@@ -21,6 +21,7 @@ struct options
extern
struct
options
Options
;
extern
struct
options
Options
;
extern
const
char
*
argv0
;
extern
const
char
*
argv0
;
extern
const
char
*
full_argv0
;
extern
void
OPTIONS_Usage
(
void
)
WINE_NORETURN
;
extern
void
OPTIONS_Usage
(
void
)
WINE_NORETURN
;
extern
void
OPTIONS_ParseOptions
(
char
*
argv
[]
);
extern
void
OPTIONS_ParseOptions
(
char
*
argv
[]
);
...
...
include/process.h
View file @
a3e0cfc5
...
@@ -147,7 +147,6 @@ extern DWORD WINAPI MapProcessHandle( HANDLE handle );
...
@@ -147,7 +147,6 @@ extern DWORD WINAPI MapProcessHandle( HANDLE handle );
extern
BOOL
ENV_BuildEnvironment
(
void
);
extern
BOOL
ENV_BuildEnvironment
(
void
);
/* scheduler/process.c */
/* scheduler/process.c */
extern
BOOL
PROCESS_Init
(
void
);
extern
void
PROCESS_InitWine
(
int
argc
,
char
*
argv
[]
)
WINE_NORETURN
;
extern
void
PROCESS_InitWine
(
int
argc
,
char
*
argv
[]
)
WINE_NORETURN
;
extern
void
PROCESS_InitWinelib
(
int
argc
,
char
*
argv
[]
)
WINE_NORETURN
;
extern
void
PROCESS_InitWinelib
(
int
argc
,
char
*
argv
[]
)
WINE_NORETURN
;
extern
PDB
*
PROCESS_IdToPDB
(
DWORD
id
);
extern
PDB
*
PROCESS_IdToPDB
(
DWORD
id
);
...
...
loader/dos/module.c
View file @
a3e0cfc5
...
@@ -432,7 +432,7 @@ BOOL MZ_InitTask( LPDOSTASK lpDosTask )
...
@@ -432,7 +432,7 @@ BOOL MZ_InitTask( LPDOSTASK lpDosTask )
/* now load dosmod */
/* now load dosmod */
/* check argv[0]-derived paths first, since the newest dosmod is most likely there
/* check argv[0]-derived paths first, since the newest dosmod is most likely there
* (at least it was once for Andreas Mohr, so I decided to make it easier for him) */
* (at least it was once for Andreas Mohr, so I decided to make it easier for him) */
fpath
=
strrchr
(
strcpy
(
path
,
argv0
),
'/'
);
fpath
=
strrchr
(
strcpy
(
path
,
full_
argv0
),
'/'
);
if
(
fpath
)
{
if
(
fpath
)
{
strcpy
(
fpath
,
"/dosmod"
);
strcpy
(
fpath
,
"/dosmod"
);
execl
(
path
,
fname
,
farg
,
NULL
);
execl
(
path
,
fname
,
farg
,
NULL
);
...
...
loader/main.c
View file @
a3e0cfc5
...
@@ -27,16 +27,8 @@ DEFAULT_DEBUG_CHANNEL(server);
...
@@ -27,16 +27,8 @@ DEFAULT_DEBUG_CHANNEL(server);
/***********************************************************************
/***********************************************************************
* Main initialisation routine
* Main initialisation routine
*/
*/
BOOL
MAIN_MainInit
(
char
*
argv
[]
)
BOOL
MAIN_MainInit
(
void
)
{
{
/* store the program name */
argv0
=
argv
[
0
];
/* Create the initial process */
if
(
!
PROCESS_Init
())
return
FALSE
;
/* Parse command line arguments */
OPTIONS_ParseOptions
(
argv
);
MAIN_WineInit
();
MAIN_WineInit
();
/* Load the configuration file */
/* Load the configuration file */
...
...
misc/options.c
View file @
a3e0cfc5
...
@@ -40,7 +40,8 @@ struct options Options =
...
@@ -40,7 +40,8 @@ struct options Options =
NULL
/* Alternate config file name */
NULL
/* Alternate config file name */
};
};
const
char
*
argv0
;
const
char
*
argv0
;
/* the original argv[0] */
const
char
*
full_argv0
;
/* the full path of argv[0] (if known) */
static
char
*
inherit_str
;
/* options to pass to child processes */
static
char
*
inherit_str
;
/* options to pass to child processes */
...
...
scheduler/client.c
View file @
a3e0cfc5
...
@@ -459,6 +459,20 @@ int CLIENT_InitServer(void)
...
@@ -459,6 +459,20 @@ int CLIENT_InitServer(void)
break
;
break
;
}
}
/* if argv[0] is a relative path, make it absolute */
full_argv0
=
argv0
;
if
(
oldcwd
&&
argv0
[
0
]
!=
'/'
&&
strchr
(
argv0
,
'/'
))
{
char
*
new_argv0
=
malloc
(
strlen
(
oldcwd
)
+
strlen
(
argv0
)
+
2
);
if
(
new_argv0
)
{
strcpy
(
new_argv0
,
oldcwd
);
strcat
(
new_argv0
,
"/"
);
strcat
(
new_argv0
,
argv0
);
full_argv0
=
new_argv0
;
}
}
/* get the server directory name */
/* get the server directory name */
if
(
gethostname
(
hostname
,
sizeof
(
hostname
)
)
==
-
1
)
fatal_perror
(
"gethostname"
);
if
(
gethostname
(
hostname
,
sizeof
(
hostname
)
)
==
-
1
)
fatal_perror
(
"gethostname"
);
configdir
=
get_config_dir
();
configdir
=
get_config_dir
();
...
...
scheduler/process.c
View file @
a3e0cfc5
...
@@ -171,13 +171,18 @@ void PROCESS_CallUserSignalProc( UINT uCode, HMODULE hModule )
...
@@ -171,13 +171,18 @@ void PROCESS_CallUserSignalProc( UINT uCode, HMODULE hModule )
/***********************************************************************
/***********************************************************************
* PROCESS_Init
* process_init
*
* Main process initialisation code
*/
*/
BOOL
PROCESS_Init
(
void
)
static
BOOL
process_init
(
char
*
argv
[]
)
{
{
struct
init_process_request
*
req
;
struct
init_process_request
*
req
;
PDB
*
pdb
=
PROCESS_Current
();
PDB
*
pdb
=
PROCESS_Current
();
/* store the program name */
argv0
=
argv
[
0
];
/* Fill the initial process structure */
/* Fill the initial process structure */
pdb
->
exit_code
=
STILL_ACTIVE
;
pdb
->
exit_code
=
STILL_ACTIVE
;
pdb
->
threads
=
1
;
pdb
->
threads
=
1
;
...
@@ -227,7 +232,10 @@ BOOL PROCESS_Init(void)
...
@@ -227,7 +232,10 @@ BOOL PROCESS_Init(void)
/* Initialize syslevel handling */
/* Initialize syslevel handling */
SYSLEVEL_Init
();
SYSLEVEL_Init
();
return
TRUE
;
/* Parse command line arguments */
OPTIONS_ParseOptions
(
argv
);
return
MAIN_MainInit
();
}
}
...
@@ -396,8 +404,8 @@ static void PROCESS_Start( HMODULE main_module, LPSTR filename )
...
@@ -396,8 +404,8 @@ static void PROCESS_Start( HMODULE main_module, LPSTR filename )
{
{
/* if no explicit filename, use argv[0] */
/* if no explicit filename, use argv[0] */
if
(
!
(
filename
=
malloc
(
MAX_PATH
)))
ExitProcess
(
1
);
if
(
!
(
filename
=
malloc
(
MAX_PATH
)))
ExitProcess
(
1
);
if
(
!
Get
FullPathNameA
(
argv0
,
MAX_PATH
,
filename
,
NULL
))
if
(
!
Get
LongPathNameA
(
full_argv0
,
filename
,
MAX_PATH
))
lstrcpynA
(
filename
,
argv0
,
MAX_PATH
);
lstrcpynA
(
filename
,
full_
argv0
,
MAX_PATH
);
}
}
/* load main module */
/* load main module */
...
@@ -432,7 +440,7 @@ void PROCESS_InitWine( int argc, char *argv[] )
...
@@ -432,7 +440,7 @@ void PROCESS_InitWine( int argc, char *argv[] )
DWORD
type
;
DWORD
type
;
/* Initialize everything */
/* Initialize everything */
if
(
!
MAIN_MainI
nit
(
argv
))
exit
(
1
);
if
(
!
process_i
nit
(
argv
))
exit
(
1
);
main_exe_argv
=
++
argv
;
/* remove argv[0] (wine itself) */
main_exe_argv
=
++
argv
;
/* remove argv[0] (wine itself) */
...
@@ -519,7 +527,7 @@ void PROCESS_InitWinelib( int argc, char *argv[] )
...
@@ -519,7 +527,7 @@ void PROCESS_InitWinelib( int argc, char *argv[] )
{
{
HMODULE
main_module
;
HMODULE
main_module
;
if
(
!
MAIN_MainI
nit
(
argv
))
exit
(
1
);
if
(
!
process_i
nit
(
argv
))
exit
(
1
);
/* create 32-bit module for main exe */
/* create 32-bit module for main exe */
if
(
!
(
main_module
=
BUILTIN32_LoadExeModule
()))
ExitProcess
(
GetLastError
()
);
if
(
!
(
main_module
=
BUILTIN32_LoadExeModule
()))
ExitProcess
(
GetLastError
()
);
...
@@ -636,11 +644,11 @@ static void exec_wine_binary( char **argv, char **envp )
...
@@ -636,11 +644,11 @@ static void exec_wine_binary( char **argv, char **envp )
execve
(
argv
[
0
],
argv
,
envp
);
execve
(
argv
[
0
],
argv
,
envp
);
/* now try the path of argv0 of the current binary */
/* now try the path of argv0 of the current binary */
if
(
!
(
argv
[
0
]
=
malloc
(
strlen
(
argv0
)
+
6
)))
return
;
if
(
!
(
argv
[
0
]
=
malloc
(
strlen
(
full_
argv0
)
+
6
)))
return
;
if
((
ptr
=
strrchr
(
argv0
,
'/'
)))
if
((
ptr
=
strrchr
(
full_
argv0
,
'/'
)))
{
{
memcpy
(
argv
[
0
],
argv0
,
ptr
-
argv0
);
memcpy
(
argv
[
0
],
full_argv0
,
ptr
-
full_
argv0
);
strcpy
(
argv
[
0
]
+
(
ptr
-
argv0
),
"/wine"
);
strcpy
(
argv
[
0
]
+
(
ptr
-
full_
argv0
),
"/wine"
);
execve
(
argv
[
0
],
argv
,
envp
);
execve
(
argv
[
0
],
argv
,
envp
);
}
}
free
(
argv
[
0
]
);
free
(
argv
[
0
]
);
...
@@ -781,7 +789,7 @@ BOOL PROCESS_Create( HFILE hFile, LPCSTR filename, LPSTR cmd_line, LPCSTR env,
...
@@ -781,7 +789,7 @@ BOOL PROCESS_Create( HFILE hFile, LPCSTR filename, LPSTR cmd_line, LPCSTR env,
}
}
else
/* new wine process */
else
/* new wine process */
{
{
if
(
!
Get
FullPathNameA
(
filename
,
server_remaining
(
req
->
filename
),
req
->
filename
,
NULL
))
if
(
!
Get
LongPathNameA
(
filename
,
req
->
filename
,
server_remaining
(
req
->
filename
)
))
lstrcpynA
(
req
->
filename
,
filename
,
server_remaining
(
req
->
filename
)
);
lstrcpynA
(
req
->
filename
,
filename
,
server_remaining
(
req
->
filename
)
);
}
}
if
(
server_call
(
REQ_NEW_PROCESS
))
return
FALSE
;
if
(
server_call
(
REQ_NEW_PROCESS
))
return
FALSE
;
...
...
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