ReactOS 0.4.16-dev-2332-g4cba65d
mscoree.c File Reference
#include <stdio.h>
#include "corerror.h"
#include "mscoree.h"
#include "metahost.h"
#include "shlwapi.h"
#include "initguid.h"
#include "wine/test.h"
Include dependency graph for mscoree.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

 DEFINE_GUID (IID__AppDomain, 0x05f696dc, 0x2b29, 0x3663, 0xad, 0x8b, 0xc4, 0x38, 0x9c, 0xf2, 0xa7, 0x13)
 
static HRESULT (WINAPI *pGetCORVersion)(LPWSTR
 
static BOOL init_functionpointers (void)
 
static int check_runtime (void)
 
static BOOL runtime_is_usable (void)
 
static void test_versioninfo (void)
 
static void test_loadlibraryshim (void)
 
static void create_xml_file (LPCWSTR filename)
 
static void test_createconfigstream (void)
 
static void test_createinstance (void)
 
static BOOL write_resource (const WCHAR *resource, const WCHAR *filename)
 
static BOOL compile_cs (const WCHAR *source, const WCHAR *target, const WCHAR *type, const WCHAR *args)
 
static BOOL create_new_dir (WCHAR newdir[MAX_PATH], const WCHAR *prefix)
 
static void test_loadpaths_execute (const WCHAR *exe_name, const WCHAR *dll_name, const WCHAR *cfg_name, const WCHAR *dll_dest, BOOL expect_failure, BOOL todo)
 
static void test_loadpaths (BOOL neutral)
 
static void test_createdomain (void)
 
 START_TEST (mscoree)
 

Variables

static int has_mono = 0
 
static const WCHAR v4_0 [] = {'v','4','.','0','.','3','0','3','1','9',0}
 
static HMODULE hmscoree
 
static DWORD
 
static DWORD *static INT *static DWORD *static LPCWSTR
 
static DWORD *static INT *static DWORD *static LPWSTR
 
static DWORD *static INT *static DWORD *static DWORD DWORD *static LPVOID
 
static DWORD *static INT *static DWORD *static DWORD DWORD *static HMODULE *static IStream **static REFIID
 
static DWORD *static INT *static DWORD *static DWORD DWORD *static HMODULE *static IStream **static VOID **static VOID **static BOOL no_legacy_runtimes
 
static const char xmldata []
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file mscoree.c.

Function Documentation

◆ check_runtime()

static int check_runtime ( void  )
static

Definition at line 85 of file mscoree.c.

86{
88 ICLRRuntimeInfo *runtimeinfo;
89 ICorRuntimeHost *runtimehost;
90 HRESULT hr;
91
92 if (!pCLRCreateInstance)
93 {
94 win_skip("Function CLRCreateInstance not found.\n");
95 return 1;
96 }
97
98 hr = pCLRCreateInstance(&CLSID_CLRMetaHost, &IID_ICLRMetaHost, (void **)&metahost);
99 if (hr == E_NOTIMPL)
100 {
101 win_skip("CLRCreateInstance not implemented\n");
102 return 1;
103 }
104 ok(SUCCEEDED(hr), "CLRCreateInstance failed, hr=%#.8lx\n", hr);
105 if (FAILED(hr))
106 return 1;
107
108 hr = ICLRMetaHost_GetRuntime(metahost, v4_0, &IID_ICLRRuntimeInfo, (void **)&runtimeinfo);
109 ok(SUCCEEDED(hr), "ICLRMetaHost::GetRuntime failed, hr=%#.8lx\n", hr);
110 if (FAILED(hr))
111 return 1;
112
113 hr = ICLRRuntimeInfo_GetInterface(runtimeinfo, &CLSID_CorRuntimeHost, &IID_ICorRuntimeHost,
114 (void **)&runtimehost);
115 todo_wine_if(!has_mono) ok(SUCCEEDED(hr), "ICLRRuntimeInfo::GetInterface failed, hr=%#.8lx\n", hr);
116 if (FAILED(hr))
117 return 1;
118
119 hr = ICorRuntimeHost_Start(runtimehost);
120 ok(SUCCEEDED(hr), "ICorRuntimeHost::Start failed, hr=%#.8lx\n", hr);
121 if (FAILED(hr))
122 return 1;
123
124 ICorRuntimeHost_Release(runtimehost);
125
126 ICLRRuntimeInfo_Release(runtimeinfo);
127
128 ICLRMetaHost_ExitProcess(metahost, 0);
129
130 ok(0, "ICLRMetaHost_ExitProcess is not supposed to return\n");
131 return 1;
132}
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define win_skip
Definition: minitest.h:67
#define todo_wine_if(is_todo)
Definition: minitest.h:81
static ICLRMetaHost * metahost
Definition: metahost.c:42
static int has_mono
Definition: mscoree.c:32
static const WCHAR v4_0[]
Definition: mscoree.c:39
HRESULT hr
Definition: shlfolder.c:183

Referenced by START_TEST().

◆ compile_cs()

static BOOL compile_cs ( const WCHAR source,
const WCHAR target,
const WCHAR type,
const WCHAR args 
)
static

Definition at line 565 of file mscoree.c.

566{
567 static const WCHAR *csc = L"C:\\windows\\Microsoft.NET\\Framework\\v2.0.50727\\csc.exe";
568 WCHAR cmdline[2 * MAX_PATH + 74];
570 STARTUPINFOW si = { 0 };
571 BOOL ret;
572
573 if (!PathFileExistsW(csc))
574 {
575 skip("Can't find csc.exe\n");
576 return FALSE;
577 }
578
579 swprintf(cmdline, ARRAY_SIZE(cmdline), L"%s /t:%s %s /out:\"%s\" \"%s\"", csc, type, args, target, source);
580
581 si.cb = sizeof(si);
583 ok(ret, "Could not create process: %lu\n", GetLastError());
584
588
590 ok(ret, "Compilation failed\n");
591
592 return ret;
593}
#define skip(...)
Definition: atltest.h:64
#define ARRAY_SIZE(A)
Definition: main.h:20
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4442
BOOL WINAPI PathFileExistsW(const WCHAR *path)
Definition: path.c:2607
#define swprintf
Definition: precomp.h:40
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static PROCESS_INFORMATION pi
Definition: debugger.c:2303
static SYSTEM_INFO si
Definition: virtual.c:39
#define wait_child_process
Definition: test.h:177
TCHAR * cmdline
Definition: stretchblt.cpp:32
Definition: match.c:390
Definition: tools.h:99
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define DETACHED_PROCESS
Definition: winbase.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by test_loadpaths().

◆ create_new_dir()

static BOOL create_new_dir ( WCHAR  newdir[MAX_PATH],
const WCHAR prefix 
)
static

Definition at line 595 of file mscoree.c.

596{
598 BOOL try_tmpdir = TRUE;
599 static unsigned i = 0;
600
602
603 while (1)
604 {
605 swprintf(newdir, MAX_PATH, L"%s\\%s%04d", path, prefix, i);
606 if (CreateDirectoryW(newdir, NULL))
607 return TRUE;
608 switch (GetLastError())
609 {
611 if (!try_tmpdir)
612 return FALSE;
613 try_tmpdir = FALSE;
615 path[wcslen(path) - 1] = 0; /* redundant trailing backslash */
616 break;
618 i++;
619 break;
620 default:
621 return FALSE;
622 }
623 }
624}
#define TRUE
Definition: types.h:120
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:58
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:1999
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
Character const *const prefix
Definition: tempnam.cpp:195

Referenced by test_loadpaths_execute().

◆ create_xml_file()

static void create_xml_file ( LPCWSTR  filename)
static

Definition at line 421 of file mscoree.c.

422{
423 DWORD dwNumberOfBytesWritten;
426 ok(hfile != INVALID_HANDLE_VALUE, "Could not open %s for writing: %lu\n", wine_dbgstr_w(filename), GetLastError());
427 WriteFile(hfile, xmldata, sizeof(xmldata) - 1, &dwNumberOfBytesWritten, NULL);
428 CloseHandle(hfile);
429}
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
unsigned long DWORD
Definition: ntddk_ex.h:95
const char * filename
Definition: ioapi.h:137
#define wine_dbgstr_w
Definition: kernel32.h:34
#define CREATE_ALWAYS
Definition: disk.h:72
static const char xmldata[]
Definition: mscoree.c:413
#define GENERIC_WRITE
Definition: nt_native.h:90

Referenced by test_createconfigstream().

◆ DEFINE_GUID()

DEFINE_GUID ( IID__AppDomain  ,
0x05f696dc  ,
0x2b29  ,
0x3663  ,
0xad  ,
0x8b  ,
0xc4  ,
0x38  ,
0x9c  ,
0xf2  ,
0xa7  ,
0x13   
)

◆ HRESULT()

static HRESULT ( WINAPI pGetCORVersion)
static

◆ init_functionpointers()

static BOOL init_functionpointers ( void  )
static

Definition at line 54 of file mscoree.c.

55{
56 hmscoree = LoadLibraryA("mscoree.dll");
57
58 if (!hmscoree)
59 {
60 win_skip("mscoree.dll not available\n");
61 return FALSE;
62 }
63
64 pGetCORVersion = (void *)GetProcAddress(hmscoree, "GetCORVersion");
65 pCorIsLatestSvc = (void *)GetProcAddress(hmscoree, "CorIsLatestSvc");
66 pGetCORSystemDirectory = (void *)GetProcAddress(hmscoree, "GetCORSystemDirectory");
67 pGetRequestedRuntimeInfo = (void *)GetProcAddress(hmscoree, "GetRequestedRuntimeInfo");
68 pLoadLibraryShim = (void *)GetProcAddress(hmscoree, "LoadLibraryShim");
69 pCreateConfigStream = (void *)GetProcAddress(hmscoree, "CreateConfigStream");
70 pCreateInterface = (void *)GetProcAddress(hmscoree, "CreateInterface");
71 pCLRCreateInstance = (void *)GetProcAddress(hmscoree, "CLRCreateInstance");
72
73 if (!pGetCORVersion || !pGetCORSystemDirectory || !pGetRequestedRuntimeInfo || !pLoadLibraryShim ||
74 !pCreateInterface || !pCLRCreateInstance || !pCorIsLatestSvc
75 )
76 {
77 win_skip("functions not available\n");
79 return FALSE;
80 }
81
82 return TRUE;
83}
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static HMODULE hmscoree
Definition: mscoree.c:41

Referenced by START_TEST().

◆ runtime_is_usable()

static BOOL runtime_is_usable ( void  )
static

Definition at line 134 of file mscoree.c.

135{
136 static const char cmdline_format[] = "\"%s\" mscoree check_runtime";
137 char** argv;
138 char cmdline[MAX_PATH + sizeof(cmdline_format)];
139 STARTUPINFOA si = {0};
141 BOOL ret;
142 DWORD exitcode;
143
145
146 sprintf(cmdline, cmdline_format, argv[0]);
147
148 si.cb = sizeof(si);
149
151 ok(ret, "Could not create process: %lu\n", GetLastError());
152 if (!ret)
153 return FALSE;
154
156
158
159 ret = GetExitCodeProcess(pi.hProcess, &exitcode);
160 ok(ret, "GetExitCodeProcess failed: %lu\n", GetLastError());
162
163 if (!ret || exitcode != 0)
164 {
165 todo_wine_if(!has_mono) win_skip(".NET 4.0 runtime is not usable\n");
166 return FALSE;
167 }
168
169 return TRUE;
170}
BOOL WINAPI GetExitCodeProcess(IN HANDLE hProcess, IN LPDWORD lpExitCode)
Definition: proc.c:1166
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(const char *app_name, char *cmd_line, SECURITY_ATTRIBUTES *process_attr, SECURITY_ATTRIBUTES *thread_attr, BOOL inherit, DWORD flags, void *env, const char *cur_dir, STARTUPINFOA *startup_info, PROCESS_INFORMATION *info)
Definition: process.c:686
#define INFINITE
Definition: serial.h:102
#define sprintf
Definition: sprintf.c:45
#define argv
Definition: mplay32.c:18
int winetest_get_mainargs(char ***pargv)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( mscoree  )

Definition at line 897 of file mscoree.c.

898{
899 int argc;
900 char** argv;
901
903 return;
904
906 if (argc >= 3 && !strcmp(argv[2], "check_runtime"))
907 {
908 int result = check_runtime();
910 exit(result);
911 }
912
917
918 if (runtime_is_usable())
919 {
921 }
922
925
927}
MonoAssembly int argc
Definition: metahost.c:107
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
GLuint64EXT * result
Definition: glext.h:11304
static int check_runtime(void)
Definition: mscoree.c:85
static void test_createdomain(void)
Definition: mscoree.c:811
static BOOL init_functionpointers(void)
Definition: mscoree.c:54
static void test_createconfigstream(void)
Definition: mscoree.c:431
static void test_versioninfo(void)
Definition: mscoree.c:172
static void test_createinstance(void)
Definition: mscoree.c:512
static BOOL runtime_is_usable(void)
Definition: mscoree.c:134
static void test_loadpaths(BOOL neutral)
Definition: mscoree.c:734
static void test_loadlibraryshim(void)
Definition: mscoree.c:304
#define exit(n)
Definition: config.h:202

◆ test_createconfigstream()

static void test_createconfigstream ( void  )
static

Definition at line 431 of file mscoree.c.

432{
434 WCHAR file[] = {'c', 'o', 'n', 'f', '.', 'x', 'm', 'l', 0};
435 WCHAR nonexistent[] = {'n', 'o', 'n', 'e', 'x', 'i', 's', 't', '.', 'x', 'm', 'l', 0};
437 HRESULT hr;
438 char buffer[256] = {0};
439
440 if (!pCreateConfigStream)
441 {
442 win_skip("CreateConfigStream not available\n");
443 return;
444 }
445
448
449 hr = pCreateConfigStream(NULL, &stream);
450 ok(hr == E_FAIL ||
451 broken(hr == HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND)) || /* some WinXP, Win2K3 and Win7 */
452 broken(hr == S_OK && !stream), /* some Win2K3 */
453 "CreateConfigStream returned %lx\n", hr);
454
455 hr = pCreateConfigStream(path, NULL);
456 ok(hr == COR_E_NULLREFERENCE, "CreateConfigStream returned %lx\n", hr);
457
458 hr = pCreateConfigStream(NULL, NULL);
459 ok(hr == COR_E_NULLREFERENCE, "CreateConfigStream returned %lx\n", hr);
460
461 hr = pCreateConfigStream(nonexistent, &stream);
462 ok(hr == COR_E_FILENOTFOUND, "CreateConfigStream returned %lx\n", hr);
463 ok(stream == NULL, "Expected stream to be NULL\n");
464
465 hr = pCreateConfigStream(path, &stream);
466 ok(hr == S_OK, "CreateConfigStream failed, hr=%lx\n", hr);
467 ok(stream != NULL, "Expected non-NULL stream\n");
468
469 if (stream)
470 {
471 DWORD count;
474 IStream *stream2 = NULL;
475 ULONG ref;
476
477 hr = IStream_Read(stream, buffer, strlen(xmldata), &count);
478 ok(hr == S_OK, "IStream_Read failed, hr=%lx\n", hr);
479 ok(count == strlen(xmldata), "wrong count: %lu\n", count);
480 ok(!strcmp(buffer, xmldata), "Strings do not match\n");
481
482 hr = IStream_Read(stream, buffer, sizeof(buffer), &count);
483 ok(hr == S_OK, "IStream_Read failed, hr=%lx\n", hr);
484 ok(!count, "wrong count: %lu\n", count);
485
486 hr = IStream_Write(stream, xmldata, strlen(xmldata), &count);
487 ok(hr == E_FAIL, "IStream_Write returned hr=%lx\n", hr);
488
489 pos.QuadPart = strlen(xmldata);
490 hr = IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
491 ok(hr == E_NOTIMPL, "IStream_Seek returned hr=%lx\n", hr);
492
493 size.QuadPart = strlen(xmldata);
494 hr = IStream_SetSize(stream, size);
495 ok(hr == E_NOTIMPL, "IStream_SetSize returned hr=%lx\n", hr);
496
497 hr = IStream_Clone(stream, &stream2);
498 ok(hr == E_NOTIMPL, "IStream_Clone returned hr=%lx\n", hr);
499
500 hr = IStream_Commit(stream, STGC_DEFAULT);
501 ok(hr == E_NOTIMPL, "IStream_Commit returned hr=%lx\n", hr);
502
503 hr = IStream_Revert(stream);
504 ok(hr == E_NOTIMPL, "IStream_Revert returned hr=%lx\n", hr);
505
506 ref = IStream_Release(stream);
507 ok(!ref, "IStream_Release returned %lu\n", ref);
508 }
510}
#define broken(x)
Definition: atltest.h:178
#define COR_E_FILENOTFOUND
Definition: corerror.h:43
#define COR_E_NULLREFERENCE
Definition: corerror.h:36
#define E_FAIL
Definition: ddrawi.h:102
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
#define S_OK
Definition: intsafe.h:52
static const WCHAR nonexistent[]
Definition: font.c:33
static void create_xml_file(LPCWSTR filename)
Definition: mscoree.c:421
Definition: fci.c:127
Definition: send.c:48
Definition: parse.h:23
uint32_t ULONG
Definition: typedefs.h:59
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define ERROR_PROC_NOT_FOUND
Definition: winerror.h:321

