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
6606615f
Commit
6606615f
authored
Apr 02, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dump string resources in a more readable way.
parent
6cd88fe6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
0 deletions
+73
-0
pe.c
tools/winedump/pe.c
+73
-0
No files found.
tools/winedump/pe.c
View file @
6606615f
...
@@ -680,6 +680,75 @@ void dump_data( const unsigned char *ptr, unsigned int size, const char *prefix
...
@@ -680,6 +680,75 @@ void dump_data( const unsigned char *ptr, unsigned int size, const char *prefix
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
/* dump a Unicode string with proper escaping */
int
dump_strW
(
const
WCHAR
*
str
,
size_t
len
)
{
static
const
char
escapes
[
32
]
=
".......abtnvfr.............e...."
;
char
buffer
[
256
];
char
*
pos
=
buffer
;
int
count
=
0
;
for
(;
len
;
str
++
,
len
--
)
{
if
(
pos
>
buffer
+
sizeof
(
buffer
)
-
8
)
{
fwrite
(
buffer
,
pos
-
buffer
,
1
,
stdout
);
count
+=
pos
-
buffer
;
pos
=
buffer
;
}
if
(
*
str
>
127
)
/* hex escape */
{
if
(
len
>
1
&&
str
[
1
]
<
128
&&
isxdigit
((
char
)
str
[
1
]))
pos
+=
sprintf
(
pos
,
"
\\
x%04x"
,
*
str
);
else
pos
+=
sprintf
(
pos
,
"
\\
x%x"
,
*
str
);
continue
;
}
if
(
*
str
<
32
)
/* octal or C escape */
{
if
(
!*
str
&&
len
==
1
)
continue
;
/* do not output terminating NULL */
if
(
escapes
[
*
str
]
!=
'.'
)
pos
+=
sprintf
(
pos
,
"
\\
%c"
,
escapes
[
*
str
]
);
else
if
(
len
>
1
&&
str
[
1
]
>=
'0'
&&
str
[
1
]
<=
'7'
)
pos
+=
sprintf
(
pos
,
"
\\
%03o"
,
*
str
);
else
pos
+=
sprintf
(
pos
,
"
\\
%o"
,
*
str
);
continue
;
}
if
(
*
str
==
'\\'
)
*
pos
++
=
'\\'
;
*
pos
++
=
*
str
;
}
fwrite
(
buffer
,
pos
-
buffer
,
1
,
stdout
);
count
+=
pos
-
buffer
;
return
count
;
}
/* dump data for a STRING resource */
void
dump_string_data
(
const
WCHAR
*
ptr
,
unsigned
int
size
,
unsigned
int
id
,
const
char
*
prefix
)
{
int
i
;
for
(
i
=
0
;
i
<
16
&&
size
;
i
++
)
{
int
len
=
*
ptr
++
;
if
(
len
>=
size
)
{
len
=
size
;
size
=
0
;
}
else
size
-=
len
+
1
;
if
(
len
)
{
printf
(
"%s%04x
\"
"
,
prefix
,
(
id
-
1
)
*
16
+
i
);
dump_strW
(
ptr
,
len
);
printf
(
"
\"\n
"
);
ptr
+=
len
;
}
}
}
static
void
dump_dir_resource
(
void
)
static
void
dump_dir_resource
(
void
)
{
{
const
IMAGE_RESOURCE_DIRECTORY
*
root
=
get_dir
(
IMAGE_FILE_RESOURCE_DIRECTORY
);
const
IMAGE_RESOURCE_DIRECTORY
*
root
=
get_dir
(
IMAGE_FILE_RESOURCE_DIRECTORY
);
...
@@ -730,6 +799,10 @@ static void dump_dir_resource(void)
...
@@ -730,6 +799,10 @@ static void dump_dir_resource(void)
printf
(
" Language=%04x:
\n
"
,
e3
->
u1
.
s2
.
Id
);
printf
(
" Language=%04x:
\n
"
,
e3
->
u1
.
s2
.
Id
);
data
=
(
IMAGE_RESOURCE_DATA_ENTRY
*
)((
char
*
)
root
+
e3
->
u2
.
OffsetToData
);
data
=
(
IMAGE_RESOURCE_DATA_ENTRY
*
)((
char
*
)
root
+
e3
->
u2
.
OffsetToData
);
if
(
!
e1
->
u1
.
s1
.
NameIsString
&&
e1
->
u1
.
s2
.
Id
==
6
)
dump_string_data
(
RVA
(
data
->
OffsetToData
,
data
->
Size
),
data
->
Size
,
e2
->
u1
.
s2
.
Id
,
" "
);
else
dump_data
(
RVA
(
data
->
OffsetToData
,
data
->
Size
),
data
->
Size
,
" "
);
dump_data
(
RVA
(
data
->
OffsetToData
,
data
->
Size
),
data
->
Size
,
" "
);
}
}
}
}
...
...
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