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
92462c2b
Commit
92462c2b
authored
Jul 13, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for dumping exported entry points in NE modules.
parent
6812cbc8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
109 additions
and
3 deletions
+109
-3
ne.c
tools/winedump/ne.c
+109
-3
No files found.
tools/winedump/ne.c
View file @
92462c2b
...
...
@@ -33,6 +33,11 @@
#include "wine/winbase16.h"
#include "winedump.h"
static
inline
WORD
get_word
(
const
BYTE
*
ptr
)
{
return
ptr
[
0
]
|
(
ptr
[
1
]
<<
8
);
}
static
void
dump_ne_header
(
const
IMAGE_OS2_HEADER
*
ne
)
{
printf
(
"File header:
\n
"
);
...
...
@@ -64,12 +69,22 @@ static void dump_ne_names( const void *base, const IMAGE_OS2_HEADER *ne )
{
char
*
pstr
=
(
char
*
)
ne
+
ne
->
ne_restab
;
printf
(
"
\n
Resident
-
name table:
\n
"
);
printf
(
"
\n
Resident
name table:
\n
"
);
while
(
*
pstr
)
{
printf
(
"
%*.*s: %d
\n
"
,
*
pstr
,
*
pstr
,
pstr
+
1
,
*
(
WORD
*
)(
pstr
+
*
pstr
+
1
)
);
printf
(
"
%4d: %*.*s
\n
"
,
get_word
(
pstr
+
*
pstr
+
1
),
*
pstr
,
*
pstr
,
pstr
+
1
);
pstr
+=
*
pstr
+
1
+
sizeof
(
WORD
);
}
if
(
ne
->
ne_cbnrestab
)
{
printf
(
"
\n
Non-resident name table:
\n
"
);
pstr
=
(
char
*
)
base
+
ne
->
ne_nrestab
;
while
(
*
pstr
)
{
printf
(
" %4d: %*.*s
\n
"
,
get_word
(
pstr
+
*
pstr
+
1
),
*
pstr
,
*
pstr
,
pstr
+
1
);
pstr
+=
*
pstr
+
1
+
sizeof
(
WORD
);
}
}
}
static
const
char
*
get_resource_type
(
WORD
id
)
...
...
@@ -99,7 +114,7 @@ static void dump_ne_resources( const void *base, const IMAGE_OS2_HEADER *ne )
{
NE_NAMEINFO
*
name
;
const
void
*
res_ptr
=
(
char
*
)
ne
+
ne
->
ne_rsrctab
;
WORD
size_shift
=
*
(
WORD
*
)
res_ptr
;
WORD
size_shift
=
get_word
(
res_ptr
)
;
NE_TYPEINFO
*
info
=
(
NE_TYPEINFO
*
)((
WORD
*
)
res_ptr
+
1
);
int
count
;
...
...
@@ -122,6 +137,96 @@ static void dump_ne_resources( const void *base, const IMAGE_OS2_HEADER *ne )
}
}
static
const
char
*
get_export_name
(
const
void
*
base
,
const
IMAGE_OS2_HEADER
*
ne
,
int
ordinal
)
{
static
char
name
[
256
];
BYTE
*
pstr
;
int
pass
=
0
;
/* search the resident names */
while
(
pass
<
2
)
{
if
(
pass
==
0
)
/* resident names */
{
pstr
=
(
BYTE
*
)
ne
+
ne
->
ne_restab
;
if
(
*
pstr
)
pstr
+=
*
pstr
+
1
+
sizeof
(
WORD
);
/* skip first entry (module name) */
}
else
/* non-resident names */
{
if
(
!
ne
->
ne_cbnrestab
)
break
;
pstr
=
(
BYTE
*
)
base
+
ne
->
ne_nrestab
;
}
while
(
*
pstr
)
{
WORD
ord
=
get_word
(
pstr
+
*
pstr
+
1
);
if
(
ord
==
ordinal
)
{
memcpy
(
name
,
pstr
+
1
,
*
pstr
);
name
[
*
pstr
]
=
0
;
return
name
;
}
pstr
+=
*
pstr
+
1
+
sizeof
(
WORD
);
}
pass
++
;
}
name
[
0
]
=
0
;
return
name
;
}
static
void
dump_ne_exports
(
const
void
*
base
,
const
IMAGE_OS2_HEADER
*
ne
)
{
BYTE
*
ptr
=
(
BYTE
*
)
ne
+
ne
->
ne_enttab
;
BYTE
*
end
=
ptr
+
ne
->
ne_cbenttab
;
int
i
,
ordinal
=
1
;
if
(
!
ne
->
ne_cbenttab
||
!*
ptr
)
return
;
printf
(
"
\n
Exported entry points:
\n
"
);
while
(
ptr
<
end
&&
*
ptr
)
{
BYTE
count
=
*
ptr
++
;
BYTE
type
=
*
ptr
++
;
switch
(
type
)
{
case
0
:
/* next bundle */
ordinal
+=
count
;
break
;
case
0xff
:
/* movable */
for
(
i
=
0
;
i
<
count
;
i
++
)
{
printf
(
" %4d MOVABLE %d:%04x %s
\n
"
,
ordinal
+
i
,
ptr
[
3
],
get_word
(
ptr
+
4
),
get_export_name
(
base
,
ne
,
ordinal
+
i
)
);
ptr
+=
6
;
}
ordinal
+=
count
;
break
;
case
0xfe
:
/* constant */
for
(
i
=
0
;
i
<
count
;
i
++
)
{
printf
(
" %4d CONST %04x %s
\n
"
,
ordinal
+
i
,
get_word
(
ptr
+
1
),
get_export_name
(
base
,
ne
,
ordinal
+
i
)
);
ptr
+=
3
;
}
ordinal
+=
count
;
break
;
default:
/* fixed */
for
(
i
=
0
;
i
<
count
;
i
++
)
{
printf
(
" %4d FIXED %d:%04x %s
\n
"
,
ordinal
+
i
,
type
,
get_word
(
ptr
+
1
),
get_export_name
(
base
,
ne
,
ordinal
+
i
)
);
ptr
+=
3
;
}
ordinal
+=
count
;
break
;
}
}
}
void
ne_dump
(
const
void
*
exe
,
size_t
exe_size
)
{
const
IMAGE_DOS_HEADER
*
dos
=
exe
;
...
...
@@ -130,4 +235,5 @@ void ne_dump( const void *exe, size_t exe_size )
dump_ne_header
(
ne
);
dump_ne_names
(
exe
,
ne
);
dump_ne_resources
(
exe
,
ne
);
dump_ne_exports
(
exe
,
ne
);
}
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