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
af25f29c
Commit
af25f29c
authored
Sep 25, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedump: Don't zero out the PE optional header regardless of specified size.
parent
4d417076
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
11 deletions
+10
-11
lib.c
tools/winedump/lib.c
+1
-1
pe.c
tools/winedump/pe.c
+8
-9
winedump.h
tools/winedump/winedump.h
+1
-1
No files found.
tools/winedump/lib.c
View file @
af25f29c
...
...
@@ -264,7 +264,7 @@ void lib_dump(void)
if
(
fh
->
SizeOfOptionalHeader
)
{
const
IMAGE_OPTIONAL_HEADER32
*
oh
=
(
const
IMAGE_OPTIONAL_HEADER32
*
)((
const
char
*
)
fh
+
sizeof
(
*
fh
));
dump_optional_header
(
oh
,
fh
->
SizeOfOptionalHeader
);
dump_optional_header
(
oh
);
}
}
/* Sanity check */
...
...
tools/winedump/pe.c
View file @
af25f29c
...
...
@@ -275,14 +275,14 @@ static inline void print_datadirectory(DWORD n, const IMAGE_DATA_DIRECTORY *dire
}
}
static
void
dump_optional_header32
(
const
IMAGE_OPTIONAL_HEADER32
*
image_oh
,
UINT
header_size
)
static
void
dump_optional_header32
(
const
IMAGE_OPTIONAL_HEADER32
*
image_oh
)
{
IMAGE_OPTIONAL_HEADER32
oh
;
const
IMAGE_OPTIONAL_HEADER32
*
optionalHeader
;
/* in case optional header is missing or partial */
memset
(
&
oh
,
0
,
sizeof
(
oh
));
memcpy
(
&
oh
,
image_oh
,
min
(
header_size
,
sizeof
(
oh
)));
memcpy
(
&
oh
,
image_oh
,
min
(
dump_total_len
-
((
char
*
)
image_oh
-
(
char
*
)
dump_base
)
,
sizeof
(
oh
)));
optionalHeader
=
&
oh
;
print_word
(
"Magic"
,
optionalHeader
->
Magic
);
...
...
@@ -320,14 +320,14 @@ static void dump_optional_header32(const IMAGE_OPTIONAL_HEADER32 *image_oh, UINT
printf
(
"
\n
"
);
}
static
void
dump_optional_header64
(
const
IMAGE_OPTIONAL_HEADER64
*
image_oh
,
UINT
header_size
)
static
void
dump_optional_header64
(
const
IMAGE_OPTIONAL_HEADER64
*
image_oh
)
{
IMAGE_OPTIONAL_HEADER64
oh
;
const
IMAGE_OPTIONAL_HEADER64
*
optionalHeader
;
/* in case optional header is missing or partial */
memset
(
&
oh
,
0
,
sizeof
(
oh
));
memcpy
(
&
oh
,
image_oh
,
min
(
header_size
,
sizeof
(
oh
)));
memcpy
(
&
oh
,
image_oh
,
min
(
dump_total_len
-
((
char
*
)
image_oh
-
(
char
*
)
dump_base
)
,
sizeof
(
oh
)));
optionalHeader
=
&
oh
;
print_word
(
"Magic"
,
optionalHeader
->
Magic
);
...
...
@@ -364,16 +364,16 @@ static void dump_optional_header64(const IMAGE_OPTIONAL_HEADER64 *image_oh, UINT
printf
(
"
\n
"
);
}
void
dump_optional_header
(
const
IMAGE_OPTIONAL_HEADER32
*
optionalHeader
,
UINT
header_size
)
void
dump_optional_header
(
const
IMAGE_OPTIONAL_HEADER32
*
optionalHeader
)
{
printf
(
"Optional Header (%s)
\n
"
,
get_magic_type
(
optionalHeader
->
Magic
));
switch
(
optionalHeader
->
Magic
)
{
case
IMAGE_NT_OPTIONAL_HDR32_MAGIC
:
dump_optional_header32
(
optionalHeader
,
header_size
);
dump_optional_header32
(
optionalHeader
);
break
;
case
IMAGE_NT_OPTIONAL_HDR64_MAGIC
:
dump_optional_header64
((
const
IMAGE_OPTIONAL_HEADER64
*
)
optionalHeader
,
header_size
);
dump_optional_header64
((
const
IMAGE_OPTIONAL_HEADER64
*
)
optionalHeader
);
break
;
default:
printf
(
" Unknown optional header magic: 0x%-4X
\n
"
,
optionalHeader
->
Magic
);
...
...
@@ -428,8 +428,7 @@ void dump_file_header(const IMAGE_FILE_HEADER *fileHeader, BOOL is_hybrid)
static
void
dump_pe_header
(
void
)
{
dump_file_header
(
&
PE_nt_headers
->
FileHeader
,
get_hybrid_metadata
()
!=
NULL
);
dump_optional_header
((
const
IMAGE_OPTIONAL_HEADER32
*
)
&
PE_nt_headers
->
OptionalHeader
,
PE_nt_headers
->
FileHeader
.
SizeOfOptionalHeader
);
dump_optional_header
((
const
IMAGE_OPTIONAL_HEADER32
*
)
&
PE_nt_headers
->
OptionalHeader
);
}
void
dump_section_characteristics
(
DWORD
characteristics
,
const
char
*
sep
)
...
...
tools/winedump/winedump.h
View file @
af25f29c
...
...
@@ -233,7 +233,7 @@ const char* get_unicode_str( const WCHAR *str, int len );
const
char
*
get_symbol_str
(
const
char
*
symname
);
void
print_fake_dll
(
void
);
void
dump_file_header
(
const
IMAGE_FILE_HEADER
*
,
BOOL
);
void
dump_optional_header
(
const
IMAGE_OPTIONAL_HEADER32
*
,
UINT
);
void
dump_optional_header
(
const
IMAGE_OPTIONAL_HEADER32
*
);
void
dump_section
(
const
IMAGE_SECTION_HEADER
*
,
const
char
*
strtable
);
void
dump_section_characteristics
(
DWORD
characteristics
,
const
char
*
sep
);
...
...
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