ntdll: Process --help and --version args earlier on during startup.
This commit is contained in:
parent
79f89b9c33
commit
f5d3adaf59
|
@ -592,22 +592,6 @@ static BOOL build_command_line( WCHAR **argv )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void version(void)
|
|
||||||
{
|
|
||||||
MESSAGE( "%s\n", PACKAGE_STRING );
|
|
||||||
ExitProcess(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void usage(void)
|
|
||||||
{
|
|
||||||
MESSAGE( "%s\n", PACKAGE_STRING );
|
|
||||||
MESSAGE( "Usage: wine PROGRAM [ARGUMENTS...] Run the specified program\n" );
|
|
||||||
MESSAGE( " wine --help Display this help and exit\n");
|
|
||||||
MESSAGE( " wine --version Output version information and exit\n");
|
|
||||||
ExitProcess(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* init_current_directory
|
* init_current_directory
|
||||||
*
|
*
|
||||||
|
@ -881,13 +865,6 @@ void __wine_kernel_init(void)
|
||||||
{
|
{
|
||||||
WCHAR exe_nameW[MAX_PATH];
|
WCHAR exe_nameW[MAX_PATH];
|
||||||
|
|
||||||
if (!__wine_main_argv[0]) usage();
|
|
||||||
if (__wine_main_argc == 1)
|
|
||||||
{
|
|
||||||
if (strcmp(__wine_main_argv[0], "--help") == 0) usage();
|
|
||||||
if (strcmp(__wine_main_argv[0], "--version") == 0) version();
|
|
||||||
}
|
|
||||||
|
|
||||||
MultiByteToWideChar( CP_UNIXCP, 0, __wine_main_argv[0], -1, exe_nameW, MAX_PATH );
|
MultiByteToWideChar( CP_UNIXCP, 0, __wine_main_argv[0], -1, exe_nameW, MAX_PATH );
|
||||||
if (!SearchPathW( NULL, exe_nameW, exeW, MAX_PATH, main_exe_name, NULL ) &&
|
if (!SearchPathW( NULL, exe_nameW, exeW, MAX_PATH, main_exe_name, NULL ) &&
|
||||||
!get_builtin_path( exe_nameW, exeW, main_exe_name, MAX_PATH ))
|
!get_builtin_path( exe_nameW, exeW, main_exe_name, MAX_PATH ))
|
||||||
|
|
|
@ -2289,10 +2289,41 @@ void __wine_init_windows_dir( const WCHAR *windir, const WCHAR *sysdir )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* check_command_line
|
||||||
|
*
|
||||||
|
* Check if command line is one that needs to be handled specially.
|
||||||
|
*/
|
||||||
|
static void check_command_line( int argc, char *argv[] )
|
||||||
|
{
|
||||||
|
static const char version[] = PACKAGE_STRING "\n";
|
||||||
|
static const char usage[] =
|
||||||
|
"Usage: wine PROGRAM [ARGUMENTS...] Run the specified program\n"
|
||||||
|
" wine --help Display this help and exit\n"
|
||||||
|
" wine --version Output version information and exit\n";
|
||||||
|
|
||||||
|
if (argc <= 1)
|
||||||
|
{
|
||||||
|
write( 2, usage, sizeof(usage) - 1 );
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (!strcmp( argv[1], "--help" ))
|
||||||
|
{
|
||||||
|
write( 1, usage, sizeof(usage) - 1 );
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
if (!strcmp( argv[1], "--version" ))
|
||||||
|
{
|
||||||
|
write( 1, version, sizeof(version) - 1 );
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* __wine_process_init
|
* __wine_process_init
|
||||||
*/
|
*/
|
||||||
void __wine_process_init( int argc, char *argv[] )
|
void __wine_process_init(void)
|
||||||
{
|
{
|
||||||
static const WCHAR kernel32W[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0};
|
static const WCHAR kernel32W[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0};
|
||||||
|
|
||||||
|
@ -2302,6 +2333,7 @@ void __wine_process_init( int argc, char *argv[] )
|
||||||
void (* DECLSPEC_NORETURN init_func)(void);
|
void (* DECLSPEC_NORETURN init_func)(void);
|
||||||
extern mode_t FILE_umask;
|
extern mode_t FILE_umask;
|
||||||
|
|
||||||
|
check_command_line( __wine_main_argc, __wine_main_argv );
|
||||||
main_exe_file = thread_init();
|
main_exe_file = thread_init();
|
||||||
|
|
||||||
/* retrieve current umask */
|
/* retrieve current umask */
|
||||||
|
|
Loading…
Reference in New Issue