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 ...@@ -55,9 +55,7 @@ typedef enum
SPEC_MODE_DLL, SPEC_MODE_DLL,
SPEC_MODE_NATIVE, SPEC_MODE_NATIVE,
SPEC_MODE_GUIEXE, SPEC_MODE_GUIEXE,
SPEC_MODE_CUIEXE, SPEC_MODE_CUIEXE
SPEC_MODE_GUIEXE_UNICODE,
SPEC_MODE_CUIEXE_UNICODE
} SPEC_MODE; } SPEC_MODE;
typedef struct typedef struct
......
...@@ -456,14 +456,6 @@ static void add_extra_undef_symbols( const DLLSPEC *spec ) ...@@ -456,14 +456,6 @@ static void add_extra_undef_symbols( const DLLSPEC *spec )
case SPEC_MODE_CUIEXE: case SPEC_MODE_CUIEXE:
kernel_imports += add_extra_symbol( extras, &count, "ExitProcess", spec ); kernel_imports += add_extra_symbol( extras, &count, "ExitProcess", spec );
break; 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) if (nb_delayed)
{ {
......
...@@ -271,8 +271,6 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec ) ...@@ -271,8 +271,6 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
case 'm': case 'm':
if (!strcmp( optarg, "gui" )) spec->mode = SPEC_MODE_GUIEXE; if (!strcmp( optarg, "gui" )) spec->mode = SPEC_MODE_GUIEXE;
else if (!strcmp( optarg, "cui" )) spec->mode = SPEC_MODE_CUIEXE; 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 if (!strcmp( optarg, "native" )) spec->mode = SPEC_MODE_NATIVE;
else usage(1); else usage(1);
break; break;
......
...@@ -643,7 +643,6 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec ) ...@@ -643,7 +643,6 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec )
subsystem = IMAGE_SUBSYSTEM_NATIVE; subsystem = IMAGE_SUBSYSTEM_NATIVE;
break; break;
case SPEC_MODE_GUIEXE: case SPEC_MODE_GUIEXE:
case SPEC_MODE_GUIEXE_UNICODE:
if (!init_func) init_func = "WinMain"; if (!init_func) init_func = "WinMain";
fprintf( outfile, fprintf( outfile,
"\ntypedef struct {\n" "\ntypedef struct {\n"
...@@ -688,36 +687,31 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec ) ...@@ -688,36 +687,31 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec )
subsystem = IMAGE_SUBSYSTEM_WINDOWS_GUI; subsystem = IMAGE_SUBSYSTEM_WINDOWS_GUI;
break; break;
case SPEC_MODE_CUIEXE: 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, fprintf( outfile,
"\nextern void __stdcall ExitProcess(int);\n" "\nextern void __stdcall ExitProcess(int);\n"
"static void __wine_exe_main(void)\n" "static void __wine_exe_main(void)\n"
"{\n" "{\n"
" int ret;\n" " int ret;\n"
" extern int %s( int argc, char *argv[] );\n"
" if (__wine_spec_init_state == 1)\n" " if (__wine_spec_init_state == 1)\n"
" _init( __wine_main_argc, __wine_main_argv, __wine_main_environ );\n" " _init( __wine_main_argc, __wine_main_argv, __wine_main_environ );\n" );
" ret = %s( __wine_main_argc, __wine_main_argv );\n" if (init_func)
" if (__wine_spec_init_state == 1) _fini();\n" fprintf( outfile,
" ExitProcess( ret );\n" " ret = %s( __wine_main_argc, __wine_main_argv );\n", init_func );
"}\n\n", init_func, init_func ); else
init_func = "__wine_exe_main"; fprintf( outfile,
subsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI; " if (wmain) ret = wmain( __wine_main_argc, __wine_main_wargv );\n"
break; " else ret = main( __wine_main_argc, __wine_main_argv );\n" );
case SPEC_MODE_CUIEXE_UNICODE:
if (!init_func) init_func = "wmain";
fprintf( outfile, 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" " if (__wine_spec_init_state == 1) _fini();\n"
" ExitProcess( ret );\n" " ExitProcess( ret );\n"
"}\n\n", init_func, init_func ); "}\n\n" );
init_func = "__wine_exe_main"; init_func = "__wine_exe_main";
subsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI; subsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI;
break; break;
......
...@@ -137,24 +137,18 @@ meaningful in \fB--dll\fR mode. ...@@ -137,24 +137,18 @@ meaningful in \fB--dll\fR mode.
Set the executable or dll mode, which can be one of the following: Set the executable or dll mode, which can be one of the following:
.br .br
.B cui .B cui
for a command line ASCII executable, for a command line executable,
.br .br
.B gui .B gui
for a graphical ASCII executable, for a graphical executable,
.br
.B cuiw
for a command line Unicode executable,
.br
.B guiw
for a graphical Unicode executable,
.br .br
.B native .B native
for a native-mode dll. for a native-mode dll.
.br .br
A command line executable entry point is a normal C \fBmain\fR The entry point of a command line executable is a normal C \fBmain\fR
function. A graphical executable has a \fBWinMain\fR entry point function. A \fBwmain\fR function can be used instead if you need the
instead. The ASCII/Unicode distinction applies to the strings that are argument array to use Unicode strings. A graphical executable has a
passed to the entry point. \fBWinMain\fR entry point.
.TP .TP
.BI \-N,\ --dll-name= dllname .BI \-N,\ --dll-name= dllname
Set the internal name of the module. It is only used in Win16 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