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
8f985a33
Commit
8f985a33
authored
Jul 16, 2008
by
James Hawkins
Committed by
Alexandre Julliard
Jul 16, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fusion: The VersionLength member is not constant, so dynamically load the metadata header.
parent
378fde9a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
11 deletions
+44
-11
assembly.c
dlls/fusion/assembly.c
+41
-8
fusionpriv.h
dlls/fusion/fusionpriv.h
+3
-3
No files found.
dlls/fusion/assembly.c
View file @
8f985a33
...
...
@@ -271,22 +271,54 @@ static HRESULT parse_clr_tables(ASSEMBLY *assembly, ULONG offset)
return
S_OK
;
}
static
HRESULT
parse_metadata_header
(
ASSEMBLY
*
assembly
,
DWORD
*
hdrsz
)
{
METADATAHDR
*
metadatahdr
;
BYTE
*
ptr
,
*
dest
;
DWORD
size
,
ofs
;
ULONG
rva
;
rva
=
assembly
->
corhdr
->
MetaData
.
VirtualAddress
;
ptr
=
ImageRvaToVa
(
assembly
->
nthdr
,
assembly
->
data
,
rva
,
NULL
);
if
(
!
ptr
)
return
E_FAIL
;
metadatahdr
=
(
METADATAHDR
*
)
ptr
;
assembly
->
metadatahdr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
METADATAHDR
));
if
(
!
assembly
->
metadatahdr
)
return
E_OUTOFMEMORY
;
size
=
FIELD_OFFSET
(
METADATAHDR
,
Version
);
memcpy
(
assembly
->
metadatahdr
,
metadatahdr
,
size
);
/* we don't care about the version string */
ofs
=
FIELD_OFFSET
(
METADATAHDR
,
Flags
);
ptr
+=
FIELD_OFFSET
(
METADATAHDR
,
Version
)
+
metadatahdr
->
VersionLength
+
1
;
dest
=
(
BYTE
*
)
assembly
->
metadatahdr
+
ofs
;
memcpy
(
dest
,
ptr
,
sizeof
(
METADATAHDR
)
-
ofs
);
*
hdrsz
=
sizeof
(
METADATAHDR
)
-
sizeof
(
LPSTR
)
+
metadatahdr
->
VersionLength
+
1
;
return
S_OK
;
}
static
HRESULT
parse_clr_metadata
(
ASSEMBLY
*
assembly
)
{
METADATASTREAMHDR
*
streamhdr
;
ULONG
rva
,
i
,
ofs
;
LPSTR
stream
;
HRESULT
hr
;
DWORD
hdrsz
;
BYTE
*
ptr
;
rva
=
assembly
->
corhdr
->
MetaData
.
VirtualAddress
;
assembly
->
metadatahdr
=
ImageRvaToVa
(
assembly
->
nthdr
,
assembly
->
data
,
rva
,
NULL
);
if
(
!
assembly
->
metadatahdr
)
return
E_FAIL
;
hr
=
parse_metadata_header
(
assembly
,
&
hdrsz
);
if
(
FAILED
(
hr
))
return
hr
;
ptr
=
ImageRvaToVa
(
assembly
->
nthdr
,
assembly
->
data
,
rva
+
sizeof
(
METADATAHDR
)
,
NULL
);
rva
=
assembly
->
corhdr
->
MetaData
.
VirtualAddress
;
ptr
=
ImageRvaToVa
(
assembly
->
nthdr
,
assembly
->
data
,
rva
+
hdrsz
,
NULL
);
if
(
!
ptr
)
return
E_FAIL
;
...
...
@@ -393,7 +425,7 @@ HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file)
return
S_OK
;
failed:
assembly_release
(
assembly
);
assembly_release
(
assembly
);
return
hr
;
}
...
...
@@ -402,6 +434,7 @@ HRESULT assembly_release(ASSEMBLY *assembly)
if
(
!
assembly
)
return
S_OK
;
HeapFree
(
GetProcessHeap
(),
0
,
assembly
->
metadatahdr
);
HeapFree
(
GetProcessHeap
(),
0
,
assembly
->
path
);
UnmapViewOfFile
(
assembly
->
data
);
CloseHandle
(
assembly
->
hmap
);
...
...
dlls/fusion/fusionpriv.h
View file @
8f985a33
...
...
@@ -27,6 +27,8 @@
#include "winbase.h"
#include "winuser.h"
#include <pshpack1.h>
typedef
struct
{
ULONG
Signature
;
...
...
@@ -34,13 +36,11 @@ typedef struct
USHORT
MinorVersion
;
ULONG
Reserved
;
ULONG
VersionLength
;
BYTE
Version
[
12
]
;
LPSTR
Version
;
BYTE
Flags
;
WORD
Streams
;
}
METADATAHDR
;
#include <pshpack1.h>
typedef
struct
{
DWORD
Offset
;
...
...
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