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
ce207221
Commit
ce207221
authored
Sep 02, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved the spec file init function and constructor to winecrt0.
parent
4d7b593b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
69 additions
and
32 deletions
+69
-32
Makefile.in
dlls/winecrt0/Makefile.in
+1
-0
crt0_private.h
dlls/winecrt0/crt0_private.h
+8
-1
dll_entry.c
dlls/winecrt0/dll_entry.c
+5
-4
exe_entry.c
dlls/winecrt0/exe_entry.c
+4
-2
exe_wentry.c
dlls/winecrt0/exe_wentry.c
+4
-2
init.c
dlls/winecrt0/init.c
+42
-0
library.h
include/wine/library.h
+1
-0
spec32.c
tools/winebuild/spec32.c
+4
-23
No files found.
dlls/winecrt0/Makefile.in
View file @
ce207221
...
...
@@ -12,6 +12,7 @@ C_SRCS = \
exe_main.c
\
exe_wentry.c
\
exe_wmain.c
\
init.c
\
stub.c
@MAKE_IMPLIB_RULES@
...
...
dlls/winecrt0/crt0_private.h
View file @
ce207221
...
...
@@ -29,6 +29,13 @@ extern void _init(int argc, char **argv, char **envp );
extern
void
_fini
(
void
);
#endif
extern
int
__wine_spec_init_state
;
enum
init_state
{
NO_INIT_DONE
,
/* no initialization done yet */
DLL_REGISTERED
,
/* the dll has been registered */
CONSTRUCTORS_DONE
/* the constructors have been run (implies dll registered too) */
};
extern
enum
init_state
__wine_spec_init_state
;
#endif
/* __WINE_CRT0_PRIVATE_H__ */
dlls/winecrt0/dll_entry.c
View file @
ce207221
...
...
@@ -28,12 +28,13 @@ extern BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved );
BOOL
WINAPI
__wine_spec_dll_entry
(
HINSTANCE
inst
,
DWORD
reason
,
LPVOID
reserved
)
{
BOOL
ret
;
BOOL
ret
,
needs_init
=
(
__wine_spec_init_state
!=
CONSTRUCTORS_DONE
)
;
if
(
reason
==
DLL_PROCESS_ATTACH
&&
__wine_spec_init_state
==
1
)
if
(
reason
==
DLL_PROCESS_ATTACH
&&
needs_init
)
_init
(
__wine_main_argc
,
__wine_main_argv
,
__wine_main_environ
);
ret
=
DllMain
(
inst
,
reason
,
reserved
);
if
(
reason
==
DLL_PROCESS_DETACH
&&
__wine_spec_init_state
==
1
)
_fini
();
if
(
reason
==
DLL_PROCESS_DETACH
&&
needs_init
)
_fini
();
return
ret
;
}
dlls/winecrt0/exe_entry.c
View file @
ce207221
...
...
@@ -29,9 +29,11 @@ extern int main( int argc, char *argv[] );
DWORD
WINAPI
__wine_spec_exe_entry
(
PEB
*
peb
)
{
BOOL
needs_init
=
(
__wine_spec_init_state
!=
CONSTRUCTORS_DONE
);
DWORD
ret
;
if
(
__wine_spec_init_state
==
1
)
_init
(
__wine_main_argc
,
__wine_main_argv
,
__wine_main_environ
);
if
(
needs_init
)
_init
(
__wine_main_argc
,
__wine_main_argv
,
__wine_main_environ
);
ret
=
main
(
__wine_main_argc
,
__wine_main_argv
);
if
(
__wine_spec_init_state
==
1
)
_fini
();
if
(
needs_init
)
_fini
();
ExitProcess
(
ret
);
}
dlls/winecrt0/exe_wentry.c
View file @
ce207221
...
...
@@ -29,9 +29,11 @@ extern int wmain( int argc, WCHAR *argv[] );
DWORD
WINAPI
__wine_spec_exe_wentry
(
PEB
*
peb
)
{
BOOL
needs_init
=
(
__wine_spec_init_state
!=
CONSTRUCTORS_DONE
);
DWORD
ret
;
if
(
__wine_spec_init_state
==
1
)
_init
(
__wine_main_argc
,
__wine_main_argv
,
__wine_main_environ
);
if
(
needs_init
)
_init
(
__wine_main_argc
,
__wine_main_argv
,
__wine_main_environ
);
ret
=
wmain
(
__wine_main_argc
,
__wine_main_wargv
);
if
(
__wine_spec_init_state
==
1
)
_fini
();
if
(
needs_init
)
_fini
();
ExitProcess
(
ret
);
}
dlls/winecrt0/init.c
0 → 100644
View file @
ce207221
/*
* Initialization code for spec files
*
* Copyright 2005 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wine/library.h"
#include "crt0_private.h"
enum
init_state
__wine_spec_init_state
=
NO_INIT_DONE
;
extern
const
IMAGE_NT_HEADERS
__wine_spec_nt_header
;
extern
const
char
__wine_spec_file_name
[];
void
__wine_spec_init
(
void
)
{
__wine_spec_init_state
=
DLL_REGISTERED
;
__wine_dll_register
(
&
__wine_spec_nt_header
,
__wine_spec_file_name
);
}
void
__wine_spec_init_ctor
(
void
)
{
if
(
__wine_spec_init_state
==
NO_INIT_DONE
)
__wine_spec_init
();
__wine_spec_init_state
=
CONSTRUCTORS_DONE
;
}
include/wine/library.h
View file @
ce207221
...
...
@@ -53,6 +53,7 @@ extern int __wine_main_argc;
extern
char
**
__wine_main_argv
;
extern
WCHAR
**
__wine_main_wargv
;
extern
char
**
__wine_main_environ
;
extern
void
__wine_dll_register
(
const
IMAGE_NT_HEADERS
*
header
,
const
char
*
filename
);
extern
void
wine_init
(
int
argc
,
char
*
argv
[],
char
*
error
,
int
error_size
);
/* debugging */
...
...
tools/winebuild/spec32.c
View file @
ce207221
...
...
@@ -474,7 +474,7 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec )
else
fprintf
(
outfile
,
"extern char _end[];
\n
"
);
fprintf
(
outfile
,
"
static
const char __wine_spec_file_name[] =
\"
%s
\"
;
\n
"
,
spec
->
file_name
);
fprintf
(
outfile
,
"const char __wine_spec_file_name[] =
\"
%s
\"
;
\n
"
,
spec
->
file_name
);
fprintf
(
outfile
,
"extern int __wine_spec_data_start[], __wine_spec_exports[];
\n\n
"
);
output_stub_funcs
(
outfile
,
spec
);
...
...
@@ -489,13 +489,12 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec )
/* Output the entry point function */
fprintf
(
outfile
,
"int __wine_spec_init_state = 0;
\n
"
);
fprintf
(
outfile
,
"extern void %s();
\n\n
"
,
spec
->
init_func
);
/* Output the NT header */
/* this is the IMAGE_NT_HEADERS structure, but we cannot include winnt.h here */
fprintf
(
outfile
,
"
static
const struct image_nt_headers
\n
{
\n
"
);
fprintf
(
outfile
,
"const struct image_nt_headers
\n
{
\n
"
);
fprintf
(
outfile
,
" int Signature;
\n
"
);
fprintf
(
outfile
,
" struct file_header {
\n
"
);
fprintf
(
outfile
,
" short Machine;
\n
"
);
...
...
@@ -539,7 +538,7 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec )
fprintf
(
outfile
,
" struct { const void *VirtualAddress; int Size; } DataDirectory[%d];
\n
"
,
IMAGE_NUMBEROF_DIRECTORY_ENTRIES
);
fprintf
(
outfile
,
" } OptionalHeader;
\n
"
);
fprintf
(
outfile
,
"} nt_header = {
\n
"
);
fprintf
(
outfile
,
"}
__wine_spec_
nt_header = {
\n
"
);
fprintf
(
outfile
,
" 0x%04x,
\n
"
,
IMAGE_NT_SIGNATURE
);
/* Signature */
switch
(
target_cpu
)
{
...
...
@@ -557,7 +556,7 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec )
break
;
}
fprintf
(
outfile
,
" 0, 0, 0, 0,
\n
"
);
fprintf
(
outfile
,
" sizeof(nt_header.OptionalHeader),
\n
"
);
/* SizeOfOptionalHeader */
fprintf
(
outfile
,
" sizeof(
__wine_spec_
nt_header.OptionalHeader),
\n
"
);
/* SizeOfOptionalHeader */
fprintf
(
outfile
,
" 0x%04x },
\n
"
,
spec
->
characteristics
);
/* Characteristics */
fprintf
(
outfile
,
" { 0x%04x,
\n
"
,
IMAGE_NT_OPTIONAL_HDR_MAGIC
);
/* Magic */
...
...
@@ -594,24 +593,6 @@ void BuildSpec32File( FILE *outfile, DLLSPEC *spec )
spec
->
nb_resources
?
"sizeof(__wine_spec_resources)"
:
"0"
);
fprintf
(
outfile
,
" }
\n
}
\n
};
\n\n
"
);
/* Output the DLL constructor */
fprintf
(
outfile
,
"void __wine_spec_init(void)
\n
"
"{
\n
"
" extern void __wine_dll_register( const struct image_nt_headers *, const char * );
\n
"
" __wine_spec_init_state = 1;
\n
"
" __wine_dll_register( &nt_header, __wine_spec_file_name );
\n
"
"}
\n\n
"
);
fprintf
(
outfile
,
"void __wine_spec_init_ctor(void)
\n
"
"{
\n
"
" if (__wine_spec_init_state) return;
\n
"
" __wine_spec_init();
\n
"
" __wine_spec_init_state = 2;
\n
"
"}
\n
"
);
fprintf
(
outfile
,
"#ifndef __GNUC__
\n
"
);
fprintf
(
outfile
,
"static void __asm__dummy(void) {
\n
"
);
fprintf
(
outfile
,
"#endif
\n
"
);
...
...
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