Rémi Bernon : mscoree/tests: Test invalid assembly paths in registry.
Alexandre Julliard
julliard at winehq.org
Mon Oct 26 16:59:41 CDT 2020
Module: wine
Branch: master
Commit: 7612ff5930c7de8c2279f2b6613c8dbaeea9894e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=7612ff5930c7de8c2279f2b6613c8dbaeea9894e
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Fri Oct 23 08:51:44 2020 +0200
mscoree/tests: Test invalid assembly paths in registry.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Esme Povirk <esme at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mscoree/tests/Makefile.in | 2 +-
dlls/mscoree/tests/comtest.c | 46 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/dlls/mscoree/tests/Makefile.in b/dlls/mscoree/tests/Makefile.in
index f65e1bc6c25..7dcd5b64113 100644
--- a/dlls/mscoree/tests/Makefile.in
+++ b/dlls/mscoree/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = mscoree.dll
-IMPORTS = ole32 shlwapi uuid shell32
+IMPORTS = ole32 shlwapi uuid shell32 advapi32
C_SRCS = \
comtest.c \
diff --git a/dlls/mscoree/tests/comtest.c b/dlls/mscoree/tests/comtest.c
index 12b112417d5..8c2ae955cef 100644
--- a/dlls/mscoree/tests/comtest.c
+++ b/dlls/mscoree/tests/comtest.c
@@ -148,6 +148,51 @@ static void run_test(BOOL expect_success)
}
IClassFactory_Release(classFactory);
}
+
+}
+
+static void run_registry_test(run_type run)
+{
+ char buffer[256];
+ ITest *test = NULL;
+ HRESULT hr, result_expected;
+ HKEY hkey;
+ DWORD ret;
+ int i = 0;
+
+ if (run == run_type_exe_directory) result_expected = S_OK;
+ else result_expected = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
+
+ sprintf(buffer, "CLSID\\%s", wine_dbgstr_guid(&CLSID_Test), "");
+ ret = RegCreateKeyA( HKEY_CLASSES_ROOT, buffer, &hkey );
+ ok(ret == ERROR_SUCCESS, "RegCreateKeyA returned %x\n", ret);
+
+ ret = RegSetKeyValueA(hkey, "InprocServer32", NULL, REG_SZ, "mscoree.dll", 11);
+ ok(ret == ERROR_SUCCESS, "RegSetKeyValueA returned %x\n", ret);
+ ret = RegSetKeyValueA(hkey, "InprocServer32", "Assembly", REG_SZ, "comtest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", 74);
+ ok(ret == ERROR_SUCCESS, "RegSetKeyValueA returned %x\n", ret);
+ ret = RegSetKeyValueA(hkey, "InprocServer32", "Class", REG_SZ, "DLL.Test", 8);
+ ok(ret == ERROR_SUCCESS, "RegSetKeyValueA returned %x\n", ret);
+ ret = RegSetKeyValueA(hkey, "InprocServer32", "CodeBase", REG_SZ, "file:///U:/invalid/path/to/comtest.dll", 41);
+ ok(ret == ERROR_SUCCESS, "RegSetKeyValueA returned %x\n", ret);
+
+ hr = CoCreateInstance(&CLSID_Test, NULL, CLSCTX_INPROC_SERVER, &IID_ITest, (void**)&test);
+ todo_wine ok(hr == result_expected, "Expected %x, got %x\n", result_expected, hr);
+
+ if (hr == S_OK)
+ {
+ hr = ITest_Func(test, &i);
+ ok(hr == S_OK, "Got %x\n", hr);
+ ok(i == 42, "Expected 42, got %d\n", i);
+ ITest_Release(test);
+ }
+
+ RegDeleteKeyValueA(hkey, "InprocServer32", "CodeBase");
+ RegDeleteKeyValueA(hkey, "InprocServer32", "Class");
+ RegDeleteKeyValueA(hkey, "InprocServer32", "Assembly");
+ RegDeleteKeyValueA(hkey, "InprocServer32", NULL);
+ RegDeleteKeyA(hkey, "InprocServer32");
+ RegCloseKey(hkey);
}
static void get_dll_path_for_run(char *path_dll, UINT path_dll_size, run_type run)
@@ -247,6 +292,7 @@ static void prepare_and_run_test(const char *dll_source, run_type run)
SetCurrentDirectoryA(path_tmp);
run_test(run == run_type_exe_directory);
+ run_registry_test(run);
cleanup:
if (handle_context != NULL && handle_context != INVALID_HANDLE_VALUE)
More information about the wine-cvs
mailing list