Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
18b4cbf1
Commit
18b4cbf1
authored
Nov 03, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put better values for code and data sizes in the NT header of builtin
dlls.
parent
137f41d1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
19 deletions
+28
-19
loader.c
libs/wine/loader.c
+17
-12
spec32.c
tools/winebuild/spec32.c
+11
-7
No files found.
libs/wine/loader.c
View file @
18b4cbf1
...
...
@@ -210,8 +210,10 @@ static void *map_dll( const IMAGE_NT_HEADERS *nt_descr )
IMAGE_DOS_HEADER
*
dos
;
IMAGE_NT_HEADERS
*
nt
;
IMAGE_SECTION_HEADER
*
sec
;
BYTE
*
addr
,
*
code_start
,
*
data_start
;
size_t
page_size
=
getpagesize
();
BYTE
*
addr
;
DWORD
code_start
,
data_start
,
data_end
;
const
size_t
page_size
=
getpagesize
();
const
size_t
page_mask
=
page_size
-
1
;
int
nb_sections
=
2
;
/* code + data */
size_t
size
=
(
sizeof
(
IMAGE_DOS_HEADER
)
...
...
@@ -227,10 +229,6 @@ static void *map_dll( const IMAGE_NT_HEADERS *nt_descr )
dos
=
(
IMAGE_DOS_HEADER
*
)
addr
;
nt
=
(
IMAGE_NT_HEADERS
*
)(
dos
+
1
);
sec
=
(
IMAGE_SECTION_HEADER
*
)(
nt
+
1
);
code_start
=
addr
+
page_size
;
/* HACK! */
data_start
=
code_start
+
page_size
;
/* Build the DOS and NT headers */
...
...
@@ -239,10 +237,17 @@ static void *map_dll( const IMAGE_NT_HEADERS *nt_descr )
*
nt
=
*
nt_descr
;
code_start
=
page_size
;
data_start
=
((
BYTE
*
)
nt
->
OptionalHeader
.
BaseOfData
-
addr
)
&
~
page_mask
;
data_end
=
(((
BYTE
*
)
nt
->
OptionalHeader
.
SizeOfImage
-
addr
)
+
page_mask
)
&
~
page_mask
;
nt
->
FileHeader
.
NumberOfSections
=
nb_sections
;
nt
->
OptionalHeader
.
BaseOfCode
=
code_start
;
nt
->
OptionalHeader
.
BaseOfData
=
data_start
;
nt
->
OptionalHeader
.
SizeOfCode
=
data_start
-
code_start
;
nt
->
OptionalHeader
.
SizeOfInitializedData
=
0
;
nt
->
OptionalHeader
.
SizeOfInitializedData
=
data_end
-
data_start
;
nt
->
OptionalHeader
.
SizeOfUninitializedData
=
0
;
nt
->
OptionalHeader
.
SizeOfImage
=
data_end
;
nt
->
OptionalHeader
.
ImageBase
=
(
DWORD
)
addr
;
fixup_rva_ptrs
(
&
nt
->
OptionalHeader
.
AddressOfEntryPoint
,
addr
,
1
);
...
...
@@ -252,18 +257,18 @@ static void *map_dll( const IMAGE_NT_HEADERS *nt_descr )
strcpy
(
sec
->
Name
,
".text"
);
sec
->
SizeOfRawData
=
data_start
-
code_start
;
sec
->
Misc
.
VirtualSize
=
sec
->
SizeOfRawData
;
sec
->
VirtualAddress
=
code_start
-
addr
;
sec
->
PointerToRawData
=
code_start
-
addr
;
sec
->
VirtualAddress
=
code_start
;
sec
->
PointerToRawData
=
code_start
;
sec
->
Characteristics
=
(
IMAGE_SCN_CNT_CODE
|
IMAGE_SCN_MEM_EXECUTE
|
IMAGE_SCN_MEM_READ
);
sec
++
;
/* Build the data section */
strcpy
(
sec
->
Name
,
".data"
);
sec
->
SizeOfRawData
=
0
;
sec
->
SizeOfRawData
=
data_end
-
data_start
;
sec
->
Misc
.
VirtualSize
=
sec
->
SizeOfRawData
;
sec
->
VirtualAddress
=
data_start
-
addr
;
sec
->
PointerToRawData
=
data_start
-
addr
;
sec
->
VirtualAddress
=
data_start
;
sec
->
PointerToRawData
=
data_start
;
sec
->
Characteristics
=
(
IMAGE_SCN_CNT_INITIALIZED_DATA
|
IMAGE_SCN_MEM_WRITE
|
IMAGE_SCN_MEM_READ
);
sec
++
;
...
...
tools/winebuild/spec32.c
View file @
18b4cbf1
...
...
@@ -515,18 +515,22 @@ void BuildSpec32File( FILE *outfile )
/* Reserve some space for the PE header */
fprintf
(
outfile
,
"extern char pe_header[];
\n
"
);
fprintf
(
outfile
,
"extern char
__wine_spec_
pe_header[];
\n
"
);
fprintf
(
outfile
,
"#ifndef __GNUC__
\n
"
);
fprintf
(
outfile
,
"static void __asm__dummy_header(void) {
\n
"
);
fprintf
(
outfile
,
"#endif
\n
"
);
fprintf
(
outfile
,
"asm(
\"
.text
\\
n
\\
t
\"\n
"
);
fprintf
(
outfile
,
"
\"
.align %d
\\
n
\"\n
"
,
get_alignment
(
page_size
)
);
fprintf
(
outfile
,
"
\"
"
__ASM_NAME
(
"pe_header"
)
":
\\
t"
__ASM_SKIP
" 65536
\\
n
\\
t
\"
);
\n
"
);
fprintf
(
outfile
,
"
\"
"
__ASM_NAME
(
"__wine_spec_pe_header"
)
":
\\
t"
__ASM_SKIP
" 65536
\\
n
\\
t
\"\n
"
);
fprintf
(
outfile
,
"
\"
.data
\\
n
\\
t
\"\n
"
);
fprintf
(
outfile
,
"
\"
.align %d
\\
n
\"\n
"
,
get_alignment
(
4
)
);
fprintf
(
outfile
,
"
\"
"
__ASM_NAME
(
"__wine_spec_data_start"
)
":
\\
t.long 1
\"
);
\n
"
);
fprintf
(
outfile
,
"#ifndef __GNUC__
\n
"
);
fprintf
(
outfile
,
"}
\n
"
);
fprintf
(
outfile
,
"#endif
\n
"
);
fprintf
(
outfile
,
"extern int __wine_spec_exports[];
\n\n
"
);
fprintf
(
outfile
,
"extern char _end[];
\n
"
);
fprintf
(
outfile
,
"extern int __wine_spec_data_start[], __wine_spec_exports[];
\n\n
"
);
#ifdef __i386__
fprintf
(
outfile
,
"#define __stdcall __attribute__((__stdcall__))
\n\n
"
);
...
...
@@ -753,7 +757,7 @@ void BuildSpec32File( FILE *outfile )
fprintf
(
outfile
,
" short MajorSubsystemVersion;
\n
"
);
fprintf
(
outfile
,
" short MinorSubsystemVersion;
\n
"
);
fprintf
(
outfile
,
" int Win32VersionValue;
\n
"
);
fprintf
(
outfile
,
"
int
SizeOfImage;
\n
"
);
fprintf
(
outfile
,
"
void *
SizeOfImage;
\n
"
);
fprintf
(
outfile
,
" int SizeOfHeaders;
\n
"
);
fprintf
(
outfile
,
" int CheckSum;
\n
"
);
fprintf
(
outfile
,
" short Subsystem;
\n
"
);
...
...
@@ -784,15 +788,15 @@ void BuildSpec32File( FILE *outfile )
fprintf
(
outfile
,
" 0, 0,
\n
"
);
/* Major/MinorLinkerVersion */
fprintf
(
outfile
,
" 0, 0, 0,
\n
"
);
/* SizeOfCode/Data */
fprintf
(
outfile
,
" %s,
\n
"
,
init_func
?
init_func
:
"DllMain"
);
/* AddressOfEntryPoint */
fprintf
(
outfile
,
" 0,
0,
\n
"
);
/* BaseOfCode/Data */
fprintf
(
outfile
,
"
pe_header,
\n
"
);
/* ImageBase */
fprintf
(
outfile
,
" 0,
__wine_spec_data_start,
\n
"
);
/* BaseOfCode/Data */
fprintf
(
outfile
,
"
__wine_spec_pe_header,
\n
"
);
/* ImageBase */
fprintf
(
outfile
,
" %ld,
\n
"
,
page_size
);
/* SectionAlignment */
fprintf
(
outfile
,
" %ld,
\n
"
,
page_size
);
/* FileAlignment */
fprintf
(
outfile
,
" 1, 0,
\n
"
);
/* Major/MinorOperatingSystemVersion */
fprintf
(
outfile
,
" 0, 0,
\n
"
);
/* Major/MinorImageVersion */
fprintf
(
outfile
,
" 4, 0,
\n
"
);
/* Major/MinorSubsystemVersion */
fprintf
(
outfile
,
" 0,
\n
"
);
/* Win32VersionValue */
fprintf
(
outfile
,
"
%ld,
\n
"
,
page_size
);
/* SizeOfImage */
fprintf
(
outfile
,
"
_end,
\n
"
);
/* SizeOfImage */
fprintf
(
outfile
,
" %ld,
\n
"
,
page_size
);
/* SizeOfHeaders */
fprintf
(
outfile
,
" 0,
\n
"
);
/* CheckSum */
fprintf
(
outfile
,
" 0x%04x,
\n
"
,
subsystem
);
/* Subsystem */
...
...
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