v2: add todo_wine to a test. missed that in 1st patch
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 | 6 ++++++ dlls/mscoree/tests/mscoree.c | 11 ++++++++++- 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..519f918223 100644 --- a/dlls/mscoree/mscoree_main.c +++ b/dlls/mscoree/mscoree_main.c @@ -309,6 +309,12 @@ 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); + 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..952f87b154 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"); @@ -175,6 +177,7 @@ static void test_versioninfo(void) WCHAR path[MAX_PATH]; DWORD size, path_len; HRESULT hr; + int unk1,unk2;
if (0) /* crashes on <= w2k3 */ { @@ -289,6 +292,12 @@ 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); + todo_wine ok(hr == E_POINTER, "CorIsLatestSvc returned %08x\n", hr); + + hr = pCorIsLatestSvc(&unk1, &unk2); + ok(hr == S_OK, "CorIsLatestSvc returned %08x\n", hr); }
static void test_loadlibraryshim(void)
v2: remove the test as it will trigger the messagebox when run in wine, thus the test will abort + small spellingfix
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 519f918223..8f83375f72 100644 --- a/dlls/mscoree/mscoree_main.c +++ b/dlls/mscoree/mscoree_main.c @@ -315,6 +315,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)
- hr = pCorIsLatestSvc(&unk1, &unk2);
- ok(hr == S_OK, "CorIsLatestSvc returned %08x\n", hr);
Does it really make sense to test this, given that we have no way of knowing the true function prototype and no reason to implement it?
Well, there was a comment in the bugreport that it might be a BOOL, so I added test to show that it is a HRESULT; that was the only reason to add the test
Regards
2018-07-10 16:44 GMT+02:00 Vincent Povirk vincent@codeweavers.com:
- hr = pCorIsLatestSvc(&unk1, &unk2);
- ok(hr == S_OK, "CorIsLatestSvc returned %08x\n", hr);
Does it really make sense to test this, given that we have no way of knowing the true function prototype and no reason to implement it?
We should only have the E_POINTER test IMO. There's no way to know what the function will do given a real pointer.
On Tue, Jul 10, 2018 at 10:07 AM, Louis Lenders xerox.xerox2000x@gmail.com wrote:
Well, there was a comment in the bugreport that it might be a BOOL, so I added test to show that it is a HRESULT; that was the only reason to add the test
Regards
2018-07-10 16:44 GMT+02:00 Vincent Povirk vincent@codeweavers.com:
- hr = pCorIsLatestSvc(&unk1, &unk2);
- ok(hr == S_OK, "CorIsLatestSvc returned %08x\n", hr);
Does it really make sense to test this, given that we have no way of knowing the true function prototype and no reason to implement it?