Skip to content

Commit 761e72c

Browse files
winesynclearn-more
authored andcommitted
[WINESYNC] msi/tests: Test self-registration of a valid DLL.
Signed-off-by: Zebediah Figura <[email protected]> Signed-off-by: Hans Leidekker <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 8867712944d839385837ae4db8b50fff1380c507 by Zebediah Figura <[email protected]>
1 parent cc5bb28 commit 761e72c

File tree

5 files changed

+103
-30
lines changed

5 files changed

+103
-30
lines changed

modules/rostests/winetests/msi/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ target_link_libraries(custom uuid)
55
set_module_type(custom win32dll)
66
add_importlibs(custom msi ole32 oleaut32 odbccp32 shell32 advapi32 msvcrt kernel32)
77

8+
spec2def(selfreg.dll selfreg.spec)
9+
add_library(selfreg MODULE selfreg.c ${CMAKE_CURRENT_BINARY_DIR}/selfreg.def)
10+
set_module_type(selfreg win32dll)
11+
add_importlibs(selfreg advapi32 msvcrt kernel32)
12+
813
list(APPEND SOURCE
914
action.c
1015
automation.c
@@ -25,7 +30,7 @@ list(APPEND PCH_SKIP_SOURCE
2530

2631
# CMake 3.9 and higher requires to specify this dependency manually
2732
# see https://gitlab.kitware.com/cmake/cmake/issues/19933
28-
set_property(SOURCE msi_winetest.rc PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/custom.dll ${CMAKE_CURRENT_BINARY_DIR}/typelib.tlb)
33+
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)
2934

3035
add_executable(msi_winetest
3136
${SOURCE}
@@ -52,4 +57,4 @@ set_module_type(msi_winetest win32cui)
5257
add_importlibs(msi_winetest cabinet msi shell32 ole32 oleaut32 odbccp32 user32 advapi32 version msvcrt kernel32)
5358
add_pch(msi_winetest precomp.h "${PCH_SKIP_SOURCE}")
5459
add_rostests_file(TARGET msi_winetest)
55-
add_dependencies(msi_winetest custom msi_winetest_idlheader stdole2)
60+
add_dependencies(msi_winetest custom selfreg msi_winetest_idlheader stdole2)

modules/rostests/winetests/msi/action.c

Lines changed: 55 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -736,30 +736,55 @@ static const char cf_custom_action_dat[] =
736736
"rf_immediate\t1\tcustom.dll\tcf_present\n"
737737
"rf_deferred\t1025\tcustom.dll\tcf_absent\n";
738738

739+
static const char sr_file_dat[] =
740+
"File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
741+
"s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
742+
"File\tFile\n"
743+
"selfreg.dll\tselfreg\tselfreg.dll\t1000\t\t\t8192\t1\n";
744+
745+
static const char sr_feature_dat[] =
746+
"Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
747+
"s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
748+
"Feature\tFeature\n"
749+
"selfreg\t\t\tselfreg feature\t1\t2\tMSITESTDIR\t0\n";
750+
751+
static const char sr_feature_comp_dat[] =
752+
"Feature_\tComponent_\n"
753+
"s38\ts72\n"
754+
"FeatureComponents\tFeature_\tComponent_\n"
755+
"selfreg\tselfreg\n";
756+
757+
static const char sr_component_dat[] =
758+
"Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
759+
"s72\tS38\ts72\ti2\tS255\tS72\n"
760+
"Component\tComponent\n"
761+
"selfreg\t{BB4C26FD-89D8-4E49-AF1C-DB4DCB5BF1B0}\tMSITESTDIR\t0\t\tselfreg.dll\n";
762+
739763
static const char sr_selfreg_dat[] =
740764
"File_\tCost\n"
741765
"s72\tI2\n"
742766
"SelfReg\tFile_\n"
743-
"one.txt\t1\n";
767+
"selfreg.dll\t\n";
744768

745769
static const char sr_install_exec_seq_dat[] =
746770
"Action\tCondition\tSequence\n"
747771
"s72\tS255\tI2\n"
748772
"InstallExecuteSequence\tAction\n"
749-
"CostFinalize\t\t1000\n"
750773
"CostInitialize\t\t800\n"
751774
"FileCost\t\t900\n"
752-
"ResolveSource\t\t950\n"
753-
"MoveFiles\t\t1700\n"
754-
"SelfUnregModules\t\t3900\n"
775+
"CostFinalize\t\t1000\n"
776+
"InstallValidate\t\t1400\n"
777+
"InstallInitialize\t\t1500\n"
778+
"ProcessComponents\t\t1600\n"
779+
"SelfUnregModules\t\t3800\n"
780+
"RemoveFiles\t\t3900\n"
755781
"InstallFiles\t\t4000\n"
756-
"DuplicateFiles\t\t4500\n"
757-
"WriteEnvironmentStrings\t\t4550\n"
782+
"SelfRegModules\t\t4100\n"
758783
"CreateShortcuts\t\t4600\n"
759-
"InstallFinalize\t\t6600\n"
760-
"InstallInitialize\t\t1500\n"
761-
"InstallValidate\t\t1400\n"
762-
"LaunchConditions\t\t100\n";
784+
"RegisterProduct\t\t5100\n"
785+
"PublishFeatures\t\t5200\n"
786+
"PublishProduct\t\t5300\n"
787+
"InstallFinalize\t\t6600\n";
763788

764789
static const char font_media_dat[] =
765790
"DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
@@ -2099,11 +2124,11 @@ static const msi_table sis_tables[] =
20992124

21002125
static const msi_table sr_tables[] =
21012126
{
2102-
ADD_TABLE(component),
2127+
ADD_TABLE(sr_component),
21032128
ADD_TABLE(directory),
2104-
ADD_TABLE(feature),
2105-
ADD_TABLE(feature_comp),
2106-
ADD_TABLE(file),
2129+
ADD_TABLE(sr_feature),
2130+
ADD_TABLE(sr_feature_comp),
2131+
ADD_TABLE(sr_file),
21072132
ADD_TABLE(sr_selfreg),
21082133
ADD_TABLE(sr_install_exec_seq),
21092134
ADD_TABLE(media),
@@ -5398,6 +5423,7 @@ static void test_install_services(void)
53985423

53995424
static void test_self_registration(void)
54005425
{
5426+
HKEY key;
54015427
UINT r;
54025428

54035429
if (is_process_limited())
@@ -5407,6 +5433,7 @@ static void test_self_registration(void)
54075433
}
54085434

54095435
create_test_files();
5436+
extract_resource("selfreg.dll", "TESTDLL", "msitest\\selfreg.dll");
54105437
create_database(msifile, sr_tables, sizeof(sr_tables) / sizeof(msi_table));
54115438

54125439
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
@@ -5419,21 +5446,21 @@ static void test_self_registration(void)
54195446
}
54205447
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
54215448

5422-
ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5423-
ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5424-
ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5425-
ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5426-
ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5427-
ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5428-
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5429-
ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5430-
ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5431-
ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5432-
ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5433-
ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5434-
ok(delete_pf("msitest", FALSE), "Directory not created\n");
5449+
r = RegOpenKeyA(HKEY_CLASSES_ROOT, "selfreg_test", &key);
5450+
ok(!r, "got %u\n", r);
5451+
RegCloseKey(key);
5452+
5453+
r = MsiInstallProductA(msifile, "REMOVE=ALL");
5454+
ok(!r, "got %u\n", r);
5455+
5456+
r = RegOpenKeyA(HKEY_CLASSES_ROOT, "selfreg_test", &key);
5457+
ok(r == ERROR_FILE_NOT_FOUND, "got %u\n", r);
5458+
5459+
ok(!delete_pf("msitest\\selfreg.dll", TRUE), "file not removed\n");
5460+
ok(!delete_pf("msitest", FALSE), "directory not removed\n");
54355461

54365462
error:
5463+
DeleteFileA("msitest\\selfreg.dll");
54375464
delete_test_files();
54385465
DeleteFileA(msifile);
54395466
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

22
CUSTOM.DLL TESTDLL "custom.dll"
3+
SELFREG.DLL TESTDLL "selfreg.dll"
34

45
typelib.tlb TYPELIB "typelib.tlb"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* DLL for testing self-registration
3+
*
4+
* Copyright 2018 Zebediah Figura
5+
*
6+
* This library is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 2.1 of the License, or (at your option) any later version.
10+
*
11+
* This library is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public
17+
* License along with this library; if not, write to the Free Software
18+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19+
*/
20+
21+
#include <stdarg.h>
22+
#include <windef.h>
23+
#include <winbase.h>
24+
#include <winreg.h>
25+
26+
HRESULT WINAPI DllRegisterServer(void)
27+
{
28+
HKEY key;
29+
RegCreateKeyA(HKEY_CLASSES_ROOT, "selfreg_test", &key);
30+
RegCloseKey(key);
31+
return S_OK;
32+
}
33+
34+
HRESULT WINAPI DllUnregisterServer(void)
35+
{
36+
RegDeleteKeyA(HKEY_CLASSES_ROOT, "selfreg_test");
37+
return S_OK;
38+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@ stdcall -private DllRegisterServer()
2+
@ stdcall -private DllUnregisterServer()

0 commit comments

Comments
 (0)