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)
...
@@ -271,22 +271,54 @@ static HRESULT parse_clr_tables(ASSEMBLY *assembly, ULONG offset)
return
S_OK
;
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
)
static
HRESULT
parse_clr_metadata
(
ASSEMBLY
*
assembly
)
{
{
METADATASTREAMHDR
*
streamhdr
;
METADATASTREAMHDR
*
streamhdr
;
ULONG
rva
,
i
,
ofs
;
ULONG
rva
,
i
,
ofs
;
LPSTR
stream
;
LPSTR
stream
;
HRESULT
hr
;
HRESULT
hr
;
DWORD
hdrsz
;
BYTE
*
ptr
;
BYTE
*
ptr
;
rva
=
assembly
->
corhdr
->
MetaData
.
VirtualAddress
;
hr
=
parse_metadata_header
(
assembly
,
&
hdrsz
);
assembly
->
metadatahdr
=
ImageRvaToVa
(
assembly
->
nthdr
,
assembly
->
data
,
if
(
FAILED
(
hr
))
rva
,
NULL
);
return
hr
;
if
(
!
assembly
->
metadatahdr
)
return
E_FAIL
;
ptr
=
ImageRvaToVa
(
assembly
->
nthdr
,
assembly
->
data
,
rva
=
assembly
->
corhdr
->
MetaData
.
VirtualAddress
;
rva
+
sizeof
(
METADATAHDR
)
,
NULL
);
ptr
=
ImageRvaToVa
(
assembly
->
nthdr
,
assembly
->
data
,
rva
+
hdrsz
,
NULL
);
if
(
!
ptr
)
if
(
!
ptr
)
return
E_FAIL
;
return
E_FAIL
;
...
@@ -393,7 +425,7 @@ HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file)
...
@@ -393,7 +425,7 @@ HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file)
return
S_OK
;
return
S_OK
;
failed:
failed:
assembly_release
(
assembly
);
assembly_release
(
assembly
);
return
hr
;
return
hr
;
}
}
...
@@ -402,6 +434,7 @@ HRESULT assembly_release(ASSEMBLY *assembly)
...
@@ -402,6 +434,7 @@ HRESULT assembly_release(ASSEMBLY *assembly)
if
(
!
assembly
)
if
(
!
assembly
)
return
S_OK
;
return
S_OK
;
HeapFree
(
GetProcessHeap
(),
0
,
assembly
->
metadatahdr
);
HeapFree
(
GetProcessHeap
(),
0
,
assembly
->
path
);
HeapFree
(
GetProcessHeap
(),
0
,
assembly
->
path
);
UnmapViewOfFile
(
assembly
->
data
);
UnmapViewOfFile
(
assembly
->
data
);
CloseHandle
(
assembly
->
hmap
);
CloseHandle
(
assembly
->
hmap
);
...
...
dlls/fusion/fusionpriv.h
View file @
8f985a33
...
@@ -27,6 +27,8 @@
...
@@ -27,6 +27,8 @@
#include "winbase.h"
#include "winbase.h"
#include "winuser.h"
#include "winuser.h"
#include <pshpack1.h>
typedef
struct
typedef
struct
{
{
ULONG
Signature
;
ULONG
Signature
;
...
@@ -34,13 +36,11 @@ typedef struct
...
@@ -34,13 +36,11 @@ typedef struct
USHORT
MinorVersion
;
USHORT
MinorVersion
;
ULONG
Reserved
;
ULONG
Reserved
;
ULONG
VersionLength
;
ULONG
VersionLength
;
BYTE
Version
[
12
]
;
LPSTR
Version
;
BYTE
Flags
;
BYTE
Flags
;
WORD
Streams
;
WORD
Streams
;
}
METADATAHDR
;
}
METADATAHDR
;
#include <pshpack1.h>
typedef
struct
typedef
struct
{
{
DWORD
Offset
;
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