Removed the Unicode exe modes, and instead detect automatically which

mode to use based on the existence of main or wmain.
This commit is contained in:
Alexandre Julliard 2004-03-24 03:39:57 +00:00
parent 9e4ed6460c
commit d1e0782c9e
5 changed files with 23 additions and 47 deletions

View File

@ -55,9 +55,7 @@ typedef enum
SPEC_MODE_DLL,
SPEC_MODE_NATIVE,
SPEC_MODE_GUIEXE,
SPEC_MODE_CUIEXE,
SPEC_MODE_GUIEXE_UNICODE,
SPEC_MODE_CUIEXE_UNICODE
SPEC_MODE_CUIEXE
} SPEC_MODE;
typedef struct

View File

@ -456,14 +456,6 @@ static void add_extra_undef_symbols( const DLLSPEC *spec )
case SPEC_MODE_CUIEXE:
kernel_imports += add_extra_symbol( extras, &count, "ExitProcess", spec );
break;
case SPEC_MODE_GUIEXE_UNICODE:
kernel_imports += add_extra_symbol( extras, &count, "GetCommandLineA", spec );
kernel_imports += add_extra_symbol( extras, &count, "GetStartupInfoA", spec );
kernel_imports += add_extra_symbol( extras, &count, "GetModuleHandleA", spec );
/* fall through */
case SPEC_MODE_CUIEXE_UNICODE:
kernel_imports += add_extra_symbol( extras, &count, "ExitProcess", spec );
break;
}
if (nb_delayed)
{

View File

@ -271,8 +271,6 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
case 'm':
if (!strcmp( optarg, "gui" )) spec->mode = SPEC_MODE_GUIEXE;
else if (!strcmp( optarg, "cui" )) spec->mode = SPEC_MODE_CUIEXE;
else if (!strcmp( optarg, "guiw" )) spec->mode = SPEC_MODE_GUIEXE_UNICODE;
else if (!strcmp( optarg, "cuiw" )) spec->mode = SPEC_MODE_CUIEXE_UNICODE;
else if (!strcmp( optarg, "native" )) spec->mode = SPEC_MODE_NATIVE;
else usage(1);
break;

View File

@ -643,7 +643,6 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec )
subsystem = IMAGE_SUBSYSTEM_NATIVE;
break;
case SPEC_MODE_GUIEXE:
case SPEC_MODE_GUIEXE_UNICODE:
if (!init_func) init_func = "WinMain";
fprintf( outfile,
"\ntypedef struct {\n"
@ -688,36 +687,31 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec )
subsystem = IMAGE_SUBSYSTEM_WINDOWS_GUI;
break;
case SPEC_MODE_CUIEXE:
if (!init_func) init_func = "main";
if (init_func)
fprintf( outfile, "extern int %s( int argc, char *argv[] );\n", init_func );
else
{
declare_weak_function( outfile, "main", "int main( int argc, char *argv[] )" );
declare_weak_function( outfile, "wmain", "int wmain( int argc, unsigned short *argv[] )" );
}
fprintf( outfile,
"\nextern void __stdcall ExitProcess(int);\n"
"static void __wine_exe_main(void)\n"
"{\n"
" int ret;\n"
" extern int %s( int argc, char *argv[] );\n"
" if (__wine_spec_init_state == 1)\n"
" _init( __wine_main_argc, __wine_main_argv, __wine_main_environ );\n"
" ret = %s( __wine_main_argc, __wine_main_argv );\n"
" if (__wine_spec_init_state == 1) _fini();\n"
" ExitProcess( ret );\n"
"}\n\n", init_func, init_func );
init_func = "__wine_exe_main";
subsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI;
break;
case SPEC_MODE_CUIEXE_UNICODE:
if (!init_func) init_func = "wmain";
" _init( __wine_main_argc, __wine_main_argv, __wine_main_environ );\n" );
if (init_func)
fprintf( outfile,
" ret = %s( __wine_main_argc, __wine_main_argv );\n", init_func );
else
fprintf( outfile,
" if (wmain) ret = wmain( __wine_main_argc, __wine_main_wargv );\n"
" else ret = main( __wine_main_argc, __wine_main_argv );\n" );
fprintf( outfile,
"\nextern void __stdcall ExitProcess(int);\n"
"static void __wine_exe_main(void)\n"
"{\n"
" int ret;\n"
" extern int %s( int argc, unsigned short *argv[] );\n"
" if (__wine_spec_init_state == 1)\n"
" _init( __wine_main_argc, __wine_main_argv, __wine_main_environ );\n"
" ret = %s( __wine_main_argc, __wine_main_wargv );\n"
" if (__wine_spec_init_state == 1) _fini();\n"
" ExitProcess( ret );\n"
"}\n\n", init_func, init_func );
"}\n\n" );
init_func = "__wine_exe_main";
subsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI;
break;

View File

@ -137,24 +137,18 @@ meaningful in \fB--dll\fR mode.
Set the executable or dll mode, which can be one of the following:
.br
.B cui
for a command line ASCII executable,
for a command line executable,
.br
.B gui
for a graphical ASCII executable,
.br
.B cuiw
for a command line Unicode executable,
.br
.B guiw
for a graphical Unicode executable,
for a graphical executable,
.br
.B native
for a native-mode dll.
.br
A command line executable entry point is a normal C \fBmain\fR
function. A graphical executable has a \fBWinMain\fR entry point
instead. The ASCII/Unicode distinction applies to the strings that are
passed to the entry point.
The entry point of a command line executable is a normal C \fBmain\fR
function. A \fBwmain\fR function can be used instead if you need the
argument array to use Unicode strings. A graphical executable has a
\fBWinMain\fR entry point.
.TP
.BI \-N,\ --dll-name= dllname
Set the internal name of the module. It is only used in Win16