Referenced by START_TEST().

◆ test_createdomain()

static void test_createdomain ( void  )
static

Definition at line 811 of file mscoree.c.

812{
813 static const WCHAR test_name[] = {'t','e','s','t',0};
814 static const WCHAR test2_name[] = {'t','e','s','t','2',0};
816 ICLRRuntimeInfo *runtimeinfo;
817 ICorRuntimeHost *runtimehost;
818 IUnknown *domain, *defaultdomain_unk, *defaultdomain, *newdomain_unk, *newdomain, *domainsetup,
819 *newdomain2_unk, *newdomain2;
820 HRESULT hr;
821
822 if (!pCLRCreateInstance)
823 {
824 win_skip("Function CLRCreateInstance not found.\n");
825 return;
826 }
827
828 hr = pCLRCreateInstance(&CLSID_CLRMetaHost, &IID_ICLRMetaHost, (void **)&metahost);
829 ok(SUCCEEDED(hr), "CLRCreateInstance failed, hr=%#.8lx\n", hr);
830
831 hr = ICLRMetaHost_GetRuntime(metahost, v4_0, &IID_ICLRRuntimeInfo, (void **)&runtimeinfo);
832 ok(SUCCEEDED(hr), "ICLRMetaHost::GetRuntime failed, hr=%#.8lx\n", hr);
833
834 hr = ICLRRuntimeInfo_GetInterface(runtimeinfo, &CLSID_CorRuntimeHost, &IID_ICorRuntimeHost,
835 (void **)&runtimehost);
836 ok(SUCCEEDED(hr), "ICLRRuntimeInfo::GetInterface failed, hr=%#.8lx\n", hr);
837
838 hr = ICorRuntimeHost_Start(runtimehost);
839 ok(SUCCEEDED(hr), "ICorRuntimeHost::Start failed, hr=%#.8lx\n", hr);
840
841 hr = ICorRuntimeHost_GetDefaultDomain(runtimehost, &domain);
842 ok(SUCCEEDED(hr), "ICorRuntimeHost::GetDefaultDomain failed, hr=%#.8lx\n", hr);
843
844 hr = IUnknown_QueryInterface(domain, &IID_IUnknown, (void **)&defaultdomain_unk);
845 ok(SUCCEEDED(hr), "COM object doesn't support IUnknown?!\n");
846
847 hr = IUnknown_QueryInterface(domain, &IID__AppDomain, (void **)&defaultdomain);
848 ok(SUCCEEDED(hr), "AppDomain object doesn't support _AppDomain interface\n");
849
850 IUnknown_Release(domain);
851
852 hr = ICorRuntimeHost_CreateDomain(runtimehost, test_name, NULL, &domain);
853 ok(SUCCEEDED(hr), "ICorRuntimeHost::CreateDomain failed, hr=%#.8lx\n", hr);
854
855 hr = IUnknown_QueryInterface(domain, &IID_IUnknown, (void **)&newdomain_unk);
856 ok(SUCCEEDED(hr), "COM object doesn't support IUnknown?!\n");
857
858 hr = IUnknown_QueryInterface(domain, &IID__AppDomain, (void **)&newdomain);
859 ok(SUCCEEDED(hr), "AppDomain object doesn't support _AppDomain interface\n");
860
861 IUnknown_Release(domain);
862
863 ok(defaultdomain_unk != newdomain_unk, "New and default domain objects are the same\n");
864
865 hr = ICorRuntimeHost_CreateDomainSetup(runtimehost, &domainsetup);
866 ok(SUCCEEDED(hr), "ICorRuntimeHost::CreateDomainSetup failed, hr=%#.8lx\n", hr);
867
868 hr = ICorRuntimeHost_CreateDomainEx(runtimehost, test2_name, domainsetup, NULL, &domain);
869 ok(SUCCEEDED(hr), "ICorRuntimeHost::CreateDomainEx failed, hr=%#.8lx\n", hr);
870
871 hr = IUnknown_QueryInterface(domain, &IID_IUnknown, (void **)&newdomain2_unk);
872 ok(SUCCEEDED(hr), "COM object doesn't support IUnknown?!\n");
873
874 hr = IUnknown_QueryInterface(domain, &IID__AppDomain, (void **)&newdomain2);
875 ok(SUCCEEDED(hr), "AppDomain object doesn't support _AppDomain interface\n");
876
877 IUnknown_Release(domain);
878
879 ok(defaultdomain_unk != newdomain2_unk, "New and default domain objects are the same\n");
880 ok(newdomain_unk != newdomain2_unk, "Both new domain objects are the same\n");
881
882 IUnknown_Release(newdomain2);
883 IUnknown_Release(newdomain2_unk);
884 IUnknown_Release(domainsetup);
885 IUnknown_Release(newdomain);
886 IUnknown_Release(newdomain_unk);
887 IUnknown_Release(defaultdomain);
888 IUnknown_Release(defaultdomain_unk);
889
890 ICorRuntimeHost_Release(runtimehost);
891
892 ICLRRuntimeInfo_Release(runtimeinfo);
893
894 ICLRMetaHost_Release(metahost);
895}
const GUID IID_IUnknown
static const char * test_name
Definition: run.c:177
Definition: cookie.c:42

