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
81575421
Commit
81575421
authored
Mar 25, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
version: Support loading resources from both 32-bit and 64-bit PE binaries.
parent
d11185a8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
9 deletions
+24
-9
resource.c
dlls/version/resource.c
+24
-9
No files found.
dlls/version/resource.c
View file @
81575421
...
@@ -196,7 +196,11 @@ static BOOL find_ne_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff )
...
@@ -196,7 +196,11 @@ static BOOL find_ne_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff )
*/
*/
static
BOOL
find_pe_resource
(
HFILE
lzfd
,
DWORD
*
resLen
,
DWORD
*
resOff
)
static
BOOL
find_pe_resource
(
HFILE
lzfd
,
DWORD
*
resLen
,
DWORD
*
resOff
)
{
{
IMAGE_NT_HEADERS
pehd
;
union
{
IMAGE_NT_HEADERS32
nt32
;
IMAGE_NT_HEADERS64
nt64
;
}
pehd
;
DWORD
pehdoffset
;
DWORD
pehdoffset
;
PIMAGE_DATA_DIRECTORY
resDataDir
;
PIMAGE_DATA_DIRECTORY
resDataDir
;
PIMAGE_SECTION_HEADER
sections
;
PIMAGE_SECTION_HEADER
sections
;
...
@@ -205,14 +209,27 @@ static BOOL find_pe_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff )
...
@@ -205,14 +209,27 @@ static BOOL find_pe_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff )
const
void
*
resDir
;
const
void
*
resDir
;
const
IMAGE_RESOURCE_DIRECTORY
*
resPtr
;
const
IMAGE_RESOURCE_DIRECTORY
*
resPtr
;
const
IMAGE_RESOURCE_DATA_ENTRY
*
resData
;
const
IMAGE_RESOURCE_DATA_ENTRY
*
resData
;
int
i
,
nSections
;
int
i
,
len
,
nSections
;
BOOL
ret
=
FALSE
;
BOOL
ret
=
FALSE
;
/* Read in PE header */
/* Read in PE header */
pehdoffset
=
LZSeek
(
lzfd
,
0
,
SEEK_CUR
);
pehdoffset
=
LZSeek
(
lzfd
,
0
,
SEEK_CUR
);
if
(
sizeof
(
pehd
)
!=
LZRead
(
lzfd
,
(
LPSTR
)
&
pehd
,
sizeof
(
pehd
)
)
)
return
0
;
len
=
LZRead
(
lzfd
,
(
LPSTR
)
&
pehd
,
sizeof
(
pehd
)
);
if
(
len
<
sizeof
(
pehd
.
nt32
.
FileHeader
))
return
0
;
if
(
len
<
sizeof
(
pehd
))
memset
(
(
char
*
)
&
pehd
+
len
,
0
,
sizeof
(
pehd
)
-
len
);
switch
(
pehd
.
nt32
.
OptionalHeader
.
Magic
)
{
case
IMAGE_NT_OPTIONAL_HDR32_MAGIC
:
resDataDir
=
pehd
.
nt32
.
OptionalHeader
.
DataDirectory
+
IMAGE_DIRECTORY_ENTRY_RESOURCE
;
break
;
case
IMAGE_NT_OPTIONAL_HDR64_MAGIC
:
resDataDir
=
pehd
.
nt64
.
OptionalHeader
.
DataDirectory
+
IMAGE_DIRECTORY_ENTRY_RESOURCE
;
break
;
default:
return
0
;
}
resDataDir
=
pehd
.
OptionalHeader
.
DataDirectory
+
IMAGE_DIRECTORY_ENTRY_RESOURCE
;
if
(
!
resDataDir
->
Size
)
if
(
!
resDataDir
->
Size
)
{
{
TRACE
(
"No resources in PE dll
\n
"
);
TRACE
(
"No resources in PE dll
\n
"
);
...
@@ -220,15 +237,13 @@ static BOOL find_pe_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff )
...
@@ -220,15 +237,13 @@ static BOOL find_pe_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff )
}
}
/* Read in section table */
/* Read in section table */
nSections
=
pehd
.
FileHeader
.
NumberOfSections
;
nSections
=
pehd
.
nt32
.
FileHeader
.
NumberOfSections
;
sections
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sections
=
HeapAlloc
(
GetProcessHeap
(),
0
,
nSections
*
sizeof
(
IMAGE_SECTION_HEADER
)
);
nSections
*
sizeof
(
IMAGE_SECTION_HEADER
)
);
if
(
!
sections
)
return
FALSE
;
if
(
!
sections
)
return
FALSE
;
LZSeek
(
lzfd
,
pehdoffset
+
len
=
FIELD_OFFSET
(
IMAGE_NT_HEADERS32
,
OptionalHeader
)
+
pehd
.
nt32
.
FileHeader
.
SizeOfOptionalHeader
;
sizeof
(
DWORD
)
+
/* Signature */
LZSeek
(
lzfd
,
pehdoffset
+
len
,
SEEK_SET
);
sizeof
(
IMAGE_FILE_HEADER
)
+
pehd
.
FileHeader
.
SizeOfOptionalHeader
,
SEEK_SET
);
if
(
nSections
*
sizeof
(
IMAGE_SECTION_HEADER
)
!=
if
(
nSections
*
sizeof
(
IMAGE_SECTION_HEADER
)
!=
LZRead
(
lzfd
,
(
LPSTR
)
sections
,
nSections
*
sizeof
(
IMAGE_SECTION_HEADER
)
)
)
LZRead
(
lzfd
,
(
LPSTR
)
sections
,
nSections
*
sizeof
(
IMAGE_SECTION_HEADER
)
)
)
...
...
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