https://git.reactos.org/?p=reactos.git;a=commitdiff;h=761e72c7d0b3d5a7988c5…
commit 761e72c7d0b3d5a7988c515f70715e11469851ce
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sat Mar 12 16:17:14 2022 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Mar 20 19:27:51 2022 +0100
[WINESYNC] msi/tests: Test self-registration of a valid DLL.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 8867712944d839385837ae4db8b50fff1380c507 by Zebediah Figura
<z.figura12(a)gmail.com>
---
modules/rostests/winetests/msi/CMakeLists.txt | 9 ++-
modules/rostests/winetests/msi/action.c | 83 +++++++++++++++++---------
modules/rostests/winetests/msi/msi_winetest.rc | 1 +
modules/rostests/winetests/msi/selfreg.c | 38 ++++++++++++
modules/rostests/winetests/msi/selfreg.spec | 2 +
5 files changed, 103 insertions(+), 30 deletions(-)
diff --git a/modules/rostests/winetests/msi/CMakeLists.txt
b/modules/rostests/winetests/msi/CMakeLists.txt
index acdd7c13a47..8a6c44c7070 100644
--- a/modules/rostests/winetests/msi/CMakeLists.txt
+++ b/modules/rostests/winetests/msi/CMakeLists.txt
@@ -5,6 +5,11 @@ target_link_libraries(custom uuid)
set_module_type(custom win32dll)
add_importlibs(custom msi ole32 oleaut32 odbccp32 shell32 advapi32 msvcrt kernel32)
+spec2def(selfreg.dll selfreg.spec)
+add_library(selfreg MODULE selfreg.c ${CMAKE_CURRENT_BINARY_DIR}/selfreg.def)
+set_module_type(selfreg win32dll)
+add_importlibs(selfreg advapi32 msvcrt kernel32)
+
list(APPEND SOURCE
action.c
automation.c
@@ -25,7 +30,7 @@ list(APPEND PCH_SKIP_SOURCE
# CMake 3.9 and higher requires to specify this dependency manually
# see
https://gitlab.kitware.com/cmake/cmake/issues/19933
-set_property(SOURCE msi_winetest.rc PROPERTY OBJECT_DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/custom.dll ${CMAKE_CURRENT_BINARY_DIR}/typelib.tlb)
+set_property(SOURCE msi_winetest.rc PROPERTY OBJECT_DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/custom.dll ${CMAKE_CURRENT_BINARY_DIR}/selfreg.dll
${CMAKE_CURRENT_BINARY_DIR}/typelib.tlb)
add_executable(msi_winetest
${SOURCE}
@@ -52,4 +57,4 @@ set_module_type(msi_winetest win32cui)
add_importlibs(msi_winetest cabinet msi shell32 ole32 oleaut32 odbccp32 user32 advapi32
version msvcrt kernel32)
add_pch(msi_winetest precomp.h "${PCH_SKIP_SOURCE}")
add_rostests_file(TARGET msi_winetest)
-add_dependencies(msi_winetest custom msi_winetest_idlheader stdole2)
+add_dependencies(msi_winetest custom selfreg msi_winetest_idlheader stdole2)
diff --git a/modules/rostests/winetests/msi/action.c
b/modules/rostests/winetests/msi/action.c
index 98d030354ca..8f26385b36a 100644
--- a/modules/rostests/winetests/msi/action.c
+++ b/modules/rostests/winetests/msi/action.c
@@ -736,30 +736,55 @@ static const char cf_custom_action_dat[] =
"rf_immediate\t1\tcustom.dll\tcf_present\n"
"rf_deferred\t1025\tcustom.dll\tcf_absent\n";
+static const char sr_file_dat[] =
+
"File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
+ "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
+ "File\tFile\n"
+ "selfreg.dll\tselfreg\tselfreg.dll\t1000\t\t\t8192\t1\n";
+
+static const char sr_feature_dat[] =
+
"Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
+ "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
+ "Feature\tFeature\n"
+ "selfreg\t\t\tselfreg feature\t1\t2\tMSITESTDIR\t0\n";
+
+static const char sr_feature_comp_dat[] =
+ "Feature_\tComponent_\n"
+ "s38\ts72\n"
+ "FeatureComponents\tFeature_\tComponent_\n"
+ "selfreg\tselfreg\n";
+
+static const char sr_component_dat[] =
+ "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
+ "s72\tS38\ts72\ti2\tS255\tS72\n"
+ "Component\tComponent\n"
+
"selfreg\t{BB4C26FD-89D8-4E49-AF1C-DB4DCB5BF1B0}\tMSITESTDIR\t0\t\tselfreg.dll\n";
+
static const char sr_selfreg_dat[] =
"File_\tCost\n"
"s72\tI2\n"
"SelfReg\tFile_\n"
- "one.txt\t1\n";
+ "selfreg.dll\t\n";
static const char sr_install_exec_seq_dat[] =
"Action\tCondition\tSequence\n"
"s72\tS255\tI2\n"
"InstallExecuteSequence\tAction\n"
- "CostFinalize\t\t1000\n"
"CostInitialize\t\t800\n"
"FileCost\t\t900\n"
- "ResolveSource\t\t950\n"
- "MoveFiles\t\t1700\n"
- "SelfUnregModules\t\t3900\n"
+ "CostFinalize\t\t1000\n"
+ "InstallValidate\t\t1400\n"
+ "InstallInitialize\t\t1500\n"
+ "ProcessComponents\t\t1600\n"
+ "SelfUnregModules\t\t3800\n"
+ "RemoveFiles\t\t3900\n"
"InstallFiles\t\t4000\n"
- "DuplicateFiles\t\t4500\n"
- "WriteEnvironmentStrings\t\t4550\n"
+ "SelfRegModules\t\t4100\n"
"CreateShortcuts\t\t4600\n"
- "InstallFinalize\t\t6600\n"
- "InstallInitialize\t\t1500\n"
- "InstallValidate\t\t1400\n"
- "LaunchConditions\t\t100\n";
+ "RegisterProduct\t\t5100\n"
+ "PublishFeatures\t\t5200\n"
+ "PublishProduct\t\t5300\n"
+ "InstallFinalize\t\t6600\n";
static const char font_media_dat[] =
"DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
@@ -2099,11 +2124,11 @@ static const msi_table sis_tables[] =
static const msi_table sr_tables[] =
{
- ADD_TABLE(component),
+ ADD_TABLE(sr_component),
ADD_TABLE(directory),
- ADD_TABLE(feature),
- ADD_TABLE(feature_comp),
- ADD_TABLE(file),
+ ADD_TABLE(sr_feature),
+ ADD_TABLE(sr_feature_comp),
+ ADD_TABLE(sr_file),
ADD_TABLE(sr_selfreg),
ADD_TABLE(sr_install_exec_seq),
ADD_TABLE(media),
@@ -5398,6 +5423,7 @@ error:
static void test_self_registration(void)
{
+ HKEY key;
UINT r;
if (is_process_limited())
@@ -5407,6 +5433,7 @@ static void test_self_registration(void)
}
create_test_files();
+ extract_resource("selfreg.dll", "TESTDLL",
"msitest\\selfreg.dll");
create_database(msifile, sr_tables, sizeof(sr_tables) / sizeof(msi_table));
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
@@ -5419,21 +5446,21 @@ static void test_self_registration(void)
}
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
- ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not
installed\n");
- ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not
created\n");
- ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not
installed\n");
- ok(delete_pf("msitest\\cabout", FALSE), "Directory not
created\n");
- ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not
installed\n");
- ok(delete_pf("msitest\\changed", FALSE), "Directory not
created\n");
- ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not
installed\n");
- ok(delete_pf("msitest\\first", FALSE), "Directory not
created\n");
- ok(delete_pf("msitest\\filename", TRUE), "File not
installed\n");
- ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
- ok(delete_pf("msitest\\service.exe", TRUE), "File not
installed\n");
- ok(delete_pf("msitest\\service2.exe", TRUE), "File not
installed\n");
- ok(delete_pf("msitest", FALSE), "Directory not created\n");
+ r = RegOpenKeyA(HKEY_CLASSES_ROOT, "selfreg_test", &key);
+ ok(!r, "got %u\n", r);
+ RegCloseKey(key);
+
+ r = MsiInstallProductA(msifile, "REMOVE=ALL");
+ ok(!r, "got %u\n", r);
+
+ r = RegOpenKeyA(HKEY_CLASSES_ROOT, "selfreg_test", &key);
+ ok(r == ERROR_FILE_NOT_FOUND, "got %u\n", r);
+
+ ok(!delete_pf("msitest\\selfreg.dll", TRUE), "file not
removed\n");
+ ok(!delete_pf("msitest", FALSE), "directory not removed\n");
error:
+ DeleteFileA("msitest\\selfreg.dll");
delete_test_files();
DeleteFileA(msifile);
}
diff --git a/modules/rostests/winetests/msi/msi_winetest.rc
b/modules/rostests/winetests/msi/msi_winetest.rc
index f1840396a75..661f39bad2c 100644
--- a/modules/rostests/winetests/msi/msi_winetest.rc
+++ b/modules/rostests/winetests/msi/msi_winetest.rc
@@ -1,4 +1,5 @@
CUSTOM.DLL TESTDLL "custom.dll"
+SELFREG.DLL TESTDLL "selfreg.dll"
typelib.tlb TYPELIB "typelib.tlb"
diff --git a/modules/rostests/winetests/msi/selfreg.c
b/modules/rostests/winetests/msi/selfreg.c
new file mode 100644
index 00000000000..668e742e9ba
--- /dev/null
+++ b/modules/rostests/winetests/msi/selfreg.c
@@ -0,0 +1,38 @@
+/*
+ * DLL for testing self-registration
+ *
+ * Copyright 2018 Zebediah Figura
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+#include <windef.h>
+#include <winbase.h>
+#include <winreg.h>
+
+HRESULT WINAPI DllRegisterServer(void)
+{
+ HKEY key;
+ RegCreateKeyA(HKEY_CLASSES_ROOT, "selfreg_test", &key);
+ RegCloseKey(key);
+ return S_OK;
+}
+
+HRESULT WINAPI DllUnregisterServer(void)
+{
+ RegDeleteKeyA(HKEY_CLASSES_ROOT, "selfreg_test");
+ return S_OK;
+}
diff --git a/modules/rostests/winetests/msi/selfreg.spec
b/modules/rostests/winetests/msi/selfreg.spec
new file mode 100644
index 00000000000..0f9b07355f7
--- /dev/null
+++ b/modules/rostests/winetests/msi/selfreg.spec
@@ -0,0 +1,2 @@
+@ stdcall -private DllRegisterServer()
+@ stdcall -private DllUnregisterServer()