Referenced by START_TEST().

◆ test_createinstance()

static void test_createinstance ( void  )
static

Definition at line 512 of file mscoree.c.

513{
514 HRESULT hr;
516
518 {
519 /* If we don't have 1.x or 2.0 runtimes, we should at least have .NET 4. */
520 ok(pCreateInterface != NULL, "no legacy runtimes or .NET 4 interfaces available\n");
521 }
522
523 if(!pCreateInterface)
524 {
525 win_skip("Function CreateInterface not found.\n");
526 return;
527 }
528
529 hr = pCreateInterface(&CLSID_CLRMetaHost, &IID_ICLRMetaHost, (void**)&host);
530 if(SUCCEEDED(hr))
531 {
532 ICLRMetaHost_Release(host);
533 }
534 else
535 {
536 win_skip(".NET 4 not installed.\n");
537 }
538}
static DWORD *static INT *static DWORD *static DWORD DWORD *static HMODULE *static IStream **static VOID **static VOID **static BOOL no_legacy_runtimes
Definition: mscoree.c:52
Definition: txthost.c:37

Referenced by START_TEST().

◆ test_loadlibraryshim()

static void test_loadlibraryshim ( void  )
static

Definition at line 304 of file mscoree.c.

305{
306 const WCHAR v2_0[] = {'v','2','.','0','.','5','0','7','2','7',0};
307 const WCHAR v1_1[] = {'v','1','.','1','.','4','3','2','2',0};
308 const WCHAR vbogus[] = {'v','b','o','g','u','s',0};
309 const WCHAR fusion[] = {'f','u','s','i','o','n',0};
310 const WCHAR fusiondll[] = {'f','u','s','i','o','n','.','d','l','l',0};
311 const WCHAR nosuchdll[] = {'j','n','v','n','l','.','d','l','l',0};
312 const WCHAR gdidll[] = {'g','d','i','3','2','.','d','l','l',0};
313 HRESULT hr;
314 const WCHAR *latest = NULL;
315 CHAR latestA[MAX_PATH];
318
320 {
321 win_skip("No legacy .NET runtimes are installed\n");
322 return;
323 }
324
325 hr = pLoadLibraryShim(fusion, v1_1, NULL, &hdll);
326 ok(hr == S_OK || hr == E_HANDLE, "LoadLibraryShim failed, hr=%lx\n", hr);
327 if (SUCCEEDED(hr))
328 {
329 latest = v1_1;
330
332
333 todo_wine_if(!has_mono) ok(StrStrIA(dllpath, "v1.1.4322") != 0, "incorrect fusion.dll path %s\n", dllpath);
334 ok(StrStrIA(dllpath, "fusion.dll") != 0, "incorrect fusion.dll path %s\n", dllpath);
335
337 }
338
339 hr = pLoadLibraryShim(fusion, v2_0, NULL, &hdll);
340 ok(hr == S_OK || hr == E_HANDLE, "LoadLibraryShim failed, hr=%lx\n", hr);
341 if (SUCCEEDED(hr))
342 {
343 latest = v2_0;
344
346
347 todo_wine_if(!has_mono) ok(StrStrIA(dllpath, "v2.0.50727") != 0, "incorrect fusion.dll path %s\n", dllpath);
348 ok(StrStrIA(dllpath, "fusion.dll") != 0, "incorrect fusion.dll path %s\n", dllpath);
349
351 }
352
353 hr = pLoadLibraryShim(fusion, v4_0, NULL, &hdll);
354 ok(hr == S_OK || hr == E_HANDLE, "LoadLibraryShim failed, hr=%lx\n", hr);
355 if (SUCCEEDED(hr))
356 {
357 /* LoadLibraryShim with a NULL version prefers 2.0 and earlier */
358 if (!latest)
359 latest = v4_0;
360
362
363 todo_wine_if(!has_mono) ok(StrStrIA(dllpath, "v4.0.30319") != 0, "incorrect fusion.dll path %s\n", dllpath);
364 ok(StrStrIA(dllpath, "fusion.dll") != 0, "incorrect fusion.dll path %s\n", dllpath);
365
367 }
368
369 hr = pLoadLibraryShim(fusion, vbogus, NULL, &hdll);
370 ok(hr == E_HANDLE, "LoadLibraryShim failed, hr=%lx\n", hr);
371 if (SUCCEEDED(hr))
373
374 WideCharToMultiByte(CP_ACP, 0, latest, -1, latestA, MAX_PATH, NULL, NULL);
375
376 hr = pLoadLibraryShim(fusion, NULL, NULL, &hdll);
377 ok(hr == S_OK, "LoadLibraryShim failed, hr=%lx\n", hr);
378 if (SUCCEEDED(hr))
379 {
381
382 if (latest)
383 todo_wine_if(!has_mono) ok(StrStrIA(dllpath, latestA) != 0, "incorrect fusion.dll path %s\n", dllpath);
384 ok(StrStrIA(dllpath, "fusion.dll") != 0, "incorrect fusion.dll path %s\n", dllpath);
385
387 }
388
389 hr = pLoadLibraryShim(fusiondll, NULL, NULL, &hdll);
390 ok(hr == S_OK, "LoadLibraryShim failed, hr=%lx\n", hr);
391 if (SUCCEEDED(hr))
392 {
394
395 if (latest)
396 todo_wine_if(!has_mono) ok(StrStrIA(dllpath, latestA) != 0, "incorrect fusion.dll path %s\n", dllpath);
397 ok(StrStrIA(dllpath, "fusion.dll") != 0, "incorrect fusion.dll path %s\n", dllpath);
398
400 }
401
402 hr = pLoadLibraryShim(nosuchdll, latest, NULL, &hdll);
403 ok(hr == E_HANDLE, "LoadLibraryShim failed, hr=%lx\n", hr);
404 if (SUCCEEDED(hr))
406
407 hr = pLoadLibraryShim(gdidll, latest, NULL, &hdll);
408 ok(hr == E_HANDLE, "LoadLibraryShim failed, hr=%lx\n", hr);
409 if (SUCCEEDED(hr))
411}
static IUnknown **const WCHAR v2_0[]
Definition: debugging.c:37
LPSTR WINAPI StrStrIA(LPCSTR lpszStr, LPCSTR lpszSearch)
Definition: string.c:351
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:539
WCHAR dllpath[MAX_PATH]
static PVOID hdll
Definition: shimdbg.c:126
#define E_HANDLE
Definition: winerror.h:4117
char CHAR
Definition: xmlstorage.h:175

