2018-02-15 03:54:54 +01:00
|
|
|
/*
|
|
|
|
* DLL for testing type 1 custom actions
|
|
|
|
*
|
|
|
|
* Copyright 2017 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 <stdio.h>
|
|
|
|
|
|
|
|
#include <windef.h>
|
|
|
|
#include <winbase.h>
|
2018-05-18 05:26:10 +02:00
|
|
|
#include <winsvc.h>
|
2018-05-19 05:00:58 +02:00
|
|
|
#include <odbcinst.h>
|
2018-02-15 03:54:55 +01:00
|
|
|
#define COBJMACROS
|
2018-05-18 05:26:08 +02:00
|
|
|
#include <shlobj.h>
|
2018-04-19 01:40:01 +02:00
|
|
|
#include <msxml.h>
|
2018-02-15 03:54:54 +01:00
|
|
|
#include <msi.h>
|
|
|
|
#include <msiquery.h>
|
|
|
|
|
2018-05-18 05:26:08 +02:00
|
|
|
static int todo_level, todo_do_loop;
|
|
|
|
|
2018-02-15 03:54:55 +01:00
|
|
|
static void ok_(MSIHANDLE hinst, int todo, const char *file, int line, int condition, const char *msg, ...)
|
|
|
|
{
|
|
|
|
static char buffer[2000];
|
|
|
|
MSIHANDLE record;
|
|
|
|
va_list valist;
|
|
|
|
|
|
|
|
va_start(valist, msg);
|
|
|
|
vsprintf(buffer, msg, valist);
|
|
|
|
va_end(valist);
|
|
|
|
|
|
|
|
record = MsiCreateRecord(5);
|
|
|
|
MsiRecordSetInteger(record, 1, todo);
|
|
|
|
MsiRecordSetStringA(record, 2, file);
|
|
|
|
MsiRecordSetInteger(record, 3, line);
|
|
|
|
MsiRecordSetInteger(record, 4, condition);
|
|
|
|
MsiRecordSetStringA(record, 5, buffer);
|
|
|
|
MsiProcessMessage(hinst, INSTALLMESSAGE_USER, record);
|
|
|
|
MsiCloseHandle(record);
|
|
|
|
}
|
2018-05-18 05:26:08 +02:00
|
|
|
|
|
|
|
static void winetest_start_todo( int is_todo )
|
|
|
|
{
|
|
|
|
todo_level = (todo_level << 1) | (is_todo != 0);
|
|
|
|
todo_do_loop=1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int winetest_loop_todo(void)
|
|
|
|
{
|
|
|
|
int do_loop=todo_do_loop;
|
|
|
|
todo_do_loop=0;
|
|
|
|
return do_loop;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void winetest_end_todo(void)
|
|
|
|
{
|
|
|
|
todo_level >>= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define ok(hinst, condition, ...) ok_(hinst, todo_level, __FILE__, __LINE__, condition, __VA_ARGS__)
|
|
|
|
#define todo_wine_if(is_todo) for (winetest_start_todo(is_todo); \
|
|
|
|
winetest_loop_todo(); \
|
|
|
|
winetest_end_todo())
|
|
|
|
#define todo_wine todo_wine_if(1)
|
2018-02-15 03:54:55 +01:00
|
|
|
|
2018-04-17 17:35:40 +02:00
|
|
|
static const char *dbgstr_w(WCHAR *str)
|
|
|
|
{
|
|
|
|
static char buffer[300], *p;
|
|
|
|
|
|
|
|
if (!str) return "(null)";
|
|
|
|
|
|
|
|
p = buffer;
|
|
|
|
*p++ = 'L';
|
|
|
|
*p++ = '"';
|
|
|
|
while ((*p++ = *str++));
|
|
|
|
*p++ = '"';
|
|
|
|
*p++ = 0;
|
|
|
|
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void check_prop(MSIHANDLE hinst, const char *prop, const char *expect)
|
|
|
|
{
|
|
|
|
char buffer[10] = "x";
|
|
|
|
DWORD sz = sizeof(buffer);
|
|
|
|
UINT r = MsiGetPropertyA(hinst, prop, buffer, &sz);
|
|
|
|
ok(hinst, !r, "'%s': got %u\n", prop, r);
|
|
|
|
ok(hinst, sz == strlen(buffer), "'%s': expected %u, got %u\n", prop, strlen(buffer), sz);
|
|
|
|
ok(hinst, !strcmp(buffer, expect), "expected '%s', got '%s'\n", expect, buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_props(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
static const WCHAR booW[] = {'b','o','o',0};
|
|
|
|
static const WCHAR xyzW[] = {'x','y','z',0};
|
|
|
|
static const WCHAR xyW[] = {'x','y',0};
|
|
|
|
char buffer[10];
|
|
|
|
WCHAR bufferW[10];
|
|
|
|
DWORD sz;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
/* test invalid values */
|
|
|
|
r = MsiGetPropertyA(hinst, NULL, NULL, NULL);
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetPropertyA(hinst, "boo", NULL, NULL);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetPropertyA(hinst, "boo", buffer, NULL );
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
r = MsiGetPropertyA(hinst, "boo", NULL, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, sz == 0, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
strcpy(buffer,"x");
|
|
|
|
r = MsiGetPropertyA(hinst, "boo", buffer, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !strcmp(buffer, "x"), "got \"%s\"\n", buffer);
|
|
|
|
ok(hinst, sz == 0, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 1;
|
|
|
|
strcpy(buffer,"x");
|
|
|
|
r = MsiGetPropertyA(hinst, "boo", buffer, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, !buffer[0], "got \"%s\"\n", buffer);
|
|
|
|
ok(hinst, sz == 0, "got size %u\n", sz);
|
|
|
|
|
|
|
|
/* set the property to something */
|
|
|
|
r = MsiSetPropertyA(hinst, NULL, NULL);
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiSetPropertyA(hinst, "", NULL);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiSetPropertyA(hinst, "", "asdf");
|
|
|
|
ok(hinst, r == ERROR_FUNCTION_FAILED, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiSetPropertyA(hinst, "=", "asdf");
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
check_prop(hinst, "=", "asdf");
|
|
|
|
|
|
|
|
r = MsiSetPropertyA(hinst, " ", "asdf");
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
check_prop(hinst, " ", "asdf");
|
|
|
|
|
|
|
|
r = MsiSetPropertyA(hinst, "'", "asdf");
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
check_prop(hinst, "'", "asdf");
|
|
|
|
|
|
|
|
r = MsiSetPropertyA(hinst, "boo", NULL);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
check_prop(hinst, "boo", "");
|
|
|
|
|
|
|
|
r = MsiSetPropertyA(hinst, "boo", "");
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
check_prop(hinst, "boo", "");
|
|
|
|
|
|
|
|
r = MsiSetPropertyA(hinst, "boo", "xyz");
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
check_prop(hinst, "boo", "xyz");
|
|
|
|
|
|
|
|
r = MsiGetPropertyA(hinst, "boo", NULL, NULL);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetPropertyA(hinst, "boo", buffer, NULL );
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
|
|
|
|
/* Returned size is in bytes, not chars, but only for custom actions.
|
|
|
|
* Seems to be a casualty of RPC... */
|
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
r = MsiGetPropertyA(hinst, "boo", NULL, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, sz == 6, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
strcpy(buffer,"q");
|
|
|
|
r = MsiGetPropertyA(hinst, "boo", buffer, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !strcmp(buffer, "q"), "got \"%s\"\n", buffer);
|
2018-05-16 06:03:35 +02:00
|
|
|
ok(hinst, sz == 6, "got size %u\n", sz);
|
2018-04-17 17:35:40 +02:00
|
|
|
|
|
|
|
sz = 1;
|
|
|
|
strcpy(buffer,"x");
|
|
|
|
r = MsiGetPropertyA(hinst, "boo", buffer, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !buffer[0], "got \"%s\"\n", buffer);
|
2018-05-16 06:03:35 +02:00
|
|
|
ok(hinst, sz == 6, "got size %u\n", sz);
|
2018-04-17 17:35:40 +02:00
|
|
|
|
|
|
|
sz = 3;
|
|
|
|
strcpy(buffer,"x");
|
|
|
|
r = MsiGetPropertyA(hinst, "boo", buffer, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !strcmp(buffer, "xy"), "got \"%s\"\n", buffer);
|
2018-05-16 06:03:35 +02:00
|
|
|
ok(hinst, sz == 6, "got size %u\n", sz);
|
2018-04-17 17:35:40 +02:00
|
|
|
|
|
|
|
sz = 4;
|
|
|
|
strcpy(buffer,"x");
|
|
|
|
r = MsiGetPropertyA(hinst, "boo", buffer, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, !strcmp(buffer, "xyz"), "got \"%s\"\n", buffer);
|
|
|
|
ok(hinst, sz == 3, "got size %u\n", sz);
|
|
|
|
|
2018-05-16 06:03:36 +02:00
|
|
|
r = MsiGetPropertyW(hinst, booW, NULL, NULL);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetPropertyW(hinst, booW, bufferW, NULL );
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
|
2018-04-17 17:35:40 +02:00
|
|
|
sz = 0;
|
|
|
|
r = MsiGetPropertyW(hinst, booW, NULL, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, sz == 3, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
lstrcpyW(bufferW, booW);
|
|
|
|
r = MsiGetPropertyW(hinst, booW, bufferW, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !lstrcmpW(bufferW, booW), "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == 3, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 1;
|
|
|
|
lstrcpyW(bufferW, booW);
|
|
|
|
r = MsiGetPropertyW(hinst, booW, bufferW, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == 3, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 3;
|
|
|
|
lstrcpyW(bufferW, booW);
|
|
|
|
r = MsiGetPropertyW(hinst, booW, bufferW, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !lstrcmpW(bufferW, xyW), "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == 3, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 4;
|
|
|
|
lstrcpyW(bufferW, booW);
|
|
|
|
r = MsiGetPropertyW(hinst, booW, bufferW, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, !lstrcmpW(bufferW, xyzW), "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == 3, "got size %u\n", sz);
|
|
|
|
|
|
|
|
r = MsiSetPropertyA(hinst, "boo", NULL);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
check_prop(hinst, "boo", "");
|
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
r = MsiGetPropertyA(hinst, "embednullprop", NULL, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, sz == 6, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 4;
|
|
|
|
memset(buffer, 0xcc, sizeof(buffer));
|
|
|
|
r = MsiGetPropertyA(hinst, "embednullprop", buffer, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, sz == 3, "got size %u\n", sz);
|
|
|
|
ok(hinst, !memcmp(buffer, "a\0\0\0\xcc", 5), "wrong data\n");
|
|
|
|
}
|
2018-02-15 03:54:55 +01:00
|
|
|
|
2018-04-19 01:40:02 +02:00
|
|
|
static void test_db(MSIHANDLE hinst)
|
|
|
|
{
|
2018-04-20 06:44:18 +02:00
|
|
|
MSIHANDLE hdb, view, rec, rec2, suminfo;
|
2018-04-19 01:40:06 +02:00
|
|
|
char buffer[10];
|
|
|
|
DWORD sz;
|
2018-04-19 01:40:02 +02:00
|
|
|
UINT r;
|
|
|
|
|
|
|
|
hdb = MsiGetActiveDatabase(hinst);
|
|
|
|
ok(hinst, hdb, "MsiGetActiveDatabase failed\n");
|
|
|
|
|
2018-04-19 01:40:03 +02:00
|
|
|
r = MsiDatabaseIsTablePersistentA(hdb, "Test");
|
|
|
|
ok(hinst, r == MSICONDITION_TRUE, "got %u\n", r);
|
|
|
|
|
2018-04-19 01:40:04 +02:00
|
|
|
r = MsiDatabaseOpenViewA(hdb, NULL, &view);
|
|
|
|
ok(hinst, r == ERROR_BAD_QUERY_SYNTAX, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `Test`", NULL);
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `Test`", &view);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
2018-04-20 06:44:14 +02:00
|
|
|
r = MsiViewGetColumnInfo(view, MSICOLINFO_NAMES, &rec2);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
sz = sizeof(buffer);
|
|
|
|
r = MsiRecordGetStringA(rec2, 1, buffer, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, sz == strlen(buffer), "got size %u\n", sz);
|
|
|
|
ok(hinst, !strcmp(buffer, "Name"), "got '%s'\n", buffer);
|
|
|
|
|
|
|
|
r = MsiCloseHandle(rec2);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
2018-04-19 01:40:05 +02:00
|
|
|
r = MsiViewExecute(view, 0);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
2018-04-19 01:40:06 +02:00
|
|
|
r = MsiViewFetch(view, &rec2);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiRecordGetFieldCount(rec2);
|
|
|
|
ok(hinst, r == 3, "got %u\n", r);
|
|
|
|
|
|
|
|
sz = sizeof(buffer);
|
|
|
|
r = MsiRecordGetStringA(rec2, 1, buffer, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, sz == strlen(buffer), "got size %u\n", sz);
|
|
|
|
ok(hinst, !strcmp(buffer, "one"), "got '%s'\n", buffer);
|
|
|
|
|
|
|
|
r = MsiRecordGetInteger(rec2, 2);
|
|
|
|
ok(hinst, r == 1, "got %d\n", r);
|
|
|
|
|
|
|
|
sz = sizeof(buffer);
|
|
|
|
r = MsiRecordReadStream(rec2, 3, buffer, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, !memcmp(buffer, "unus", 4), "wrong data\n");
|
|
|
|
|
|
|
|
r = MsiCloseHandle(rec2);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiViewFetch(view, &rec2);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiRecordGetFieldCount(rec2);
|
|
|
|
ok(hinst, r == 3, "got %u\n", r);
|
|
|
|
|
|
|
|
sz = sizeof(buffer);
|
|
|
|
r = MsiRecordGetStringA(rec2, 1, buffer, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, sz == strlen(buffer), "got size %u\n", sz);
|
|
|
|
ok(hinst, !strcmp(buffer, "two"), "got '%s'\n", buffer);
|
|
|
|
|
|
|
|
r = MsiRecordGetInteger(rec2, 2);
|
|
|
|
ok(hinst, r == 2, "got %d\n", r);
|
|
|
|
|
|
|
|
sz = sizeof(buffer);
|
|
|
|
r = MsiRecordReadStream(rec2, 3, buffer, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, !memcmp(buffer, "duo", 3), "wrong data\n");
|
|
|
|
|
2018-04-20 06:44:15 +02:00
|
|
|
r = MsiViewModify(view, MSIMODIFY_REFRESH, 0);
|
|
|
|
ok(hinst, r == ERROR_INVALID_HANDLE, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiRecordSetStringA(rec2, 1, "three");
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiRecordSetInteger(rec2, 2, 3);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiRecordSetInteger(rec2, 3, 3);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiViewModify(view, MSIMODIFY_REFRESH, rec2);
|
|
|
|
ok(hinst, !r, "got %d\n", r);
|
|
|
|
|
|
|
|
sz = sizeof(buffer);
|
|
|
|
r = MsiRecordGetStringA(rec2, 1, buffer, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, sz == strlen(buffer), "got size %u\n", sz);
|
|
|
|
ok(hinst, !strcmp(buffer, "two"), "got '%s'\n", buffer);
|
|
|
|
|
|
|
|
r = MsiRecordGetInteger(rec2, 2);
|
|
|
|
ok(hinst, r == 2, "got %d\n", r);
|
|
|
|
|
|
|
|
sz = sizeof(buffer);
|
|
|
|
r = MsiRecordReadStream(rec2, 3, buffer, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, !memcmp(buffer, "duo", 3), "wrong data\n");
|
|
|
|
|
2018-04-19 01:40:06 +02:00
|
|
|
r = MsiCloseHandle(rec2);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiViewFetch(view, &rec2);
|
|
|
|
ok(hinst, r == ERROR_NO_MORE_ITEMS, "got %u\n", r);
|
|
|
|
ok(hinst, !rec2, "got %u\n", rec2);
|
|
|
|
|
2018-04-20 06:44:13 +02:00
|
|
|
r = MsiViewClose(view);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
2018-04-19 01:40:05 +02:00
|
|
|
r = MsiCloseHandle(view);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `Test` WHERE `Name` = ?", &view);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
rec = MsiCreateRecord(1);
|
|
|
|
MsiRecordSetStringA(rec, 1, "one");
|
|
|
|
|
|
|
|
r = MsiViewExecute(view, rec);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
2018-04-19 01:40:06 +02:00
|
|
|
r = MsiViewFetch(view, &rec2);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiRecordGetInteger(rec2, 2);
|
|
|
|
ok(hinst, r == 1, "got %d\n", r);
|
|
|
|
|
|
|
|
r = MsiCloseHandle(rec2);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiViewFetch(view, &rec2);
|
|
|
|
ok(hinst, r == ERROR_NO_MORE_ITEMS, "got %u\n", r);
|
|
|
|
ok(hinst, !rec2, "got %u\n", rec2);
|
|
|
|
|
2018-04-19 01:40:05 +02:00
|
|
|
r = MsiCloseHandle(rec);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
2018-04-19 01:40:04 +02:00
|
|
|
r = MsiCloseHandle(view);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
2018-04-20 06:44:17 +02:00
|
|
|
/* test MsiDatabaseGetPrimaryKeys() */
|
|
|
|
r = MsiDatabaseGetPrimaryKeysA(hdb, "Test", &rec);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiRecordGetFieldCount(rec);
|
|
|
|
ok(hinst, r == 1, "got %d\n", r);
|
|
|
|
|
|
|
|
sz = sizeof(buffer);
|
|
|
|
r = MsiRecordGetStringA(rec, 0, buffer, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, sz == strlen(buffer), "got size %u\n", sz);
|
|
|
|
ok(hinst, !strcmp(buffer, "Test"), "got '%s'\n", buffer);
|
|
|
|
|
|
|
|
sz = sizeof(buffer);
|
|
|
|
r = MsiRecordGetStringA(rec, 1, buffer, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, sz == strlen(buffer), "got size %u\n", sz);
|
|
|
|
ok(hinst, !strcmp(buffer, "Name"), "got '%s'\n", buffer);
|
|
|
|
|
|
|
|
r = MsiCloseHandle(rec);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
2018-04-20 06:44:18 +02:00
|
|
|
r = MsiGetSummaryInformationA(hdb, NULL, 1, NULL);
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetSummaryInformationA(hdb, NULL, 1, &suminfo);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiCloseHandle(suminfo);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
2018-04-19 01:40:02 +02:00
|
|
|
r = MsiCloseHandle(hdb);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
}
|
|
|
|
|
2018-04-22 02:33:43 +02:00
|
|
|
static void test_doaction(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
r = MsiDoActionA(hinst, "nested51");
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
check_prop(hinst, "nested", "1");
|
|
|
|
|
|
|
|
r = MsiDoActionA(hinst, "nested1");
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
check_prop(hinst, "nested", "2");
|
2018-04-22 02:33:44 +02:00
|
|
|
|
|
|
|
r = MsiSequenceA(hinst, NULL, 0);
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiSequenceA(hinst, "TestSequence", 0);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
check_prop(hinst, "nested", "1");
|
2018-04-22 02:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI nested(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
MsiSetPropertyA(hinst, "nested", "2");
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2018-04-22 02:33:45 +02:00
|
|
|
static void test_targetpath(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
static const WCHAR targetdirW[] = {'T','A','R','G','E','T','D','I','R',0};
|
|
|
|
static const WCHAR xyzW[] = {'C',':','\\',0};
|
|
|
|
static const WCHAR xyW[] = {'C',':',0};
|
2018-04-22 02:33:47 +02:00
|
|
|
WCHAR bufferW[100];
|
|
|
|
char buffer[100];
|
|
|
|
DWORD sz, srcsz;
|
2018-04-22 02:33:45 +02:00
|
|
|
UINT r;
|
|
|
|
|
|
|
|
/* test invalid values */
|
|
|
|
r = MsiGetTargetPathA(hinst, NULL, NULL, NULL);
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetTargetPathA(hinst, "TARGETDIR", NULL, NULL );
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetTargetPathA(hinst, "TARGETDIR", buffer, NULL );
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
|
|
|
|
/* Returned size is in bytes, not chars, but only for custom actions.
|
|
|
|
* Seems to be a casualty of RPC... */
|
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
r = MsiGetTargetPathA(hinst, "TARGETDIR", NULL, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
2018-05-17 17:48:16 +02:00
|
|
|
ok(hinst, sz == 6, "got size %u\n", sz);
|
2018-04-22 02:33:45 +02:00
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
strcpy(buffer,"q");
|
|
|
|
r = MsiGetTargetPathA(hinst, "TARGETDIR", buffer, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !strcmp(buffer, "q"), "got \"%s\"\n", buffer);
|
2018-05-17 17:48:16 +02:00
|
|
|
ok(hinst, sz == 6, "got size %u\n", sz);
|
2018-04-22 02:33:45 +02:00
|
|
|
|
|
|
|
sz = 1;
|
|
|
|
strcpy(buffer,"x");
|
|
|
|
r = MsiGetTargetPathA(hinst, "TARGETDIR", buffer, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !buffer[0], "got \"%s\"\n", buffer);
|
2018-05-17 17:48:16 +02:00
|
|
|
ok(hinst, sz == 6, "got size %u\n", sz);
|
2018-04-22 02:33:45 +02:00
|
|
|
|
|
|
|
sz = 3;
|
|
|
|
strcpy(buffer,"x");
|
|
|
|
r = MsiGetTargetPathA(hinst, "TARGETDIR", buffer, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !strcmp(buffer, "C:"), "got \"%s\"\n", buffer);
|
2018-05-17 17:48:16 +02:00
|
|
|
ok(hinst, sz == 6, "got size %u\n", sz);
|
2018-04-22 02:33:45 +02:00
|
|
|
|
|
|
|
sz = 4;
|
|
|
|
strcpy(buffer,"x");
|
|
|
|
r = MsiGetTargetPathA(hinst, "TARGETDIR", buffer, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, !strcmp(buffer, "C:\\"), "got \"%s\"\n", buffer);
|
|
|
|
ok(hinst, sz == 3, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
r = MsiGetTargetPathW(hinst, targetdirW, NULL, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, sz == 3, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
bufferW[0] = 'q';
|
|
|
|
r = MsiGetTargetPathW(hinst, targetdirW, bufferW, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, bufferW[0] == 'q', "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == 3, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 1;
|
|
|
|
bufferW[0] = 'q';
|
|
|
|
r = MsiGetTargetPathW(hinst, targetdirW, bufferW, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == 3, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 3;
|
|
|
|
bufferW[0] = 'q';
|
|
|
|
r = MsiGetTargetPathW(hinst, targetdirW, bufferW, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !lstrcmpW(bufferW, xyW), "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == 3, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 4;
|
|
|
|
bufferW[0] = 'q';
|
|
|
|
r = MsiGetTargetPathW(hinst, targetdirW, bufferW, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, !lstrcmpW(bufferW, xyzW), "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == 3, "got size %u\n", sz);
|
2018-04-22 02:33:46 +02:00
|
|
|
|
|
|
|
r = MsiSetTargetPathA(hinst, NULL, "C:\\subdir");
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
|
2018-05-19 04:55:43 +02:00
|
|
|
r = MsiSetTargetPathA(hinst, "MSITESTDIR", NULL);
|
2018-04-22 02:33:46 +02:00
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
|
2018-05-19 04:55:43 +02:00
|
|
|
r = MsiSetTargetPathA(hinst, "MSITESTDIR", "C:\\subdir");
|
2018-04-22 02:33:46 +02:00
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
sz = sizeof(buffer);
|
2018-05-19 04:55:43 +02:00
|
|
|
r = MsiGetTargetPathA(hinst, "MSITESTDIR", buffer, &sz);
|
2018-04-22 02:33:46 +02:00
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, !strcmp(buffer, "C:\\subdir\\"), "got \"%s\"\n", buffer);
|
|
|
|
|
2018-05-19 04:55:43 +02:00
|
|
|
r = MsiSetTargetPathA(hinst, "MSITESTDIR", "C:\\");
|
2018-04-22 02:33:47 +02:00
|
|
|
|
|
|
|
/* test GetSourcePath() */
|
|
|
|
|
|
|
|
r = MsiGetSourcePathA(hinst, NULL, NULL, NULL);
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetSourcePathA(hinst, "TARGETDIR", NULL, NULL );
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetSourcePathA(hinst, "TARGETDIR", buffer, NULL );
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
|
|
|
|
/* Returned size is in bytes, not chars, but only for custom actions.
|
|
|
|
* Seems to be a casualty of RPC... */
|
|
|
|
|
|
|
|
srcsz = 0;
|
|
|
|
MsiGetSourcePathW(hinst, targetdirW, NULL, &srcsz);
|
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
r = MsiGetSourcePathA(hinst, "TARGETDIR", NULL, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
2018-05-17 17:48:18 +02:00
|
|
|
ok(hinst, sz == srcsz * 2, "got size %u\n", sz);
|
2018-04-22 02:33:47 +02:00
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
strcpy(buffer,"q");
|
|
|
|
r = MsiGetSourcePathA(hinst, "TARGETDIR", buffer, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !strcmp(buffer, "q"), "got \"%s\"\n", buffer);
|
2018-05-17 17:48:18 +02:00
|
|
|
ok(hinst, sz == srcsz * 2, "got size %u\n", sz);
|
2018-04-22 02:33:47 +02:00
|
|
|
|
|
|
|
sz = 1;
|
|
|
|
strcpy(buffer,"x");
|
|
|
|
r = MsiGetSourcePathA(hinst, "TARGETDIR", buffer, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !buffer[0], "got \"%s\"\n", buffer);
|
2018-05-17 17:48:18 +02:00
|
|
|
ok(hinst, sz == srcsz * 2, "got size %u\n", sz);
|
2018-04-22 02:33:47 +02:00
|
|
|
|
|
|
|
sz = srcsz;
|
|
|
|
strcpy(buffer,"x");
|
|
|
|
r = MsiGetSourcePathA(hinst, "TARGETDIR", buffer, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, strlen(buffer) == srcsz - 1, "wrong buffer length %d\n", strlen(buffer));
|
2018-05-17 17:48:18 +02:00
|
|
|
ok(hinst, sz == srcsz * 2, "got size %u\n", sz);
|
2018-04-22 02:33:47 +02:00
|
|
|
|
|
|
|
sz = srcsz + 1;
|
|
|
|
strcpy(buffer,"x");
|
|
|
|
r = MsiGetSourcePathA(hinst, "TARGETDIR", buffer, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, strlen(buffer) == srcsz, "wrong buffer length %d\n", strlen(buffer));
|
|
|
|
ok(hinst, sz == srcsz, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
r = MsiGetSourcePathW(hinst, targetdirW, NULL, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, sz == srcsz, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
bufferW[0] = 'q';
|
|
|
|
r = MsiGetSourcePathW(hinst, targetdirW, bufferW, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, bufferW[0] == 'q', "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == srcsz, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 1;
|
|
|
|
bufferW[0] = 'q';
|
|
|
|
r = MsiGetSourcePathW(hinst, targetdirW, bufferW, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == srcsz, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = srcsz;
|
|
|
|
bufferW[0] = 'q';
|
|
|
|
r = MsiGetSourcePathW(hinst, targetdirW, bufferW, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, lstrlenW(bufferW) == srcsz - 1, "wrong buffer length %d\n", lstrlenW(bufferW));
|
|
|
|
ok(hinst, sz == srcsz, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = srcsz + 1;
|
|
|
|
bufferW[0] = 'q';
|
|
|
|
r = MsiGetSourcePathW(hinst, targetdirW, bufferW, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, lstrlenW(bufferW) == srcsz, "wrong buffer length %d\n", lstrlenW(bufferW));
|
|
|
|
ok(hinst, sz == srcsz, "got size %u\n", sz);
|
2018-04-22 02:33:45 +02:00
|
|
|
}
|
|
|
|
|
2018-04-25 05:27:37 +02:00
|
|
|
static void test_misc(MSIHANDLE hinst)
|
2018-04-24 06:18:14 +02:00
|
|
|
{
|
2018-04-25 05:27:40 +02:00
|
|
|
MSICONDITION cond;
|
2018-04-25 05:27:37 +02:00
|
|
|
LANGID lang;
|
2018-04-24 06:18:14 +02:00
|
|
|
UINT r;
|
|
|
|
|
|
|
|
r = MsiSetMode(hinst, MSIRUNMODE_REBOOTATEND, FALSE);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
2018-04-25 05:27:37 +02:00
|
|
|
|
|
|
|
lang = MsiGetLanguage(hinst);
|
|
|
|
ok(hinst, lang == 1033, "got %u\n", lang);
|
2018-04-25 05:27:38 +02:00
|
|
|
|
|
|
|
check_prop(hinst, "INSTALLLEVEL", "3");
|
|
|
|
r = MsiSetInstallLevel(hinst, 123);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
check_prop(hinst, "INSTALLLEVEL", "123");
|
|
|
|
MsiSetInstallLevel(hinst, 3);
|
2018-04-25 05:27:40 +02:00
|
|
|
|
|
|
|
cond = MsiEvaluateConditionA(hinst, NULL);
|
|
|
|
ok(hinst, cond == MSICONDITION_NONE, "got %u\n", cond);
|
|
|
|
MsiSetPropertyA(hinst, "condprop", "1");
|
|
|
|
cond = MsiEvaluateConditionA(hinst, "condprop = 1");
|
|
|
|
ok(hinst, cond == MSICONDITION_TRUE, "got %u\n", cond);
|
2018-04-24 06:18:14 +02:00
|
|
|
}
|
|
|
|
|
2018-04-24 06:18:15 +02:00
|
|
|
static void test_feature_states(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
INSTALLSTATE state, action;
|
|
|
|
UINT r;
|
|
|
|
|
2018-04-24 06:18:17 +02:00
|
|
|
/* test feature states */
|
|
|
|
|
2018-04-24 06:18:15 +02:00
|
|
|
r = MsiGetFeatureStateA(hinst, NULL, &state, &action);
|
|
|
|
ok(hinst, r == ERROR_UNKNOWN_FEATURE, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetFeatureStateA(hinst, "fake", &state, &action);
|
|
|
|
ok(hinst, r == ERROR_UNKNOWN_FEATURE, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetFeatureStateA(hinst, "One", NULL, &action);
|
|
|
|
ok(hinst, r == RPC_X_NULL_REF_POINTER, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetFeatureStateA(hinst, "One", &state, NULL);
|
|
|
|
ok(hinst, r == RPC_X_NULL_REF_POINTER, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetFeatureStateA(hinst, "One", &state, &action);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, state == INSTALLSTATE_ABSENT, "got state %d\n", state);
|
|
|
|
ok(hinst, action == INSTALLSTATE_LOCAL, "got action %d\n", action);
|
2018-04-24 06:18:16 +02:00
|
|
|
|
|
|
|
r = MsiSetFeatureStateA(hinst, NULL, INSTALLSTATE_ABSENT);
|
|
|
|
ok(hinst, r == ERROR_UNKNOWN_FEATURE, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiSetFeatureStateA(hinst, "One", INSTALLSTATE_ADVERTISED);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetFeatureStateA(hinst, "One", &state, &action);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, action == INSTALLSTATE_ADVERTISED, "got action %d\n", action);
|
|
|
|
|
|
|
|
r = MsiSetFeatureStateA(hinst, "One", INSTALLSTATE_LOCAL);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetFeatureStateA(hinst, "One", &state, &action);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, action == INSTALLSTATE_LOCAL, "got action %d\n", action);
|
2018-04-24 06:18:17 +02:00
|
|
|
|
|
|
|
/* test component states */
|
|
|
|
|
|
|
|
r = MsiGetComponentStateA(hinst, NULL, &state, &action);
|
|
|
|
ok(hinst, r == ERROR_UNKNOWN_COMPONENT, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetComponentStateA(hinst, "fake", &state, &action);
|
|
|
|
ok(hinst, r == ERROR_UNKNOWN_COMPONENT, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetComponentStateA(hinst, "One", NULL, &action);
|
|
|
|
ok(hinst, r == RPC_X_NULL_REF_POINTER, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetComponentStateA(hinst, "One", &state, NULL);
|
|
|
|
ok(hinst, r == RPC_X_NULL_REF_POINTER, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetComponentStateA(hinst, "One", &state, &action);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, state == INSTALLSTATE_ABSENT, "got state %d\n", state);
|
|
|
|
ok(hinst, action == INSTALLSTATE_LOCAL, "got action %d\n", action);
|
|
|
|
|
|
|
|
r = MsiGetComponentStateA(hinst, "dangler", &state, &action);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, state == INSTALLSTATE_ABSENT, "got state %d\n", state);
|
|
|
|
ok(hinst, action == INSTALLSTATE_UNKNOWN, "got action %d\n", action);
|
|
|
|
|
|
|
|
r = MsiGetComponentStateA(hinst, "component", &state, &action);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, state == INSTALLSTATE_UNKNOWN, "got state %d\n", state);
|
|
|
|
ok(hinst, action == INSTALLSTATE_LOCAL, "got action %d\n", action);
|
2018-04-24 06:18:18 +02:00
|
|
|
|
|
|
|
r = MsiSetComponentStateA(hinst, NULL, INSTALLSTATE_ABSENT);
|
|
|
|
ok(hinst, r == ERROR_UNKNOWN_COMPONENT, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiSetComponentStateA(hinst, "One", INSTALLSTATE_SOURCE);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetComponentStateA(hinst, "One", &state, &action);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, state == INSTALLSTATE_ABSENT, "got state %d\n", state);
|
|
|
|
ok(hinst, action == INSTALLSTATE_SOURCE, "got action %d\n", action);
|
|
|
|
|
|
|
|
r = MsiSetComponentStateA(hinst, "One", INSTALLSTATE_LOCAL);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiGetComponentStateA(hinst, "One", &state, &action);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, state == INSTALLSTATE_ABSENT, "got state %d\n", state);
|
|
|
|
ok(hinst, action == INSTALLSTATE_LOCAL, "got action %d\n", action);
|
2018-04-24 06:18:15 +02:00
|
|
|
}
|
|
|
|
|
2018-04-25 05:27:39 +02:00
|
|
|
static void test_format_record(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
static const WCHAR xyzW[] = {'f','o','o',' ','1','2','3',0};
|
|
|
|
static const WCHAR xyW[] = {'f','o','o',' ','1','2',0};
|
|
|
|
WCHAR bufferW[10];
|
|
|
|
char buffer[10];
|
|
|
|
MSIHANDLE rec;
|
|
|
|
DWORD sz;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
r = MsiFormatRecordA(hinst, 0, NULL, NULL);
|
|
|
|
ok(hinst, r == ERROR_INVALID_HANDLE, "got %u\n", r);
|
|
|
|
|
|
|
|
rec = MsiCreateRecord(1);
|
|
|
|
MsiRecordSetStringA(rec, 0, "foo [1]");
|
|
|
|
MsiRecordSetInteger(rec, 1, 123);
|
|
|
|
|
|
|
|
r = MsiFormatRecordA(hinst, rec, NULL, NULL);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiFormatRecordA(hinst, rec, buffer, NULL);
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
|
|
|
|
/* Returned size is in bytes, not chars, but only for custom actions. */
|
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
r = MsiFormatRecordA(hinst, rec, NULL, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
2018-05-16 06:03:33 +02:00
|
|
|
ok(hinst, sz == 14, "got size %u\n", sz);
|
2018-04-25 05:27:39 +02:00
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
strcpy(buffer,"q");
|
|
|
|
r = MsiFormatRecordA(hinst, rec, buffer, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !strcmp(buffer, "q"), "got \"%s\"\n", buffer);
|
2018-05-16 06:03:33 +02:00
|
|
|
ok(hinst, sz == 14, "got size %u\n", sz);
|
2018-04-25 05:27:39 +02:00
|
|
|
|
|
|
|
sz = 1;
|
|
|
|
strcpy(buffer,"x");
|
|
|
|
r = MsiFormatRecordA(hinst, rec, buffer, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !buffer[0], "got \"%s\"\n", buffer);
|
2018-05-16 06:03:33 +02:00
|
|
|
ok(hinst, sz == 14, "got size %u\n", sz);
|
2018-04-25 05:27:39 +02:00
|
|
|
|
|
|
|
sz = 7;
|
|
|
|
strcpy(buffer,"x");
|
|
|
|
r = MsiFormatRecordA(hinst, rec, buffer, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !strcmp(buffer, "foo 12"), "got \"%s\"\n", buffer);
|
2018-05-16 06:03:33 +02:00
|
|
|
ok(hinst, sz == 14, "got size %u\n", sz);
|
2018-04-25 05:27:39 +02:00
|
|
|
|
|
|
|
sz = 8;
|
|
|
|
strcpy(buffer,"x");
|
|
|
|
r = MsiFormatRecordA(hinst, rec, buffer, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, !strcmp(buffer, "foo 123"), "got \"%s\"\n", buffer);
|
|
|
|
ok(hinst, sz == 7, "got size %u\n", sz);
|
|
|
|
|
2018-05-16 06:03:34 +02:00
|
|
|
r = MsiFormatRecordW(hinst, rec, NULL, NULL);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiFormatRecordW(hinst, rec, bufferW, NULL);
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
r = MsiFormatRecordW(hinst, rec, NULL, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, sz == 7, "got size %u\n", sz);
|
|
|
|
|
2018-04-25 05:27:39 +02:00
|
|
|
sz = 0;
|
|
|
|
bufferW[0] = 'q';
|
|
|
|
r = MsiFormatRecordW(hinst, rec, bufferW, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, bufferW[0] == 'q', "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == 7, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 1;
|
|
|
|
bufferW[0] = 'q';
|
|
|
|
r = MsiFormatRecordW(hinst, rec, bufferW, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == 7, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 7;
|
|
|
|
bufferW[0] = 'q';
|
|
|
|
r = MsiFormatRecordW(hinst, rec, bufferW, &sz);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !lstrcmpW(bufferW, xyW), "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == 7, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 8;
|
|
|
|
bufferW[0] = 'q';
|
|
|
|
r = MsiFormatRecordW(hinst, rec, bufferW, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, !lstrcmpW(bufferW, xyzW), "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == 7, "got size %u\n", sz);
|
|
|
|
|
|
|
|
/* check that properties work */
|
|
|
|
MsiSetPropertyA(hinst, "fmtprop", "foobar");
|
|
|
|
MsiRecordSetStringA(rec, 0, "[fmtprop]");
|
|
|
|
sz = sizeof(buffer);
|
|
|
|
r = MsiFormatRecordA(hinst, rec, buffer, &sz);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, !strcmp(buffer, "foobar"), "got \"%s\"\n", buffer);
|
|
|
|
ok(hinst, sz == 6, "got size %u\n", sz);
|
|
|
|
|
|
|
|
MsiCloseHandle(rec);
|
|
|
|
}
|
|
|
|
|
2018-04-25 05:27:42 +02:00
|
|
|
static void test_costs(MSIHANDLE hinst)
|
|
|
|
{
|
2018-04-26 03:54:38 +02:00
|
|
|
static const WCHAR oneW[] = {'O','n','e',0};
|
|
|
|
static const WCHAR xyzW[] = {'C',':',0};
|
|
|
|
static const WCHAR xyW[] = {'C',0};
|
|
|
|
WCHAR bufferW[10];
|
|
|
|
char buffer[10];
|
|
|
|
int cost, temp;
|
|
|
|
DWORD sz;
|
2018-04-25 05:27:42 +02:00
|
|
|
UINT r;
|
|
|
|
|
|
|
|
cost = 0xdead;
|
|
|
|
r = MsiGetFeatureCostA(hinst, NULL, MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, &cost);
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
2018-05-18 05:26:08 +02:00
|
|
|
todo_wine
|
|
|
|
ok(hinst, !cost, "got %d\n", cost);
|
2018-04-25 05:27:42 +02:00
|
|
|
|
|
|
|
r = MsiGetFeatureCostA(hinst, "One", MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, NULL);
|
|
|
|
ok(hinst, r == RPC_X_NULL_REF_POINTER, "got %u\n", r);
|
|
|
|
|
|
|
|
cost = 0xdead;
|
|
|
|
r = MsiGetFeatureCostA(hinst, "One", MSICOSTTREE_CHILDREN, INSTALLSTATE_LOCAL, &cost);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
2018-05-18 05:26:08 +02:00
|
|
|
todo_wine
|
|
|
|
ok(hinst, cost == 8, "got %d\n", cost);
|
2018-04-26 03:54:38 +02:00
|
|
|
|
|
|
|
sz = cost = temp = 0xdead;
|
|
|
|
r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, NULL, &sz, &cost, &temp);
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
ok(hinst, sz == 0xdead, "got size %d\n", sz);
|
|
|
|
ok(hinst, cost == 0xdead, "got cost %d\n", cost);
|
|
|
|
ok(hinst, temp == 0xdead, "got temp %d\n", temp);
|
|
|
|
|
|
|
|
cost = temp = 0xdead;
|
|
|
|
r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, NULL, &cost, &temp);
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
ok(hinst, cost == 0xdead, "got cost %d\n", cost);
|
|
|
|
ok(hinst, temp == 0xdead, "got temp %d\n", temp);
|
|
|
|
|
|
|
|
sz = temp = 0xdead;
|
|
|
|
r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, NULL, &temp);
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
ok(hinst, sz == 0xdead, "got size %d\n", sz);
|
|
|
|
ok(hinst, temp == 0xdead, "got temp %d\n", temp);
|
|
|
|
|
|
|
|
sz = cost = 0xdead;
|
|
|
|
r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, NULL);
|
|
|
|
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
|
|
|
|
ok(hinst, sz == 0xdead, "got size %d\n", sz);
|
|
|
|
ok(hinst, cost == 0xdead, "got cost %d\n", cost);
|
|
|
|
|
|
|
|
cost = temp = 0xdead;
|
|
|
|
sz = sizeof(buffer);
|
|
|
|
r = MsiEnumComponentCostsA(hinst, NULL, 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, sz == 2, "got size %u\n", sz);
|
|
|
|
ok(hinst, !strcmp(buffer, "C:"), "got '%s'\n", buffer);
|
|
|
|
ok(hinst, !cost, "got cost %d\n", cost);
|
|
|
|
ok(hinst, temp && temp != 0xdead, "got temp %d\n", temp);
|
|
|
|
|
|
|
|
cost = temp = 0xdead;
|
|
|
|
sz = sizeof(buffer);
|
|
|
|
r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, sz == 2, "got size %u\n", sz);
|
|
|
|
ok(hinst, !strcmp(buffer, "C:"), "got '%s'\n", buffer);
|
|
|
|
ok(hinst, cost == 8, "got cost %d\n", cost);
|
|
|
|
ok(hinst, !temp, "got temp %d\n", temp);
|
|
|
|
|
|
|
|
/* same string behaviour */
|
|
|
|
cost = temp = 0xdead;
|
|
|
|
sz = 0;
|
|
|
|
strcpy(buffer,"q");
|
|
|
|
r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !strcmp(buffer, "q"), "got \"%s\"\n", buffer);
|
2018-05-18 05:26:08 +02:00
|
|
|
todo_wine
|
|
|
|
ok(hinst, sz == 4, "got size %u\n", sz);
|
2018-04-26 03:54:38 +02:00
|
|
|
ok(hinst, cost == 8, "got cost %d\n", cost);
|
|
|
|
ok(hinst, !temp, "got temp %d\n", temp);
|
|
|
|
|
|
|
|
sz = 1;
|
|
|
|
strcpy(buffer,"x");
|
|
|
|
r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
2018-05-18 05:26:08 +02:00
|
|
|
todo_wine {
|
|
|
|
ok(hinst, !buffer[0], "got \"%s\"\n", buffer);
|
|
|
|
ok(hinst, sz == 4, "got size %u\n", sz);
|
|
|
|
}
|
2018-04-26 03:54:38 +02:00
|
|
|
|
|
|
|
sz = 2;
|
|
|
|
strcpy(buffer,"x");
|
|
|
|
r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
2018-05-18 05:26:08 +02:00
|
|
|
todo_wine {
|
|
|
|
ok(hinst, !strcmp(buffer, "C"), "got \"%s\"\n", buffer);
|
|
|
|
ok(hinst, sz == 4, "got size %u\n", sz);
|
|
|
|
}
|
2018-04-26 03:54:38 +02:00
|
|
|
|
|
|
|
sz = 3;
|
|
|
|
strcpy(buffer,"x");
|
|
|
|
r = MsiEnumComponentCostsA(hinst, "One", 0, INSTALLSTATE_LOCAL, buffer, &sz, &cost, &temp);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, !strcmp(buffer, "C:"), "got \"%s\"\n", buffer);
|
|
|
|
ok(hinst, sz == 2, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
bufferW[0] = 'q';
|
|
|
|
r = MsiEnumComponentCostsW(hinst, oneW, 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, bufferW[0] == 'q', "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == 2, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 1;
|
|
|
|
bufferW[0] = 'q';
|
|
|
|
r = MsiEnumComponentCostsW(hinst, oneW, 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == 2, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 2;
|
|
|
|
bufferW[0] = 'q';
|
|
|
|
r = MsiEnumComponentCostsW(hinst, oneW, 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp);
|
|
|
|
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
|
|
|
|
ok(hinst, !lstrcmpW(bufferW, xyW), "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == 2, "got size %u\n", sz);
|
|
|
|
|
|
|
|
sz = 3;
|
|
|
|
bufferW[0] = 'q';
|
|
|
|
r = MsiEnumComponentCostsW(hinst, oneW, 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
ok(hinst, !lstrcmpW(bufferW, xyzW), "got %s\n", dbgstr_w(bufferW));
|
|
|
|
ok(hinst, sz == 2, "got size %u\n", sz);
|
2018-04-25 05:27:42 +02:00
|
|
|
}
|
|
|
|
|
2018-02-15 03:54:55 +01:00
|
|
|
/* Main test. Anything that doesn't depend on a specific install configuration
|
|
|
|
* or have undesired side effects should go here. */
|
|
|
|
UINT WINAPI main_test(MSIHANDLE hinst)
|
|
|
|
{
|
2018-02-15 03:54:56 +01:00
|
|
|
UINT res;
|
2018-02-15 03:54:55 +01:00
|
|
|
IUnknown *unk = NULL;
|
2018-04-19 01:40:01 +02:00
|
|
|
HRESULT hr;
|
2018-02-15 03:54:55 +01:00
|
|
|
|
|
|
|
/* Test for an MTA apartment */
|
2018-04-19 01:40:01 +02:00
|
|
|
hr = CoCreateInstance(&CLSID_XMLDocument, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
|
2018-04-26 03:54:40 +02:00
|
|
|
ok(hinst, hr == S_OK, "CoCreateInstance failed with %08x\n", hr);
|
2018-02-15 03:54:55 +01:00
|
|
|
|
|
|
|
if (unk) IUnknown_Release(unk);
|
|
|
|
|
2018-04-19 01:40:01 +02:00
|
|
|
/* but ours is uninitialized */
|
|
|
|
hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
|
|
|
|
ok(hinst, hr == S_OK, "got %#x\n", hr);
|
|
|
|
CoUninitialize();
|
|
|
|
|
2018-02-15 03:54:56 +01:00
|
|
|
/* Test MsiGetDatabaseState() */
|
|
|
|
res = MsiGetDatabaseState(hinst);
|
2018-05-18 05:26:08 +02:00
|
|
|
todo_wine
|
|
|
|
ok(hinst, res == MSIDBSTATE_ERROR, "expected MSIDBSTATE_ERROR, got %u\n", res);
|
2018-02-15 03:54:56 +01:00
|
|
|
|
2018-04-17 17:35:40 +02:00
|
|
|
test_props(hinst);
|
2018-04-19 01:40:02 +02:00
|
|
|
test_db(hinst);
|
2018-04-22 02:33:43 +02:00
|
|
|
test_doaction(hinst);
|
2018-04-22 02:33:45 +02:00
|
|
|
test_targetpath(hinst);
|
2018-04-25 05:27:37 +02:00
|
|
|
test_misc(hinst);
|
2018-04-24 06:18:15 +02:00
|
|
|
test_feature_states(hinst);
|
2018-04-25 05:27:39 +02:00
|
|
|
test_format_record(hinst);
|
2018-04-25 05:27:42 +02:00
|
|
|
test_costs(hinst);
|
2018-04-17 17:35:40 +02:00
|
|
|
|
2018-02-15 03:54:55 +01:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2018-02-15 03:54:54 +01:00
|
|
|
UINT WINAPI test_retval(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
char prop[10];
|
|
|
|
DWORD len = sizeof(prop);
|
|
|
|
UINT retval;
|
|
|
|
|
|
|
|
MsiGetPropertyA(hinst, "TEST_RETVAL", prop, &len);
|
|
|
|
sscanf(prop, "%u", &retval);
|
|
|
|
return retval;
|
|
|
|
}
|
2018-02-20 16:03:19 +01:00
|
|
|
|
|
|
|
static void append_file(MSIHANDLE hinst, const char *filename, const char *text)
|
|
|
|
{
|
|
|
|
DWORD size;
|
|
|
|
HANDLE file = CreateFileA(filename, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
|
|
|
ok(hinst, file != INVALID_HANDLE_VALUE, "CreateFile failed, error %u\n", GetLastError());
|
|
|
|
|
|
|
|
SetFilePointer(file, 0, NULL, FILE_END);
|
|
|
|
WriteFile(file, text, strlen(text), &size, NULL);
|
|
|
|
CloseHandle(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI da_immediate(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
char prop[300];
|
|
|
|
DWORD len = sizeof(prop);
|
|
|
|
|
|
|
|
MsiGetPropertyA(hinst, "TESTPATH", prop, &len);
|
|
|
|
|
|
|
|
append_file(hinst, prop, "one");
|
|
|
|
|
2018-02-20 16:03:20 +01:00
|
|
|
ok(hinst, !MsiGetMode(hinst, MSIRUNMODE_SCHEDULED), "shouldn't be scheduled\n");
|
|
|
|
ok(hinst, !MsiGetMode(hinst, MSIRUNMODE_ROLLBACK), "shouldn't be rollback\n");
|
|
|
|
ok(hinst, !MsiGetMode(hinst, MSIRUNMODE_COMMIT), "shouldn't be commit\n");
|
|
|
|
|
2018-02-20 16:03:19 +01:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI da_deferred(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
char prop[300];
|
|
|
|
DWORD len = sizeof(prop);
|
2018-02-20 16:03:20 +01:00
|
|
|
LANGID lang;
|
|
|
|
UINT r;
|
2018-02-20 16:03:19 +01:00
|
|
|
|
2018-02-20 16:03:20 +01:00
|
|
|
/* Test that we were in fact deferred */
|
|
|
|
r = MsiGetPropertyA(hinst, "CustomActionData", prop, &len);
|
|
|
|
ok(hinst, r == ERROR_SUCCESS, "got %u\n", r);
|
|
|
|
ok(hinst, prop[0], "CustomActionData was empty\n");
|
2018-02-20 16:03:19 +01:00
|
|
|
|
|
|
|
append_file(hinst, prop, "two");
|
|
|
|
|
2018-02-20 16:03:20 +01:00
|
|
|
/* Test available properties */
|
|
|
|
len = sizeof(prop);
|
|
|
|
r = MsiGetPropertyA(hinst, "ProductCode", prop, &len);
|
|
|
|
ok(hinst, r == ERROR_SUCCESS, "got %u\n", r);
|
|
|
|
ok(hinst, prop[0], "got %s\n", prop);
|
|
|
|
|
|
|
|
len = sizeof(prop);
|
|
|
|
r = MsiGetPropertyA(hinst, "UserSID", prop, &len);
|
|
|
|
ok(hinst, r == ERROR_SUCCESS, "got %u\n", r);
|
|
|
|
ok(hinst, prop[0], "got %s\n", prop);
|
|
|
|
|
|
|
|
len = sizeof(prop);
|
|
|
|
r = MsiGetPropertyA(hinst, "TESTPATH", prop, &len);
|
|
|
|
ok(hinst, r == ERROR_SUCCESS, "got %u\n", r);
|
2018-05-18 05:26:08 +02:00
|
|
|
todo_wine
|
|
|
|
ok(hinst, !prop[0], "got %s\n", prop);
|
2018-02-20 16:03:20 +01:00
|
|
|
|
|
|
|
/* Test modes */
|
|
|
|
ok(hinst, MsiGetMode(hinst, MSIRUNMODE_SCHEDULED), "should be scheduled\n");
|
|
|
|
ok(hinst, !MsiGetMode(hinst, MSIRUNMODE_ROLLBACK), "shouldn't be rollback\n");
|
|
|
|
ok(hinst, !MsiGetMode(hinst, MSIRUNMODE_COMMIT), "shouldn't be commit\n");
|
|
|
|
|
|
|
|
lang = MsiGetLanguage(hinst);
|
|
|
|
ok(hinst, lang != ERROR_INVALID_HANDLE, "MsiGetLanguage failed\n");
|
|
|
|
|
2018-02-20 16:03:19 +01:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-18 05:26:08 +02:00
|
|
|
|
|
|
|
static BOOL pf_exists(const char *file)
|
|
|
|
{
|
|
|
|
char path[MAX_PATH];
|
|
|
|
|
|
|
|
if (FAILED(SHGetFolderPathA(NULL, CSIDL_PROGRAM_FILESX86, NULL, 0, path)))
|
|
|
|
SHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES, NULL, 0, path);
|
|
|
|
strcat(path, "\\");
|
|
|
|
strcat(path, file);
|
|
|
|
return GetFileAttributesA(path) != INVALID_FILE_ATTRIBUTES;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI cf_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
|
|
|
|
ok(hinst, pf_exists("msitest\\first"), "folder absent\n");
|
|
|
|
ok(hinst, pf_exists("msitest\\second"), "folder absent\n");
|
|
|
|
ok(hinst, pf_exists("msitest\\third"), "folder absent\n");
|
|
|
|
}
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI cf_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
|
|
|
|
ok(hinst, !pf_exists("msitest\\first"), "folder present\n");
|
|
|
|
ok(hinst, !pf_exists("msitest\\second"), "folder present\n");
|
|
|
|
ok(hinst, !pf_exists("msitest\\third"), "folder present\n");
|
|
|
|
}
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-18 05:26:09 +02:00
|
|
|
|
2018-05-19 05:00:54 +02:00
|
|
|
UINT WINAPI file_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
|
|
|
|
ok(hinst, pf_exists("msitest\\first\\one.txt"), "file absent\n");
|
|
|
|
ok(hinst, pf_exists("msitest\\second\\two.txt"), "file absent\n");
|
|
|
|
}
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI file_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
|
|
|
|
ok(hinst, !pf_exists("msitest\\first\\one.txt"), "file present\n");
|
|
|
|
ok(hinst, !pf_exists("msitest\\second\\two.txt"), "file present\n");
|
|
|
|
}
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2018-05-18 05:26:09 +02:00
|
|
|
UINT WINAPI crs_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED))
|
|
|
|
ok(hinst, pf_exists("msitest\\shortcut.lnk"), "shortcut absent\n");
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI crs_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED))
|
|
|
|
ok(hinst, !pf_exists("msitest\\shortcut.lnk"), "shortcut present\n");
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-18 05:26:10 +02:00
|
|
|
|
|
|
|
UINT WINAPI sds_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
SC_HANDLE manager, service;
|
|
|
|
manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
|
|
|
service = OpenServiceA(manager, "TestService3", GENERIC_ALL);
|
|
|
|
todo_wine
|
|
|
|
ok(hinst, !!service, "service absent: %u\n", GetLastError());
|
|
|
|
CloseServiceHandle(service);
|
|
|
|
CloseServiceHandle(manager);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI sds_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
SC_HANDLE manager, service;
|
|
|
|
manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
|
|
|
service = OpenServiceA(manager, "TestService3", GENERIC_ALL);
|
|
|
|
ok(hinst, !service, "service present\n");
|
|
|
|
if (service) CloseServiceHandle(service);
|
|
|
|
CloseServiceHandle(manager);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-18 05:26:11 +02:00
|
|
|
|
|
|
|
UINT WINAPI sis_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
SC_HANDLE manager, service;
|
|
|
|
manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
|
|
|
service = OpenServiceA(manager, "TestService", GENERIC_ALL);
|
|
|
|
ok(hinst, !!service, "service absent: %u\n", GetLastError());
|
|
|
|
CloseServiceHandle(service);
|
|
|
|
CloseServiceHandle(manager);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI sis_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
SC_HANDLE manager, service;
|
|
|
|
manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
|
|
|
service = OpenServiceA(manager, "TestService", GENERIC_ALL);
|
|
|
|
todo_wine
|
|
|
|
ok(hinst, !service, "service present\n");
|
|
|
|
if (service) CloseServiceHandle(service);
|
|
|
|
CloseServiceHandle(manager);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-18 05:26:12 +02:00
|
|
|
|
|
|
|
UINT WINAPI sss_started(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
SC_HANDLE manager, service;
|
|
|
|
SERVICE_STATUS status;
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
|
|
|
service = OpenServiceA(manager, "Spooler", SC_MANAGER_ALL_ACCESS);
|
|
|
|
ret = QueryServiceStatus(service, &status);
|
|
|
|
ok(hinst, ret, "QueryServiceStatus failed: %u\n", GetLastError());
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED))
|
|
|
|
ok(hinst, status.dwCurrentState == SERVICE_RUNNING, "got %u\n", status.dwCurrentState);
|
|
|
|
|
|
|
|
CloseServiceHandle(service);
|
|
|
|
CloseServiceHandle(manager);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI sss_stopped(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
SC_HANDLE manager, service;
|
|
|
|
SERVICE_STATUS status;
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
|
|
|
service = OpenServiceA(manager, "Spooler", SC_MANAGER_ALL_ACCESS);
|
|
|
|
ret = QueryServiceStatus(service, &status);
|
|
|
|
ok(hinst, ret, "QueryServiceStatus failed: %u\n", GetLastError());
|
|
|
|
ok(hinst, status.dwCurrentState == SERVICE_STOPPED, "got %u\n", status.dwCurrentState);
|
|
|
|
|
|
|
|
CloseServiceHandle(service);
|
|
|
|
CloseServiceHandle(manager);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-19 05:00:53 +02:00
|
|
|
|
|
|
|
UINT WINAPI rd_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
|
|
|
|
ok(hinst, pf_exists("msitest\\original2.txt"), "file absent\n");
|
|
|
|
ok(hinst, pf_exists("msitest\\duplicate.txt"), "file absent\n");
|
|
|
|
}
|
|
|
|
ok(hinst, !pf_exists("msitest\\original3.txt"), "file present\n");
|
|
|
|
ok(hinst, !pf_exists("msitest\\duplicate2.txt"), "file present\n");
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI rd_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
|
|
|
|
ok(hinst, !pf_exists("msitest\\original2.txt"), "file present\n");
|
|
|
|
ok(hinst, !pf_exists("msitest\\duplicate.txt"), "file present\n");
|
|
|
|
}
|
|
|
|
ok(hinst, !pf_exists("msitest\\original3.txt"), "file present\n");
|
|
|
|
ok(hinst, !pf_exists("msitest\\duplicate2.txt"), "file present\n");
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-19 05:00:58 +02:00
|
|
|
|
|
|
|
UINT WINAPI odbc_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
int gotdriver = 0, gotdriver2 = 0;
|
|
|
|
char buffer[1000], *p;
|
|
|
|
WORD len;
|
|
|
|
BOOL r;
|
|
|
|
|
|
|
|
r = SQLGetInstalledDrivers(buffer, sizeof(buffer), &len);
|
|
|
|
ok(hinst, len < sizeof(buffer), "buffer too small\n");
|
|
|
|
ok(hinst, r, "SQLGetInstalledDrivers failed\n");
|
|
|
|
for (p = buffer; *p; p += strlen(p) + 1)
|
|
|
|
{
|
|
|
|
if (!strcmp(p, "ODBC test driver"))
|
|
|
|
gotdriver = 1;
|
|
|
|
if (!strcmp(p, "ODBC test driver2"))
|
|
|
|
gotdriver2 = 1;
|
|
|
|
}
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
|
|
|
|
ok(hinst, gotdriver, "driver absent\n");
|
|
|
|
ok(hinst, gotdriver2, "driver 2 absent\n");
|
|
|
|
}
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI odbc_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
int gotdriver = 0, gotdriver2 = 0;
|
|
|
|
char buffer[1000], *p;
|
|
|
|
WORD len;
|
|
|
|
BOOL r;
|
|
|
|
|
|
|
|
r = SQLGetInstalledDrivers(buffer, sizeof(buffer), &len);
|
|
|
|
ok(hinst, len < sizeof(buffer), "buffer too small\n");
|
|
|
|
ok(hinst, r, "SQLGetInstalledDrivers failed\n");
|
|
|
|
for (p = buffer; *p; p += strlen(p) + 1)
|
|
|
|
{
|
|
|
|
if (!strcmp(p, "ODBC test driver"))
|
|
|
|
gotdriver = 1;
|
|
|
|
if (!strcmp(p, "ODBC test driver2"))
|
|
|
|
gotdriver2 = 1;
|
|
|
|
}
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
|
|
|
|
ok(hinst, !gotdriver, "driver present\n");
|
|
|
|
ok(hinst, !gotdriver2, "driver 2 present\n");
|
|
|
|
}
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-23 01:39:24 +02:00
|
|
|
|
|
|
|
UINT WINAPI mov_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
ok(hinst, pf_exists("msitest\\canada"), "file absent\n");
|
|
|
|
ok(hinst, pf_exists("msitest\\dominica"), "file absent\n");
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI mov_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
todo_wine {
|
|
|
|
ok(hinst, !pf_exists("msitest\\canada"), "file present\n");
|
|
|
|
ok(hinst, !pf_exists("msitest\\dominica"), "file present\n");
|
|
|
|
}
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-25 02:14:10 +02:00
|
|
|
|
|
|
|
static void check_reg_str(MSIHANDLE hinst, HKEY key, const char *name, const char *expect)
|
|
|
|
{
|
|
|
|
char value[300];
|
|
|
|
DWORD sz;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
sz = sizeof(value);
|
|
|
|
res = RegQueryValueExA(key, name, NULL, NULL, (BYTE *)value, &sz);
|
|
|
|
if (expect)
|
|
|
|
{
|
|
|
|
ok(hinst, !res, "failed to get value \"%s\": %d\n", name, res);
|
|
|
|
ok(hinst, !strcmp(value, expect), "\"%s\": expected \"%s\", got \"%s\"\n",
|
|
|
|
name, expect, value);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ok(hinst, res == ERROR_FILE_NOT_FOUND, "\"%s\": expected missing, got %u\n",
|
|
|
|
name, res);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char path_dotnet[] = "Software\\Microsoft\\Installer\\Assemblies\\Global";
|
|
|
|
static const char name_dotnet[] = "Wine.Dotnet.Assembly,processorArchitecture=\"MSIL\","
|
|
|
|
"publicKeyToken=\"abcdef0123456789\",version=\"1.0.0.0\",culture=\"neutral\"";
|
|
|
|
|
|
|
|
UINT WINAPI pa_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &key);
|
|
|
|
ok(hinst, !res, "got %d\n", res);
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
|
|
|
|
check_reg_str(hinst, key, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]");
|
|
|
|
}
|
|
|
|
RegCloseKey(key);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI pa_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &key);
|
|
|
|
ok(hinst, !res || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
|
|
|
|
if (!res)
|
|
|
|
{
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
|
|
|
|
check_reg_str(hinst, key, name_dotnet, NULL);
|
|
|
|
}
|
|
|
|
RegCloseKey(key);
|
|
|
|
}
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-25 02:14:11 +02:00
|
|
|
|
|
|
|
static const char ppc_key[] = "Software\\Microsoft\\Windows\\CurrentVersion\\"
|
|
|
|
"Installer\\UserData\\S-1-5-18\\Components\\CBABC2FDCCB35E749A8944D8C1C098B5";
|
|
|
|
|
|
|
|
UINT WINAPI ppc_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
char expect[MAX_PATH];
|
|
|
|
HKEY key;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
r = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ppc_key, 0, KEY_QUERY_VALUE | KEY_WOW64_64KEY, &key);
|
|
|
|
ok(hinst, !r, "got %u\n", r);
|
|
|
|
|
|
|
|
if (FAILED(SHGetFolderPathA(NULL, CSIDL_PROGRAM_FILESX86, NULL, 0, expect)))
|
|
|
|
SHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES, NULL, 0, expect);
|
|
|
|
strcat(expect, "\\msitest\\maximus");
|
|
|
|
check_reg_str(hinst, key, "84A88FD7F6998CE40A22FB59F6B9C2BB", expect);
|
|
|
|
|
|
|
|
RegCloseKey(key);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI ppc_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
r = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ppc_key, 0, KEY_QUERY_VALUE | KEY_WOW64_64KEY, &key);
|
|
|
|
todo_wine
|
|
|
|
ok(hinst, r == ERROR_FILE_NOT_FOUND, "got %u\n", r);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-25 02:14:12 +02:00
|
|
|
|
|
|
|
static const char pub_key[] = "Software\\Microsoft\\Installer\\Components\\0CBCFA296AC907244845745CEEB2F8AA";
|
|
|
|
|
|
|
|
UINT WINAPI pub_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
|
|
|
|
res = RegOpenKeyA(HKEY_CURRENT_USER, pub_key, &key);
|
|
|
|
ok(hinst, !res, "got %u\n", res);
|
|
|
|
res = RegQueryValueExA(key, "english.txt", NULL, NULL, NULL, NULL);
|
|
|
|
ok(hinst, !res, "got %u\n", res);
|
|
|
|
}
|
|
|
|
RegCloseKey(key);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI pub_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
res = RegOpenKeyA(HKEY_CURRENT_USER, pub_key, &key);
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED))
|
|
|
|
ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-25 02:14:13 +02:00
|
|
|
|
|
|
|
static const char pf_classkey[] = "Installer\\Features\\84A88FD7F6998CE40A22FB59F6B9C2BB";
|
|
|
|
static const char pf_userkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\"
|
|
|
|
"Installer\\UserData\\S-1-5-18\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features";
|
|
|
|
|
|
|
|
UINT WINAPI pf_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
|
|
|
|
res = RegOpenKeyExA(HKEY_CLASSES_ROOT, pf_classkey, 0, KEY_READ | KEY_WOW64_64KEY, &key);
|
|
|
|
ok(hinst, !res, "got %u\n", res);
|
|
|
|
check_reg_str(hinst, key, "feature", "");
|
|
|
|
check_reg_str(hinst, key, "montecristo", "");
|
|
|
|
RegCloseKey(key);
|
|
|
|
|
|
|
|
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, pf_userkey, 0, KEY_READ | KEY_WOW64_64KEY, &key);
|
|
|
|
ok(hinst, !res, "got %u\n", res);
|
|
|
|
check_reg_str(hinst, key, "feature", "VGtfp^p+,?82@JU1j_KE");
|
|
|
|
check_reg_str(hinst, key, "montecristo", "VGtfp^p+,?82@JU1j_KE");
|
|
|
|
RegCloseKey(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI pf_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
res = RegOpenKeyExA(HKEY_CLASSES_ROOT, pf_classkey, 0, KEY_READ | KEY_WOW64_64KEY, &key);
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED))
|
|
|
|
ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res);
|
|
|
|
|
|
|
|
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, pf_userkey, 0, KEY_READ | KEY_WOW64_64KEY, &key);
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED))
|
|
|
|
ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-25 02:14:14 +02:00
|
|
|
|
|
|
|
static const char pp_prodkey[] = "Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
|
|
|
|
|
|
|
|
UINT WINAPI pp_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
res = RegOpenKeyExA(HKEY_CLASSES_ROOT, pp_prodkey, 0, KEY_READ | KEY_WOW64_64KEY, &key);
|
|
|
|
ok(hinst, !res, "got %u\n", res);
|
|
|
|
check_reg_str(hinst, key, "ProductName", "MSITEST");
|
|
|
|
check_reg_str(hinst, key, "PackageCode", "AC75740029052C94DA02821EECD05F2F");
|
|
|
|
check_reg_str(hinst, key, "Clients", ":");
|
|
|
|
|
|
|
|
RegCloseKey(key);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI pp_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
res = RegOpenKeyExA(HKEY_CLASSES_ROOT, pp_prodkey, 0, KEY_READ | KEY_WOW64_64KEY, &key);
|
|
|
|
todo_wine
|
|
|
|
ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-26 04:18:12 +02:00
|
|
|
|
|
|
|
UINT WINAPI rci_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
|
|
|
|
res = RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}",
|
|
|
|
0, KEY_READ | KEY_WOW64_32KEY, &key);
|
|
|
|
ok(hinst, !res, "got %u\n", res);
|
|
|
|
RegCloseKey(key);
|
|
|
|
|
|
|
|
res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &key);
|
|
|
|
ok(hinst, !res, "got %u\n", res);
|
|
|
|
RegCloseKey(key);
|
|
|
|
|
|
|
|
res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &key);
|
|
|
|
ok(hinst, !res, "got %u\n", res);
|
|
|
|
RegCloseKey(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI rci_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
|
|
|
|
res = RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}",
|
|
|
|
0, KEY_READ | KEY_WOW64_32KEY, &key);
|
|
|
|
ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res);
|
|
|
|
|
|
|
|
res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &key);
|
|
|
|
ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res);
|
|
|
|
|
|
|
|
res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &key);
|
|
|
|
ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-26 04:18:13 +02:00
|
|
|
|
|
|
|
UINT WINAPI rei_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
|
|
|
|
res = RegOpenKeyA(HKEY_CLASSES_ROOT, ".extension", &key);
|
|
|
|
ok(hinst, !res, "got %u\n", res);
|
|
|
|
RegCloseKey(key);
|
|
|
|
|
|
|
|
res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Prog.Id.1\\shell\\Open\\command", &key);
|
|
|
|
ok(hinst, !res, "got %u\n", res);
|
|
|
|
RegCloseKey(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI rei_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
|
|
|
|
res = RegOpenKeyA(HKEY_CLASSES_ROOT, ".extension", &key);
|
|
|
|
ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res);
|
|
|
|
|
|
|
|
res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Prog.Id.1\\shell\\Open\\command", &key);
|
|
|
|
ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-26 04:18:14 +02:00
|
|
|
|
|
|
|
static const char font_key[] = "Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
|
|
|
|
|
|
|
|
UINT WINAPI font_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, font_key, 0, KEY_QUERY_VALUE | KEY_WOW64_64KEY, &key);
|
|
|
|
ok(hinst, !res, "got %u\n", res);
|
|
|
|
res = RegQueryValueExA(key, "msi test font", NULL, NULL, NULL, NULL);
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED))
|
|
|
|
ok(hinst, !res, "got %u\n", res);
|
|
|
|
RegCloseKey(key);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI font_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, font_key, 0, KEY_QUERY_VALUE | KEY_WOW64_64KEY, &key);
|
|
|
|
ok(hinst, !res, "got %u\n", res);
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED)) {
|
|
|
|
check_reg_str(hinst, key, "msi test font", NULL);
|
|
|
|
}
|
|
|
|
RegCloseKey(key);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-26 04:18:15 +02:00
|
|
|
|
|
|
|
UINT WINAPI rmi_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &key);
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED))
|
|
|
|
ok(hinst, !res, "got %u\n", res);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI rmi_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &key);
|
|
|
|
todo_wine_if(!MsiGetMode(hinst, MSIRUNMODE_SCHEDULED))
|
|
|
|
ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-05-29 04:07:51 +02:00
|
|
|
|
|
|
|
static const char rp_key[] = "Software\\Microsoft\\Windows\\CurrentVersion\\"
|
|
|
|
"Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
|
|
|
|
|
|
|
|
UINT WINAPI rp_present(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, rp_key, 0, KEY_READ | KEY_WOW64_32KEY, &key);
|
|
|
|
ok(hinst, !res, "got %u\n", res);
|
|
|
|
check_reg_str(hinst, key, "DisplayName", "MSITEST");
|
|
|
|
RegCloseKey(key);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
UINT WINAPI rp_absent(MSIHANDLE hinst)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
LONG res;
|
|
|
|
|
|
|
|
res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, rp_key, 0, KEY_READ | KEY_WOW64_32KEY, &key);
|
|
|
|
todo_wine
|
|
|
|
ok(hinst, res == ERROR_FILE_NOT_FOUND, "got %u\n", res);
|
|
|
|
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|