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
1467bbd5
Commit
1467bbd5
authored
Aug 27, 2002
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Aug 27, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Relax a bit PE consistency checks.
Return BINARY_DOS type if extended header was not recognized.
parent
155710ce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
module.c
loader/module.c
+5
-6
mapping.c
server/mapping.c
+6
-1
No files found.
loader/module.c
View file @
1467bbd5
...
@@ -635,15 +635,14 @@ enum binary_type MODULE_GetBinaryType( HANDLE hfile )
...
@@ -635,15 +635,14 @@ enum binary_type MODULE_GetBinaryType( HANDLE hfile )
*/
*/
if
(
!
memcmp
(
magic
,
"PE
\0\0
"
,
4
))
if
(
!
memcmp
(
magic
,
"PE
\0\0
"
,
4
))
{
{
IMAGE_
NT_HEADERS
nt
;
IMAGE_
FILE_HEADER
FileHeader
;
if
(
SetFilePointer
(
hfile
,
header
.
mz
.
e_lfanew
,
NULL
,
SEEK_SET
)
!=
-
1
&&
if
(
ReadFile
(
hfile
,
&
FileHeader
,
sizeof
(
FileHeader
),
&
len
,
NULL
)
&&
len
==
sizeof
(
FileHeader
))
ReadFile
(
hfile
,
&
nt
,
sizeof
(
nt
),
&
len
,
NULL
)
&&
len
==
sizeof
(
nt
))
{
{
if
(
nt
.
FileHeader
.
Characteristics
&
IMAGE_FILE_DLL
)
return
BINARY_PE_DLL
;
if
(
FileHeader
.
Characteristics
&
IMAGE_FILE_DLL
)
return
BINARY_PE_DLL
;
return
BINARY_PE_EXE
;
return
BINARY_PE_EXE
;
}
}
return
BINARY_
UNKNOWN
;
return
BINARY_
DOS
;
}
}
if
(
!
memcmp
(
magic
,
"NE"
,
2
))
if
(
!
memcmp
(
magic
,
"NE"
,
2
))
...
@@ -666,7 +665,7 @@ enum binary_type MODULE_GetBinaryType( HANDLE hfile )
...
@@ -666,7 +665,7 @@ enum binary_type MODULE_GetBinaryType( HANDLE hfile )
}
}
}
}
/* Couldn't read header, so abort. */
/* Couldn't read header, so abort. */
return
BINARY_
UNKNOWN
;
return
BINARY_
DOS
;
}
}
/* Unknown extended header, but this file is nonetheless DOS-executable. */
/* Unknown extended header, but this file is nonetheless DOS-executable. */
...
...
server/mapping.c
View file @
1467bbd5
...
@@ -211,8 +211,13 @@ static int get_image_params( struct mapping *mapping )
...
@@ -211,8 +211,13 @@ static int get_image_params( struct mapping *mapping )
if
(
read
(
fd
,
&
dos
,
sizeof
(
dos
)
)
!=
sizeof
(
dos
))
goto
error
;
if
(
read
(
fd
,
&
dos
,
sizeof
(
dos
)
)
!=
sizeof
(
dos
))
goto
error
;
if
(
dos
.
e_magic
!=
IMAGE_DOS_SIGNATURE
)
goto
error
;
if
(
dos
.
e_magic
!=
IMAGE_DOS_SIGNATURE
)
goto
error
;
if
(
lseek
(
fd
,
dos
.
e_lfanew
,
SEEK_SET
)
==
-
1
)
goto
error
;
if
(
lseek
(
fd
,
dos
.
e_lfanew
,
SEEK_SET
)
==
-
1
)
goto
error
;
if
(
read
(
fd
,
&
nt
,
sizeof
(
nt
)
)
!=
sizeof
(
nt
))
goto
error
;
if
(
read
(
fd
,
&
nt
.
Signature
,
sizeof
(
nt
.
Signature
)
)
!=
sizeof
(
nt
.
Signature
))
goto
error
;
if
(
nt
.
Signature
!=
IMAGE_NT_SIGNATURE
)
goto
error
;
if
(
nt
.
Signature
!=
IMAGE_NT_SIGNATURE
)
goto
error
;
if
(
read
(
fd
,
&
nt
.
FileHeader
,
sizeof
(
nt
.
FileHeader
)
)
!=
sizeof
(
nt
.
FileHeader
))
goto
error
;
/* zero out Optional header in the case it's not present or partial */
memset
(
&
nt
.
OptionalHeader
,
0
,
sizeof
(
nt
.
OptionalHeader
));
if
(
read
(
fd
,
&
nt
.
OptionalHeader
,
nt
.
FileHeader
.
SizeOfOptionalHeader
)
!=
nt
.
FileHeader
.
SizeOfOptionalHeader
)
goto
error
;
/* load the section headers */
/* load the section headers */
...
...
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