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
32e31ac7
Commit
32e31ac7
authored
Apr 08, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatically detect whether the entry point is main or WinMain
instead of depending on the subsystem type.
parent
743997fa
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
38 deletions
+28
-38
import.c
tools/winebuild/import.c
+1
-2
spec32.c
tools/winebuild/spec32.c
+22
-32
winebuild.man.in
tools/winebuild/winebuild.man.in
+5
-4
No files found.
tools/winebuild/import.c
View file @
32e31ac7
...
...
@@ -451,11 +451,10 @@ static void add_extra_undef_symbols( const DLLSPEC *spec )
switch
(
spec
->
subsystem
)
{
case
IMAGE_SUBSYSTEM_WINDOWS_GUI
:
case
IMAGE_SUBSYSTEM_WINDOWS_CUI
:
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
IMAGE_SUBSYSTEM_WINDOWS_CUI
:
kernel_imports
+=
add_extra_symbol
(
extras
,
&
count
,
"ExitProcess"
,
spec
);
break
;
}
...
...
tools/winebuild/spec32.c
View file @
32e31ac7
...
...
@@ -640,7 +640,15 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec )
init_func
=
"__wine_driver_entry"
;
break
;
case
IMAGE_SUBSYSTEM_WINDOWS_GUI
:
if
(
!
init_func
)
init_func
=
"WinMain"
;
case
IMAGE_SUBSYSTEM_WINDOWS_CUI
:
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[] )"
);
declare_weak_function
(
outfile
,
"WinMain"
,
"int __stdcall WinMain(void *,void *,char *,int)"
);
}
fprintf
(
outfile
,
"
\n
typedef struct {
\n
"
" unsigned int cb;
\n
"
...
...
@@ -651,16 +659,24 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec )
" char *lpReserved2;
\n
"
" void *hStdInput, *hStdOutput, *hStdError;
\n
"
"} STARTUPINFOA;
\n
"
"extern int __stdcall %s(void *,void *,char *,int);
\n
"
"extern char * __stdcall GetCommandLineA(void);
\n
"
"extern void * __stdcall GetModuleHandleA(char *);
\n
"
"extern void __stdcall GetStartupInfoA(STARTUPINFOA *);
\n
"
"extern void __stdcall ExitProcess(unsigned int);
\n
"
"static void __wine_exe_main(void)
\n
"
"{
\n
"
" int ret;
\n
"
" if (__wine_spec_init_state == 1)
\n
"
" _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 (WinMain) {
\n
"
" STARTUPINFOA info;
\n
"
" char *cmdline = GetCommandLineA();
\n
"
" int ret,
bcount=0, in_quotes=0;
\n
"
" int
bcount=0, in_quotes=0;
\n
"
" while (*cmdline) {
\n
"
" if ((*cmdline=='
\\
t' || *cmdline==' ') && !in_quotes) break;
\n
"
" else if (*cmdline=='
\\\\
') bcount++;
\n
"
...
...
@@ -674,35 +690,9 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec )
" while (*cmdline=='
\\
t' || *cmdline==' ') cmdline++;
\n
"
" GetStartupInfoA( &info );
\n
"
" if (!(info.dwFlags & 1)) info.wShowWindow = 1;
\n
"
" if (__wine_spec_init_state == 1)
\n
"
" _init( __wine_main_argc, __wine_main_argv, __wine_main_environ );
\n
"
" ret = %s( GetModuleHandleA(0), 0, cmdline, info.wShowWindow );
\n
"
" if (__wine_spec_init_state == 1) _fini();
\n
"
" ExitProcess( ret );
\n
"
"}
\n\n
"
,
init_func
,
init_func
);
init_func
=
"__wine_exe_main"
;
break
;
case
IMAGE_SUBSYSTEM_WINDOWS_CUI
:
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
,
"
\n
extern void __stdcall ExitProcess(int);
\n
"
"static void __wine_exe_main(void)
\n
"
"{
\n
"
" int ret;
\n
"
" if (__wine_spec_init_state == 1)
\n
"
" _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
"
" ret = WinMain( GetModuleHandleA(0), 0, cmdline, info.wShowWindow );
\n
"
" }
\n
"
" else if (wmain) ret = wmain( __wine_main_argc, __wine_main_wargv );
\n
"
" else ret = main( __wine_main_argc, __wine_main_argv );
\n
"
);
fprintf
(
outfile
,
" if (__wine_spec_init_state == 1) _fini();
\n
"
...
...
tools/winebuild/winebuild.man.in
View file @
32e31ac7
...
...
@@ -76,11 +76,12 @@ Specify the module entry point function; if not specified, the default
is
.B DllMain
for dlls, and
.B main
or
.B WinMain
for CUI or GUI executables respectively. This is only valid for Win32
modules.
for executables (if
.B WinMain
is not defined, the standard C
.B main
is used instead). This is only valid for Win32 modules.
.TP
.BI \-f\ flags
Ignored for compatibility with the C compiler.
...
...
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