mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 13:56:05 +00:00
[WINESYNC] msi/tests: Test registration of a valid typelib.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id f5da1902aa24433375fc3c99eaadad00917daa9f by Zebediah Figura <z.figura12@gmail.com>
This commit is contained in:
parent
b493df633a
commit
45a3a9f56b
4 changed files with 84 additions and 11 deletions
|
@ -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)
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
|
||||
CUSTOM.DLL TESTDLL "custom.dll"
|
||||
|
||||
typelib.tlb TYPELIB "typelib.tlb"
|
||||
|
|
29
modules/rostests/winetests/msi/typelib.idl
Normal file
29
modules/rostests/winetests/msi/typelib.idl
Normal file
|
@ -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
|
||||
{
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue