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
de6d4e21
Commit
de6d4e21
authored
Nov 05, 2001
by
Eric Pouech
Committed by
Alexandre Julliard
Nov 05, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed and globalized some path and module name handling.
Tweaked the demangling of function pointers as function parameters.
parent
2f9eb3b0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
27 deletions
+69
-27
main.c
tools/winedump/main.c
+28
-3
msmangle.c
tools/winedump/msmangle.c
+35
-7
output.c
tools/winedump/output.c
+3
-3
pe.c
tools/winedump/pe.c
+1
-13
winedump.h
tools/winedump/winedump.h
+2
-1
No files found.
tools/winedump/main.c
View file @
de6d4e21
...
...
@@ -36,7 +36,7 @@ static void do_spec (const char *arg)
{
if
(
globals
.
mode
!=
NONE
)
fatal
(
"Only one mode can be specified
\n
"
);
globals
.
mode
=
SPEC
;
globals
.
input_name
=
strip_ext
(
arg
)
;
globals
.
input_name
=
arg
;
}
...
...
@@ -162,7 +162,7 @@ static const struct option option_table[] = {
{
"-e"
,
SPEC
,
1
,
do_end
,
"-e num End prototype search after symbol 'num'"
},
{
"-q"
,
SPEC
,
0
,
do_quiet
,
"-q Don't show progress (quiet)."
},
{
"-v"
,
SPEC
,
0
,
do_verbose
,
"-v Show lots of detail while working (verbose)."
},
{
"dump"
,
DUMP
,
2
,
do_dump
,
"dump <
dll> Dumps the content of the dll named <dll
>"
},
{
"dump"
,
DUMP
,
2
,
do_dump
,
"dump <
mod> Dumps the content of the module (dll, exe...) named <mod
>"
},
{
"-C"
,
DUMP
,
0
,
do_symdmngl
,
"-C Turns on symbol demangling"
},
{
"-f"
,
DUMP
,
0
,
do_dumphead
,
"-f Dumps file header information"
},
{
"-j"
,
DUMP
,
1
,
do_dumpsect
,
"-j sect_name Dumps only the content of section sect_name (import, export, debug)"
},
...
...
@@ -247,6 +247,29 @@ static void parse_options (char *argv[])
fatal
(
"Options -v and -q are mutually exclusive"
);
}
static
void
set_module_name
(
unsigned
setUC
)
{
const
char
*
ptr
;
char
*
buf
;
int
len
;
/* FIXME: we shouldn't assume all module extensions are .dll in winedump
* in some cases, we could have some .drv for example
*/
/* get module name from name */
if
((
ptr
=
strrchr
(
globals
.
input_name
,
'/'
)))
ptr
++
;
else
ptr
=
globals
.
input_name
;
len
=
strlen
(
ptr
);
if
(
len
>
4
&&
strcmp
(
ptr
+
len
-
4
,
".dll"
)
==
0
)
len
-=
4
;
buf
=
malloc
(
len
+
1
);
memcpy
(
buf
,
(
void
*
)
ptr
,
len
);
buf
[
len
]
=
0
;
globals
.
input_module
=
buf
;
OUTPUT_UC_DLL_NAME
=
(
setUC
)
?
str_toupper
(
strdup
(
OUTPUT_DLL_NAME
))
:
""
;
}
/*******************************************************************
* main
...
...
@@ -274,6 +297,7 @@ int main (int argc, char *argv[])
VERBOSE
=
1
;
symbol_init
(
&
symbol
,
globals
.
input_name
);
globals
.
input_module
=
""
;
if
(
symbol_demangle
(
&
symbol
)
==
-
1
)
fatal
(
"Symbol hasn't got a mangled name
\n
"
);
if
(
symbol
.
flags
&
SYM_DATA
)
...
...
@@ -285,6 +309,7 @@ int main (int argc, char *argv[])
break
;
case
SPEC
:
set_module_name
(
1
);
dll_open
(
globals
.
input_name
);
output_spec_preamble
();
...
...
@@ -335,7 +360,7 @@ int main (int argc, char *argv[])
do_usage
();
break
;
case
DUMP
:
globals
.
uc_dll_name
=
""
;
set_module_name
(
0
)
;
dump_file
(
globals
.
input_name
);
break
;
}
...
...
tools/winedump/msmangle.c
View file @
de6d4e21
...
...
@@ -487,15 +487,43 @@ static char *demangle_datatype (char **str, compound_type *ct,
/* FIXME: P6 = Function pointer, others who knows.. */
if
(
isdigit
(
*
iter
))
{
if
(
*
iter
==
'6'
)
printf
(
"Function pointer in argument list is not handled yet
\n
"
);
return
NULL
;
if
(
*
iter
==
'6'
)
{
/* FIXME: there are a tons of memory leaks here */
/* FIXME: this is still broken in some cases and it has to be
* merged with the function prototype parsing above...
*/
iter
+=
3
;
/* FIXME */
if
(
!
demangle_datatype
(
&
iter
,
&
sub_ct
,
sym
))
return
NULL
;
ct
->
expression
=
str_create
(
2
,
sub_ct
.
expression
,
" (*)("
);
if
(
*
iter
!=
'@'
)
{
while
(
*
iter
!=
'Z'
)
{
FREE_CT
(
sub_ct
);
INIT_CT
(
sub_ct
);
if
(
!
demangle_datatype
(
&
iter
,
&
sub_ct
,
sym
))
return
NULL
;
ct
->
expression
=
str_create
(
3
,
ct
->
expression
,
", "
,
sub_ct
.
expression
);
while
(
*
iter
==
'@'
)
iter
++
;
}
}
else
while
(
*
iter
==
'@'
)
iter
++
;
iter
++
;
ct
->
expression
=
str_create
(
2
,
ct
->
expression
,
")"
);
FREE_CT
(
sub_ct
);
}
else
return
NULL
;
}
else
{
/* Recurse to get the pointed-to type */
if
(
!
demangle_datatype
(
&
iter
,
&
sub_ct
,
sym
))
return
NULL
;
/* Recurse to get the pointed-to type */
if
(
!
demangle_datatype
(
&
iter
,
&
sub_ct
,
sym
))
return
NULL
;
ct
->
expression
=
get_pointer_type_string
(
ct
,
sub_ct
.
expression
);
ct
->
expression
=
get_pointer_type_string
(
ct
,
sub_ct
.
expression
);
}
FREE_CT
(
sub_ct
);
}
...
...
tools/winedump/output.c
View file @
de6d4e21
...
...
@@ -33,7 +33,7 @@ void output_spec_preamble (void)
puts
(
"Creating .spec preamble"
);
fprintf
(
specfile
,
"# Generated from %s
.dll
by winedump
\n
name %s
\n
"
"# Generated from %s by winedump
\n
name %s
\n
"
"type win32
\n
init %s_Init
\n\n
import kernel32.dll
\n
"
"import ntdll.dll
\n
"
,
globals
.
input_name
,
OUTPUT_DLL_NAME
,
OUTPUT_UC_DLL_NAME
);
...
...
@@ -199,7 +199,7 @@ void output_c_preamble (void)
atexit
(
output_c_postamble
);
fprintf
(
cfile
,
"/*
\n
* %s.dll
\n
*
\n
* Generated from %s
.dll
by winedump.
\n
*
\n
"
"/*
\n
* %s.dll
\n
*
\n
* Generated from %s by winedump.
\n
*
\n
"
" * DO NOT SUBMIT GENERATED DLLS FOR INCLUSION INTO WINE!
\n
*
\n
*/"
"
\n\n
#include
\"
%s_dll.h
\"\n\n
DEFAULT_DEBUG_CHANNEL(%s);
\n\n
"
,
OUTPUT_DLL_NAME
,
globals
.
input_name
,
OUTPUT_DLL_NAME
,
...
...
@@ -419,7 +419,7 @@ void output_makefile (void)
puts
(
"Creating makefile"
);
fprintf
(
makefile
,
"# Generated from %s
.dll
by winedump.
\n
TOPSRCDIR = @top_srcdir@
\n
"
"# Generated from %s by winedump.
\n
TOPSRCDIR = @top_srcdir@
\n
"
"TOPOBJDIR = ../..
\n
SRCDIR = @srcdir@
\n
VPATH = @srcdir@
\n
"
"MODULE = %s
\n
EXTRALIBS = $(LIBUNICODE)
\n\n
"
"LDDLLFLAGS = @LDDLLFLAGS@
\n
SYMBOLFILE = $(MODULE).tmp.o
\n\n
"
...
...
tools/winedump/pe.c
View file @
de6d4e21
...
...
@@ -653,20 +653,13 @@ static enum FileSig check_headers(void)
int
pe_analysis
(
const
char
*
name
,
void
(
*
fn
)(
void
),
enum
FileSig
wanted_sig
)
{
int
fd
;
int
len
;
enum
FileSig
effective_sig
;
int
ret
=
1
;
struct
stat
s
;
char
*
name_suffix
;
setbuf
(
stdout
,
NULL
);
len
=
strlen
(
name
)
+
5
;
name_suffix
=
malloc
(
len
);
strcpy
(
name_suffix
,
name
);
strcat
(
name_suffix
,
".dll"
);
fd
=
open
(
name
_suffix
,
O_RDONLY
);
fd
=
open
(
name
,
O_RDONLY
);
if
(
fd
==
-
1
)
fatal
(
"Can't open file"
);
if
(
fstat
(
fd
,
&
s
)
<
0
)
fatal
(
"Can't get size"
);
...
...
@@ -798,11 +791,6 @@ static void do_grab_sym(void)
pFunc
=
RVA
(
exportDir
->
AddressOfFunctions
,
exportDir
->
NumberOfFunctions
*
sizeof
(
DWORD
));
if
(
!
pFunc
)
{
printf
(
"Can't grab functions' address table
\n
"
);
return
;}
/* Set DLL output names */
if
((
ptr
=
strrchr
(
globals
.
input_name
,
'/'
)))
globals
.
input_name
=
ptr
+
1
;
/* Strip path */
OUTPUT_UC_DLL_NAME
=
str_toupper
(
strdup
(
OUTPUT_DLL_NAME
));
for
(
i
=
0
;
i
<
exportDir
->
NumberOfFunctions
;
i
++
)
{
if
(
pFunc
[
i
]
&&
!
(
map
[
i
/
32
]
&
(
1
<<
(
i
%
32
))))
...
...
tools/winedump/winedump.h
View file @
de6d4e21
...
...
@@ -88,6 +88,7 @@ typedef struct __globals
/* Option arguments: generic */
const
char
*
input_name
;
/* */
const
char
*
input_module
;
/* input module name generated after input_name according mode */
/* Options: spec mode */
int
do_code
;
/* -c, -t, -f */
...
...
@@ -118,7 +119,7 @@ extern _globals globals;
/* Names to use for output DLL */
#define OUTPUT_DLL_NAME \
(globals.dll_name ? globals.dll_name :
globals.input_name
)
(globals.dll_name ? globals.dll_name :
(globals.input_module ? globals.input_module : globals.input_name)
)
#define OUTPUT_UC_DLL_NAME globals.uc_dll_name
/* Verbosity levels */
...
...
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