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
b374e7e3
Commit
b374e7e3
authored
Apr 09, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebuild: Don't include any Windows header to avoid data types dependencies.
parent
89f6bc2e
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
101 additions
and
56 deletions
+101
-56
build.h
tools/winebuild/build.h
+32
-0
import.c
tools/winebuild/import.c
+0
-2
main.c
tools/winebuild/main.c
+0
-2
parser.c
tools/winebuild/parser.c
+0
-2
relay.c
tools/winebuild/relay.c
+6
-7
res16.c
tools/winebuild/res16.c
+8
-10
res32.c
tools/winebuild/res32.c
+20
-17
spec16.c
tools/winebuild/spec16.c
+22
-10
spec32.c
tools/winebuild/spec32.c
+13
-4
utils.c
tools/winebuild/utils.c
+0
-2
No files found.
tools/winebuild/build.h
View file @
b374e7e3
...
...
@@ -31,6 +31,13 @@
#include <stdlib.h>
#include <string.h>
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
typedef
enum
{
TYPE_VARIABLE
,
/* variable */
...
...
@@ -141,6 +148,31 @@ extern enum target_platform target_platform;
#define MAX_ORDINALS 65535
/* some Windows constants */
#define IMAGE_FILE_RELOCS_STRIPPED 0x0001
/* No relocation info */
#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
#define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
#define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
#define IMAGE_FILE_16BIT_MACHINE 0x0040
#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
#define IMAGE_FILE_32BIT_MACHINE 0x0100
#define IMAGE_FILE_DEBUG_STRIPPED 0x0200
#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
#define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
#define IMAGE_FILE_SYSTEM 0x1000
#define IMAGE_FILE_DLL 0x2000
#define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
#define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
#define IMAGE_SUBSYSTEM_NATIVE 1
#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
/* global functions */
#ifndef __GNUC__
...
...
tools/winebuild/import.c
View file @
b374e7e3
...
...
@@ -35,8 +35,6 @@
# include <unistd.h>
#endif
#include "windef.h"
#include "winbase.h"
#include "build.h"
struct
import
...
...
tools/winebuild/main.c
View file @
b374e7e3
...
...
@@ -36,8 +36,6 @@
# include <getopt.h>
#endif
#include "windef.h"
#include "winbase.h"
#include "build.h"
int
UsePIC
=
0
;
...
...
tools/winebuild/parser.c
View file @
b374e7e3
...
...
@@ -32,8 +32,6 @@
#include <stdlib.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "build.h"
int
current_line
=
0
;
...
...
tools/winebuild/relay.c
View file @
b374e7e3
...
...
@@ -28,7 +28,6 @@
#include <ctype.h>
#include <stdarg.h>
#include "windef.h"
#include "build.h"
/* offset of the stack pointer relative to %fs:(0) */
...
...
@@ -647,7 +646,7 @@ static void BuildRet16Func(void)
* (ebp+4) ret addr
* (ebp) ebp
*/
static
void
BuildCallTo32CBClient
(
BOOL
isEx
)
static
void
BuildCallTo32CBClient
(
int
isEx
)
{
function_header
(
isEx
?
"CALL32_CBClientEx"
:
"CALL32_CBClient"
);
...
...
@@ -925,13 +924,13 @@ void BuildRelays16(void)
output
(
"%s
\n
"
,
asm_globl
(
"__wine_call16_start"
)
);
/* Standard CallFrom16 routine */
BuildCallFrom16Core
(
FALSE
,
FALSE
);
BuildCallFrom16Core
(
0
,
0
);
/* Register CallFrom16 routine */
BuildCallFrom16Core
(
TRUE
,
FALSE
);
BuildCallFrom16Core
(
1
,
0
);
/* C16ThkSL CallFrom16 routine */
BuildCallFrom16Core
(
FALSE
,
TRUE
);
BuildCallFrom16Core
(
0
,
1
);
/* Standard CallTo16 routine */
BuildCallTo16Core
(
0
);
...
...
@@ -943,10 +942,10 @@ void BuildRelays16(void)
BuildRet16Func
();
/* CBClientThunkSL routine */
BuildCallTo32CBClient
(
FALSE
);
BuildCallTo32CBClient
(
0
);
/* CBClientThunkSLEx routine */
BuildCallTo32CBClient
(
TRUE
);
BuildCallTo32CBClient
(
1
);
/* Pending DPMI events check stub */
BuildPendingEventCheck
();
...
...
tools/winebuild/res16.c
View file @
b374e7e3
...
...
@@ -38,15 +38,13 @@
#include <sys/mman.h>
#endif
#include "windef.h"
#include "winbase.h"
#include "build.h"
/* Unicode string or integer id */
struct
string_id
{
char
*
str
;
/* ptr to string */
WORD
id
;
/* integer id if str is NULL */
unsigned
short
id
;
/* integer id if str is NULL */
};
/* descriptor for a resource */
...
...
@@ -56,7 +54,7 @@ struct resource
struct
string_id
name
;
const
void
*
data
;
unsigned
int
data_size
;
WORD
memopt
;
unsigned
int
memopt
;
};
/* type level of the resource tree */
...
...
@@ -105,7 +103,7 @@ static unsigned char get_byte(void)
}
/* get the next word from the current resource file */
static
WORD
get_word
(
void
)
static
unsigned
short
get_word
(
void
)
{
/* might not be aligned */
#ifdef WORDS_BIGENDIAN
...
...
@@ -119,14 +117,14 @@ static WORD get_word(void)
}
/* get the next dword from the current resource file */
static
DWORD
get_dword
(
void
)
static
unsigned
int
get_dword
(
void
)
{
#ifdef WORDS_BIGENDIAN
WORD
high
=
get_word
();
WORD
low
=
get_word
();
unsigned
short
high
=
get_word
();
unsigned
short
low
=
get_word
();
#else
WORD
low
=
get_word
();
WORD
high
=
get_word
();
unsigned
short
low
=
get_word
();
unsigned
short
high
=
get_word
();
#endif
return
low
|
(
high
<<
16
);
}
...
...
tools/winebuild/res32.c
View file @
b374e7e3
...
...
@@ -37,15 +37,15 @@
#include <sys/mman.h>
#endif
#include "windef.h"
#include "winbase.h"
#include "build.h"
typedef
unsigned
short
WCHAR
;
/* Unicode string or integer id */
struct
string_id
{
WCHAR
*
str
;
/* ptr to Unicode string */
WORD
id
;
/* integer id if str is NULL */
unsigned
short
id
;
/* integer id if str is NULL */
};
/* descriptor for a resource */
...
...
@@ -55,7 +55,7 @@ struct resource
struct
string_id
name
;
const
void
*
data
;
unsigned
int
data_size
;
WORD
lang
;
unsigned
short
lang
;
};
/* name level of the resource tree */
...
...
@@ -90,7 +90,10 @@ static const unsigned char *file_end; /* end of resource file */
static
const
char
*
file_name
;
/* current resource file name */
/* size of a resource directory with n entries */
#define RESDIR_SIZE(n) (sizeof(IMAGE_RESOURCE_DIRECTORY) + (n) * sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY))
#define RESOURCE_DIR_SIZE (4 * sizeof(unsigned int))
#define RESOURCE_DIR_ENTRY_SIZE (2 * sizeof(unsigned int))
#define RESOURCE_DATA_ENTRY_SIZE (4 * sizeof(unsigned int))
#define RESDIR_SIZE(n) (RESOURCE_DIR_SIZE + (n) * RESOURCE_DIR_ENTRY_SIZE)
static
inline
struct
resource
*
add_resource
(
DLLSPEC
*
spec
)
...
...
@@ -137,22 +140,22 @@ static struct res_type *add_type( struct res_tree *tree, const struct resource *
}
/* get the next word from the current resource file */
static
WORD
get_word
(
void
)
static
unsigned
short
get_word
(
void
)
{
WORD
ret
=
*
(
const
WORD
*
)
file_pos
;
unsigned
short
ret
=
*
(
const
unsigned
short
*
)
file_pos
;
if
(
byte_swapped
)
ret
=
(
ret
<<
8
)
|
(
ret
>>
8
);
file_pos
+=
sizeof
(
WORD
);
file_pos
+=
sizeof
(
unsigned
short
);
if
(
file_pos
>
file_end
)
fatal_error
(
"%s is a truncated file
\n
"
,
file_name
);
return
ret
;
}
/* get the next dword from the current resource file */
static
DWORD
get_dword
(
void
)
static
unsigned
int
get_dword
(
void
)
{
DWORD
ret
=
*
(
const
DWORD
*
)
file_pos
;
unsigned
int
ret
=
*
(
const
unsigned
int
*
)
file_pos
;
if
(
byte_swapped
)
ret
=
((
ret
<<
24
)
|
((
ret
<<
8
)
&
0x00ff0000
)
|
((
ret
>>
8
)
&
0x0000ff00
)
|
(
ret
>>
24
));
file_pos
+=
sizeof
(
DWORD
);
file_pos
+=
sizeof
(
unsigned
int
);
if
(
file_pos
>
file_end
)
fatal_error
(
"%s is a truncated file
\n
"
,
file_name
);
return
ret
;
}
...
...
@@ -179,7 +182,7 @@ static void get_string( struct string_id *str )
/* all values must be zero except header size */
static
int
check_header
(
void
)
{
DWORD
size
;
unsigned
int
size
;
if
(
get_dword
())
return
0
;
/* data size */
size
=
get_dword
();
/* header size */
...
...
@@ -198,17 +201,17 @@ static int check_header(void)
/* load the next resource from the current file */
static
void
load_next_resource
(
DLLSPEC
*
spec
)
{
DWORD
hdr_size
;
unsigned
int
hdr_size
;
struct
resource
*
res
=
add_resource
(
spec
);
res
->
data_size
=
(
get_dword
()
+
3
)
&
~
3
;
hdr_size
=
get_dword
();
if
(
hdr_size
&
3
)
fatal_error
(
"%s header size not aligned
\n
"
,
file_name
);
res
->
data
=
file_pos
-
2
*
sizeof
(
DWORD
)
+
hdr_size
;
res
->
data
=
file_pos
-
2
*
sizeof
(
unsigned
int
)
+
hdr_size
;
get_string
(
&
res
->
type
);
get_string
(
&
res
->
name
);
if
((
UINT_PTR
)
file_pos
&
2
)
get_word
();
/* align to dword boundary */
if
((
unsigned
long
)
file_pos
&
2
)
get_word
();
/* align to dword boundary */
get_dword
();
/* skip data version */
get_word
();
/* skip mem options */
res
->
lang
=
get_word
();
...
...
@@ -360,7 +363,7 @@ void output_resources( DLLSPEC *spec )
for
(
n
=
0
,
name
=
type
->
names
;
n
<
type
->
nb_names
;
n
++
,
name
++
)
offset
+=
RESDIR_SIZE
(
name
->
nb_languages
);
}
offset
+=
spec
->
nb_resources
*
sizeof
(
IMAGE_RESOURCE_DATA_ENTRY
)
;
offset
+=
spec
->
nb_resources
*
RESOURCE_DATA_ENTRY_SIZE
;
for
(
i
=
nb_id_types
=
0
,
type
=
tree
->
types
;
i
<
tree
->
nb_types
;
i
++
,
type
++
)
{
...
...
@@ -428,7 +431,7 @@ void output_resources( DLLSPEC *spec )
output_res_dir
(
0
,
name
->
nb_languages
);
for
(
k
=
0
,
res
=
name
->
res
;
k
<
name
->
nb_languages
;
k
++
,
res
++
)
{
unsigned
int
entry_offset
=
(
res
-
spec
->
resources
)
*
sizeof
(
IMAGE_RESOURCE_DATA_ENTRY
)
;
unsigned
int
entry_offset
=
(
res
-
spec
->
resources
)
*
RESOURCE_DATA_ENTRY_SIZE
;
output
(
"
\t
.long 0x%08x,0x%08x
\n
"
,
res
->
lang
,
data_offset
+
entry_offset
);
}
}
...
...
tools/winebuild/spec16.c
View file @
b374e7e3
...
...
@@ -28,10 +28,24 @@
#include <assert.h>
#include <ctype.h>
#include "wine/winbase16.h"
#include "build.h"
#define NE_FFLAGS_SINGLEDATA 0x0001
#define NE_FFLAGS_LIBMODULE 0x8000
/* argument type flags for relay debugging */
enum
arg_types
{
ARG_NONE
=
0
,
/* indicates end of arg list */
ARG_WORD
,
/* unsigned word */
ARG_SWORD
,
/* signed word */
ARG_LONG
,
/* long or segmented pointer */
ARG_PTR
,
/* linear pointer */
ARG_STR
,
/* linear pointer to null-terminated string */
ARG_SEGSTR
,
/* segmented pointer to null-terminated string */
ARG_VARARG
/* start of varargs */
};
/* sequences of nops to fill a certain number of words */
static
const
char
*
const
nop_sequence
[
4
]
=
{
...
...
@@ -587,8 +601,7 @@ static void output_module16( DLLSPEC *spec )
output
(
"
\t
.data
\n
"
);
output
(
"
\t
.align %d
\n
"
,
get_alignment
(
4
)
);
output
(
".L__wine_spec_dos_header:
\n
"
);
output
(
"
\t
%s 0x%04x
\n
"
,
get_asm_short_keyword
(),
/* e_magic */
IMAGE_DOS_SIGNATURE
);
output
(
"
\t
%s 0x5a4d
\n
"
,
get_asm_short_keyword
()
);
/* e_magic */
output
(
"
\t
%s 0
\n
"
,
get_asm_short_keyword
()
);
/* e_cblp */
output
(
"
\t
%s 0
\n
"
,
get_asm_short_keyword
()
);
/* e_cp */
output
(
"
\t
%s 0
\n
"
,
get_asm_short_keyword
()
);
/* e_crlc */
...
...
@@ -609,8 +622,7 @@ static void output_module16( DLLSPEC *spec )
output
(
"
\t
.long .L__wine_spec_ne_header-.L__wine_spec_dos_header
\n
"
);
/* e_lfanew */
output
(
".L__wine_spec_ne_header:
\n
"
);
output
(
"
\t
%s 0x%04x
\n
"
,
get_asm_short_keyword
(),
/* ne_magic */
IMAGE_OS2_SIGNATURE
);
output
(
"
\t
%s 0x454e
\n
"
,
get_asm_short_keyword
()
);
/* ne_magic */
output
(
"
\t
.byte 0
\n
"
);
/* ne_ver */
output
(
"
\t
.byte 0
\n
"
);
/* ne_rev */
output
(
"
\t
%s .L__wine_spec_ne_enttab-.L__wine_spec_ne_header
\n
"
,
/* ne_enttab */
...
...
@@ -645,8 +657,8 @@ static void output_module16( DLLSPEC *spec )
output
(
"
\t
%s 0
\n
"
,
get_asm_short_keyword
()
);
/* ne_cmovent */
output
(
"
\t
%s 0
\n
"
,
get_asm_short_keyword
()
);
/* ne_align */
output
(
"
\t
%s 0
\n
"
,
get_asm_short_keyword
()
);
/* ne_cres */
output
(
"
\t
.byte 0x
%02x
\n
"
,
NE_OSFLAGS_WINDOWS
);
/* ne_exetyp
*/
output
(
"
\t
.byte 0x
%02x
\n
"
,
NE_AFLAGS_FASTLOAD
);
/* ne_flagsothers
*/
output
(
"
\t
.byte 0x
04
\n
"
);
/* ne_exetyp = NE_OSFLAGS_WINDOWS
*/
output
(
"
\t
.byte 0x
08
\n
"
);
/* ne_flagsothers = NE_AFLAGS_FASTLOAD
*/
output
(
"
\t
%s 0
\n
"
,
get_asm_short_keyword
()
);
/* ne_pretthunks */
output
(
"
\t
%s 0
\n
"
,
get_asm_short_keyword
()
);
/* ne_psegrefbytes */
output
(
"
\t
%s 0
\n
"
,
get_asm_short_keyword
()
);
/* ne_swaparea */
...
...
@@ -662,7 +674,7 @@ static void output_module16( DLLSPEC *spec )
get_asm_short_keyword
()
);
output
(
"
\t
%s .L__wine_spec_code_segment_end-.L__wine_spec_code_segment
\n
"
,
/* size */
get_asm_short_keyword
()
);
output
(
"
\t
%s 0x
%04x
\n
"
,
get_asm_short_keyword
(),
NE_SEGFLAGS_32BIT
);
/* flags
*/
output
(
"
\t
%s 0x
2000
\n
"
,
get_asm_short_keyword
()
);
/* flags = NE_SEGFLAGS_32BIT
*/
output
(
"
\t
%s .L__wine_spec_code_segment_end-.L__wine_spec_code_segment
\n
"
,
/* minsize */
get_asm_short_keyword
()
);
...
...
@@ -672,7 +684,7 @@ static void output_module16( DLLSPEC *spec )
get_asm_short_keyword
()
);
output
(
"
\t
%s .L__wine_spec_data_segment_end-.L__wine_spec_data_segment
\n
"
,
/* size */
get_asm_short_keyword
()
);
output
(
"
\t
%s 0x
%04x
\n
"
,
get_asm_short_keyword
(),
NE_SEGFLAGS_DATA
);
/* flags
*/
output
(
"
\t
%s 0x
0001
\n
"
,
get_asm_short_keyword
()
);
/* flags = NE_SEGFLAGS_DATA
*/
output
(
"
\t
%s .L__wine_spec_data_segment_end-.L__wine_spec_data_segment
\n
"
,
/* minsize */
get_asm_short_keyword
()
);
...
...
tools/winebuild/spec32.c
View file @
b374e7e3
...
...
@@ -30,11 +30,20 @@
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wine/exception.h"
#include "build.h"
#define IMAGE_FILE_MACHINE_UNKNOWN 0
#define IMAGE_FILE_MACHINE_I386 0x014c
#define IMAGE_FILE_MACHINE_ALPHA 0x0184
#define IMAGE_FILE_MACHINE_POWERPC 0x01f0
#define IMAGE_FILE_MACHINE_AMD64 0x8664
#define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
#define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
#define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
/* check if entry point needs a relay thunk */
static
inline
int
needs_relay
(
const
ORDDEF
*
odp
)
...
...
@@ -416,7 +425,7 @@ void output_module( DLLSPEC *spec )
output
(
"%s
\n
"
,
asm_globl
(
"__wine_spec_nt_header"
)
);
output
(
".L__wine_spec_rva_base:
\n
"
);
output
(
"
\t
.long 0x
%04x
\n
"
,
IMAGE_NT_SIGNATURE
);
/* Signature */
output
(
"
\t
.long 0x
4550
\n
"
);
/* Signature */
switch
(
target_cpu
)
{
case
CPU_x86
:
machine
=
IMAGE_FILE_MACHINE_I386
;
break
;
...
...
tools/winebuild/utils.c
View file @
b374e7e3
...
...
@@ -31,8 +31,6 @@
# include <unistd.h>
#endif
#include "windef.h"
#include "winnt.h"
#include "build.h"
#define MAX_TMP_FILES 8
...
...
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