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
67204137
Commit
67204137
authored
May 18, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate the 16-bit module header in the standard on-disk format, so
that winebuild doesn't need to know about kernel internal structures.
parent
66b019c1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
50 deletions
+54
-50
ne_module.c
dlls/kernel/ne_module.c
+32
-44
build.h
tools/winebuild/build.h
+1
-1
res16.c
tools/winebuild/res16.c
+21
-5
spec16.c
tools/winebuild/spec16.c
+0
-0
No files found.
dlls/kernel/ne_module.c
View file @
67204137
...
...
@@ -70,12 +70,10 @@ struct ne_segment_table_entry_s
typedef
struct
{
void
*
module_start
;
/* 32-bit address of the module data */
int
module_size
;
/* Size of the module data */
void
*
code_start
;
/* 32-bit address of DLL code */
void
*
data_start
;
/* 32-bit address of DLL data */
const
char
*
owner
;
/* 32-bit dll that contains this dll */
const
void
*
rsrc
;
/* resources data */
const
char
*
file_name
;
/* module file name */
const
void
*
module
;
/* module header */
void
*
code_start
;
/* 32-bit address of DLL code */
const
void
*
rsrc
;
/* resources data */
}
BUILTIN16_DESCRIPTOR
;
/* Table of all built-in DLLs */
...
...
@@ -157,12 +155,11 @@ static const BUILTIN16_DESCRIPTOR *find_dll_descr( const char *dllname )
const
BUILTIN16_DESCRIPTOR
*
descr
=
builtin_dlls
[
i
];
if
(
descr
)
{
IMAGE_OS2_HEADER
*
pModule
=
descr
->
module_start
;
OFSTRUCT
*
pOfs
=
(
OFSTRUCT
*
)(
pModule
+
1
);
const
IMAGE_OS2_HEADER
*
pModule
=
descr
->
module
;
BYTE
*
name_table
=
(
BYTE
*
)
pModule
+
pModule
->
ne_restab
;
/* check the dll file name */
if
(
!
NE_strcasecmp
(
pOfs
->
szPathN
ame
,
dllname
))
return
descr
;
if
(
!
NE_strcasecmp
(
descr
->
file_n
ame
,
dllname
))
return
descr
;
/* check the dll module name (without extension) */
if
(
!
NE_strncasecmp
(
dllname
,
name_table
+
1
,
*
name_table
)
&&
!
strcmp
(
dllname
+
*
name_table
,
".dll"
))
...
...
@@ -1077,32 +1074,23 @@ static HINSTANCE16 NE_LoadModule( LPCSTR name, BOOL lib_only )
*/
static
HMODULE16
NE_DoLoadBuiltinModule
(
const
BUILTIN16_DESCRIPTOR
*
descr
)
{
IMAGE_OS2_HEADER
*
header
;
NE_MODULE
*
pModule
;
OFSTRUCT
*
ofs
;
int
minsize
;
SEGTABLEENTRY
*
pSegTable
;
HMODULE16
hModule
;
hModule
=
GLOBAL_CreateBlock
(
GMEM_MOVEABLE
,
descr
->
module_start
,
descr
->
module_size
,
0
,
WINE_LDT_FLAGS_DATA
);
if
(
!
hModule
)
return
ERROR_NOT_ENOUGH_MEMORY
;
FarSetOwner16
(
hModule
,
hModule
);
header
=
GlobalLock16
(
hModule
);
pModule
=
(
NE_MODULE
*
)
header
;
ofs
=
(
OFSTRUCT
*
)(
header
+
1
);
/* move the fileinfo structure a bit further to make space for the Wine-specific fields */
if
(
sizeof
(
*
header
)
+
sizeof
(
*
ofs
)
<
sizeof
(
*
pModule
)
+
ofs
->
cBytes
+
1
)
{
FIXME
(
"module name %s too long
\n
"
,
debugstr_a
(
ofs
->
szPathName
)
);
return
ERROR_NOT_ENOUGH_MEMORY
;
}
memmove
(
pModule
+
1
,
ofs
,
ofs
->
cBytes
+
1
);
SEGTABLEENTRY
*
pSegTable
;
const
IMAGE_DOS_HEADER
*
mz_header
;
const
IMAGE_OS2_HEADER
*
ne_header
;
unsigned
int
fastload_offset
,
fastload_length
;
mz_header
=
descr
->
module
;
ne_header
=
(
const
IMAGE_OS2_HEADER
*
)((
const
BYTE
*
)
mz_header
+
mz_header
->
e_lfanew
);
fastload_offset
=
ne_header
->
ne_pretthunks
<<
ne_header
->
ne_align
;
fastload_length
=
ne_header
->
ne_psegrefbytes
<<
ne_header
->
ne_align
;
hModule
=
build_module
(
mz_header
,
ne_header
,
0
,
descr
->
file_name
,
descr
->
module
,
fastload_offset
,
fastload_length
);
if
(
hModule
<
32
)
return
hModule
;
pModule
=
GlobalLock16
(
hModule
);
pModule
->
ne_flags
|=
NE_FFLAGS_BUILTIN
;
pModule
->
count
=
1
;
pModule
->
fileinfo
=
sizeof
(
*
pModule
);
pModule
->
self
=
hModule
;
/* NOTE: (Ab)use the rsrc32_map parameter for resource data pointer */
pModule
->
rsrc32_map
=
(
void
*
)
descr
->
rsrc
;
...
...
@@ -1114,26 +1102,26 @@ static HMODULE16 NE_DoLoadBuiltinModule( const BUILTIN16_DESCRIPTOR *descr )
WINE_LDT_FLAGS_CODE
|
WINE_LDT_FLAGS_32BIT
);
if
(
!
pSegTable
->
hSeg
)
return
ERROR_NOT_ENOUGH_MEMORY
;
patch_code_segment
(
descr
->
code_start
);
pSegTable
->
flags
|=
NE_SEGFLAGS_ALLOCATED
|
NE_SEGFLAGS_LOADED
;
pSegTable
++
;
/* Allocate the data segment */
minsize
=
pSegTable
->
minsize
?
pSegTable
->
minsize
:
0x10000
;
minsize
+=
pModule
->
ne_heap
;
if
(
minsize
>
0x10000
)
minsize
=
0x10000
;
pSegTable
->
hSeg
=
GlobalAlloc16
(
GMEM_FIXED
,
minsize
);
if
(
!
pSegTable
->
hSeg
)
return
ERROR_NOT_ENOUGH_MEMORY
;
FarSetOwner16
(
pSegTable
->
hSeg
,
hModule
);
if
(
!
NE_CreateSegment
(
pModule
,
2
))
return
ERROR_NOT_ENOUGH_MEMORY
;
pModule
->
dgroup_entry
=
(
char
*
)
pSegTable
-
(
char
*
)
pModule
;
if
(
pSegTable
->
minsize
)
memcpy
(
GlobalLock16
(
pSegTable
->
hSeg
),
descr
->
data_start
,
pSegTable
->
minsize
);
memcpy
(
GlobalLock16
(
pSegTable
->
hSeg
),
(
const
char
*
)
descr
->
module
+
(
pSegTable
->
filepos
<<
pModule
->
ne_align
),
pSegTable
->
minsize
);
pSegTable
->
flags
|=
NE_SEGFLAGS_LOADED
;
if
(
pModule
->
ne_heap
)
LocalInit16
(
GlobalHandleToSel16
(
pSegTable
->
hSeg
),
pSegTable
->
minsize
,
minsize
);
{
unsigned
int
size
=
pSegTable
->
minsize
+
pModule
->
ne_heap
;
if
(
size
>
0xfffe
)
size
=
0xfffe
;
LocalInit16
(
GlobalHandleToSel16
(
pSegTable
->
hSeg
),
pSegTable
->
minsize
,
size
);
}
NE_InitResourceHandler
(
hModule
);
NE_RegisterModule
(
pModule
);
return
hModule
;
}
...
...
tools/winebuild/build.h
View file @
67204137
...
...
@@ -178,7 +178,7 @@ extern int load_res32_file( const char *name, DLLSPEC *spec );
extern
void
output_resources
(
FILE
*
outfile
,
DLLSPEC
*
spec
);
extern
void
load_res16_file
(
const
char
*
name
,
DLLSPEC
*
spec
);
extern
int
output_res16_data
(
FILE
*
outfile
,
DLLSPEC
*
spec
);
extern
int
output_res16_directory
(
unsigned
char
*
buffer
,
DLLSPEC
*
spec
);
extern
unsigned
int
output_res16_directory
(
unsigned
char
**
ret_buf
,
DLLSPEC
*
spec
);
extern
void
output_dll_init
(
FILE
*
outfile
,
const
char
*
constructor
,
const
char
*
destructor
);
extern
void
BuildRelays16
(
FILE
*
outfile
);
...
...
tools/winebuild/res16.c
View file @
67204137
...
...
@@ -21,6 +21,7 @@
#include "config.h"
#include "wine/port.h"
#include <assert.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
...
...
@@ -293,21 +294,35 @@ int output_res16_data( FILE *outfile, DLLSPEC *spec )
}
/* output the resource definitions */
int
output_res16_directory
(
unsigned
char
*
buffer
,
DLLSPEC
*
spec
)
unsigned
int
output_res16_directory
(
unsigned
char
**
ret_buf
,
DLLSPEC
*
spec
)
{
int
offset
,
res_offset
=
0
;
unsigned
int
i
,
j
;
unsigned
int
i
,
j
,
total_size
;
struct
res_tree
*
tree
;
const
struct
res_type
*
type
;
const
struct
resource
*
res
;
unsigned
char
*
start
=
buffer
;
unsigned
char
*
buffer
;
tree
=
build_resource_tree
(
spec
);
/* first compute total size */
offset
=
4
;
/* alignment + terminator */
offset
+=
tree
->
nb_types
*
8
;
/* typeinfo structures */
offset
+=
spec
->
nb_resources
*
12
;
/* nameinfo structures */
total_size
=
offset
;
for
(
i
=
0
,
type
=
tree
->
types
;
i
<
tree
->
nb_types
;
i
++
,
type
++
)
{
if
(
type
->
type
->
str
)
total_size
+=
strlen
(
type
->
type
->
str
)
+
1
;
for
(
j
=
0
,
res
=
type
->
res
;
j
<
type
->
nb_names
;
j
++
,
res
++
)
if
(
res
->
name
.
str
)
total_size
+=
strlen
(
res
->
name
.
str
)
+
1
;
}
total_size
++
;
/* final terminator */
if
(
total_size
&
1
)
total_size
++
;
*
ret_buf
=
buffer
=
xmalloc
(
total_size
);
put_word
(
&
buffer
,
ALIGNMENT
);
/* type and name structures */
...
...
@@ -356,8 +371,9 @@ int output_res16_directory( unsigned char *buffer, DLLSPEC *spec )
}
}
put_byte
(
&
buffer
,
0
);
/* names terminator */
if
((
buffer
-
start
)
&
1
)
put_byte
(
&
buffer
,
0
);
/* align on word boundary */
if
((
buffer
-
*
ret_buf
)
&
1
)
put_byte
(
&
buffer
,
0
);
/* align on word boundary */
assert
(
buffer
-
*
ret_buf
==
total_size
);
free_resource_tree
(
tree
);
return
buffer
-
start
;
return
total_size
;
}
tools/winebuild/spec16.c
View file @
67204137
This diff is collapsed.
Click to expand it.
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