Referenced by START_TEST().

◆ test_loadpaths()

static void test_loadpaths ( BOOL  neutral)
static

Definition at line 734 of file mscoree.c.

735{
736 static const WCHAR *loadpaths[] = {L"", L"en", L"libloadpaths", L"en\\libloadpaths"};
737 static const WCHAR *dll_source = L"loadpaths.dll.cs";
738 static const WCHAR *dll_name = L"libloadpaths.dll";
739 static const WCHAR *exe_source = L"loadpaths.exe.cs";
740 static const WCHAR *exe_name = L"loadpaths.exe";
741 static const WCHAR *cfg_name = L"loadpaths.exe.config";
742 WCHAR tmp[MAX_PATH];
743 BOOL ret;
744 int i;
745
746 DeleteFileW(dll_source);
747 ret = write_resource(dll_source, dll_source);
748 ok(ret, "Could not write resource: %lu\n", GetLastError());
749 DeleteFileW(dll_name);
750 ret = compile_cs(dll_source, dll_name, L"library", neutral ? L"-define:NEUTRAL" : L"");
751 if (!ret) return;
752 ret = DeleteFileW(dll_source);
753 ok(ret, "DeleteFileW failed: %lu\n", GetLastError());
754
755 DeleteFileW(exe_source);
756 ret = write_resource(exe_source, exe_source);
757 ok(ret, "Could not write resource: %lu\n", GetLastError());
758 DeleteFileW(exe_name);
759 ret = compile_cs(exe_source, exe_name, L"winexe", L"/reference:libloadpaths.dll");
760 if (!ret) return;
761 ret = DeleteFileW(exe_source);
762 ok(ret, "DeleteFileW failed: %lu\n", GetLastError());
763
764 DeleteFileW(cfg_name);
765 ret = write_resource(cfg_name, cfg_name);
766 ok(ret, "Could not write resource: %lu\n", GetLastError());
767
768 for (i = 0; i < ARRAY_SIZE(loadpaths); ++i)
769 {
770 const WCHAR *path = loadpaths[i];
771 BOOL expect_failure = neutral ? wcsstr(path, L"en") != NULL
772 : wcsstr(path, L"en") == NULL;
773
774 wcscpy(tmp, path);
775 PathAppendW(tmp, dll_name);
776 test_loadpaths_execute(exe_name, dll_name, NULL, tmp, expect_failure, !neutral && !*path);
777
778 wcscpy(tmp, L"private");
779 if (*path) PathAppendW(tmp, path);
780 PathAppendW(tmp, dll_name);
781
782 test_loadpaths_execute(exe_name, dll_name, NULL, tmp, TRUE, FALSE);
783 test_loadpaths_execute(exe_name, dll_name, cfg_name, tmp, expect_failure, FALSE);
784
785 /* exe name for dll should work too */
786 if (*path)
787 {
788 wcscpy(tmp, path);
789 PathAppendW(tmp, dll_name);
790 wcscpy(tmp + wcslen(tmp) - 4, L".exe");
791 test_loadpaths_execute(exe_name, dll_name, NULL, tmp, expect_failure, FALSE);
792 }
793
794 wcscpy(tmp, L"private");
795 if (*path) PathAppendW(tmp, path);
796 PathAppendW(tmp, dll_name);
797 wcscpy(tmp + wcslen(tmp) - 4, L".exe");
798
799 test_loadpaths_execute(exe_name, dll_name, NULL, tmp, TRUE, FALSE);
800 test_loadpaths_execute(exe_name, dll_name, cfg_name, tmp, expect_failure, FALSE);
801 }
802
803 ret = DeleteFileW(cfg_name);
804 ok(ret, "DeleteFileW failed: %lu\n", GetLastError());
805 ret = DeleteFileW(exe_name);
806 ok(ret, "DeleteFileW failed: %lu\n", GetLastError());
807 ret = DeleteFileW(dll_name);
808 ok(ret, "DeleteFileW failed: %lu\n", GetLastError());
809}
_ACRTIMP wchar_t *__cdecl wcsstr(const wchar_t *, const wchar_t *)
Definition: wcs.c:2993
static BOOL write_resource(const WCHAR *resource, const WCHAR *filename)
Definition: mscoree.c:540
static void test_loadpaths_execute(const WCHAR *exe_name, const WCHAR *dll_name, const WCHAR *cfg_name, const WCHAR *dll_dest, BOOL expect_failure, BOOL todo)
Definition: mscoree.c:626
static BOOL compile_cs(const WCHAR *source, const WCHAR *target, const WCHAR *type, const WCHAR *args)
Definition: mscoree.c:565
#define PathAppendW
Definition: pathcch.h:310
wcscpy

