v3: removed a test and make last remaining test succeed
This function can be called in case of a broken .NET installation. See also https://bugs.winehq.org/show_bug.cgi?id=31688 Hopefully this stub will reduce amount of invalid bugreports in bugzilla about this issue
Signed-off-by: Louis Lenders xerox.xerox2000x@gmail.com --- dlls/mscoree/mscoree.spec | 2 +- dlls/mscoree/mscoree_main.c | 10 ++++++++++ dlls/mscoree/tests/mscoree.c | 7 ++++++- 3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/dlls/mscoree/mscoree.spec b/dlls/mscoree/mscoree.spec index 3715b7c79d..ec4668bc3c 100644 --- a/dlls/mscoree/mscoree.spec +++ b/dlls/mscoree/mscoree.spec @@ -25,7 +25,7 @@ @ stub CorDllMainWorker @ stdcall CorExitProcess(long) @ stub CorGetSvc -@ stub CorIsLatestSvc +@ stdcall CorIsLatestSvc(ptr ptr) @ stub CorMarkThreadInThreadPool @ stub CorTickleSvc @ stdcall CreateConfigStream(wstr ptr) diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c index 9561405608..f3ea417f9e 100644 --- a/dlls/mscoree/mscoree_main.c +++ b/dlls/mscoree/mscoree_main.c @@ -309,6 +309,16 @@ HRESULT WINAPI GetCORVersion(LPWSTR pbuffer, DWORD cchBuffer, DWORD *dwLength) return ret; }
+HRESULT WINAPI CorIsLatestSvc(int *unk1, int *unk2) +{ + FIXME("%p, %p stub: If this function is called, it is likely the result of a broken .NET installation!\n", unk1, unk2); + + if (!unk1 || !unk2) + return E_POINTER; + + return S_OK; +} + HRESULT WINAPI GetRequestedRuntimeInfo(LPCWSTR pExe, LPCWSTR pwszVersion, LPCWSTR pConfigurationFile, DWORD startupFlags, DWORD runtimeInfoFlags, LPWSTR pDirectory, DWORD dwDirectory, DWORD *dwDirectoryLength, LPWSTR pVersion, DWORD cchBuffer, DWORD *dwlength) diff --git a/dlls/mscoree/tests/mscoree.c b/dlls/mscoree/tests/mscoree.c index 63517dc79b..dd4724dc76 100644 --- a/dlls/mscoree/tests/mscoree.c +++ b/dlls/mscoree/tests/mscoree.c @@ -35,6 +35,7 @@ static const WCHAR v4_0[] = {'v','4','.','0','.','3','0','3','1','9',0}; static HMODULE hmscoree;
static HRESULT (WINAPI *pGetCORVersion)(LPWSTR, DWORD, DWORD*); +static HRESULT (WINAPI *pCorIsLatestSvc)(INT*, INT*); static HRESULT (WINAPI *pGetCORSystemDirectory)(LPWSTR, DWORD, DWORD*); static HRESULT (WINAPI *pGetRequestedRuntimeInfo)(LPCWSTR, LPCWSTR, LPCWSTR, DWORD, DWORD, LPWSTR, DWORD, DWORD*, LPWSTR, DWORD, DWORD*); static HRESULT (WINAPI *pLoadLibraryShim)(LPCWSTR, LPCWSTR, LPVOID, HMODULE*); @@ -55,6 +56,7 @@ static BOOL init_functionpointers(void) }
pGetCORVersion = (void *)GetProcAddress(hmscoree, "GetCORVersion"); + pCorIsLatestSvc = (void *)GetProcAddress(hmscoree, "CorIsLatestSvc"); pGetCORSystemDirectory = (void *)GetProcAddress(hmscoree, "GetCORSystemDirectory"); pGetRequestedRuntimeInfo = (void *)GetProcAddress(hmscoree, "GetRequestedRuntimeInfo"); pLoadLibraryShim = (void *)GetProcAddress(hmscoree, "LoadLibraryShim"); @@ -63,7 +65,7 @@ static BOOL init_functionpointers(void) pCLRCreateInstance = (void *)GetProcAddress(hmscoree, "CLRCreateInstance");
if (!pGetCORVersion || !pGetCORSystemDirectory || !pGetRequestedRuntimeInfo || !pLoadLibraryShim || - !pCreateInterface || !pCLRCreateInstance + !pCreateInterface || !pCLRCreateInstance || !pCorIsLatestSvc ) { win_skip("functions not available\n"); @@ -289,6 +291,9 @@ static void test_versioninfo(void) hr = pGetRequestedRuntimeInfo( NULL, v2_0_0, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, path, MAX_PATH, &path_len, version, MAX_PATH, NULL); ok(hr == S_OK, "GetRequestedRuntimeInfo returned %08x\n", hr); ok(!winetest_strcmpW(version, v2_0), "version is %s , expected %s\n", wine_dbgstr_w(version), wine_dbgstr_w(v2_0)); + + hr = pCorIsLatestSvc(NULL, NULL); + ok(hr == E_POINTER, "CorIsLatestSvc returned %08x\n", hr); }
static void test_loadlibraryshim(void)
v3: no changes
See bug https://www.winehq.org/pipermail/wine-bugs/2018-July/494631.html. This patch shows users some hints to fix broken .Net installation, instead of crashing and leaving user in the dark
Signed-off-by: Louis Lenders xerox.xerox2000x@gmail.com --- dlls/mscoree/mscoree.spec | 2 +- dlls/mscoree/mscoree_main.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/dlls/mscoree/mscoree.spec b/dlls/mscoree/mscoree.spec index ec4668bc3c..7fa68bf8b1 100644 --- a/dlls/mscoree/mscoree.spec +++ b/dlls/mscoree/mscoree.spec @@ -24,7 +24,7 @@ @ stdcall CorBindToRuntimeHost(wstr wstr wstr ptr long ptr ptr ptr) @ stub CorDllMainWorker @ stdcall CorExitProcess(long) -@ stub CorGetSvc +@ stdcall CorGetSvc(ptr) @ stdcall CorIsLatestSvc(ptr ptr) @ stub CorMarkThreadInThreadPool @ stub CorTickleSvc diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c index f3ea417f9e..4e3898aab7 100644 --- a/dlls/mscoree/mscoree_main.c +++ b/dlls/mscoree/mscoree_main.c @@ -319,6 +319,28 @@ HRESULT WINAPI CorIsLatestSvc(int *unk1, int *unk2) return S_OK; }
+HRESULT WINAPI CorGetSvc(IUnknown **pIUnknown) +{ + typedef INT (WINAPI *MessageBoxA)(HWND,LPCSTR,LPCSTR,UINT); + HMODULE hUser32 = LoadLibraryA("user32"); + MessageBoxA pMessageBoxA = (void *)GetProcAddress(hUser32, "MessageBoxA"); + + FIXME("%p stub\n",pIUnknown); + if (pMessageBoxA) + { + pMessageBoxA(NULL, + "Something is broken in your .Net installation.\n" + "Apparently you tried to run an app with MS .NET Framework but have Wine-Mono installed. " + "Please use 'winetricks' to install .NET Frameworks " + "and redo the installation in a new WINEPREFIX.\n", + "Wine: Unimplemented CorGetSvc", + 0x10); + ExitProcess(1); + + } + return S_OK; +} + HRESULT WINAPI GetRequestedRuntimeInfo(LPCWSTR pExe, LPCWSTR pwszVersion, LPCWSTR pConfigurationFile, DWORD startupFlags, DWORD runtimeInfoFlags, LPWSTR pDirectory, DWORD dwDirectory, DWORD *dwDirectoryLength, LPWSTR pVersion, DWORD cchBuffer, DWORD *dwlength)
Signed-off-by: Vincent Povirk vincent@codeweavers.com
Louis Lenders xerox.xerox2000x@gmail.com writes:
+HRESULT WINAPI CorGetSvc(IUnknown **pIUnknown) +{
- typedef INT (WINAPI *MessageBoxA)(HWND,LPCSTR,LPCSTR,UINT);
- HMODULE hUser32 = LoadLibraryA("user32");
- MessageBoxA pMessageBoxA = (void *)GetProcAddress(hUser32, "MessageBoxA");
- FIXME("%p stub\n",pIUnknown);
- if (pMessageBoxA)
Is there any reason to load the function dynamically?
no, no reason, i just copied this from how it is done in rpcrt4/cproxy.c, there`s a similar case for a function where it aborts with a MessageBox
Signed-off-by: Vincent Povirk vincent@codeweavers.com
I don't know how to create an appropriately-broken .NET installation to test this myself, so I'm just going to assume that part works.
Louis Lenders xerox.xerox2000x@gmail.com writes:
+HRESULT WINAPI CorIsLatestSvc(int *unk1, int *unk2) +{
- FIXME("%p, %p stub: If this function is called, it is likely the result of a broken .NET installation!\n", unk1, unk2);
This should probably go to the winediag channel.
On 07/11/2018 11:07 AM, Louis Lenders wrote:
v3: removed a test and make last remaining test succeed
This function can be called in case of a broken .NET installation. See also https://bugs.winehq.org/show_bug.cgi?id=31688 Hopefully this stub will reduce amount of invalid bugreports in bugzilla about this issue
Signed-off-by: Louis Lenders xerox.xerox2000x@gmail.com
dlls/mscoree/mscoree.spec | 2 +- dlls/mscoree/mscoree_main.c | 10 ++++++++++ dlls/mscoree/tests/mscoree.c | 7 ++++++- 3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/dlls/mscoree/mscoree.spec b/dlls/mscoree/mscoree.spec index 3715b7c79d..ec4668bc3c 100644 --- a/dlls/mscoree/mscoree.spec +++ b/dlls/mscoree/mscoree.spec @@ -25,7 +25,7 @@ @ stub CorDllMainWorker @ stdcall CorExitProcess(long) @ stub CorGetSvc -@ stub CorIsLatestSvc +@ stdcall CorIsLatestSvc(ptr ptr) @ stub CorMarkThreadInThreadPool @ stub CorTickleSvc @ stdcall CreateConfigStream(wstr ptr) diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c index 9561405608..f3ea417f9e 100644 --- a/dlls/mscoree/mscoree_main.c +++ b/dlls/mscoree/mscoree_main.c @@ -309,6 +309,16 @@ HRESULT WINAPI GetCORVersion(LPWSTR pbuffer, DWORD cchBuffer, DWORD *dwLength) return ret; }
+HRESULT WINAPI CorIsLatestSvc(int *unk1, int *unk2) +{
- FIXME("%p, %p stub: If this function is called, it is likely the result of a broken .NET installation!\n", unk1, unk2);
- if (!unk1 || !unk2)
return E_POINTER;
- return S_OK;
+}
What's a point of argument checks? If it's not going to work, winediag message with E_NOTIMPL seems to be sufficient.
HRESULT WINAPI GetRequestedRuntimeInfo(LPCWSTR pExe, LPCWSTR pwszVersion, LPCWSTR pConfigurationFile, DWORD startupFlags, DWORD runtimeInfoFlags, LPWSTR pDirectory, DWORD dwDirectory, DWORD *dwDirectoryLength, LPWSTR pVersion, DWORD cchBuffer, DWORD *dwlength) diff --git a/dlls/mscoree/tests/mscoree.c b/dlls/mscoree/tests/mscoree.c index 63517dc79b..dd4724dc76 100644 --- a/dlls/mscoree/tests/mscoree.c +++ b/dlls/mscoree/tests/mscoree.c @@ -35,6 +35,7 @@ static const WCHAR v4_0[] = {'v','4','.','0','.','3','0','3','1','9',0}; static HMODULE hmscoree;
static HRESULT (WINAPI *pGetCORVersion)(LPWSTR, DWORD, DWORD*); +static HRESULT (WINAPI *pCorIsLatestSvc)(INT*, INT*); static HRESULT (WINAPI *pGetCORSystemDirectory)(LPWSTR, DWORD, DWORD*); static HRESULT (WINAPI *pGetRequestedRuntimeInfo)(LPCWSTR, LPCWSTR, LPCWSTR, DWORD, DWORD, LPWSTR, DWORD, DWORD*, LPWSTR, DWORD, DWORD*); static HRESULT (WINAPI *pLoadLibraryShim)(LPCWSTR, LPCWSTR, LPVOID, HMODULE*); @@ -55,6 +56,7 @@ static BOOL init_functionpointers(void) }
pGetCORVersion = (void *)GetProcAddress(hmscoree, "GetCORVersion");
- pCorIsLatestSvc = (void *)GetProcAddress(hmscoree, "CorIsLatestSvc"); pGetCORSystemDirectory = (void *)GetProcAddress(hmscoree, "GetCORSystemDirectory"); pGetRequestedRuntimeInfo = (void *)GetProcAddress(hmscoree, "GetRequestedRuntimeInfo"); pLoadLibraryShim = (void *)GetProcAddress(hmscoree, "LoadLibraryShim");
@@ -63,7 +65,7 @@ static BOOL init_functionpointers(void) pCLRCreateInstance = (void *)GetProcAddress(hmscoree, "CLRCreateInstance");
if (!pGetCORVersion || !pGetCORSystemDirectory || !pGetRequestedRuntimeInfo || !pLoadLibraryShim ||
!pCreateInterface || !pCLRCreateInstance
!pCreateInterface || !pCLRCreateInstance || !pCorIsLatestSvc ) { win_skip("functions not available\n");
@@ -289,6 +291,9 @@ static void test_versioninfo(void) hr = pGetRequestedRuntimeInfo( NULL, v2_0_0, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, path, MAX_PATH, &path_len, version, MAX_PATH, NULL); ok(hr == S_OK, "GetRequestedRuntimeInfo returned %08x\n", hr); ok(!winetest_strcmpW(version, v2_0), "version is %s , expected %s\n", wine_dbgstr_w(version), wine_dbgstr_w(v2_0));
hr = pCorIsLatestSvc(NULL, NULL);
ok(hr == E_POINTER, "CorIsLatestSvc returned %08x\n", hr); }
static void test_loadlibraryshim(void)