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
ad438726
Commit
ad438726
authored
Feb 18, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebuild: Add a --prefer-native option to set a Wine-specific flag in the PE header.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
717dd6ce
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
1 deletion
+28
-1
build.h
tools/winebuild/build.h
+3
-1
main.c
tools/winebuild/main.c
+8
-0
spec32.c
tools/winebuild/spec32.c
+13
-0
winebuild.man.in
tools/winebuild/winebuild.man.in
+4
-0
No files found.
tools/winebuild/build.h
View file @
ad438726
...
@@ -217,7 +217,8 @@ struct strarray
...
@@ -217,7 +217,8 @@ struct strarray
#define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
#define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
#define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
#define IMAGE_DLLCHARACTERISTICS_PREFER_NATIVE 0x0010
/* Wine extension */
#define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
#define IMAGE_SUBSYSTEM_NATIVE 1
#define IMAGE_SUBSYSTEM_NATIVE 1
#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
...
@@ -380,6 +381,7 @@ extern int unwind_tables;
...
@@ -380,6 +381,7 @@ extern int unwind_tables;
extern
int
use_msvcrt
;
extern
int
use_msvcrt
;
extern
int
unix_lib
;
extern
int
unix_lib
;
extern
int
safe_seh
;
extern
int
safe_seh
;
extern
int
prefer_native
;
extern
char
*
input_file_name
;
extern
char
*
input_file_name
;
extern
char
*
spec_file_name
;
extern
char
*
spec_file_name
;
...
...
tools/winebuild/main.c
View file @
ad438726
...
@@ -49,6 +49,7 @@ int unwind_tables = 0;
...
@@ -49,6 +49,7 @@ int unwind_tables = 0;
int
use_msvcrt
=
0
;
int
use_msvcrt
=
0
;
int
unix_lib
=
0
;
int
unix_lib
=
0
;
int
safe_seh
=
0
;
int
safe_seh
=
0
;
int
prefer_native
=
0
;
#ifdef __i386__
#ifdef __i386__
enum
target_cpu
target_cpu
=
CPU_x86
;
enum
target_cpu
target_cpu
=
CPU_x86
;
...
@@ -294,6 +295,7 @@ static const char usage_str[] =
...
@@ -294,6 +295,7 @@ static const char usage_str[] =
" --nxcompat=y|n Set the NX compatibility flag (default: yes)
\n
"
" --nxcompat=y|n Set the NX compatibility flag (default: yes)
\n
"
" -N, --dll-name=DLLNAME Set the DLL name (default: from input file name)
\n
"
" -N, --dll-name=DLLNAME Set the DLL name (default: from input file name)
\n
"
" -o, --output=NAME Set the output file name (default: stdout)
\n
"
" -o, --output=NAME Set the output file name (default: stdout)
\n
"
" --prefer-native Set the flag to prefer loading native at run time
\n
"
" -r, --res=RSRC.RES Load resources from RSRC.RES
\n
"
" -r, --res=RSRC.RES Load resources from RSRC.RES
\n
"
" --safeseh Mark object files as SEH compatible
\n
"
" --safeseh Mark object files as SEH compatible
\n
"
" --save-temps Do not delete the generated intermediate files
\n
"
" --save-temps Do not delete the generated intermediate files
\n
"
...
@@ -329,6 +331,7 @@ enum long_options_values
...
@@ -329,6 +331,7 @@ enum long_options_values
LONG_OPT_LDCMD
,
LONG_OPT_LDCMD
,
LONG_OPT_NMCMD
,
LONG_OPT_NMCMD
,
LONG_OPT_NXCOMPAT
,
LONG_OPT_NXCOMPAT
,
LONG_OPT_PREFER_NATIVE
,
LONG_OPT_RESOURCES
,
LONG_OPT_RESOURCES
,
LONG_OPT_SAFE_SEH
,
LONG_OPT_SAFE_SEH
,
LONG_OPT_SAVE_TEMPS
,
LONG_OPT_SAVE_TEMPS
,
...
@@ -356,6 +359,7 @@ static const struct option long_options[] =
...
@@ -356,6 +359,7 @@ static const struct option long_options[] =
{
"ld-cmd"
,
1
,
0
,
LONG_OPT_LDCMD
},
{
"ld-cmd"
,
1
,
0
,
LONG_OPT_LDCMD
},
{
"nm-cmd"
,
1
,
0
,
LONG_OPT_NMCMD
},
{
"nm-cmd"
,
1
,
0
,
LONG_OPT_NMCMD
},
{
"nxcompat"
,
1
,
0
,
LONG_OPT_NXCOMPAT
},
{
"nxcompat"
,
1
,
0
,
LONG_OPT_NXCOMPAT
},
{
"prefer-native"
,
0
,
0
,
LONG_OPT_PREFER_NATIVE
},
{
"resources"
,
0
,
0
,
LONG_OPT_RESOURCES
},
{
"resources"
,
0
,
0
,
LONG_OPT_RESOURCES
},
{
"safeseh"
,
0
,
0
,
LONG_OPT_SAFE_SEH
},
{
"safeseh"
,
0
,
0
,
LONG_OPT_SAFE_SEH
},
{
"save-temps"
,
0
,
0
,
LONG_OPT_SAVE_TEMPS
},
{
"save-temps"
,
0
,
0
,
LONG_OPT_SAVE_TEMPS
},
...
@@ -575,6 +579,10 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
...
@@ -575,6 +579,10 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
case
LONG_OPT_SAFE_SEH
:
case
LONG_OPT_SAFE_SEH
:
safe_seh
=
1
;
safe_seh
=
1
;
break
;
break
;
case
LONG_OPT_PREFER_NATIVE
:
prefer_native
=
1
;
spec
->
dll_characteristics
|=
IMAGE_DLLCHARACTERISTICS_PREFER_NATIVE
;
break
;
case
LONG_OPT_RESOURCES
:
case
LONG_OPT_RESOURCES
:
set_exec_mode
(
MODE_RESOURCES
);
set_exec_mode
(
MODE_RESOURCES
);
break
;
break
;
...
...
tools/winebuild/spec32.c
View file @
ad438726
...
@@ -1076,6 +1076,19 @@ void make_builtin_files( char *argv[] )
...
@@ -1076,6 +1076,19 @@ void make_builtin_files( char *argv[] )
if
(
header
.
e_lfanew
<
sizeof
(
header
)
+
sizeof
(
builtin_signature
))
if
(
header
.
e_lfanew
<
sizeof
(
header
)
+
sizeof
(
builtin_signature
))
fatal_error
(
"%s: Not enough space (%x) for Wine signature
\n
"
,
argv
[
i
],
header
.
e_lfanew
);
fatal_error
(
"%s: Not enough space (%x) for Wine signature
\n
"
,
argv
[
i
],
header
.
e_lfanew
);
write
(
fd
,
builtin_signature
,
sizeof
(
builtin_signature
)
);
write
(
fd
,
builtin_signature
,
sizeof
(
builtin_signature
)
);
if
(
prefer_native
)
{
unsigned
int
pos
=
header
.
e_lfanew
+
0x5e
;
/* OptionalHeader.DllCharacteristics */
unsigned
short
dll_charact
;
lseek
(
fd
,
pos
,
SEEK_SET
);
if
(
read
(
fd
,
&
dll_charact
,
sizeof
(
dll_charact
)
)
==
sizeof
(
dll_charact
))
{
dll_charact
|=
IMAGE_DLLCHARACTERISTICS_PREFER_NATIVE
;
lseek
(
fd
,
pos
,
SEEK_SET
);
write
(
fd
,
&
dll_charact
,
sizeof
(
dll_charact
)
);
}
}
}
}
else
fatal_error
(
"%s: Unrecognized file format
\n
"
,
argv
[
i
]
);
else
fatal_error
(
"%s: Unrecognized file format
\n
"
,
argv
[
i
]
);
close
(
fd
);
close
(
fd
);
...
...
tools/winebuild/winebuild.man.in
View file @
ad438726
...
@@ -209,6 +209,10 @@ output file name ends in .o, the text output is sent to a
...
@@ -209,6 +209,10 @@ output file name ends in .o, the text output is sent to a
temporary file that is then assembled to produce the specified .o
temporary file that is then assembled to produce the specified .o
file.
file.
.TP
.TP
.B --prefer-native
Specify that the native DLL should be preferred if available at run
time. This can be used on modules that are mostly unimplemented.
.TP
.BI \-r,\ --res= rsrc.res
.BI \-r,\ --res= rsrc.res
Load resources from the specified binary resource file. The
Load resources from the specified binary resource file. The
\fIrsrc.res\fR file can be produced from a source resource file with
\fIrsrc.res\fR file can be produced from a source resource file with
...
...
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