Referenced by START_TEST().

◆ test_loadpaths_execute()

static void test_loadpaths_execute ( const WCHAR exe_name,
const WCHAR dll_name,
const WCHAR cfg_name,
const WCHAR dll_dest,
BOOL  expect_failure,
BOOL  todo 
)
static

Definition at line 626 of file mscoree.c.

628{
629 WCHAR tmpdir[MAX_PATH], tmpexe[MAX_PATH], tmpcfg[MAX_PATH], tmpdll[MAX_PATH];
631 STARTUPINFOW si = { 0 };
632 WCHAR *ptr, *end;
633 DWORD exit_code = 0xdeadbeef, err;
634 BOOL ret;
635
636 ret = create_new_dir(tmpdir, L"loadpaths");
637 ok(ret, "failed to create a new dir %lu\n", GetLastError());
638 end = tmpdir + wcslen(tmpdir);
639
640 wcscpy(tmpexe, tmpdir);
641 PathAppendW(tmpexe, exe_name);
642 ret = CopyFileW(exe_name, tmpexe, FALSE);
643 ok(ret, "CopyFileW(%s) failed: %lu\n", debugstr_w(tmpexe), GetLastError());
644
645 if (cfg_name)
646 {
647 wcscpy(tmpcfg, tmpdir);
648 PathAppendW(tmpcfg, cfg_name);
649 ret = CopyFileW(cfg_name, tmpcfg, FALSE);
650 ok(ret, "CopyFileW(%s) failed: %lu\n", debugstr_w(tmpcfg), GetLastError());
651 }
652
653 ptr = tmpdir + wcslen(tmpdir);
654 PathAppendW(tmpdir, dll_dest);
655 while (*ptr && (ptr = wcschr(ptr + 1, '\\')))
656 {
657 *ptr = '\0';
659 ok(ret, "CreateDirectoryW(%s) failed: %lu\n", debugstr_w(tmpdir), GetLastError());
660 *ptr = '\\';
661 }
662
663 wcscpy(tmpdll, tmpdir);
664 if ((ptr = wcsrchr(tmpdir, '\\'))) *ptr = '\0';
665
666 ret = CopyFileW(dll_name, tmpdll, FALSE);
667 ok(ret, "CopyFileW(%s) failed: %lu\n", debugstr_w(tmpdll), GetLastError());
668
669 si.cb = sizeof(si);
670 ret = CreateProcessW(tmpexe, tmpexe, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
671 ok(ret, "CreateProcessW(%s) failed: %lu\n", debugstr_w(tmpexe), GetLastError());
672
673 if (expect_failure) ret = WaitForSingleObject(pi.hProcess, 2000);
674 else
675 {
677 ok(ret == WAIT_OBJECT_0, "%s: WaitForSingleObject returned %d: %lu\n", debugstr_w(dll_dest), ret, GetLastError());
678 }
679
681 if (ret == WAIT_TIMEOUT) TerminateProcess(pi.hProcess, 0xdeadbeef);
684
685 if (expect_failure) todo_wine_if(todo) ok(exit_code != 0, "%s: Succeeded to execute process\n", debugstr_w(dll_dest));
686 else ok(exit_code == 0, "%s: Failed to execute process\n", debugstr_w(dll_dest));
687
688 /* sometimes the failing process never returns, in which case cleaning up won't work */
689 if (ret == WAIT_TIMEOUT && expect_failure) return;
690
691 if (cfg_name)
692 {
693 ret = DeleteFileW(tmpcfg);
694 ok(ret, "DeleteFileW(%s) failed: %lu\n", debugstr_w(tmpcfg), GetLastError());
695 }
696 ret = DeleteFileW(tmpdll);
697 ok(ret, "DeleteFileW(%s) failed: %lu\n", debugstr_w(tmpdll), GetLastError());
698 ret = DeleteFileW(tmpexe);
699 ok(ret, "DeleteFileW(%s) failed: %lu\n", debugstr_w(tmpexe), GetLastError());
700
701 ptr = end;
702 while (ptr >= end && (ptr = wcsrchr(tmpdir, '\\')))
703 {
705 err = GetLastError();
706 ok(ret, "RemoveDirectoryW(%s) failed: %lu\n", debugstr_w(tmpdir), err);
707
708 if (!ret && err == ERROR_DIR_NOT_EMPTY)
709 {
711 HANDLE hfind;
712
713 wcscat(tmpdir, L"\\*");
714 hfind = FindFirstFileW(tmpdir, &fd);
715 while (hfind != INVALID_HANDLE_VALUE && (!wcscmp(fd.cFileName, L".") || !wcscmp(fd.cFileName, L"..")))
716 {
717 if (!FindNextFileW(hfind, &fd))
718 {
719 FindClose(hfind);
720 hfind = INVALID_HANDLE_VALUE;
721 }
722 }
723 if (hfind != INVALID_HANDLE_VALUE)
724 {
725 trace("file %s still present in tmpdir\n", debugstr_w(fd.cFileName));
726 FindClose(hfind);
727 }
728 }
729
730 *ptr = '\0';
731 }
732}
#define trace
Definition: atltest.h:70
#define WAIT_TIMEOUT
Definition: dderror.h:14
#define wcschr
Definition: compat.h:17
#define wcsrchr
Definition: compat.h:16
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:365
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
Definition: dir.c:700
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1376
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1972
GLuint GLuint end
Definition: gl.h:1545
#define debugstr_w
Definition: kernel32.h:32
static PVOID ptr
Definition: dispmode.c:27
BOOL todo
Definition: filedlg.c:313
static UINT exit_code
Definition: process.c:80
static BOOL create_new_dir(WCHAR newdir[MAX_PATH], const WCHAR *prefix)
Definition: mscoree.c:595
#define err(...)
wcscat
static int fd
Definition: io.c:51
static char tmpdir[MAX_PATH]
Definition: shlexec.c:52
#define WAIT_OBJECT_0
Definition: winbase.h:383
#define ERROR_DIR_NOT_EMPTY
Definition: winerror.h:339

Referenced by test_loadpaths().

◆ test_versioninfo()

static void test_versioninfo ( void  )
static

Definition at line 172 of file mscoree.c.

173{
174 const WCHAR v9_0[] = {'v','9','.','0','.','3','0','3','1','9',0};
175 const WCHAR v2_0cap[] = {'V','2','.','0','.','5','0','7','2','7',0};
176 const WCHAR v2_0[] = {'v','2','.','0','.','5','0','7','2','7',0};
177 const WCHAR v2_0_0[] = {'v','2','.','0','.','0',0};
178 const WCHAR v1_1[] = {'v','1','.','1','.','4','3','2','2',0};
179 const WCHAR v1_1_0[] = {'v','1','.','1','.','0',0};
180
184 HRESULT hr;
185
186 if (0) /* crashes on <= w2k3 */
187 {
188 hr = pGetCORVersion(NULL, MAX_PATH, &size);
189 ok(hr == E_POINTER,"GetCORVersion returned %08lx\n", hr);
190 }
191
192 hr = pGetCORVersion(version, 1, &size);
193 if (hr == CLR_E_SHIM_RUNTIME)
194 {
196 win_skip("No legacy .NET runtimes are installed\n");
197 return;
198 }
199
200 ok(hr == E_NOT_SUFFICIENT_BUFFER, "GetCORVersion returned %08lx\n", hr);
201
202 hr = pGetCORVersion(version, MAX_PATH, &size);
203 ok(hr == S_OK,"GetCORVersion returned %08lx\n", hr);
204
205 trace("latest installed .net runtime: %s\n", wine_dbgstr_w(version));
206
207 hr = pGetCORSystemDirectory(path, MAX_PATH , &size);
208 todo_wine_if(!has_mono) ok(hr == S_OK, "GetCORSystemDirectory returned %08lx\n", hr);
209 /* size includes terminating null-character */
210 todo_wine_if(!has_mono) ok(size == (lstrlenW(path) + 1),"size is %ld instead of %d\n", size, (lstrlenW(path) + 1));
211
212 path_len = size;
213
214 hr = pGetCORSystemDirectory(path, path_len-1 , &size);
215 todo_wine_if(!has_mono) ok(hr == E_NOT_SUFFICIENT_BUFFER, "GetCORSystemDirectory returned %08lx\n", hr);
216
217 if (0) /* crashes on <= w2k3 */
218 {
219 hr = pGetCORSystemDirectory(NULL, MAX_PATH , &size);
220 ok(hr == E_NOT_SUFFICIENT_BUFFER, "GetCORSystemDirectory returned %08lx\n", hr);
221 }
222
223 hr = pGetCORSystemDirectory(path, MAX_PATH , NULL);
224 ok(hr == E_POINTER,"GetCORSystemDirectory returned %08lx\n", hr);
225
226 trace("latest installed .net installed in directory: %s\n", wine_dbgstr_w(path));
227
228 /* test GetRequestedRuntimeInfo, first get info about different versions of runtime */
229 hr = pGetRequestedRuntimeInfo( NULL, v2_0, NULL, 0, 0, path, MAX_PATH, &path_len, version, MAX_PATH, &size);
230
231 if(hr == CLR_E_SHIM_RUNTIME) return; /* skipping rest of tests on win2k as .net 2.0 not installed */
232
233 todo_wine_if(!has_mono) ok(hr == S_OK, "GetRequestedRuntimeInfo returned %08lx\n", hr);
234 trace(" installed in directory %s is .net version %s\n", wine_dbgstr_w(path), wine_dbgstr_w(version));
235
236 hr = pGetRequestedRuntimeInfo( NULL, v1_1, NULL, 0, 0, path, MAX_PATH, &path_len, version, MAX_PATH, &size);
237 todo_wine_if(!has_mono) ok(hr == S_OK || hr == CLR_E_SHIM_RUNTIME /*v1_1 not installed*/, "GetRequestedRuntimeInfo returned %08lx\n", hr);
238 if(hr == S_OK)
239 trace(" installed in directory %s is .net version %s\n", wine_dbgstr_w(path), wine_dbgstr_w(version));
240 /* version number NULL not allowed without RUNTIME_INFO_UPGRADE_VERSION flag */
241 hr = pGetRequestedRuntimeInfo( NULL, NULL, NULL, 0, 0, path, MAX_PATH, &path_len, version, MAX_PATH, &size);
242 ok(hr == CLR_E_SHIM_RUNTIME, "GetRequestedRuntimeInfo returned %08lx\n", hr);
243 /* with RUNTIME_INFO_UPGRADE_VERSION flag and version number NULL, latest installed version is returned */
244 hr = pGetRequestedRuntimeInfo( NULL, NULL, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, path, MAX_PATH, &path_len, version, MAX_PATH, &size);
245 todo_wine_if(!has_mono) ok(hr == S_OK, "GetRequestedRuntimeInfo returned %08lx\n", hr);
246
247 hr = pGetRequestedRuntimeInfo( NULL, v2_0, NULL, 0, 0, path, 1, &path_len, version, MAX_PATH, &size);
248 todo_wine_if(!has_mono) ok(hr == E_NOT_SUFFICIENT_BUFFER, "GetRequestedRuntimeInfo returned %08lx\n", hr);
249
250 /* if one of the buffers is NULL, the other one is still happily filled */
251 memset(version, 0, sizeof(version));
252 hr = pGetRequestedRuntimeInfo( NULL, v2_0, NULL, 0, 0, NULL, MAX_PATH, &path_len, version, MAX_PATH, &size);
253 todo_wine_if(!has_mono) ok(hr == S_OK, "GetRequestedRuntimeInfo returned %08lx\n", hr);
254 ok(!wcscmp(version, v2_0), "version is %s , expected %s\n", wine_dbgstr_w(version), wine_dbgstr_w(v2_0));
255 /* With NULL-pointer for bufferlength, the buffer itself still gets filled with correct string */
256 memset(version, 0, sizeof(version));
257 hr = pGetRequestedRuntimeInfo( NULL, v2_0, NULL, 0, 0, path, MAX_PATH, &path_len, version, MAX_PATH, NULL);
258 todo_wine_if(!has_mono) ok(hr == S_OK, "GetRequestedRuntimeInfo returned %08lx\n", hr);
259 ok(!wcscmp(version, v2_0), "version is %s , expected %s\n", wine_dbgstr_w(version), wine_dbgstr_w(v2_0));
260
261 memset(version, 0, sizeof(version));
262 hr = pGetRequestedRuntimeInfo( NULL, v2_0cap, NULL, 0, 0, path, MAX_PATH, &path_len, version, MAX_PATH, NULL);
263 todo_wine_if(!has_mono) ok(hr == S_OK, "GetRequestedRuntimeInfo returned %08lx\n", hr);
264 ok(!wcscmp(version, v2_0cap), "version is %s , expected %s\n", wine_dbgstr_w(version), wine_dbgstr_w(v2_0cap));
265
266 /* Invalid Version and RUNTIME_INFO_UPGRADE_VERSION flag*/
267 memset(version, 0, sizeof(version));
268 hr = pGetRequestedRuntimeInfo( NULL, v1_1, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, path, MAX_PATH, &path_len, version, MAX_PATH, NULL);
269 todo_wine_if(!has_mono) ok(hr == S_OK || hr == CLR_E_SHIM_RUNTIME , "GetRequestedRuntimeInfo returned %08lx\n", hr);
270 if(hr == S_OK)
271 {
272 /* .NET 1.1 may not be installed. */
273 ok(!wcscmp(version, v1_1) || !wcscmp(version, v2_0),
274 "version is %s , expected %s or %s\n", wine_dbgstr_w(version), wine_dbgstr_w(v1_1), wine_dbgstr_w(v2_0));
275
276 }
277
278 memset(version, 0, sizeof(version));
279 hr = pGetRequestedRuntimeInfo( NULL, v9_0, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, path, MAX_PATH, &path_len, version, MAX_PATH, NULL);
280 ok(hr == CLR_E_SHIM_RUNTIME, "GetRequestedRuntimeInfo returned %08lx\n", hr);
281
282 memset(version, 0, sizeof(version));
283 hr = pGetRequestedRuntimeInfo( NULL, v1_1_0, NULL, 0, 0, path, MAX_PATH, &path_len, version, MAX_PATH, NULL);
284 ok(hr == CLR_E_SHIM_RUNTIME, "GetRequestedRuntimeInfo returned %08lx\n", hr);
285
286 memset(version, 0, sizeof(version));
287 hr = pGetRequestedRuntimeInfo( NULL, v1_1_0, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, path, MAX_PATH, &path_len, version, MAX_PATH, NULL);
288 todo_wine_if(!has_mono) ok(hr == S_OK, "GetRequestedRuntimeInfo returned %08lx\n", hr);
289 ok(!wcscmp(version, v2_0), "version is %s , expected %s\n", wine_dbgstr_w(version), wine_dbgstr_w(v2_0));
290
291 memset(version, 0, sizeof(version));
292 hr = pGetRequestedRuntimeInfo( NULL, v2_0_0, NULL, 0, 0, path, MAX_PATH, &path_len, version, MAX_PATH, NULL);
293 ok(hr == CLR_E_SHIM_RUNTIME, "GetRequestedRuntimeInfo returned %08lx\n", hr);
294
295 memset(version, 0, sizeof(version));
296 hr = pGetRequestedRuntimeInfo( NULL, v2_0_0, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, path, MAX_PATH, &path_len, version, MAX_PATH, NULL);
297 todo_wine_if(!has_mono) ok(hr == S_OK, "GetRequestedRuntimeInfo returned %08lx\n", hr);
298 ok(!wcscmp(version, v2_0), "version is %s , expected %s\n", wine_dbgstr_w(version), wine_dbgstr_w(v2_0));
299
300 hr = pCorIsLatestSvc(NULL, NULL);
301 ok(hr == E_POINTER, "CorIsLatestSvc returned %08lx\n", hr);
302}
#define CLR_E_SHIM_RUNTIME
Definition: corerror.h:226
#define lstrlenW
Definition: compat.h:750
static const WCHAR version[]
Definition: asmname.c:66
static DWORD path_len
Definition: batch.c:31
@ RUNTIME_INFO_UPGRADE_VERSION
Definition: mscoree.idl:40
#define memset(x, y, z)
Definition: compat.h:39
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:3437
#define E_POINTER
Definition: winerror.h:3480

Referenced by START_TEST().

◆ write_resource()

static BOOL write_resource ( const WCHAR resource,
const WCHAR filename 
)
static

Definition at line 540 of file mscoree.c.

541{
542 HANDLE file;
543 HRSRC rsrc;
544 void *data;
545 DWORD size;
546 BOOL ret;
547
549 if (!rsrc) return FALSE;
550
552 if (!data) return FALSE;
553
555 if (!size) return FALSE;
556
558 if (file == INVALID_HANDLE_VALUE) return FALSE;
559
562 return ret;
563}
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define RT_RCDATA
Definition: pedump.c:372
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by test_loadpaths().

Variable Documentation

◆ DWORD

DWORD *static INT *static DWORD *static DWORD DWORD

Definition at line 43 of file mscoree.c.

◆ has_mono

int has_mono = 0
static

Definition at line 32 of file mscoree.c.

Referenced by check_runtime(), runtime_is_usable(), test_loadlibraryshim(), and test_versioninfo().

◆ hmscoree

HMODULE hmscoree
static

Definition at line 41 of file mscoree.c.

Referenced by init_functionpointers(), and START_TEST().

◆ LPCWSTR

DWORD *static INT *static DWORD *static DWORD DWORD *static LPCWSTR

Definition at line 46 of file mscoree.c.

◆ LPVOID

DWORD *static INT *static DWORD *static DWORD DWORD *static LPVOID

Definition at line 47 of file mscoree.c.

◆ LPWSTR

DWORD *static INT *static DWORD *static DWORD LPWSTR

Definition at line 46 of file mscoree.c.

◆ no_legacy_runtimes

DWORD *static INT *static DWORD *static DWORD DWORD *static HMODULE *static IStream **static VOID **static VOID** static BOOL no_legacy_runtimes
static

Definition at line 52 of file mscoree.c.

Referenced by test_createinstance(), test_loadlibraryshim(), and test_versioninfo().

◆ REFIID

DWORD *static INT *static DWORD *static DWORD DWORD *static HMODULE *static IStream **static VOID **static REFIID

Definition at line 49 of file mscoree.c.

◆ v4_0

const WCHAR v4_0[] = {'v','4','.','0','.','3','0','3','1','9',0}
static

Definition at line 39 of file mscoree.c.

Referenced by check_runtime(), test_createdomain(), and test_loadlibraryshim().

◆ xmldata

const char xmldata[]
static
Initial value:
=
"<?xml version=\"1.0\" ?>\n"
"<!DOCTYPE Config>\n"
"<Configuration>\n"
" <Name>Test</Name>\n"
" <Value>1234</Value>\n"
"</Configuration>"

Definition at line 413 of file mscoree.c.

Referenced by create_xml_file(), and test_createconfigstream().