https://git.reactos.org/?p=reactos.git;a=commitdiff;h=45a3a9f56b2b7ad9a896d…
commit 45a3a9f56b2b7ad9a896dd36da9ba545e82aa8c8
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sat Mar 12 15:14:54 2022 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Mar 20 19:27:51 2022 +0100
[WINESYNC] msi/tests: Test registration of a valid typelib.
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 f5da1902aa24433375fc3c99eaadad00917daa9f by Zebediah Figura
<z.figura12(a)gmail.com>
---
modules/rostests/winetests/msi/CMakeLists.txt | 12 ++++--
modules/rostests/winetests/msi/action.c | 52 ++++++++++++++++++++++----
modules/rostests/winetests/msi/msi_winetest.rc | 2 +
modules/rostests/winetests/msi/typelib.idl | 29 ++++++++++++++
4 files changed, 84 insertions(+), 11 deletions(-)
diff --git a/modules/rostests/winetests/msi/CMakeLists.txt
b/modules/rostests/winetests/msi/CMakeLists.txt
index e40bf5dc904..66187352588 100644
--- a/modules/rostests/winetests/msi/CMakeLists.txt
+++ b/modules/rostests/winetests/msi/CMakeLists.txt
@@ -16,20 +16,26 @@ list(APPEND SOURCE
patch.c
record.c
source.c
- suminfo.c)
+ suminfo.c
+ typelib.idl)
list(APPEND PCH_SKIP_SOURCE
+ ${CMAKE_CURRENT_BINARY_DIR}/typelib_i.c
testlist.c)
# 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)
+set_property(SOURCE msi_winetest.rc PROPERTY OBJECT_DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/custom.dll ${CMAKE_CURRENT_BINARY_DIR}/typelib.tlb)
add_executable(msi_winetest
${SOURCE}
${PCH_SKIP_SOURCE}
msi_winetest.rc)
+add_idl_headers(msi_winetest_idlheader typelib.idl)
+generate_idl_iids(typelib.idl)
+add_typelib(typelib.idl)
+
target_compile_definitions(msi_winetest PRIVATE __WINESRC__ USE_WINE_TODOS)
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
@@ -46,4 +52,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)
+add_dependencies(msi_winetest custom msi_winetest_idlheader stdole2)
diff --git a/modules/rostests/winetests/msi/action.c
b/modules/rostests/winetests/msi/action.c
index ea8c0e86c75..7026a0c5b73 100644
--- a/modules/rostests/winetests/msi/action.c
+++ b/modules/rostests/winetests/msi/action.c
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <stdlib.h>
+#define COBJMACROS
#include <windows.h>
#include <msiquery.h>
#include <msidefs.h>
@@ -33,9 +34,13 @@
#include <shellapi.h>
#include <winsvc.h>
#include <odbcinst.h>
+#ifdef __REACTOS__
+#include <oleauto.h>
+#endif
#include "wine/test.h"
#include "utils.h"
+#include "typelib.h"
static UINT (WINAPI *pMsiQueryComponentStateA)
(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *);
@@ -1003,10 +1008,10 @@ static const char tl_install_exec_seq_dat[] =
"InstallValidate\t\t1400\n"
"InstallInitialize\t\t1500\n"
"ProcessComponents\t\t1600\n"
- "RemoveFiles\t\t1700\n"
- "InstallFiles\t\t2000\n"
- "RegisterTypeLibraries\tREGISTER_TYPELIB=1\t3000\n"
"UnregisterTypeLibraries\t\t3100\n"
+ "RemoveFiles\t\t3200\n"
+ "InstallFiles\t\t3300\n"
+ "RegisterTypeLibraries\t\t3400\n"
"RegisterProduct\t\t5100\n"
"PublishFeatures\t\t5200\n"
"PublishProduct\t\t5300\n"
@@ -2647,6 +2652,24 @@ static DWORD get_estimated_size(void)
return size;
}
+static void extract_resource(const char *name, const char *type, const char *path)
+{
+ DWORD written;
+ HANDLE file;
+ HRSRC res;
+ void *ptr;
+
+ file = CreateFileA(path, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
+ ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n",
path, GetLastError());
+
+ res = FindResourceA(NULL, name, type);
+ ok( res != 0, "couldn't find resource\n" );
+ ptr = LockResource( LoadResource( GetModuleHandleA(NULL), res ));
+ WriteFile( file, ptr, SizeofResource( GetModuleHandleA(NULL), res ), &written,
NULL );
+ ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't
write resource\n" );
+ CloseHandle( file );
+}
+
static void test_register_product(void)
{
UINT r;
@@ -5594,6 +5617,8 @@ error:
static void test_register_typelib(void)
{
+ ITypeLib *tlb;
+ HRESULT hr;
UINT r;
if (is_process_limited())
@@ -5602,26 +5627,37 @@ static void test_register_typelib(void)
return;
}
+ /* UnregisterTypeLibraries action fails in 64-bit Windows <= 7 */
+ if (sizeof(void *) == 8)
+ {
+ win_skip("broken on 64-bit Windows\n");
+ return;
+ }
+
create_test_files();
- create_file("msitest\\typelib.dll", 1000);
+ extract_resource("typelib.tlb", "TYPELIB",
"msitest\\typelib.dll");
create_database(msifile, tl_tables, sizeof(tl_tables) / sizeof(msi_table));
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
- r = MsiInstallProductA(msifile, "REGISTER_TYPELIB=1");
+ r = MsiInstallProductA(msifile, NULL);
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
{
skip("Not enough rights to perform tests\n");
goto error;
}
- ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n",
r);
+ ok(r == ERROR_SUCCESS, "got %u\n", r);
- r = MsiInstallProductA(msifile, NULL);
- ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+ hr = LoadRegTypeLib(&LIBID_register_test, 7, 1, 0, &tlb);
+ ok(hr == S_OK, "got %#x\n", hr);
+ ITypeLib_Release(tlb);
r = MsiInstallProductA(msifile, "REMOVE=ALL");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+ hr = LoadRegTypeLib(&LIBID_register_test, 7, 1, 0, &tlb);
+ ok(hr == TYPE_E_LIBNOTREGISTERED, "got %#x\n", hr);
+
ok(!delete_pf("msitest\\typelib.dll", TRUE), "file not
removed\n");
ok(!delete_pf("msitest", FALSE), "directory not removed\n");
diff --git a/modules/rostests/winetests/msi/msi_winetest.rc
b/modules/rostests/winetests/msi/msi_winetest.rc
index 6aa15fe499b..f1840396a75 100644
--- a/modules/rostests/winetests/msi/msi_winetest.rc
+++ b/modules/rostests/winetests/msi/msi_winetest.rc
@@ -1,2 +1,4 @@
CUSTOM.DLL TESTDLL "custom.dll"
+
+typelib.tlb TYPELIB "typelib.tlb"
diff --git a/modules/rostests/winetests/msi/typelib.idl
b/modules/rostests/winetests/msi/typelib.idl
new file mode 100644
index 00000000000..f447c60ea09
--- /dev/null
+++ b/modules/rostests/winetests/msi/typelib.idl
@@ -0,0 +1,29 @@
+/*
+ * 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
+ */
+
+#pragma makedep ident
+#pragma makedep typelib
+#pragma makedep header
+
+[
+ uuid(eac5166a-9734-4d91-878f-1dd02304c66c),
+ version(7.1)
+]
+library register_test
+{
+}