Commit d1e0782c authored by Alexandre Julliard's avatar Alexandre Julliard

Removed the Unicode exe modes, and instead detect automatically which

mode to use based on the existence of main or wmain.
parent 9e4ed646
......@@ -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
......
......@@ -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)
{
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment