Skip to content

Commit 030e396

Browse files
[MSCOREE] Sync to wine-10.0
1 parent 4e1b8bf commit 030e396

25 files changed

+4508
-1177
lines changed

dll/win32/mscoree/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
remove_definitions(-D_WIN32_WINNT=0x502)
3-
add_definitions(-D_WIN32_WINNT=0x600)
3+
add_definitions(-D_WIN32_WINNT=0x600 -DUSE_NEW_WINE_REGISTER_RESOURCES)
44

55
spec2def(mscoree.dll mscoree.spec)
66

@@ -24,8 +24,8 @@ add_library(mscoree MODULE
2424
${CMAKE_CURRENT_BINARY_DIR}/mscoree.def)
2525

2626
set_module_type(mscoree win32dll)
27-
target_link_libraries(mscoree uuid wine)
28-
add_importlibs(mscoree dbghelp advapi32 shell32 ole32 shlwapi msvcrt kernel32 ntdll)
29-
add_pch(mscoree mscoree_private.h "${PCH_SKIP_SOURCE}")
27+
target_link_libraries(mscoree uuid wine oldnames)
28+
add_importlibs(mscoree dbghelp advapi32 shell32 kernel32_vista ole32 shlwapi msvcrt kernel32 ntdll)
29+
#add_pch(mscoree mscoree_private.h "${PCH_SKIP_SOURCE}")
3030
add_cd_file(TARGET mscoree DESTINATION reactos/system32 FOR all)
3131
set_wine_module_FIXME(mscoree) # CORE-5743: No CONST_VTABLE

dll/win32/mscoree/assembly.c

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,23 @@
1818
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
1919
*/
2020

21+
#include <stdarg.h>
22+
#include <stdio.h>
23+
24+
#include "windef.h"
25+
#include "winbase.h"
26+
#include "winuser.h"
27+
#include "winver.h"
28+
#include "dbghelp.h"
29+
#include "ole2.h"
30+
#include "mscoree.h"
31+
#include "corhdr.h"
32+
#include "metahost.h"
33+
#include "cordebug.h"
34+
#include "wine/list.h"
2135
#include "mscoree_private.h"
2236

23-
#include <winver.h>
24-
#include <dbghelp.h>
37+
#include "wine/debug.h"
2538

2639
typedef struct
2740
{
@@ -49,7 +62,7 @@ typedef struct tagCLRTABLE
4962

5063
struct tagASSEMBLY
5164
{
52-
int is_mapped_file;
65+
BOOL is_mapped_file;
5366

5467
/* mapped files */
5568
LPWSTR path;
@@ -64,20 +77,6 @@ struct tagASSEMBLY
6477
METADATAHDR *metadatahdr;
6578
};
6679

67-
static inline LPWSTR strdupW(LPCWSTR src)
68-
{
69-
LPWSTR dest;
70-
71-
if (!src)
72-
return NULL;
73-
74-
dest = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(src) + 1) * sizeof(WCHAR));
75-
if (dest)
76-
lstrcpyW(dest, src);
77-
78-
return dest;
79-
}
80-
8180
static void* assembly_rva_to_va(ASSEMBLY *assembly, ULONG rva)
8281
{
8382
if (assembly->is_mapped_file)
@@ -115,7 +114,7 @@ static HRESULT parse_metadata_header(ASSEMBLY *assembly, DWORD *hdrsz)
115114

116115
metadatahdr = (METADATAHDR *)ptr;
117116

118-
assembly->metadatahdr = HeapAlloc(GetProcessHeap(), 0, sizeof(METADATAHDR));
117+
assembly->metadatahdr = malloc(sizeof(METADATAHDR));
119118
if (!assembly->metadatahdr)
120119
return E_OUTOFMEMORY;
121120

@@ -195,13 +194,13 @@ HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file)
195194

196195
*out = NULL;
197196

198-
assembly = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ASSEMBLY));
197+
assembly = calloc(1, sizeof(ASSEMBLY));
199198
if (!assembly)
200199
return E_OUTOFMEMORY;
201200

202-
assembly->is_mapped_file = 1;
201+
assembly->is_mapped_file = TRUE;
203202

204-
assembly->path = strdupW(file);
203+
assembly->path = wcsdup(file);
205204
if (!assembly->path)
206205
{
207206
hr = E_OUTOFMEMORY;
@@ -249,11 +248,11 @@ HRESULT assembly_from_hmodule(ASSEMBLY **out, HMODULE hmodule)
249248

250249
*out = NULL;
251250

252-
assembly = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ASSEMBLY));
251+
assembly = calloc(1, sizeof(ASSEMBLY));
253252
if (!assembly)
254253
return E_OUTOFMEMORY;
255254

256-
assembly->is_mapped_file = 0;
255+
assembly->is_mapped_file = FALSE;
257256

258257
assembly->data = (BYTE*)hmodule;
259258

@@ -277,9 +276,9 @@ HRESULT assembly_release(ASSEMBLY *assembly)
277276
CloseHandle(assembly->hmap);
278277
CloseHandle(assembly->hfile);
279278
}
280-
HeapFree(GetProcessHeap(), 0, assembly->metadatahdr);
281-
HeapFree(GetProcessHeap(), 0, assembly->path);
282-
HeapFree(GetProcessHeap(), 0, assembly);
279+
free(assembly->metadatahdr);
280+
free(assembly->path);
281+
free(assembly);
283282

284283
return S_OK;
285284
}
@@ -300,3 +299,17 @@ HRESULT assembly_get_vtable_fixups(ASSEMBLY *assembly, VTableFixup **fixups, DWO
300299

301300
return S_OK;
302301
}
302+
303+
HRESULT assembly_get_native_entrypoint(ASSEMBLY *assembly, NativeEntryPointFunc *func)
304+
{
305+
if (assembly->corhdr->Flags & COMIMAGE_FLAGS_NATIVE_ENTRYPOINT)
306+
{
307+
*func = assembly_rva_to_va(assembly, assembly->corhdr->EntryPointRVA);
308+
return S_OK;
309+
}
310+
else
311+
{
312+
*func = NULL;
313+
return S_FALSE;
314+
}
315+
}

0 commit comments

Comments
 (0)