mscoree: String returned by GetCORVersion starts with letter 'v'.
[wine] / dlls / mscoree / mscoree_main.c
1 /*
2  * Implementation of mscoree.dll
3  * Microsoft Component Object Runtime Execution Engine
4  *
5  * Copyright 2006 Paul Chitescu
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21
22 #include <stdarg.h>
23
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
28
29 #include "wine/debug.h"
30
31 WINE_DEFAULT_DEBUG_CHANNEL( mscoree );
32
33 HRESULT WINAPI CorBindToRuntimeHost(LPCWSTR pwszVersion, LPCWSTR pwszBuildFlavor,
34                                     LPCWSTR pwszHostConfigFile, VOID *pReserved,
35                                     DWORD startupFlags, REFCLSID rclsid,
36                                     REFIID riid, LPVOID *ppv)
37 {
38     FIXME("(%s, %s, %s, %p, %d, %p, %p, %p): stub!\n", debugstr_w(pwszVersion),
39           debugstr_w(pwszBuildFlavor), debugstr_w(pwszHostConfigFile), pReserved,
40           startupFlags, rclsid, riid, ppv);
41
42     return E_FAIL;
43 }
44
45 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
46 {
47     TRACE("(%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
48
49     switch (fdwReason)
50     {
51     case DLL_WINE_PREATTACH:
52         return FALSE;  /* prefer native version */
53     case DLL_PROCESS_ATTACH:
54         DisableThreadLibraryCalls(hinstDLL);
55         break;
56     case DLL_PROCESS_DETACH:
57         break;
58     }
59     return TRUE;
60 }
61
62 BOOL WINAPI _CorDllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
63 {
64     FIXME("(%p, %d, %p): stub\n", hinstDLL, fdwReason, lpvReserved);
65
66     switch (fdwReason)
67     {
68     case DLL_PROCESS_ATTACH:
69         DisableThreadLibraryCalls(hinstDLL);
70         break;
71     case DLL_PROCESS_DETACH:
72         break;
73     }
74     return TRUE;
75 }
76
77 int WINAPI _CorExeMain(void)
78 {
79     FIXME("Directly running .NET applications not supported.\n");
80     return -1;
81 }
82
83 int WINAPI _CorExeMain2(PBYTE ptrMemory, DWORD cntMemory, LPCWSTR imageName, LPCWSTR loaderName, LPCWSTR cmdLine)
84 {
85     TRACE("(%p, %u, %s, %s, %s)\n", ptrMemory, cntMemory, debugstr_w(imageName), debugstr_w(loaderName), debugstr_w(cmdLine));
86     FIXME("Directly running .NET applications not supported.\n");
87     return -1;
88 }
89
90 void WINAPI _CorImageUnloading(LPCVOID* imageBase)
91 {
92     TRACE("(%p): stub\n", imageBase);
93 }
94
95 DWORD _CorValidateImage(LPCVOID* imageBase, LPCWSTR imageName)
96 {
97     TRACE("(%p, %s): stub\n", imageBase, debugstr_w(imageName));
98     return E_FAIL;
99 }
100
101 HRESULT WINAPI GetCORVersion(LPWSTR pbuffer, DWORD cchBuffer, DWORD *dwLength)
102 {
103     static const WCHAR version[] = {'v','1','.','1','.','4','3','2','2',0};
104
105     FIXME("(%p, %d, %p): semi-stub!\n", pbuffer, cchBuffer, dwLength);
106
107     if (!dwLength)
108         return E_POINTER;
109
110     *dwLength = lstrlenW(version);
111
112     if (cchBuffer < *dwLength)
113         return ERROR_INSUFFICIENT_BUFFER;
114
115     if (pbuffer)
116         lstrcpyW(pbuffer, version);
117
118     return S_OK;
119 }
120
121 HRESULT WINAPI LoadLibraryShim( LPCWSTR szDllName, LPCWSTR szVersion, LPVOID pvReserved, HMODULE * phModDll)
122 {
123     *phModDll = LoadLibraryW(szDllName);
124     FIXME("(%p %s, %p, %p, %p): semi-stub\n", szDllName, debugstr_w(szDllName), szVersion, pvReserved, phModDll);
125     return S_OK;
126 }
127
128 HRESULT WINAPI CoInitializeCor(DWORD fFlags)
129 {
130     FIXME("(0x%08x): stub\n", fFlags);
131     return S_OK;
132 }
133
134 HRESULT WINAPI GetAssemblyMDImport(LPCWSTR szFileName, REFIID riid, IUnknown **ppIUnk)
135 {
136     FIXME("(%p %s, %p, %p): stub\n", szFileName, debugstr_w(szFileName), riid, *ppIUnk);
137     return ERROR_CALL_NOT_IMPLEMENTED;
138 }