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
6c08994c
Commit
6c08994c
authored
Jan 15, 2004
by
Eric Pouech
Committed by
Alexandre Julliard
Jan 15, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Be more strict about checks (especially in RVA translations).
parent
6ec42c0c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
19 deletions
+25
-19
main.c
tools/winedump/main.c
+2
-1
pe.c
tools/winedump/pe.c
+21
-16
winedump.h
tools/winedump/winedump.h
+2
-2
No files found.
tools/winedump/main.c
View file @
6c08994c
...
...
@@ -404,7 +404,8 @@ int main (int argc, char *argv[])
if
(
globals
.
input_name
==
NULL
)
fatal
(
"No file name has been given
\n
"
);
set_module_name
(
1
);
dll_open
(
globals
.
input_name
);
if
(
!
dll_open
(
globals
.
input_name
))
break
;
output_spec_preamble
();
output_header_preamble
();
...
...
tools/winedump/pe.c
View file @
6c08994c
...
...
@@ -111,27 +111,23 @@ void* RVA(unsigned long rva, unsigned long len)
IMAGE_SECTION_HEADER
*
sectHead
;
int
i
;
if
(
rva
==
0
)
return
NULL
;
sectHead
=
(
IMAGE_SECTION_HEADER
*
)((
char
*
)
PE_nt_headers
+
sizeof
(
DWORD
)
+
sizeof
(
IMAGE_FILE_HEADER
)
+
PE_nt_headers
->
FileHeader
.
SizeOfOptionalHeader
);
if
(
rva
==
0
)
return
NULL
;
for
(
i
=
PE_nt_headers
->
FileHeader
.
NumberOfSections
-
1
;
i
>=
0
;
i
--
)
{
if
(
sectHead
[
i
].
VirtualAddress
<=
rva
&&
rva
+
len
<=
(
DWORD
)
sectHead
[
i
].
VirtualAddress
+
sectHead
[
i
].
SizeOfRawData
)
break
;
}
if
(
i
<
0
)
{
printf
(
"rva not found in any section (%lu)
\n
"
,
rva
);
return
NULL
;
{
/* return image import directory offset */
return
PRD
(
sectHead
[
i
].
PointerToRawData
+
rva
-
sectHead
[
i
].
VirtualAddress
,
len
);
}
}
/* return image import directory offset */
return
PRD
(
sectHead
[
i
].
PointerToRawData
+
rva
-
sectHead
[
i
].
VirtualAddress
,
len
);
return
NULL
;
}
static
void
*
get_dir
(
unsigned
idx
)
...
...
@@ -170,7 +166,7 @@ static void dump_pe_header(void)
printf
(
" Machine: %04X (%s)
\n
"
,
fileHeader
->
Machine
,
get_machine_str
(
fileHeader
->
Machine
));
printf
(
" Number of Sections: %d
\n
"
,
fileHeader
->
NumberOfSections
);
printf
(
" TimeDateStamp: %08lX (%s) offset %l
d
\n
"
,
printf
(
" TimeDateStamp: %08lX (%s) offset %l
u
\n
"
,
fileHeader
->
TimeDateStamp
,
get_time_str
(
fileHeader
->
TimeDateStamp
),
Offset
(
&
(
fileHeader
->
TimeDateStamp
)));
printf
(
" PointerToSymbolTable: %08lX
\n
"
,
fileHeader
->
PointerToSymbolTable
);
...
...
@@ -591,8 +587,12 @@ static void dump_dir_tls(void)
printf
(
" Callbacks %08lx -> {"
,
(
DWORD
)
dir
->
AddressOfCallBacks
);
if
(
dir
->
AddressOfCallBacks
)
{
callbacks
=
RVA
((
DWORD
)
dir
->
AddressOfCallBacks
-
PE_nt_headers
->
OptionalHeader
.
ImageBase
,
0
);
while
(
*
callbacks
)
printf
(
" %08lx"
,
*
callbacks
++
);
DWORD
addr
=
(
DWORD
)
dir
->
AddressOfCallBacks
-
PE_nt_headers
->
OptionalHeader
.
ImageBase
;
while
((
callbacks
=
RVA
(
addr
,
sizeof
(
DWORD
)))
&&
*
callbacks
)
{
printf
(
" %08lx"
,
*
callbacks
);
addr
+=
sizeof
(
DWORD
);
}
}
printf
(
" }
\n\n
"
);
}
...
...
@@ -704,6 +704,11 @@ void dump_data( const unsigned char *ptr, unsigned int size, const char *prefix
unsigned
int
i
,
j
;
printf
(
"%s"
,
prefix
);
if
(
!
ptr
)
{
printf
(
"NULL
\n
"
);
return
;
}
for
(
i
=
0
;
i
<
size
;
i
++
)
{
printf
(
"%02x%c"
,
ptr
[
i
],
(
i
%
16
==
7
)
?
'-'
:
' '
);
...
...
@@ -1224,9 +1229,9 @@ static void do_grab_sym( enum FileSig sig )
*
* Open a DLL and read in exported symbols
*/
void
dll_open
(
const
char
*
dll_name
)
int
dll_open
(
const
char
*
dll_name
)
{
pe_analysis
(
dll_name
,
do_grab_sym
,
SIG_PE
);
return
pe_analysis
(
dll_name
,
do_grab_sym
,
SIG_PE
);
}
/*******************************************************************
...
...
tools/winedump/winedump.h
View file @
6c08994c
...
...
@@ -157,9 +157,9 @@ extern _globals globals;
void
dump_file
(
const
char
*
name
);
/* DLL functions */
void
dll_open
(
const
char
*
dll_name
);
int
dll_open
(
const
char
*
dll_name
);
int
dll_next_symbol
(
parsed_symbol
*
sym
);
int
dll_next_symbol
(
parsed_symbol
*
sym
);
/* Symbol functions */
int
symbol_init
(
parsed_symbol
*
symbol
,
const
char
*
name
);
...
...
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