2007-03-06 11:59:18 +00:00
|
|
|
/*
|
|
|
|
* tests for Microsoft Installer functionality
|
|
|
|
*
|
|
|
|
* Copyright 2005 Mike McCormack for CodeWeavers
|
|
|
|
* Copyright 2005 Aric Stewart for CodeWeavers
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2017-12-18 12:48:13 +00:00
|
|
|
#include "precomp.h"
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2017-10-08 08:15:09 +00:00
|
|
|
#include <assert.h>
|
2012-01-21 17:21:57 +00:00
|
|
|
#include <shlobj.h>
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
static BOOL is_wow64;
|
2009-12-22 09:14:17 +00:00
|
|
|
static const char msifile[] = "winetest-package.msi";
|
2014-04-23 14:49:34 +00:00
|
|
|
static const WCHAR msifileW[] =
|
|
|
|
{'w','i','n','e','t','e','s','t','-','p','a','c','k','a','g','e','.','m','s','i',0};
|
2012-01-21 17:21:57 +00:00
|
|
|
static char CURR_DIR[MAX_PATH];
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)(LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
|
|
|
|
static HRESULT (WINAPI *pSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR);
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
static BOOL (WINAPI *pCheckTokenMembership)(HANDLE,PSID,PBOOL);
|
2009-06-06 15:59:11 +00:00
|
|
|
static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
|
2012-01-21 17:21:57 +00:00
|
|
|
static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE );
|
|
|
|
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
|
|
|
|
static LONG (WINAPI *pRegDeleteKeyExW)(HKEY, LPCWSTR, REGSAM, DWORD);
|
|
|
|
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
|
|
|
|
static void (WINAPI *pGetSystemInfo)(LPSYSTEM_INFO);
|
|
|
|
static void (WINAPI *pGetNativeSystemInfo)(LPSYSTEM_INFO);
|
|
|
|
static UINT (WINAPI *pGetSystemWow64DirectoryA)(LPSTR, UINT);
|
2009-06-06 15:59:11 +00:00
|
|
|
|
2009-10-19 21:11:46 +00:00
|
|
|
static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
|
|
|
|
static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
|
|
|
|
|
2009-06-06 15:59:11 +00:00
|
|
|
static void init_functionpointers(void)
|
|
|
|
{
|
|
|
|
HMODULE hmsi = GetModuleHandleA("msi.dll");
|
|
|
|
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
|
2012-01-21 17:21:57 +00:00
|
|
|
HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
|
|
|
|
HMODULE hshell32 = GetModuleHandleA("shell32.dll");
|
2009-10-19 21:11:46 +00:00
|
|
|
HMODULE hsrclient;
|
2009-06-06 15:59:11 +00:00
|
|
|
|
|
|
|
#define GET_PROC(mod, func) \
|
|
|
|
p ## func = (void*)GetProcAddress(mod, #func);
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
GET_PROC(hmsi, MsiGetComponentPathExA);
|
|
|
|
GET_PROC(hshell32, SHGetFolderPathA);
|
2009-06-06 15:59:11 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
GET_PROC(hadvapi32, CheckTokenMembership);
|
2009-06-06 15:59:11 +00:00
|
|
|
GET_PROC(hadvapi32, ConvertSidToStringSidA);
|
2012-01-21 17:21:57 +00:00
|
|
|
GET_PROC(hadvapi32, OpenProcessToken);
|
|
|
|
GET_PROC(hadvapi32, RegDeleteKeyExA)
|
|
|
|
GET_PROC(hadvapi32, RegDeleteKeyExW)
|
|
|
|
GET_PROC(hkernel32, IsWow64Process)
|
|
|
|
GET_PROC(hkernel32, GetNativeSystemInfo)
|
|
|
|
GET_PROC(hkernel32, GetSystemInfo)
|
|
|
|
GET_PROC(hkernel32, GetSystemWow64DirectoryA)
|
2009-06-06 15:59:11 +00:00
|
|
|
|
2009-10-19 21:11:46 +00:00
|
|
|
hsrclient = LoadLibraryA("srclient.dll");
|
|
|
|
GET_PROC(hsrclient, SRRemoveRestorePoint);
|
|
|
|
GET_PROC(hsrclient, SRSetRestorePointA);
|
2009-06-06 15:59:11 +00:00
|
|
|
#undef GET_PROC
|
|
|
|
}
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
static BOOL is_process_limited(void)
|
|
|
|
{
|
2014-04-23 14:49:34 +00:00
|
|
|
SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
|
2014-09-23 18:33:25 +00:00
|
|
|
PSID Group = NULL;
|
2014-04-23 14:49:34 +00:00
|
|
|
BOOL IsInGroup;
|
2012-01-21 17:21:57 +00:00
|
|
|
HANDLE token;
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
|
|
|
|
|
|
|
|
if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
|
2014-09-23 18:33:25 +00:00
|
|
|
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
|
2014-04-23 14:49:34 +00:00
|
|
|
!pCheckTokenMembership(NULL, Group, &IsInGroup))
|
|
|
|
{
|
|
|
|
trace("Could not check if the current user is an administrator\n");
|
2014-09-23 18:33:25 +00:00
|
|
|
FreeSid(Group);
|
2014-04-23 14:49:34 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2014-09-23 18:33:25 +00:00
|
|
|
FreeSid(Group);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
if (!IsInGroup)
|
|
|
|
{
|
|
|
|
if (!AllocateAndInitializeSid(&NtAuthority, 2,
|
|
|
|
SECURITY_BUILTIN_DOMAIN_RID,
|
|
|
|
DOMAIN_ALIAS_RID_POWER_USERS,
|
|
|
|
0, 0, 0, 0, 0, 0, &Group) ||
|
|
|
|
!pCheckTokenMembership(NULL, Group, &IsInGroup))
|
|
|
|
{
|
|
|
|
trace("Could not check if the current user is a power user\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (!IsInGroup)
|
|
|
|
{
|
|
|
|
/* Only administrators and power users can be powerful */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
2012-01-21 17:21:57 +00:00
|
|
|
|
|
|
|
if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
|
|
|
|
{
|
|
|
|
BOOL ret;
|
|
|
|
TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
|
|
|
|
DWORD size;
|
|
|
|
|
2012-08-13 16:18:14 +00:00
|
|
|
ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
CloseHandle(token);
|
|
|
|
return (ret && type == TokenElevationTypeLimited);
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
2009-06-06 15:59:11 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
|
|
|
|
{
|
|
|
|
if (pRegDeleteKeyExA)
|
|
|
|
return pRegDeleteKeyExA( key, subkey, access, 0 );
|
|
|
|
return RegDeleteKeyA( key, subkey );
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *get_user_sid(void)
|
2008-12-28 10:25:32 +00:00
|
|
|
{
|
|
|
|
HANDLE token;
|
2012-01-21 17:21:57 +00:00
|
|
|
DWORD size = 0;
|
|
|
|
TOKEN_USER *user;
|
|
|
|
char *usersid = NULL;
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
if (!pConvertSidToStringSidA)
|
2009-06-06 15:59:11 +00:00
|
|
|
{
|
|
|
|
win_skip("ConvertSidToStringSidA is not available\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-12-28 10:25:32 +00:00
|
|
|
OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
|
2012-01-21 17:21:57 +00:00
|
|
|
GetTokenInformation(token, TokenUser, NULL, size, &size);
|
|
|
|
|
|
|
|
user = HeapAlloc(GetProcessHeap(), 0, size);
|
|
|
|
GetTokenInformation(token, TokenUser, user, size, &size);
|
|
|
|
pConvertSidToStringSidA(user->User.Sid, &usersid);
|
|
|
|
HeapFree(GetProcessHeap(), 0, user);
|
|
|
|
|
2009-01-31 14:17:07 +00:00
|
|
|
CloseHandle(token);
|
2012-01-21 17:21:57 +00:00
|
|
|
return usersid;
|
2008-12-28 10:25:32 +00:00
|
|
|
}
|
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
/* RegDeleteTreeW from dlls/advapi32/registry.c */
|
2012-01-21 17:21:57 +00:00
|
|
|
static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM access)
|
2008-02-10 13:22:36 +00:00
|
|
|
{
|
|
|
|
LONG ret;
|
|
|
|
DWORD dwMaxSubkeyLen, dwMaxValueLen;
|
|
|
|
DWORD dwMaxLen, dwSize;
|
|
|
|
WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
|
|
|
|
HKEY hSubKey = hKey;
|
|
|
|
|
|
|
|
if(lpszSubKey)
|
|
|
|
{
|
2012-01-21 17:21:57 +00:00
|
|
|
ret = RegOpenKeyExW(hKey, lpszSubKey, 0, access, &hSubKey);
|
2008-02-10 13:22:36 +00:00
|
|
|
if (ret) return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
|
|
|
|
&dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
|
|
|
|
if (ret) goto cleanup;
|
|
|
|
|
|
|
|
dwMaxSubkeyLen++;
|
|
|
|
dwMaxValueLen++;
|
|
|
|
dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
|
|
|
|
if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
|
|
|
|
{
|
|
|
|
/* Name too big: alloc a buffer for it */
|
|
|
|
if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
|
|
|
|
{
|
|
|
|
ret = ERROR_NOT_ENOUGH_MEMORY;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Recursively delete all the subkeys */
|
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
dwSize = dwMaxLen;
|
|
|
|
if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
|
|
|
|
NULL, NULL, NULL)) break;
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
ret = package_RegDeleteTreeW(hSubKey, lpszName, access);
|
2008-02-10 13:22:36 +00:00
|
|
|
if (ret) goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lpszSubKey)
|
2012-01-21 17:21:57 +00:00
|
|
|
{
|
|
|
|
if (pRegDeleteKeyExW)
|
|
|
|
ret = pRegDeleteKeyExW(hKey, lpszSubKey, access, 0);
|
|
|
|
else
|
|
|
|
ret = RegDeleteKeyW(hKey, lpszSubKey);
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
else
|
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
dwSize = dwMaxLen;
|
|
|
|
if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
|
|
|
|
NULL, NULL, NULL, NULL)) break;
|
|
|
|
|
|
|
|
ret = RegDeleteValueW(hKey, lpszName);
|
|
|
|
if (ret) goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
if (lpszName != szNameBuf)
|
|
|
|
HeapFree(GetProcessHeap(), 0, lpszName);
|
|
|
|
if(lpszSubKey)
|
|
|
|
RegCloseKey(hSubKey);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
|
|
|
|
{
|
|
|
|
DWORD i,n=1;
|
|
|
|
GUID guid;
|
|
|
|
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
if (FAILED(CLSIDFromString((LPCOLESTR)in, &guid)))
|
2008-12-28 10:25:32 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
for(i=0; i<8; i++)
|
|
|
|
out[7-i] = in[n++];
|
|
|
|
n++;
|
|
|
|
for(i=0; i<4; i++)
|
|
|
|
out[11-i] = in[n++];
|
|
|
|
n++;
|
|
|
|
for(i=0; i<4; i++)
|
|
|
|
out[15-i] = in[n++];
|
|
|
|
n++;
|
|
|
|
for(i=0; i<2; i++)
|
|
|
|
{
|
|
|
|
out[17+i*2] = in[n++];
|
|
|
|
out[16+i*2] = in[n++];
|
|
|
|
}
|
|
|
|
n++;
|
|
|
|
for( ; i<8; i++)
|
|
|
|
{
|
|
|
|
out[17+i*2] = in[n++];
|
|
|
|
out[16+i*2] = in[n++];
|
|
|
|
}
|
|
|
|
out[32]=0;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void create_test_guid(LPSTR prodcode, LPSTR squashed)
|
|
|
|
{
|
|
|
|
WCHAR guidW[MAX_PATH];
|
|
|
|
WCHAR squashedW[MAX_PATH];
|
|
|
|
GUID guid;
|
|
|
|
HRESULT hr;
|
|
|
|
int size;
|
|
|
|
|
|
|
|
hr = CoCreateGuid(&guid);
|
|
|
|
ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
|
|
|
|
|
2009-01-18 09:03:44 +00:00
|
|
|
size = StringFromGUID2(&guid, guidW, MAX_PATH);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(size == 39, "Expected 39, got %d\n", hr);
|
|
|
|
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, guidW, size, prodcode, MAX_PATH, NULL, NULL);
|
|
|
|
squash_guid(guidW, squashedW);
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void set_component_path(LPCSTR filename, MSIINSTALLCONTEXT context,
|
|
|
|
LPCSTR guid, LPSTR usersid, BOOL dir)
|
|
|
|
{
|
|
|
|
WCHAR guidW[MAX_PATH];
|
|
|
|
WCHAR squashedW[MAX_PATH];
|
|
|
|
CHAR squashed[MAX_PATH];
|
|
|
|
CHAR comppath[MAX_PATH];
|
|
|
|
CHAR prodpath[MAX_PATH];
|
|
|
|
CHAR path[MAX_PATH];
|
|
|
|
LPCSTR prod = NULL;
|
|
|
|
HKEY hkey;
|
2012-01-21 17:21:57 +00:00
|
|
|
REGSAM access = KEY_ALL_ACCESS;
|
|
|
|
|
|
|
|
if (is_wow64)
|
|
|
|
access |= KEY_WOW64_64KEY;
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
|
|
|
|
squash_guid(guidW, squashedW);
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
|
|
|
|
|
|
|
|
if (context == MSIINSTALLCONTEXT_MACHINE)
|
|
|
|
{
|
|
|
|
prod = "3D0DAE300FACA1300AD792060BCDAA92";
|
|
|
|
sprintf(comppath,
|
|
|
|
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
|
|
|
|
"Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
|
|
|
|
lstrcpyA(prodpath,
|
|
|
|
"SOFTWARE\\Classes\\Installer\\"
|
|
|
|
"Products\\3D0DAE300FACA1300AD792060BCDAA92");
|
|
|
|
}
|
|
|
|
else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
|
|
|
|
{
|
|
|
|
prod = "7D2F387510109040002000060BECB6AB";
|
|
|
|
sprintf(comppath,
|
|
|
|
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
|
|
|
|
"Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
|
|
|
|
sprintf(prodpath,
|
|
|
|
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
|
|
|
|
"Installer\\%s\\Installer\\Products\\"
|
|
|
|
"7D2F387510109040002000060BECB6AB", usersid);
|
|
|
|
}
|
|
|
|
else if (context == MSIINSTALLCONTEXT_USERMANAGED)
|
|
|
|
{
|
|
|
|
prod = "7D2F387510109040002000060BECB6AB";
|
|
|
|
sprintf(comppath,
|
|
|
|
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
|
|
|
|
"Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
|
|
|
|
sprintf(prodpath,
|
|
|
|
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
|
|
|
|
"Installer\\Managed\\%s\\Installer\\Products\\"
|
|
|
|
"7D2F387510109040002000060BECB6AB", usersid);
|
|
|
|
}
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
RegCreateKeyExA(HKEY_LOCAL_MACHINE, comppath, 0, NULL, 0, access, NULL, &hkey, NULL);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
lstrcpyA(path, CURR_DIR);
|
|
|
|
lstrcatA(path, "\\");
|
|
|
|
if (!dir) lstrcatA(path, filename);
|
|
|
|
|
|
|
|
RegSetValueExA(hkey, prod, 0, REG_SZ, (LPBYTE)path, lstrlenA(path));
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
RegCreateKeyExA(HKEY_LOCAL_MACHINE, prodpath, 0, NULL, 0, access, NULL, &hkey, NULL);
|
2008-12-28 10:25:32 +00:00
|
|
|
RegCloseKey(hkey);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void delete_component_path(LPCSTR guid, MSIINSTALLCONTEXT context, LPSTR usersid)
|
|
|
|
{
|
|
|
|
WCHAR guidW[MAX_PATH];
|
|
|
|
WCHAR squashedW[MAX_PATH];
|
|
|
|
WCHAR substrW[MAX_PATH];
|
|
|
|
CHAR squashed[MAX_PATH];
|
|
|
|
CHAR comppath[MAX_PATH];
|
|
|
|
CHAR prodpath[MAX_PATH];
|
2012-01-21 17:21:57 +00:00
|
|
|
REGSAM access = KEY_ALL_ACCESS;
|
|
|
|
|
|
|
|
if (is_wow64)
|
|
|
|
access |= KEY_WOW64_64KEY;
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, guid, -1, guidW, MAX_PATH);
|
|
|
|
squash_guid(guidW, squashedW);
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, squashedW, -1, squashed, MAX_PATH, NULL, NULL);
|
|
|
|
|
|
|
|
if (context == MSIINSTALLCONTEXT_MACHINE)
|
|
|
|
{
|
|
|
|
sprintf(comppath,
|
|
|
|
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
|
|
|
|
"Installer\\UserData\\S-1-5-18\\Components\\%s", squashed);
|
|
|
|
lstrcpyA(prodpath,
|
|
|
|
"SOFTWARE\\Classes\\Installer\\"
|
|
|
|
"Products\\3D0DAE300FACA1300AD792060BCDAA92");
|
|
|
|
}
|
|
|
|
else if (context == MSIINSTALLCONTEXT_USERUNMANAGED)
|
|
|
|
{
|
|
|
|
sprintf(comppath,
|
|
|
|
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
|
|
|
|
"Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
|
|
|
|
sprintf(prodpath,
|
|
|
|
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
|
|
|
|
"Installer\\%s\\Installer\\Products\\"
|
|
|
|
"7D2F387510109040002000060BECB6AB", usersid);
|
|
|
|
}
|
|
|
|
else if (context == MSIINSTALLCONTEXT_USERMANAGED)
|
|
|
|
{
|
|
|
|
sprintf(comppath,
|
|
|
|
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
|
|
|
|
"Installer\\UserData\\%s\\Components\\%s", usersid, squashed);
|
|
|
|
sprintf(prodpath,
|
|
|
|
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\"
|
|
|
|
"Installer\\Managed\\%s\\Installer\\Products\\"
|
|
|
|
"7D2F387510109040002000060BECB6AB", usersid);
|
|
|
|
}
|
|
|
|
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, comppath, -1, substrW, MAX_PATH);
|
2012-01-21 17:21:57 +00:00
|
|
|
package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW, access);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, prodpath, -1, substrW, MAX_PATH);
|
2012-01-21 17:21:57 +00:00
|
|
|
package_RegDeleteTreeW(HKEY_LOCAL_MACHINE, substrW, access);
|
2008-12-28 10:25:32 +00:00
|
|
|
}
|
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
static UINT do_query(MSIHANDLE hdb, const char *query, MSIHANDLE *phrec)
|
|
|
|
{
|
|
|
|
MSIHANDLE hview = 0;
|
|
|
|
UINT r, ret;
|
|
|
|
|
|
|
|
/* open a select query */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDatabaseOpenViewA(hdb, query, &hview);
|
2008-02-10 13:22:36 +00:00
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
return r;
|
|
|
|
r = MsiViewExecute(hview, 0);
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
return r;
|
|
|
|
ret = MsiViewFetch(hview, phrec);
|
|
|
|
r = MsiViewClose(hview);
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
return r;
|
|
|
|
r = MsiCloseHandle(hview);
|
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
return r;
|
|
|
|
return ret;
|
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
static UINT run_query( MSIHANDLE hdb, const char *query )
|
|
|
|
{
|
|
|
|
MSIHANDLE hview = 0;
|
|
|
|
UINT r;
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDatabaseOpenViewA(hdb, query, &hview);
|
2007-03-06 11:59:18 +00:00
|
|
|
if( r != ERROR_SUCCESS )
|
|
|
|
return r;
|
|
|
|
|
|
|
|
r = MsiViewExecute(hview, 0);
|
|
|
|
if( r == ERROR_SUCCESS )
|
|
|
|
r = MsiViewClose(hview);
|
|
|
|
MsiCloseHandle(hview);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_component_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query( hdb,
|
2007-03-06 11:59:18 +00:00
|
|
|
"CREATE TABLE `Component` ( "
|
|
|
|
"`Component` CHAR(72) NOT NULL, "
|
|
|
|
"`ComponentId` CHAR(38), "
|
|
|
|
"`Directory_` CHAR(72) NOT NULL, "
|
|
|
|
"`Attributes` SHORT NOT NULL, "
|
|
|
|
"`Condition` CHAR(255), "
|
|
|
|
"`KeyPath` CHAR(72) "
|
|
|
|
"PRIMARY KEY `Component`)" );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create Component table: %u\n", r);
|
|
|
|
return r;
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_feature_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query( hdb,
|
2007-03-06 11:59:18 +00:00
|
|
|
"CREATE TABLE `Feature` ( "
|
|
|
|
"`Feature` CHAR(38) NOT NULL, "
|
|
|
|
"`Feature_Parent` CHAR(38), "
|
|
|
|
"`Title` CHAR(64), "
|
|
|
|
"`Description` CHAR(255), "
|
|
|
|
"`Display` SHORT NOT NULL, "
|
|
|
|
"`Level` SHORT NOT NULL, "
|
|
|
|
"`Directory_` CHAR(72), "
|
|
|
|
"`Attributes` SHORT NOT NULL "
|
|
|
|
"PRIMARY KEY `Feature`)" );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create Feature table: %u\n", r);
|
|
|
|
return r;
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_feature_components_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query( hdb,
|
2007-03-06 11:59:18 +00:00
|
|
|
"CREATE TABLE `FeatureComponents` ( "
|
|
|
|
"`Feature_` CHAR(38) NOT NULL, "
|
|
|
|
"`Component_` CHAR(72) NOT NULL "
|
|
|
|
"PRIMARY KEY `Feature_`, `Component_` )" );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create FeatureComponents table: %u\n", r);
|
|
|
|
return r;
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_file_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query( hdb,
|
2007-03-06 11:59:18 +00:00
|
|
|
"CREATE TABLE `File` ("
|
|
|
|
"`File` CHAR(72) NOT NULL, "
|
|
|
|
"`Component_` CHAR(72) NOT NULL, "
|
|
|
|
"`FileName` CHAR(255) NOT NULL, "
|
|
|
|
"`FileSize` LONG NOT NULL, "
|
|
|
|
"`Version` CHAR(72), "
|
|
|
|
"`Language` CHAR(20), "
|
|
|
|
"`Attributes` SHORT, "
|
|
|
|
"`Sequence` SHORT NOT NULL "
|
|
|
|
"PRIMARY KEY `File`)" );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create File table: %u\n", r);
|
|
|
|
return r;
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_remove_file_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query( hdb,
|
2007-03-06 11:59:18 +00:00
|
|
|
"CREATE TABLE `RemoveFile` ("
|
|
|
|
"`FileKey` CHAR(72) NOT NULL, "
|
|
|
|
"`Component_` CHAR(72) NOT NULL, "
|
|
|
|
"`FileName` CHAR(255) LOCALIZABLE, "
|
|
|
|
"`DirProperty` CHAR(72) NOT NULL, "
|
|
|
|
"`InstallMode` SHORT NOT NULL "
|
|
|
|
"PRIMARY KEY `FileKey`)" );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create RemoveFile table: %u\n", r);
|
|
|
|
return r;
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_appsearch_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query( hdb,
|
2007-03-06 11:59:18 +00:00
|
|
|
"CREATE TABLE `AppSearch` ("
|
|
|
|
"`Property` CHAR(72) NOT NULL, "
|
|
|
|
"`Signature_` CHAR(72) NOT NULL "
|
|
|
|
"PRIMARY KEY `Property`, `Signature_`)" );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create AppSearch table: %u\n", r);
|
|
|
|
return r;
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_reglocator_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query( hdb,
|
2007-03-06 11:59:18 +00:00
|
|
|
"CREATE TABLE `RegLocator` ("
|
|
|
|
"`Signature_` CHAR(72) NOT NULL, "
|
|
|
|
"`Root` SHORT NOT NULL, "
|
|
|
|
"`Key` CHAR(255) NOT NULL, "
|
|
|
|
"`Name` CHAR(255), "
|
|
|
|
"`Type` SHORT "
|
|
|
|
"PRIMARY KEY `Signature_`)" );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create RegLocator table: %u\n", r);
|
|
|
|
return r;
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_signature_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query( hdb,
|
2007-03-06 11:59:18 +00:00
|
|
|
"CREATE TABLE `Signature` ("
|
|
|
|
"`Signature` CHAR(72) NOT NULL, "
|
|
|
|
"`FileName` CHAR(255) NOT NULL, "
|
|
|
|
"`MinVersion` CHAR(20), "
|
|
|
|
"`MaxVersion` CHAR(20), "
|
|
|
|
"`MinSize` LONG, "
|
|
|
|
"`MaxSize` LONG, "
|
|
|
|
"`MinDate` LONG, "
|
|
|
|
"`MaxDate` LONG, "
|
|
|
|
"`Languages` CHAR(255) "
|
|
|
|
"PRIMARY KEY `Signature`)" );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create Signature table: %u\n", r);
|
|
|
|
return r;
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
static UINT create_launchcondition_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query( hdb,
|
2008-02-10 13:22:36 +00:00
|
|
|
"CREATE TABLE `LaunchCondition` ("
|
|
|
|
"`Condition` CHAR(255) NOT NULL, "
|
|
|
|
"`Description` CHAR(255) NOT NULL "
|
|
|
|
"PRIMARY KEY `Condition`)" );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create LaunchCondition table: %u\n", r);
|
|
|
|
return r;
|
2008-02-10 13:22:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_property_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query( hdb,
|
2008-02-10 13:22:36 +00:00
|
|
|
"CREATE TABLE `Property` ("
|
|
|
|
"`Property` CHAR(72) NOT NULL, "
|
|
|
|
"`Value` CHAR(0) "
|
|
|
|
"PRIMARY KEY `Property`)" );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create Property table: %u\n", r);
|
|
|
|
return r;
|
2008-02-10 13:22:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_install_execute_sequence_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query( hdb,
|
2008-02-10 13:22:36 +00:00
|
|
|
"CREATE TABLE `InstallExecuteSequence` ("
|
|
|
|
"`Action` CHAR(72) NOT NULL, "
|
|
|
|
"`Condition` CHAR(255), "
|
|
|
|
"`Sequence` SHORT "
|
|
|
|
"PRIMARY KEY `Action`)" );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create InstallExecuteSequence table: %u\n", r);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_install_ui_sequence_table( MSIHANDLE hdb )
|
|
|
|
{
|
|
|
|
UINT r = run_query( hdb,
|
|
|
|
"CREATE TABLE `InstallUISequence` ("
|
|
|
|
"`Action` CHAR(72) NOT NULL, "
|
|
|
|
"`Condition` CHAR(255), "
|
|
|
|
"`Sequence` SHORT "
|
|
|
|
"PRIMARY KEY `Action`)" );
|
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create InstallUISequence table: %u\n", r);
|
|
|
|
return r;
|
2008-02-10 13:22:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_media_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query( hdb,
|
2008-02-10 13:22:36 +00:00
|
|
|
"CREATE TABLE `Media` ("
|
|
|
|
"`DiskId` SHORT NOT NULL, "
|
|
|
|
"`LastSequence` SHORT NOT NULL, "
|
|
|
|
"`DiskPrompt` CHAR(64), "
|
|
|
|
"`Cabinet` CHAR(255), "
|
|
|
|
"`VolumeLabel` CHAR(32), "
|
|
|
|
"`Source` CHAR(72) "
|
|
|
|
"PRIMARY KEY `DiskId`)" );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create Media table: %u\n", r);
|
|
|
|
return r;
|
2008-02-10 13:22:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_ccpsearch_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query( hdb,
|
2008-02-10 13:22:36 +00:00
|
|
|
"CREATE TABLE `CCPSearch` ("
|
|
|
|
"`Signature_` CHAR(72) NOT NULL "
|
|
|
|
"PRIMARY KEY `Signature_`)" );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create CCPSearch table: %u\n", r);
|
|
|
|
return r;
|
2008-02-10 13:22:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_drlocator_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query( hdb,
|
2008-02-10 13:22:36 +00:00
|
|
|
"CREATE TABLE `DrLocator` ("
|
|
|
|
"`Signature_` CHAR(72) NOT NULL, "
|
|
|
|
"`Parent` CHAR(72), "
|
|
|
|
"`Path` CHAR(255), "
|
|
|
|
"`Depth` SHORT "
|
|
|
|
"PRIMARY KEY `Signature_`, `Parent`, `Path`)" );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create DrLocator table: %u\n", r);
|
|
|
|
return r;
|
2008-02-10 13:22:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_complocator_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query( hdb,
|
2008-02-10 13:22:36 +00:00
|
|
|
"CREATE TABLE `CompLocator` ("
|
|
|
|
"`Signature_` CHAR(72) NOT NULL, "
|
|
|
|
"`ComponentId` CHAR(38) NOT NULL, "
|
|
|
|
"`Type` SHORT "
|
|
|
|
"PRIMARY KEY `Signature_`)" );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create CompLocator table: %u\n", r);
|
|
|
|
return r;
|
2008-02-10 13:22:36 +00:00
|
|
|
}
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
static UINT create_inilocator_table( MSIHANDLE hdb )
|
2007-03-06 11:59:18 +00:00
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query( hdb,
|
2008-12-28 10:25:32 +00:00
|
|
|
"CREATE TABLE `IniLocator` ("
|
|
|
|
"`Signature_` CHAR(72) NOT NULL, "
|
|
|
|
"`FileName` CHAR(255) NOT NULL, "
|
|
|
|
"`Section` CHAR(96)NOT NULL, "
|
|
|
|
"`Key` CHAR(128)NOT NULL, "
|
|
|
|
"`Field` SHORT, "
|
|
|
|
"`Type` SHORT "
|
|
|
|
"PRIMARY KEY `Signature_`)" );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create IniLocator table: %u\n", r);
|
|
|
|
return r;
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
2012-12-09 19:52:12 +00:00
|
|
|
static UINT create_custom_action_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query( hdb,
|
2012-12-09 19:52:12 +00:00
|
|
|
"CREATE TABLE `CustomAction` ("
|
|
|
|
"`Action` CHAR(72) NOT NULL, "
|
|
|
|
"`Type` SHORT NOT NULL, "
|
|
|
|
"`Source` CHAR(75), "
|
|
|
|
"`Target` CHAR(255) "
|
|
|
|
"PRIMARY KEY `Action`)" );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create CustomAction table: %u\n", r);
|
|
|
|
return r;
|
2012-12-09 19:52:12 +00:00
|
|
|
}
|
|
|
|
|
2017-10-08 08:15:09 +00:00
|
|
|
static UINT create_dialog_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query(hdb,
|
2017-10-08 08:15:09 +00:00
|
|
|
"CREATE TABLE `Dialog` ("
|
|
|
|
"`Dialog` CHAR(72) NOT NULL, "
|
|
|
|
"`HCentering` SHORT NOT NULL, "
|
|
|
|
"`VCentering` SHORT NOT NULL, "
|
|
|
|
"`Width` SHORT NOT NULL, "
|
|
|
|
"`Height` SHORT NOT NULL, "
|
|
|
|
"`Attributes` LONG, "
|
|
|
|
"`Title` CHAR(128) LOCALIZABLE, "
|
|
|
|
"`Control_First` CHAR(50) NOT NULL, "
|
|
|
|
"`Control_Default` CHAR(50), "
|
|
|
|
"`Control_Cancel` CHAR(50) "
|
|
|
|
"PRIMARY KEY `Dialog`)");
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create Dialog table: %u\n", r);
|
|
|
|
return r;
|
2017-10-08 08:15:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_control_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query(hdb,
|
2017-10-08 08:15:09 +00:00
|
|
|
"CREATE TABLE `Control` ("
|
|
|
|
"`Dialog_` CHAR(72) NOT NULL, "
|
|
|
|
"`Control` CHAR(50) NOT NULL, "
|
|
|
|
"`Type` CHAR(20) NOT NULL, "
|
|
|
|
"`X` SHORT NOT NULL, "
|
|
|
|
"`Y` SHORT NOT NULL, "
|
|
|
|
"`Width` SHORT NOT NULL, "
|
|
|
|
"`Height` SHORT NOT NULL, "
|
|
|
|
"`Attributes` LONG, "
|
|
|
|
"`Property` CHAR(50), "
|
|
|
|
"`Text` CHAR(0) LOCALIZABLE, "
|
|
|
|
"`Control_Next` CHAR(50), "
|
|
|
|
"`Help` CHAR(255) LOCALIZABLE "
|
|
|
|
"PRIMARY KEY `Dialog_`, `Control`)");
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create Control table: %u\n", r);
|
|
|
|
return r;
|
2017-10-08 08:15:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_controlevent_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query(hdb,
|
2017-10-08 08:15:09 +00:00
|
|
|
"CREATE TABLE `ControlEvent` ("
|
|
|
|
"`Dialog_` CHAR(72) NOT NULL, "
|
|
|
|
"`Control_` CHAR(50) NOT NULL, "
|
|
|
|
"`Event` CHAR(50) NOT NULL, "
|
|
|
|
"`Argument` CHAR(255) NOT NULL, "
|
|
|
|
"`Condition` CHAR(255), "
|
|
|
|
"`Ordering` SHORT "
|
|
|
|
"PRIMARY KEY `Dialog_`, `Control_`, `Event`, `Argument`, `Condition`)");
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create ControlEvent table: %u\n", r);
|
|
|
|
return r;
|
2017-10-08 08:15:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static UINT create_actiontext_table( MSIHANDLE hdb )
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
UINT r = run_query(hdb,
|
2017-10-08 08:15:09 +00:00
|
|
|
"CREATE TABLE `ActionText` ("
|
|
|
|
"`Action` CHAR(72) NOT NULL, "
|
|
|
|
"`Description` CHAR(64) LOCALIZABLE, "
|
|
|
|
"`Template` CHAR(128) LOCALIZABLE "
|
|
|
|
"PRIMARY KEY `Action`)");
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create ActionText table: %u\n", r);
|
|
|
|
return r;
|
2017-10-08 08:15:09 +00:00
|
|
|
}
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
static inline UINT add_entry(const char *file, int line, const char *type, MSIHANDLE hdb, const char *values, const char *insert)
|
|
|
|
{
|
|
|
|
char *query;
|
|
|
|
UINT sz, r;
|
|
|
|
|
|
|
|
sz = strlen(values) + strlen(insert) + 1;
|
|
|
|
query = HeapAlloc(GetProcessHeap(), 0, sz);
|
|
|
|
sprintf(query, insert, values);
|
|
|
|
r = run_query(hdb, query);
|
|
|
|
HeapFree(GetProcessHeap(), 0, query);
|
|
|
|
ok_(file, line)(r == ERROR_SUCCESS, "failed to insert into %s table: %u\n", type, r);
|
|
|
|
return r;
|
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_component_entry(hdb, values) add_entry(__FILE__, __LINE__, "Component", hdb, values, \
|
|
|
|
"INSERT INTO `Component` " \
|
|
|
|
"(`Component`, `ComponentId`, `Directory_`, " \
|
2008-12-28 10:25:32 +00:00
|
|
|
"`Attributes`, `Condition`, `KeyPath`) VALUES( %s )")
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_directory_entry(hdb, values) add_entry(__FILE__, __LINE__, "Directory", hdb, values, \
|
|
|
|
"INSERT INTO `Directory` " \
|
2008-12-28 10:25:32 +00:00
|
|
|
"(`Directory`,`Directory_Parent`,`DefaultDir`) VALUES( %s )")
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_feature_entry(hdb, values) add_entry(__FILE__, __LINE__, "Feature", hdb, values, \
|
|
|
|
"INSERT INTO `Feature` " \
|
|
|
|
"(`Feature`, `Feature_Parent`, `Title`, `Description`, " \
|
2008-12-28 10:25:32 +00:00
|
|
|
"`Display`, `Level`, `Directory_`, `Attributes`) VALUES( %s )")
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_feature_components_entry(hdb, values) add_entry(__FILE__, __LINE__, "FeatureComponents", hdb, values, \
|
|
|
|
"INSERT INTO `FeatureComponents` " \
|
2008-12-28 10:25:32 +00:00
|
|
|
"(`Feature_`, `Component_`) VALUES( %s )")
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_file_entry(hdb, values) add_entry(__FILE__, __LINE__, "File", hdb, values, \
|
|
|
|
"INSERT INTO `File` " \
|
|
|
|
"(`File`, `Component_`, `FileName`, `FileSize`, " \
|
2008-12-28 10:25:32 +00:00
|
|
|
"`Version`, `Language`, `Attributes`, `Sequence`) VALUES( %s )")
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_appsearch_entry(hdb, values) add_entry(__FILE__, __LINE__, "AppSearch", hdb, values, \
|
|
|
|
"INSERT INTO `AppSearch` " \
|
2008-12-28 10:25:32 +00:00
|
|
|
"(`Property`, `Signature_`) VALUES( %s )")
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_signature_entry(hdb, values) add_entry(__FILE__, __LINE__, "Signature", hdb, values, \
|
|
|
|
"INSERT INTO `Signature` " \
|
|
|
|
"(`Signature`, `FileName`, `MinVersion`, `MaxVersion`," \
|
|
|
|
" `MinSize`, `MaxSize`, `MinDate`, `MaxDate`, `Languages`) " \
|
2008-12-28 10:25:32 +00:00
|
|
|
"VALUES( %s )")
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_launchcondition_entry(hdb, values) add_entry(__FILE__, __LINE__, "LaunchCondition", hdb, values, \
|
|
|
|
"INSERT INTO `LaunchCondition` " \
|
2008-12-28 10:25:32 +00:00
|
|
|
"(`Condition`, `Description`) VALUES( %s )")
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_property_entry(hdb, values) add_entry(__FILE__, __LINE__, "Property", hdb, values, \
|
2008-12-28 10:25:32 +00:00
|
|
|
"INSERT INTO `Property` (`Property`, `Value`) VALUES( %s )")
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_install_execute_sequence_entry(hdb, values) add_entry(__FILE__, __LINE__, "InstallExecuteSequence", hdb, values, \
|
|
|
|
"INSERT INTO `InstallExecuteSequence` " \
|
|
|
|
"(`Action`, `Condition`, `Sequence`) VALUES( %s )")
|
|
|
|
|
|
|
|
#define add_install_ui_sequence_entry(hdb, values) add_entry(__FILE__, __LINE__, "InstallUISequence", hdb, values, \
|
|
|
|
"INSERT INTO `InstallUISequence` " \
|
2008-12-28 10:25:32 +00:00
|
|
|
"(`Action`, `Condition`, `Sequence`) VALUES( %s )")
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_media_entry(hdb, values) add_entry(__FILE__, __LINE__, "Media", hdb, values, \
|
|
|
|
"INSERT INTO `Media` " \
|
|
|
|
"(`DiskId`, `LastSequence`, `DiskPrompt`, " \
|
2008-12-28 10:25:32 +00:00
|
|
|
"`Cabinet`, `VolumeLabel`, `Source`) VALUES( %s )")
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_ccpsearch_entry(hdb, values) add_entry(__FILE__, __LINE__, "CCPSearch", hdb, values, \
|
2008-12-28 10:25:32 +00:00
|
|
|
"INSERT INTO `CCPSearch` (`Signature_`) VALUES( %s )")
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_drlocator_entry(hdb, values) add_entry(__FILE__, __LINE__, "DrLocator", hdb, values, \
|
|
|
|
"INSERT INTO `DrLocator` " \
|
2008-12-28 10:25:32 +00:00
|
|
|
"(`Signature_`, `Parent`, `Path`, `Depth`) VALUES( %s )")
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_complocator_entry(hdb, values) add_entry(__FILE__, __LINE__, "CompLocator", hdb, values, \
|
|
|
|
"INSERT INTO `CompLocator` " \
|
2008-12-28 10:25:32 +00:00
|
|
|
"(`Signature_`, `ComponentId`, `Type`) VALUES( %s )")
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_inilocator_entry(hdb, values) add_entry(__FILE__, __LINE__, "IniLocator", hdb, values, \
|
|
|
|
"INSERT INTO `IniLocator` " \
|
|
|
|
"(`Signature_`, `FileName`, `Section`, `Key`, `Field`, `Type`) " \
|
2008-12-28 10:25:32 +00:00
|
|
|
"VALUES( %s )")
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_custom_action_entry(hdb, values) add_entry(__FILE__, __LINE__, "CustomAction", hdb, values, \
|
|
|
|
"INSERT INTO `CustomAction` " \
|
2012-12-09 19:52:12 +00:00
|
|
|
"(`Action`, `Type`, `Source`, `Target`) VALUES( %s )")
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_dialog_entry(hdb, values) add_entry(__FILE__, __LINE__, "Dialog", hdb, values, \
|
|
|
|
"INSERT INTO `Dialog` " \
|
2017-10-08 08:15:09 +00:00
|
|
|
"(`Dialog`, `HCentering`, `VCentering`, `Width`, `Height`, `Attributes`, `Control_First`) VALUES ( %s )")
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_control_entry(hdb, values) add_entry(__FILE__, __LINE__, "Control", hdb, values, \
|
|
|
|
"INSERT INTO `Control` " \
|
2017-10-08 08:15:09 +00:00
|
|
|
"(`Dialog_`, `Control`, `Type`, `X`, `Y`, `Width`, `Height`, `Attributes`, `Text`) VALUES( %s )");
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_controlevent_entry(hdb, values) add_entry(__FILE__, __LINE__, "ControlEvent", hdb, values, \
|
|
|
|
"INSERT INTO `ControlEvent` " \
|
2017-10-08 08:15:09 +00:00
|
|
|
"(`Dialog_`, `Control_`, `Event`, `Argument`, `Condition`, `Ordering`) VALUES( %s )");
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
#define add_actiontext_entry(hdb, values) add_entry(__FILE__, __LINE__, "ActionText", hdb, values, \
|
|
|
|
"INSERT INTO `ActionText` " \
|
2017-10-08 08:15:09 +00:00
|
|
|
"(`Action`, `Description`, `Template`) VALUES( %s )");
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
static UINT add_reglocator_entry( MSIHANDLE hdb, const char *sig, UINT root, const char *path,
|
|
|
|
const char *name, UINT type )
|
|
|
|
{
|
|
|
|
const char insert[] =
|
|
|
|
"INSERT INTO `RegLocator` (`Signature_`, `Root`, `Key`, `Name`, `Type`) "
|
|
|
|
"VALUES( '%s', %u, '%s', '%s', %u )";
|
|
|
|
char *query;
|
|
|
|
UINT sz, r;
|
|
|
|
|
|
|
|
sz = strlen( sig ) + 10 + strlen( path ) + strlen( name ) + 10 + sizeof( insert );
|
|
|
|
query = HeapAlloc( GetProcessHeap(), 0, sz );
|
|
|
|
sprintf( query, insert, sig, root, path, name, type );
|
|
|
|
r = run_query( hdb, query );
|
|
|
|
HeapFree( GetProcessHeap(), 0, query );
|
2018-01-20 11:30:30 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to insert into reglocator table: %u\n", r); \
|
2012-01-21 17:21:57 +00:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
static UINT set_summary_info(MSIHANDLE hdb)
|
|
|
|
{
|
|
|
|
UINT res;
|
|
|
|
MSIHANDLE suminfo;
|
|
|
|
|
2008-05-09 17:35:45 +00:00
|
|
|
/* build summary info */
|
2014-04-23 14:49:34 +00:00
|
|
|
res = MsiGetSummaryInformationA(hdb, NULL, 7, &suminfo);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( res == ERROR_SUCCESS , "Failed to open summaryinfo\n" );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
res = MsiSummaryInfoSetPropertyA(suminfo,2, VT_LPSTR, 0,NULL,
|
2007-03-06 11:59:18 +00:00
|
|
|
"Installation Database");
|
|
|
|
ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
res = MsiSummaryInfoSetPropertyA(suminfo,3, VT_LPSTR, 0,NULL,
|
2007-03-06 11:59:18 +00:00
|
|
|
"Installation Database");
|
|
|
|
ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
res = MsiSummaryInfoSetPropertyA(suminfo,4, VT_LPSTR, 0,NULL,
|
2007-03-06 11:59:18 +00:00
|
|
|
"Wine Hackers");
|
|
|
|
ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
res = MsiSummaryInfoSetPropertyA(suminfo,7, VT_LPSTR, 0,NULL,
|
2007-03-06 11:59:18 +00:00
|
|
|
";1033");
|
|
|
|
ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
res = MsiSummaryInfoSetPropertyA(suminfo,9, VT_LPSTR, 0,NULL,
|
2007-03-06 11:59:18 +00:00
|
|
|
"{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
|
|
|
|
ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
res = MsiSummaryInfoSetPropertyA(suminfo, 14, VT_I4, 100, NULL, NULL);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
res = MsiSummaryInfoSetPropertyA(suminfo, 15, VT_I4, 0, NULL, NULL);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( res == ERROR_SUCCESS , "Failed to set summary info\n" );
|
|
|
|
|
|
|
|
res = MsiSummaryInfoPersist(suminfo);
|
|
|
|
ok( res == ERROR_SUCCESS , "Failed to make summary info persist\n" );
|
|
|
|
|
|
|
|
res = MsiCloseHandle( suminfo);
|
|
|
|
ok( res == ERROR_SUCCESS , "Failed to close suminfo\n" );
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
static MSIHANDLE create_package_db(void)
|
2007-03-06 11:59:18 +00:00
|
|
|
{
|
|
|
|
MSIHANDLE hdb = 0;
|
|
|
|
UINT res;
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* create an empty database */
|
2014-04-23 14:49:34 +00:00
|
|
|
res = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb );
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( res == ERROR_SUCCESS , "Failed to create database %u\n", res );
|
2007-03-06 11:59:18 +00:00
|
|
|
if( res != ERROR_SUCCESS )
|
|
|
|
return hdb;
|
|
|
|
|
|
|
|
res = MsiDatabaseCommit( hdb );
|
|
|
|
ok( res == ERROR_SUCCESS , "Failed to commit database\n" );
|
|
|
|
|
|
|
|
res = set_summary_info(hdb);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( res == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", res);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
res = run_query( hdb,
|
|
|
|
"CREATE TABLE `Directory` ( "
|
|
|
|
"`Directory` CHAR(255) NOT NULL, "
|
|
|
|
"`Directory_Parent` CHAR(255), "
|
|
|
|
"`DefaultDir` CHAR(255) NOT NULL "
|
|
|
|
"PRIMARY KEY `Directory`)" );
|
|
|
|
ok( res == ERROR_SUCCESS , "Failed to create directory table\n" );
|
|
|
|
|
|
|
|
return hdb;
|
|
|
|
}
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
static UINT package_from_db(MSIHANDLE hdb, MSIHANDLE *handle)
|
2007-03-06 11:59:18 +00:00
|
|
|
{
|
|
|
|
UINT res;
|
2012-01-21 17:21:57 +00:00
|
|
|
CHAR szPackage[12];
|
2007-03-06 11:59:18 +00:00
|
|
|
MSIHANDLE hPackage;
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
sprintf(szPackage, "#%u", hdb);
|
2014-04-23 14:49:34 +00:00
|
|
|
res = MsiOpenPackageA(szPackage, &hPackage);
|
2008-02-10 13:22:36 +00:00
|
|
|
if (res != ERROR_SUCCESS)
|
2012-01-21 17:21:57 +00:00
|
|
|
{
|
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
return res;
|
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
res = MsiCloseHandle(hdb);
|
2008-02-10 13:22:36 +00:00
|
|
|
if (res != ERROR_SUCCESS)
|
2012-01-21 17:21:57 +00:00
|
|
|
{
|
|
|
|
MsiCloseHandle(hPackage);
|
|
|
|
return res;
|
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
*handle = hPackage;
|
|
|
|
return ERROR_SUCCESS;
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
2017-10-08 08:15:09 +00:00
|
|
|
static void create_file_data(LPCSTR name, LPCSTR data)
|
2007-03-06 11:59:18 +00:00
|
|
|
{
|
|
|
|
HANDLE file;
|
|
|
|
DWORD written;
|
|
|
|
|
|
|
|
file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
|
|
|
ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
|
2017-10-08 08:15:09 +00:00
|
|
|
if (file == INVALID_HANDLE_VALUE)
|
|
|
|
return;
|
|
|
|
|
|
|
|
WriteFile(file, data, strlen(data), &written, NULL);
|
2007-03-06 11:59:18 +00:00
|
|
|
WriteFile(file, "\n", strlen("\n"), &written, NULL);
|
2017-10-08 08:15:09 +00:00
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
CloseHandle(file);
|
|
|
|
}
|
|
|
|
|
2017-10-08 08:15:09 +00:00
|
|
|
static void create_test_file(const CHAR *name)
|
|
|
|
{
|
|
|
|
create_file_data(name, name);
|
|
|
|
}
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
typedef struct _tagVS_VERSIONINFO
|
2007-03-06 11:59:18 +00:00
|
|
|
{
|
2008-12-28 10:25:32 +00:00
|
|
|
WORD wLength;
|
|
|
|
WORD wValueLength;
|
|
|
|
WORD wType;
|
|
|
|
WCHAR szKey[1];
|
|
|
|
WORD wPadding1[1];
|
|
|
|
VS_FIXEDFILEINFO Value;
|
|
|
|
WORD wPadding2[1];
|
|
|
|
WORD wChildren[1];
|
|
|
|
} VS_VERSIONINFO;
|
|
|
|
|
|
|
|
#define roundoffs(a, b, r) (((BYTE *)(b) - (BYTE *)(a) + ((r) - 1)) & ~((r) - 1))
|
|
|
|
#define roundpos(a, b, r) (((BYTE *)(a)) + roundoffs(a, b, r))
|
|
|
|
|
|
|
|
static BOOL create_file_with_version(const CHAR *name, LONG ms, LONG ls)
|
2007-03-06 11:59:18 +00:00
|
|
|
{
|
2008-12-28 10:25:32 +00:00
|
|
|
VS_VERSIONINFO *pVerInfo;
|
|
|
|
VS_FIXEDFILEINFO *pFixedInfo;
|
|
|
|
LPBYTE buffer, ofs;
|
|
|
|
CHAR path[MAX_PATH];
|
|
|
|
DWORD handle, size;
|
|
|
|
HANDLE resource;
|
|
|
|
BOOL ret = FALSE;
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
GetSystemDirectoryA(path, MAX_PATH);
|
2009-10-19 21:11:46 +00:00
|
|
|
/* Some dlls can't be updated on Vista/W2K8 */
|
|
|
|
lstrcatA(path, "\\version.dll");
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
CopyFileA(path, name, FALSE);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
size = GetFileVersionInfoSizeA(path, &handle);
|
2008-12-28 10:25:32 +00:00
|
|
|
buffer = HeapAlloc(GetProcessHeap(), 0, size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
GetFileVersionInfoA(path, 0, size, buffer);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
pVerInfo = (VS_VERSIONINFO *)buffer;
|
|
|
|
ofs = (BYTE *)&pVerInfo->szKey[lstrlenW(pVerInfo->szKey) + 1];
|
|
|
|
pFixedInfo = (VS_FIXEDFILEINFO *)roundpos(pVerInfo, ofs, 4);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
pFixedInfo->dwFileVersionMS = ms;
|
|
|
|
pFixedInfo->dwFileVersionLS = ls;
|
|
|
|
pFixedInfo->dwProductVersionMS = ms;
|
|
|
|
pFixedInfo->dwProductVersionLS = ls;
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
resource = BeginUpdateResourceA(name, FALSE);
|
2008-12-28 10:25:32 +00:00
|
|
|
if (!resource)
|
|
|
|
goto done;
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
if (!UpdateResourceA(resource, (LPCSTR)RT_VERSION, (LPCSTR)MAKEINTRESOURCE(VS_VERSION_INFO),
|
|
|
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), buffer, size))
|
2008-12-28 10:25:32 +00:00
|
|
|
goto done;
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
if (!EndUpdateResourceA(resource, FALSE))
|
2008-12-28 10:25:32 +00:00
|
|
|
goto done;
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
ret = TRUE;
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
done:
|
|
|
|
HeapFree(GetProcessHeap(), 0, buffer);
|
|
|
|
return ret;
|
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2009-10-19 21:11:46 +00:00
|
|
|
static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
|
|
|
|
{
|
|
|
|
RESTOREPOINTINFOA spec;
|
|
|
|
|
|
|
|
spec.dwEventType = event_type;
|
|
|
|
spec.dwRestorePtType = APPLICATION_INSTALL;
|
|
|
|
spec.llSequenceNumber = status->llSequenceNumber;
|
|
|
|
lstrcpyA(spec.szDescription, "msitest restore point");
|
|
|
|
|
|
|
|
return pSRSetRestorePointA(&spec, status);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void remove_restore_point(DWORD seq_number)
|
|
|
|
{
|
|
|
|
DWORD res;
|
|
|
|
|
|
|
|
res = pSRRemoveRestorePoint(seq_number);
|
|
|
|
if (res != ERROR_SUCCESS)
|
|
|
|
trace("Failed to remove the restore point : %08x\n", res);
|
|
|
|
}
|
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
static BOOL is_root(const char *path)
|
|
|
|
{
|
|
|
|
return (isalpha(path[0]) && path[1] == ':' && path[2] == '\\' && !path[3]);
|
|
|
|
}
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
static void test_createpackage(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hPackage = 0;
|
|
|
|
UINT res;
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
res = package_from_db(create_package_db(), &hPackage);
|
|
|
|
if (res == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( res == ERROR_SUCCESS, " Failed to create package %u\n", res );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
res = MsiCloseHandle( hPackage);
|
|
|
|
ok( res == ERROR_SUCCESS , "Failed to close package\n" );
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_doaction( void )
|
|
|
|
{
|
|
|
|
MSIHANDLE hpkg;
|
|
|
|
UINT r;
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( -1, NULL );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(create_package_db(), &hpkg);
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, NULL);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(0, "boo");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "boo");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_FUNCTION_NOT_CALLED, "wrong return val\n");
|
|
|
|
|
|
|
|
MsiCloseHandle( hpkg );
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_gettargetpath_bad(void)
|
|
|
|
{
|
2009-10-25 11:06:38 +00:00
|
|
|
static const WCHAR boo[] = {'b','o','o',0};
|
|
|
|
static const WCHAR empty[] = {0};
|
2007-03-06 11:59:18 +00:00
|
|
|
char buffer[0x80];
|
2009-10-25 11:06:38 +00:00
|
|
|
WCHAR bufferW[0x80];
|
2007-03-06 11:59:18 +00:00
|
|
|
MSIHANDLE hpkg;
|
|
|
|
DWORD sz;
|
|
|
|
UINT r;
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(create_package_db(), &hpkg);
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetTargetPathA( 0, NULL, NULL, NULL );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetTargetPathA( 0, NULL, NULL, &sz );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetTargetPathA( 0, "boo", NULL, NULL );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetTargetPathA( 0, "boo", NULL, NULL );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetTargetPathA( hpkg, "boo", NULL, NULL );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_DIRECTORY, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetTargetPathA( hpkg, "boo", buffer, NULL );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_DIRECTORY, "wrong return val\n");
|
|
|
|
|
2009-10-25 11:06:38 +00:00
|
|
|
sz = 0;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetTargetPathA( hpkg, "", buffer, &sz );
|
2009-10-25 11:06:38 +00:00
|
|
|
ok( r == ERROR_DIRECTORY, "wrong return val\n");
|
|
|
|
|
|
|
|
r = MsiGetTargetPathW( 0, NULL, NULL, NULL );
|
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
|
|
|
|
|
|
|
|
r = MsiGetTargetPathW( 0, NULL, NULL, &sz );
|
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
|
|
|
|
|
|
|
|
r = MsiGetTargetPathW( 0, boo, NULL, NULL );
|
|
|
|
ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
|
|
|
|
|
|
|
|
r = MsiGetTargetPathW( 0, boo, NULL, NULL );
|
|
|
|
ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
|
|
|
|
|
|
|
|
r = MsiGetTargetPathW( hpkg, boo, NULL, NULL );
|
|
|
|
ok( r == ERROR_DIRECTORY, "wrong return val\n");
|
|
|
|
|
|
|
|
r = MsiGetTargetPathW( hpkg, boo, bufferW, NULL );
|
|
|
|
ok( r == ERROR_DIRECTORY, "wrong return val\n");
|
|
|
|
|
|
|
|
sz = 0;
|
|
|
|
r = MsiGetTargetPathW( hpkg, empty, bufferW, &sz );
|
|
|
|
ok( r == ERROR_DIRECTORY, "wrong return val\n");
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
MsiCloseHandle( hpkg );
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void query_file_path(MSIHANDLE hpkg, LPCSTR file, LPSTR buff)
|
|
|
|
{
|
|
|
|
UINT r;
|
|
|
|
DWORD size;
|
|
|
|
MSIHANDLE rec;
|
|
|
|
|
|
|
|
rec = MsiCreateRecord( 1 );
|
|
|
|
ok(rec, "MsiCreate record failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiRecordSetStringA( rec, 0, file );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiFormatRecordA( hpkg, rec, buff, &size );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
|
|
|
|
|
|
|
|
MsiCloseHandle( rec );
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_settargetpath(void)
|
|
|
|
{
|
2008-02-10 13:22:36 +00:00
|
|
|
char tempdir[MAX_PATH+8], buffer[MAX_PATH], file[MAX_PATH];
|
2007-03-06 11:59:18 +00:00
|
|
|
DWORD sz;
|
|
|
|
MSIHANDLE hpkg;
|
|
|
|
UINT r;
|
|
|
|
MSIHANDLE hdb;
|
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok ( hdb, "failed to create package database\n" );
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_component_table( hdb );
|
|
|
|
add_component_entry( hdb, "'RootComp', '{83e2694d-0864-4124-9323-6d37630912a1}', 'TARGETDIR', 8, '', 'RootFile'" );
|
|
|
|
add_component_entry( hdb, "'TestComp', '{A3FB59C8-C293-4F7E-B8C5-F0E1D8EEE4E5}', 'TestDir', 0, '', 'TestFile'" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_feature_table( hdb );
|
|
|
|
add_feature_entry( hdb, "'TestFeature', '', '', '', 0, 1, '', 0" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_feature_components_table( hdb );
|
|
|
|
add_feature_components_entry( hdb, "'TestFeature', 'RootComp'" );
|
|
|
|
add_feature_components_entry( hdb, "'TestFeature', 'TestComp'" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
add_directory_entry( hdb, "'TestParent', 'TARGETDIR', 'TestParent'" );
|
|
|
|
add_directory_entry( hdb, "'TestDir', 'TestParent', 'TestDir'" );
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_file_table( hdb );
|
|
|
|
add_file_entry( hdb, "'RootFile', 'RootComp', 'rootfile.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'TestFile', 'TestComp', 'testfile.txt', 0, '', '1033', 8192, 1" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db( hdb, &hpkg );
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
|
|
|
|
|
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostInitialize");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "cost init failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "FileCost");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostFinalize");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "cost finalize failed\n");
|
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
buffer[0] = 0;
|
|
|
|
sz = sizeof(buffer);
|
|
|
|
r = MsiGetPropertyA( hpkg, "OutOfNoRbDiskSpace", buffer, &sz );
|
|
|
|
ok( r == ERROR_SUCCESS, "MsiGetProperty returned %u\n", r );
|
|
|
|
trace( "OutOfNoRbDiskSpace = \"%s\"\n", buffer );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetTargetPathA( 0, NULL, NULL );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetTargetPathA( 0, "boo", "C:\\bogusx" );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetTargetPathA( hpkg, "boo", NULL );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetTargetPathA( hpkg, "boo", "c:\\bogusx" );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_DIRECTORY, "wrong return val\n");
|
|
|
|
|
|
|
|
sz = sizeof tempdir - 1;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetTargetPathA( hpkg, "TARGETDIR", tempdir, &sz );
|
2008-02-10 13:22:36 +00:00
|
|
|
sprintf( file, "%srootfile.txt", tempdir );
|
2009-06-06 15:59:11 +00:00
|
|
|
buffer[0] = 0;
|
2008-02-10 13:22:36 +00:00
|
|
|
query_file_path( hpkg, "[#RootFile]", buffer );
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
|
2014-04-23 14:49:34 +00:00
|
|
|
ok( !lstrcmpA(buffer, file), "Expected %s, got %s\n", file, buffer );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
GetTempFileNameA( tempdir, "_wt", 0, buffer );
|
2008-02-10 13:22:36 +00:00
|
|
|
sprintf( tempdir, "%s\\subdir", buffer );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetTargetPathA( hpkg, "TARGETDIR", buffer );
|
2008-04-04 16:43:16 +00:00
|
|
|
ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
|
|
|
|
"MsiSetTargetPath on file returned %d\n", r );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetTargetPathA( hpkg, "TARGETDIR", tempdir );
|
2008-04-04 16:43:16 +00:00
|
|
|
ok( r == ERROR_SUCCESS || r == ERROR_DIRECTORY,
|
|
|
|
"MsiSetTargetPath on 'subdir' of file returned %d\n", r );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA( buffer );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetTargetPathA( hpkg, "TARGETDIR", buffer );
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = GetFileAttributesA( buffer );
|
2008-02-10 13:22:36 +00:00
|
|
|
ok ( r == INVALID_FILE_ATTRIBUTES, "file/directory exists after MsiSetTargetPath. Attributes: %08X\n", r );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetTargetPathA( hpkg, "TARGETDIR", tempdir );
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "MsiSetTargetPath on subsubdir returned %d\n", r );
|
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
buffer[0] = 0;
|
2008-02-10 13:22:36 +00:00
|
|
|
sz = sizeof buffer - 1;
|
2014-04-23 14:49:34 +00:00
|
|
|
lstrcatA( tempdir, "\\" );
|
|
|
|
r = MsiGetTargetPathA( hpkg, "TARGETDIR", buffer, &sz );
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
|
2014-04-23 14:49:34 +00:00
|
|
|
ok( !lstrcmpA(buffer, tempdir), "Expected %s, got %s\n", tempdir, buffer);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
sprintf( file, "%srootfile.txt", tempdir );
|
|
|
|
query_file_path( hpkg, "[#RootFile]", buffer );
|
2014-04-23 14:49:34 +00:00
|
|
|
ok( !lstrcmpA(buffer, file), "Expected %s, got %s\n", file, buffer);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
buffer[0] = 0;
|
2012-01-21 17:21:57 +00:00
|
|
|
sz = sizeof(buffer);
|
|
|
|
r = MsiGetPropertyA( hpkg, "TestParent", buffer, &sz );
|
|
|
|
ok( r == ERROR_SUCCESS, "MsiGetProperty returned %u\n", r );
|
|
|
|
lstrcatA( tempdir, "TestParent\\" );
|
2014-04-23 14:49:34 +00:00
|
|
|
ok( !lstrcmpiA(buffer, tempdir), "Expected \"%s\", got \"%s\"\n", tempdir, buffer );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetTargetPathA( hpkg, "TestParent", "C:\\one\\two" );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
|
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
buffer[0] = 0;
|
2012-01-21 17:21:57 +00:00
|
|
|
sz = sizeof(buffer);
|
|
|
|
r = MsiGetPropertyA( hpkg, "TestParent", buffer, &sz );
|
|
|
|
ok( r == ERROR_SUCCESS, "MsiGetProperty returned %u\n", r );
|
2014-04-23 14:49:34 +00:00
|
|
|
ok( lstrcmpiA(buffer, "C:\\one\\two\\TestDir\\"),
|
2012-01-21 17:21:57 +00:00
|
|
|
"Expected \"C:\\one\\two\\TestDir\\\", got \"%s\"\n", buffer );
|
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
buffer[0] = 0;
|
2007-03-06 11:59:18 +00:00
|
|
|
query_file_path( hpkg, "[#TestFile]", buffer );
|
2014-04-23 14:49:34 +00:00
|
|
|
ok( !lstrcmpiA(buffer, "C:\\one\\two\\TestDir\\testfile.txt"),
|
2007-03-06 11:59:18 +00:00
|
|
|
"Expected C:\\one\\two\\TestDir\\testfile.txt, got %s\n", buffer );
|
2007-10-19 23:01:40 +00:00
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
buffer[0] = 0;
|
2008-02-10 13:22:36 +00:00
|
|
|
sz = sizeof buffer - 1;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetTargetPathA( hpkg, "TestParent", buffer, &sz );
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
|
2014-04-23 14:49:34 +00:00
|
|
|
ok( !lstrcmpiA(buffer, "C:\\one\\two\\"), "Expected C:\\one\\two\\, got %s\n", buffer);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetTargetPathA( hpkg, "TestParent", "C:\\one\\two\\three" );
|
2010-02-06 21:29:15 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
|
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
buffer[0] = 0;
|
2010-02-06 21:29:15 +00:00
|
|
|
sz = sizeof buffer - 1;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetTargetPathA( hpkg, "TestParent", buffer, &sz );
|
2010-02-06 21:29:15 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
|
2014-04-23 14:49:34 +00:00
|
|
|
ok( !lstrcmpiA(buffer, "C:\\one\\two\\three\\"), "Expected C:\\one\\two\\three\\, got %s\n", buffer);
|
2010-02-06 21:29:15 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetTargetPathA( hpkg, "TestParent", "C:\\\\one\\\\two " );
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
|
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
buffer[0] = 0;
|
2012-01-21 17:21:57 +00:00
|
|
|
sz = sizeof buffer - 1;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetTargetPathA( hpkg, "TestParent", buffer, &sz );
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
|
2014-04-23 14:49:34 +00:00
|
|
|
ok( !lstrcmpiA(buffer, "C:\\one\\two\\"), "Expected \"C:\\one\\two\\\", got %s\n", buffer);
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetTargetPathA( hpkg, "TestParent", "C:\\\\ Program Files \\\\ " );
|
2012-05-14 21:41:45 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );
|
|
|
|
|
|
|
|
buffer[0] = 0;
|
|
|
|
sz = sizeof buffer - 1;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetTargetPathA( hpkg, "TestParent", buffer, &sz );
|
2012-05-14 21:41:45 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
|
2014-04-23 14:49:34 +00:00
|
|
|
ok( !lstrcmpiA(buffer, "C:\\Program Files\\"), "Expected \"C:\\Program Files\\\", got %s\n", buffer);
|
2012-05-14 21:41:45 +00:00
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
MsiCloseHandle( hpkg );
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_condition(void)
|
|
|
|
{
|
2012-01-21 17:21:57 +00:00
|
|
|
static const WCHAR cond1[] = {'\"','a',0x30a,'\"','<','\"',0xe5,'\"',0};
|
|
|
|
static const WCHAR cond2[] = {'\"','a',0x30a,'\"','>','\"',0xe5,'\"',0};
|
|
|
|
static const WCHAR cond3[] = {'\"','a',0x30a,'\"','<','>','\"',0xe5,'\"',0};
|
|
|
|
static const WCHAR cond4[] = {'\"','a',0x30a,'\"','=','\"',0xe5,'\"',0};
|
2007-03-06 11:59:18 +00:00
|
|
|
MSICONDITION r;
|
|
|
|
MSIHANDLE hpkg;
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(create_package_db(), &hpkg);
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(0, NULL);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_ERROR, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, NULL);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_NONE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_NONE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "-1");
|
2008-04-04 16:43:16 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 = 0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 <> 0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 = 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 > 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 ~> 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "1 > 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "1 ~> 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 >= 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 ~>= 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "1 >= 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "1 ~>= 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 < 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 ~< 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "1 < 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "1 ~< 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 <= 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 ~<= 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "1 <= 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "1 ~<= 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 >=");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_ERROR, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, " ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_NONE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "LicView <> \"1\"");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "LicView <> \"0\"");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "LicView <> LicView");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "not 0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "not LicView");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "\"Testing\" ~<< \"Testing\"");
|
2009-05-17 07:05:22 +00:00
|
|
|
ok (r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "LicView ~<< \"Testing\"");
|
2009-05-17 07:05:22 +00:00
|
|
|
ok (r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "Not LicView ~<< \"Testing\"");
|
2009-05-17 07:05:22 +00:00
|
|
|
ok (r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "not \"A\"");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "~not \"A\"");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_ERROR, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "\"0\"");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "1 and 2");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "not 0 and 3");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "not 0 and 0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "not 0 or 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "(0)");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "(((((1))))))");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_ERROR, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "(((((1)))))");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, " \"A\" < \"B\" ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, " \"A\" > \"B\" ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, " \"1\" > \"12\" ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, " \"100\" < \"21\" ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 < > 0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_ERROR, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "(1<<1) == 2");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_ERROR, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, " \"A\" = \"a\" ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, " \"A\" ~ = \"a\" ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_ERROR, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, " \"A\" ~= \"a\" ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, " \"A\" ~= 1 ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, " \"A\" = 1 ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, " 1 ~= 1 ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, " 1 ~= \"1\" ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, " 1 = \"1\" ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, " 0 = \"1\" ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, " 0 < \"100\" ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, " 100 > \"0\" ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "1 XOR 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "1 IMP 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "1 IMP 0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 IMP 0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 EQV 0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 EQV 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "1 IMP 1 OR 0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "1 IMPL 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_ERROR, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "\"ASFD\" >< \"S\" ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "\"ASFD\" ~>< \"s\" ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "\"ASFD\" ~>< \"\" ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "\"ASFD\" ~>< \"sss\" ");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "mm", "5" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "mm = 5");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "mm < 6");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "mm <= 5");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "mm > 4");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "mm < 12");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "mm = \"5\"");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 = \"\"");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 AND \"\"");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "1 AND \"\"");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "1 AND \"1\"");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "3 >< 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "3 >< 4");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "NOT 0 AND 0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "NOT 0 AND 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "NOT 1 OR 0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 AND 1 OR 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "0 AND 0 OR 1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "NOT 0 AND 1 OR 0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "_1 = _1");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "( 1 AND 1 ) = 2");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_ERROR, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "NOT ( 1 AND 1 )");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "Installed<>\"\"");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "NOT 1 AND 0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael=0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael<>0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael<0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael>0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael>=0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael<=0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael~<>0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "bandalmael", "0" );
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael=0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "bandalmael", "" );
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael=0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "bandalmael", "asdf" );
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael=0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "bandalmael", "0asdf" );
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael=0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "bandalmael", "0 " );
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael=0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "bandalmael", "-0" );
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael=0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "bandalmael", "0000000000000" );
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael=0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "bandalmael", "--0" );
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael=0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "bandalmael", "0x00" );
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael=0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "bandalmael", "-" );
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael=0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "bandalmael", "+0" );
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael=0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "bandalmael", "0.0" );
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael=0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "bandalmael<>0");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "hi");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "hithere");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >< two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "hithere");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "hi");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >< two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "hello");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "hi");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >< two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "hellohithere");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "hi");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >< two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "hi");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >< two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "hi");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >< two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >< two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "1234");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "1");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >< two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "one 1234");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "1");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >< two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "hithere");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "hi");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one << two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "hi");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "hithere");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one << two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "hi");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "hi");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one << two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "abcdhithere");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "hi");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one << two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "hi");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one << two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "hithere");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one << two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one << two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "1234");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "1");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one << two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "1234 one");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "1");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one << two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "hithere");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "there");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >> two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "hithere");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "hi");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >> two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "there");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "hithere");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >> two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "there");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "there");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >> two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "abcdhithere");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "hi");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >> two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "there");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >> two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "there");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >> two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >> two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "1234");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "4");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >> two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "one 1234");
|
|
|
|
MsiSetPropertyA(hpkg, "two", "4");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one >> two");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "MsiNetAssemblySupport", NULL); /* make sure it's empty */
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport > \"1.1.4322\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport >= \"1.1.4322\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport <= \"1.1.4322\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport <> \"1.1.4322\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport ~< \"1.1.4322\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"abcd\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"a1.1.4322\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"1.1.4322a\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"0000001.1.4322\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"1.1.4322.1.1\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "\"2\" < \"1.1");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "\"2\" < \"1.1\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "\"2\" < \"12.1\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "\"02.1\" < \"2.11\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "\"02.1.1\" < \"2.1\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"1.1\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"1\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"0\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"-1\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"a\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"!\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"!\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"/\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \" \"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"azAZ_\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"a[a]\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"a[a]a\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"[a]\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"[a]a\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"{a}\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"{a\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"[a\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"a{\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"a]\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"A\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "MsiNetAssemblySupport", "1.1.4322");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"1.1.4322\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"1.1.14322\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"1.1.5\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"1.1\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "MsiNetAssemblySupport < \"1\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "one", "1");
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "one < \"1\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "X", "5.0");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "X != \"\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "X =\"5.0\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "X =\"5.1\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "X =\"6.0\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "X =\"5.0\" or X =\"5.1\" or X =\"6.0\"");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "(X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "X !=\"\" and (X =\"5.0\" or X =\"5.1\" or X =\"6.0\")");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == MSICONDITION_ERROR, "wrong return val (%d)\n", r);
|
|
|
|
|
2008-04-04 16:43:16 +00:00
|
|
|
/* feature doesn't exist */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "&nofeature");
|
2008-04-04 16:43:16 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
|
2018-01-20 11:30:30 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "&nofeature=\"\"");
|
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
r = MsiEvaluateConditionA(hpkg, "!nofeature=\"\"");
|
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
MsiEvaluateConditionA(hpkg, "$nocomponent=\"\"");
|
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
MsiEvaluateConditionA(hpkg, "?nocomponent=\"\"");
|
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
2008-04-04 16:43:16 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "A", "2");
|
|
|
|
MsiSetPropertyA(hpkg, "X", "50");
|
2008-05-17 19:46:54 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "2 <= X");
|
2008-05-17 19:46:54 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "A <= X");
|
2008-05-17 19:46:54 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "A <= 50");
|
2008-05-17 19:46:54 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "X", "50val");
|
2008-05-17 19:46:54 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "2 <= X");
|
2008-05-17 19:46:54 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "A <= X");
|
2008-05-17 19:46:54 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "A", "7");
|
|
|
|
MsiSetPropertyA(hpkg, "X", "50");
|
2008-05-17 19:46:54 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "7 <= X");
|
2008-05-17 19:46:54 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "A <= X");
|
2008-05-17 19:46:54 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "A <= 50");
|
2008-05-17 19:46:54 +00:00
|
|
|
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
MsiSetPropertyA(hpkg, "X", "50val");
|
2008-05-17 19:46:54 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "2 <= X");
|
2008-05-17 19:46:54 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiEvaluateConditionA(hpkg, "A <= X");
|
2008-05-17 19:46:54 +00:00
|
|
|
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = MsiEvaluateConditionW(hpkg, cond1);
|
|
|
|
ok( r == MSICONDITION_TRUE || broken(r == MSICONDITION_FALSE),
|
|
|
|
"wrong return val (%d)\n", r);
|
|
|
|
|
|
|
|
r = MsiEvaluateConditionW(hpkg, cond2);
|
|
|
|
ok( r == MSICONDITION_FALSE || broken(r == MSICONDITION_TRUE),
|
|
|
|
"wrong return val (%d)\n", r);
|
|
|
|
|
|
|
|
r = MsiEvaluateConditionW(hpkg, cond3);
|
|
|
|
ok( r == MSICONDITION_TRUE || broken(r == MSICONDITION_FALSE),
|
|
|
|
"wrong return val (%d)\n", r);
|
|
|
|
|
|
|
|
r = MsiEvaluateConditionW(hpkg, cond4);
|
|
|
|
ok( r == MSICONDITION_FALSE || broken(r == MSICONDITION_TRUE),
|
|
|
|
"wrong return val (%d)\n", r);
|
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
MsiCloseHandle( hpkg );
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2008-02-10 13:22:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL check_prop_empty( MSIHANDLE hpkg, const char * prop)
|
|
|
|
{
|
|
|
|
UINT r;
|
|
|
|
DWORD sz;
|
|
|
|
char buffer[2];
|
|
|
|
|
|
|
|
sz = sizeof buffer;
|
|
|
|
strcpy(buffer,"x");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA( hpkg, prop, buffer, &sz );
|
2008-02-10 13:22:36 +00:00
|
|
|
return r == ERROR_SUCCESS && buffer[0] == 0 && sz == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_props(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hpkg, hdb;
|
|
|
|
UINT r;
|
|
|
|
DWORD sz;
|
|
|
|
char buffer[0x100];
|
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_property_table(hdb);
|
|
|
|
add_property_entry(hdb, "'MetadataCompName', 'Photoshop.dll'");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db( hdb, &hpkg );
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
/* test invalid values */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA( 0, NULL, NULL, NULL );
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA( hpkg, NULL, NULL, NULL );
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA( hpkg, "boo", NULL, NULL );
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA( hpkg, "boo", buffer, NULL );
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
|
|
|
|
|
|
|
|
/* test retrieving an empty/nonexistent property */
|
2007-03-06 11:59:18 +00:00
|
|
|
sz = sizeof buffer;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA( hpkg, "boo", NULL, &sz );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "wrong return val\n");
|
|
|
|
ok( sz == 0, "wrong size returned\n");
|
|
|
|
|
|
|
|
check_prop_empty( hpkg, "boo");
|
|
|
|
sz = 0;
|
|
|
|
strcpy(buffer,"x");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA( hpkg, "boo", buffer, &sz );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_MORE_DATA, "wrong return val\n");
|
|
|
|
ok( !strcmp(buffer,"x"), "buffer was changed\n");
|
|
|
|
ok( sz == 0, "wrong size returned\n");
|
|
|
|
|
|
|
|
sz = 1;
|
|
|
|
strcpy(buffer,"x");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA( hpkg, "boo", buffer, &sz );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "wrong return val\n");
|
|
|
|
ok( buffer[0] == 0, "buffer was not changed\n");
|
|
|
|
ok( sz == 0, "wrong size returned\n");
|
|
|
|
|
|
|
|
/* set the property to something */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA( 0, NULL, NULL );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA( hpkg, NULL, NULL );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA( hpkg, "", NULL );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "wrong return val\n");
|
|
|
|
|
|
|
|
/* try set and get some illegal property identifiers */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA( hpkg, "", "asdf" );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_FUNCTION_FAILED, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA( hpkg, "=", "asdf" );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA( hpkg, " ", "asdf" );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "wrong return val\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA( hpkg, "'", "asdf" );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "wrong return val\n");
|
|
|
|
|
|
|
|
sz = sizeof buffer;
|
|
|
|
buffer[0]=0;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA( hpkg, "'", buffer, &sz );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "wrong return val\n");
|
|
|
|
ok( !strcmp(buffer,"asdf"), "buffer was not changed\n");
|
|
|
|
|
|
|
|
/* set empty values */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA( hpkg, "boo", NULL );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "wrong return val\n");
|
|
|
|
ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA( hpkg, "boo", "" );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "wrong return val\n");
|
|
|
|
ok( check_prop_empty( hpkg, "boo"), "prop wasn't empty\n");
|
|
|
|
|
|
|
|
/* set a non-empty value */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA( hpkg, "boo", "xyz" );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "wrong return val\n");
|
|
|
|
|
|
|
|
sz = 1;
|
|
|
|
strcpy(buffer,"x");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA( hpkg, "boo", buffer, &sz );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_MORE_DATA, "wrong return val\n");
|
|
|
|
ok( buffer[0] == 0, "buffer was not changed\n");
|
|
|
|
ok( sz == 3, "wrong size returned\n");
|
|
|
|
|
|
|
|
sz = 4;
|
|
|
|
strcpy(buffer,"x");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA( hpkg, "boo", buffer, &sz );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "wrong return val\n");
|
|
|
|
ok( !strcmp(buffer,"xyz"), "buffer was not changed\n");
|
|
|
|
ok( sz == 3, "wrong size returned\n");
|
|
|
|
|
|
|
|
sz = 3;
|
|
|
|
strcpy(buffer,"x");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA( hpkg, "boo", buffer, &sz );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_MORE_DATA, "wrong return val\n");
|
|
|
|
ok( !strcmp(buffer,"xy"), "buffer was not changed\n");
|
|
|
|
ok( sz == 3, "wrong size returned\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA(hpkg, "SourceDir", "foo");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "wrong return val\n");
|
|
|
|
|
|
|
|
sz = 4;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", buffer, &sz);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "wrong return val\n");
|
|
|
|
ok( !strcmp(buffer,""), "buffer wrong\n");
|
|
|
|
ok( sz == 0, "wrong size returned\n");
|
|
|
|
|
|
|
|
sz = 4;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOMERANDOMNAME", buffer, &sz);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "wrong return val\n");
|
|
|
|
ok( !strcmp(buffer,""), "buffer wrong\n");
|
|
|
|
ok( sz == 0, "wrong size returned\n");
|
|
|
|
|
|
|
|
sz = 4;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", buffer, &sz);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "wrong return val\n");
|
|
|
|
ok( !strcmp(buffer,"foo"), "buffer wrong\n");
|
|
|
|
ok( sz == 3, "wrong size returned\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA(hpkg, "MetadataCompName", "Photoshop.dll");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "wrong return val\n");
|
|
|
|
|
|
|
|
sz = 0;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "MetadataCompName", NULL, &sz );
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "return wrong\n");
|
|
|
|
ok( sz == 13, "size wrong (%d)\n", sz);
|
|
|
|
|
|
|
|
sz = 13;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "MetadataCompName", buffer, &sz );
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_MORE_DATA, "return wrong\n");
|
|
|
|
ok( !strcmp(buffer,"Photoshop.dl"), "buffer wrong\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA(hpkg, "property", "value");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
sz = 6;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "property", buffer, &sz);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok( !strcmp(buffer, "value"), "Expected value, got %s\n", buffer);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA(hpkg, "property", NULL);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
sz = 6;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "property", buffer, &sz);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2015-03-09 20:28:54 +00:00
|
|
|
ok(!buffer[0], "Expected empty string, got %s\n", buffer);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
MsiCloseHandle( hpkg );
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
2012-12-09 19:52:12 +00:00
|
|
|
static BOOL find_prop_in_property(MSIHANDLE hdb, LPCSTR prop, LPCSTR val, int len)
|
2008-02-10 13:22:36 +00:00
|
|
|
{
|
|
|
|
MSIHANDLE hview, hrec;
|
2012-12-09 19:52:12 +00:00
|
|
|
BOOL found = FALSE;
|
2008-02-10 13:22:36 +00:00
|
|
|
CHAR buffer[MAX_PATH];
|
|
|
|
DWORD sz;
|
|
|
|
UINT r;
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `_Property`", &hview);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
|
|
|
|
r = MsiViewExecute(hview, 0);
|
|
|
|
ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
|
|
|
|
|
2012-12-09 19:52:12 +00:00
|
|
|
if (len < 0) len = lstrlenA(val);
|
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
while (r == ERROR_SUCCESS && !found)
|
|
|
|
{
|
|
|
|
r = MsiViewFetch(hview, &hrec);
|
|
|
|
if (r != ERROR_SUCCESS) break;
|
|
|
|
|
|
|
|
sz = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiRecordGetStringA(hrec, 1, buffer, &sz);
|
2008-02-10 13:22:36 +00:00
|
|
|
if (r == ERROR_SUCCESS && !lstrcmpA(buffer, prop))
|
|
|
|
{
|
|
|
|
sz = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiRecordGetStringA(hrec, 2, buffer, &sz);
|
2012-12-09 19:52:12 +00:00
|
|
|
if (r == ERROR_SUCCESS && !memcmp(buffer, val, len) && !buffer[len])
|
|
|
|
{
|
|
|
|
ok(sz == len, "wrong size %u\n", sz);
|
2008-02-10 13:22:36 +00:00
|
|
|
found = TRUE;
|
2012-12-09 19:52:12 +00:00
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MsiCloseHandle(hrec);
|
|
|
|
}
|
|
|
|
MsiViewClose(hview);
|
|
|
|
MsiCloseHandle(hview);
|
|
|
|
return found;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_property_table(void)
|
|
|
|
{
|
|
|
|
const char *query;
|
|
|
|
UINT r;
|
|
|
|
MSIHANDLE hpkg, hdb, hrec;
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
char buffer[MAX_PATH], package[10];
|
2008-02-10 13:22:36 +00:00
|
|
|
DWORD sz;
|
|
|
|
BOOL found;
|
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok( hdb, "failed to create package\n");
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(hdb, &hpkg);
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
|
|
|
|
hdb = MsiGetActiveDatabase(hpkg);
|
|
|
|
|
|
|
|
query = "CREATE TABLE `_Property` ( "
|
|
|
|
"`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
|
|
|
|
r = run_query(hdb, query);
|
|
|
|
ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
|
|
|
|
|
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
MsiCloseHandle(hpkg);
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok( hdb, "failed to create package\n");
|
|
|
|
|
|
|
|
query = "CREATE TABLE `_Property` ( "
|
|
|
|
"`foo` INT NOT NULL, `bar` INT LOCALIZABLE PRIMARY KEY `foo`)";
|
|
|
|
r = run_query(hdb, query);
|
|
|
|
ok(r == ERROR_SUCCESS, "failed to create table\n");
|
|
|
|
|
|
|
|
query = "ALTER `_Property` ADD `foo` INTEGER";
|
|
|
|
r = run_query(hdb, query);
|
|
|
|
ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
|
|
|
|
|
|
|
|
query = "ALTER TABLE `_Property` ADD `foo` INTEGER";
|
|
|
|
r = run_query(hdb, query);
|
|
|
|
ok(r == ERROR_BAD_QUERY_SYNTAX, "failed to add column\n");
|
|
|
|
|
|
|
|
query = "ALTER TABLE `_Property` ADD `extra` INTEGER";
|
|
|
|
r = run_query(hdb, query);
|
|
|
|
ok(r == ERROR_SUCCESS, "failed to add column\n");
|
|
|
|
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
sprintf(package, "#%i", hdb);
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenPackageA(package, &hpkg);
|
2013-04-03 21:58:14 +00:00
|
|
|
ok(r != ERROR_SUCCESS, "MsiOpenPackage succeeded\n");
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
if (r == ERROR_SUCCESS)
|
|
|
|
MsiCloseHandle(hpkg);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
r = MsiCloseHandle(hdb);
|
|
|
|
ok(r == ERROR_SUCCESS, "MsiCloseHandle failed %u\n", r);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok (hdb, "failed to create package database\n");
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_property_table(hdb);
|
|
|
|
add_property_entry(hdb, "'prop', 'val'");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_custom_action_table(hdb);
|
|
|
|
add_custom_action_entry( hdb, "'EmbedNull', 51, 'prop2', '[~]np'" );
|
2012-12-09 19:52:12 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(hdb, &hpkg);
|
|
|
|
ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
|
|
|
|
sz = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "prop", buffer, &sz);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2014-04-23 14:49:34 +00:00
|
|
|
ok(!lstrcmpA(buffer, "val"), "Expected val, got %s\n", buffer);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
hdb = MsiGetActiveDatabase(hpkg);
|
|
|
|
|
2012-12-09 19:52:12 +00:00
|
|
|
found = find_prop_in_property(hdb, "prop", "val", -1);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(found, "prop should be in the _Property table\n");
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
add_property_entry(hdb, "'dantes', 'mercedes'");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
query = "SELECT * FROM `_Property` WHERE `Property` = 'dantes'";
|
|
|
|
r = do_query(hdb, query, &hrec);
|
|
|
|
ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
|
|
|
|
|
2012-12-09 19:52:12 +00:00
|
|
|
found = find_prop_in_property(hdb, "dantes", "mercedes", -1);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(found == FALSE, "dantes should not be in the _Property table\n");
|
|
|
|
|
|
|
|
sz = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
lstrcpyA(buffer, "aaa");
|
|
|
|
r = MsiGetPropertyA(hpkg, "dantes", buffer, &sz);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2015-03-09 20:28:54 +00:00
|
|
|
ok(!buffer[0], "Expected empty string, got %s\n", buffer);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA(hpkg, "dantes", "mercedes");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
2012-12-09 19:52:12 +00:00
|
|
|
found = find_prop_in_property(hdb, "dantes", "mercedes", -1);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(found == TRUE, "dantes should be in the _Property table\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "EmbedNull" );
|
2012-12-09 19:52:12 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "EmbedNull failed: %d\n", r);
|
|
|
|
|
|
|
|
sz = MAX_PATH;
|
|
|
|
memset( buffer, 'a', sizeof(buffer) );
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA( hpkg, "prop2", buffer, &sz );
|
2012-12-09 19:52:12 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
|
|
|
|
ok( !memcmp( buffer, "\0np", sizeof("\0np") ), "wrong value\n");
|
|
|
|
ok( sz == sizeof("\0np") - 1, "got %u\n", sz );
|
|
|
|
|
|
|
|
found = find_prop_in_property(hdb, "prop2", "\0np", 3);
|
|
|
|
ok(found == TRUE, "prop2 should be in the _Property table\n");
|
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
MsiCloseHandle(hpkg);
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2008-02-10 13:22:36 +00:00
|
|
|
}
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )
|
|
|
|
{
|
|
|
|
MSIHANDLE htab = 0;
|
|
|
|
UINT res;
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
res = MsiDatabaseOpenViewA( hdb, szQuery, &htab );
|
2007-03-06 11:59:18 +00:00
|
|
|
if( res == ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
r = MsiViewExecute( htab, hrec );
|
|
|
|
if( r != ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
res = r;
|
|
|
|
fprintf(stderr,"MsiViewExecute failed %08x\n", res);
|
|
|
|
}
|
|
|
|
|
|
|
|
r = MsiViewClose( htab );
|
|
|
|
if( r != ERROR_SUCCESS )
|
|
|
|
res = r;
|
|
|
|
|
|
|
|
r = MsiCloseHandle( htab );
|
|
|
|
if( r != ERROR_SUCCESS )
|
|
|
|
res = r;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT try_query( MSIHANDLE hdb, LPCSTR szQuery )
|
|
|
|
{
|
|
|
|
return try_query_param( hdb, szQuery, 0 );
|
|
|
|
}
|
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
static void set_summary_str(MSIHANDLE hdb, DWORD pid, LPCSTR value)
|
|
|
|
{
|
|
|
|
MSIHANDLE summary;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
r = MsiSummaryInfoSetPropertyA(summary, pid, VT_LPSTR, 0, NULL, value);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiSummaryInfoPersist(summary);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
|
|
|
|
|
|
|
|
MsiCloseHandle(summary);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void set_summary_dword(MSIHANDLE hdb, DWORD pid, DWORD value)
|
|
|
|
{
|
|
|
|
MSIHANDLE summary;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
r = MsiGetSummaryInformationA(hdb, NULL, 1, &summary);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
r = MsiSummaryInfoSetPropertyA(summary, pid, VT_I4, value, NULL, NULL);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
|
|
|
|
|
|
|
|
r = MsiSummaryInfoPersist(summary);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
|
|
|
|
|
|
|
|
MsiCloseHandle(summary);
|
|
|
|
}
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
static void test_msipackage(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hdb = 0, hpack = 100;
|
|
|
|
UINT r;
|
|
|
|
const char *query;
|
|
|
|
char name[10];
|
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
/* NULL szPackagePath */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenPackageA(NULL, &hpack);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
/* empty szPackagePath */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenPackageA("", &hpack);
|
2012-01-21 17:21:57 +00:00
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
|
|
|
return;
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
if (r == ERROR_SUCCESS)
|
|
|
|
MsiCloseHandle(hpack);
|
|
|
|
|
|
|
|
/* nonexistent szPackagePath */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenPackageA("nonexistent", &hpack);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
|
|
|
|
|
|
|
|
/* NULL hProduct */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenPackageA(msifile, NULL);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
name[0]='#';
|
|
|
|
name[1]=0;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenPackageA(name, &hpack);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
2016-06-25 11:28:00 +00:00
|
|
|
/* database exists, but is empty */
|
2009-01-18 09:03:44 +00:00
|
|
|
sprintf(name, "#%d", hdb);
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenPackageA(name, &hpack);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_INSTALL_PACKAGE_INVALID,
|
|
|
|
"Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
query = "CREATE TABLE `Property` ( "
|
|
|
|
"`Property` CHAR(72), `Value` CHAR(0) "
|
|
|
|
"PRIMARY KEY `Property`)";
|
|
|
|
r = try_query(hdb, query);
|
|
|
|
ok(r == ERROR_SUCCESS, "failed to create Properties table\n");
|
|
|
|
|
|
|
|
query = "CREATE TABLE `InstallExecuteSequence` ("
|
|
|
|
"`Action` CHAR(72), `Condition` CHAR(0), `Sequence` INTEGER "
|
|
|
|
"PRIMARY KEY `Action`)";
|
|
|
|
r = try_query(hdb, query);
|
|
|
|
ok(r == ERROR_SUCCESS, "failed to create InstallExecuteSequence table\n");
|
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
/* a few key tables exist */
|
2009-01-18 09:03:44 +00:00
|
|
|
sprintf(name, "#%d", hdb);
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenPackageA(name, &hpack);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_INSTALL_PACKAGE_INVALID,
|
|
|
|
"Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
MsiCloseHandle(hdb);
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
/* start with a clean database to show what constitutes a valid package */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
2009-01-18 09:03:44 +00:00
|
|
|
sprintf(name, "#%d", hdb);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
/* The following summary information props must exist:
|
|
|
|
* - PID_REVNUMBER
|
|
|
|
* - PID_PAGECOUNT
|
|
|
|
*/
|
|
|
|
|
|
|
|
set_summary_dword(hdb, PID_PAGECOUNT, 100);
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenPackageA(name, &hpack);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_INSTALL_PACKAGE_INVALID,
|
|
|
|
"Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
|
|
|
|
|
2012-08-13 16:18:14 +00:00
|
|
|
set_summary_str(hdb, PID_REVNUMBER, "{004757CD-5092-49C2-AD20-28E1CE0DF5F2}");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenPackageA(name, &hpack);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS,
|
|
|
|
"Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
MsiCloseHandle(hpack);
|
|
|
|
MsiCloseHandle(hdb);
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_formatrecord2(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hpkg, hrec ;
|
|
|
|
char buffer[0x100];
|
|
|
|
DWORD sz;
|
|
|
|
UINT r;
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(create_package_db(), &hpkg);
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA(hpkg, "Manufacturer", " " );
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "set property failed\n");
|
|
|
|
|
|
|
|
hrec = MsiCreateRecord(2);
|
|
|
|
ok(hrec, "create record failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiRecordSetStringA( hrec, 0, "[ProgramFilesFolder][Manufacturer]\\asdf");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "format record failed\n");
|
|
|
|
|
|
|
|
buffer[0] = 0;
|
|
|
|
sz = sizeof buffer;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiFormatRecordA( hpkg, hrec, buffer, &sz );
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiRecordSetStringA(hrec, 0, "[foo][1]");
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiRecordSetStringA(hrec, 1, "hoo");
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
sz = sizeof buffer;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiFormatRecordA(hpkg, hrec, buffer, &sz);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( sz == 3, "size wrong\n");
|
|
|
|
ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
|
|
|
|
ok( r == ERROR_SUCCESS, "format failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiRecordSetStringA(hrec, 0, "x[~]x");
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
sz = sizeof buffer;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiFormatRecordA(hpkg, hrec, buffer, &sz);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( sz == 3, "size wrong\n");
|
|
|
|
ok( 0 == strcmp(buffer,"x"), "wrong output %s\n",buffer);
|
|
|
|
ok( r == ERROR_SUCCESS, "format failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiRecordSetStringA(hrec, 0, "[foo.$%}][1]");
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiRecordSetStringA(hrec, 1, "hoo");
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
sz = sizeof buffer;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiFormatRecordA(hpkg, hrec, buffer, &sz);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( sz == 3, "size wrong\n");
|
|
|
|
ok( 0 == strcmp(buffer,"hoo"), "wrong output %s\n",buffer);
|
|
|
|
ok( r == ERROR_SUCCESS, "format failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiRecordSetStringA(hrec, 0, "[\\[]");
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
sz = sizeof buffer;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiFormatRecordA(hpkg, hrec, buffer, &sz);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( sz == 1, "size wrong\n");
|
|
|
|
ok( 0 == strcmp(buffer,"["), "wrong output %s\n",buffer);
|
|
|
|
ok( r == ERROR_SUCCESS, "format failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
SetEnvironmentVariableA("FOO", "BAR");
|
|
|
|
r = MsiRecordSetStringA(hrec, 0, "[%FOO]");
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
sz = sizeof buffer;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiFormatRecordA(hpkg, hrec, buffer, &sz);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( sz == 3, "size wrong\n");
|
|
|
|
ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
|
|
|
|
ok( r == ERROR_SUCCESS, "format failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiRecordSetStringA(hrec, 0, "[[1]]");
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiRecordSetStringA(hrec, 1, "%FOO");
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
sz = sizeof buffer;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiFormatRecordA(hpkg, hrec, buffer, &sz);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( sz == 3, "size wrong\n");
|
|
|
|
ok( 0 == strcmp(buffer,"BAR"), "wrong output %s\n",buffer);
|
|
|
|
ok( r == ERROR_SUCCESS, "format failed\n");
|
|
|
|
|
|
|
|
MsiCloseHandle( hrec );
|
|
|
|
MsiCloseHandle( hpkg );
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
static void test_formatrecord_tables(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hdb, hrec, hpkg = 0;
|
|
|
|
CHAR buf[MAX_PATH];
|
|
|
|
CHAR curr_dir[MAX_PATH];
|
|
|
|
CHAR expected[MAX_PATH];
|
|
|
|
CHAR root[MAX_PATH];
|
|
|
|
DWORD size;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
GetCurrentDirectoryA( MAX_PATH, curr_dir );
|
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok ( hdb, "failed to create package database\n");
|
|
|
|
|
|
|
|
add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
|
|
|
|
add_directory_entry( hdb, "'ReallyLongDir', 'TARGETDIR', "
|
|
|
|
"'I am a really long directory'" );
|
|
|
|
|
|
|
|
create_feature_table( hdb );
|
|
|
|
add_feature_entry( hdb, "'occipitofrontalis', '', '', '', 2, 1, '', 0" );
|
|
|
|
|
|
|
|
create_component_table( hdb );
|
|
|
|
add_component_entry( hdb, "'frontal', '', 'TARGETDIR', 0, '', 'frontal_file'" );
|
|
|
|
add_component_entry( hdb, "'parietal', '', 'TARGETDIR', 1, '', 'parietal_file'" );
|
|
|
|
add_component_entry( hdb, "'temporal', '', 'ReallyLongDir', 0, '', 'temporal_file'" );
|
|
|
|
|
|
|
|
create_feature_components_table( hdb );
|
|
|
|
add_feature_components_entry( hdb, "'occipitofrontalis', 'frontal'" );
|
|
|
|
add_feature_components_entry( hdb, "'occipitofrontalis', 'parietal'" );
|
|
|
|
add_feature_components_entry( hdb, "'occipitofrontalis', 'temporal'" );
|
|
|
|
|
|
|
|
create_file_table( hdb );
|
|
|
|
add_file_entry( hdb, "'frontal_file', 'frontal', 'frontal.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'parietal_file', 'parietal', 'parietal.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'temporal_file', 'temporal', 'temporal.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
|
|
|
|
create_custom_action_table( hdb );
|
|
|
|
add_custom_action_entry( hdb, "'MyCustom', 51, 'prop', '[!temporal_file]'" );
|
|
|
|
add_custom_action_entry( hdb, "'EscapeIt1', 51, 'prop', '[\\[]Bracket Text[\\]]'" );
|
|
|
|
add_custom_action_entry( hdb, "'EscapeIt2', 51, 'prop', '[\\xabcd]'" );
|
|
|
|
add_custom_action_entry( hdb, "'EscapeIt3', 51, 'prop', '[abcd\\xefgh]'" );
|
|
|
|
add_custom_action_entry( hdb, "'EmbedNull', 51, 'prop', '[~]np'" );
|
|
|
|
|
|
|
|
r = package_from_db( hdb, &hpkg );
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
|
|
|
MsiCloseHandle( hdb );
|
|
|
|
DeleteFileA( msifile );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
|
|
|
|
|
|
|
|
MsiCloseHandle( hdb );
|
|
|
|
|
|
|
|
r = MsiSetPropertyA( hpkg, "imaprop", "ringer" );
|
|
|
|
ok( r == ERROR_SUCCESS, "cannot set property: %d\n", r);
|
|
|
|
|
|
|
|
hrec = MsiCreateRecord( 1 );
|
|
|
|
|
|
|
|
/* property doesn't exist */
|
|
|
|
size = MAX_PATH;
|
|
|
|
/*MsiRecordSetStringA( hrec, 0, "[1]" ); */
|
|
|
|
MsiRecordSetStringA( hrec, 1, "[idontexist]" );
|
|
|
|
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
|
|
|
|
ok( !lstrcmpA( buf, "1: " ), "Expected '1: ', got %s\n", buf );
|
|
|
|
|
|
|
|
/* property exists */
|
|
|
|
size = MAX_PATH;
|
|
|
|
MsiRecordSetStringA( hrec, 1, "[imaprop]" );
|
|
|
|
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
|
|
|
|
ok( !lstrcmpA( buf, "1: ringer " ), "Expected '1: ringer ', got %s\n", buf );
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
MsiRecordSetStringA( hrec, 0, "1: [1] " );
|
|
|
|
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
|
|
|
|
ok( !lstrcmpA( buf, "1: ringer " ), "Expected '1: ringer ', got %s\n", buf );
|
|
|
|
|
|
|
|
/* environment variable doesn't exist */
|
|
|
|
size = MAX_PATH;
|
|
|
|
MsiRecordSetStringA( hrec, 1, "[%idontexist]" );
|
|
|
|
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
|
|
|
|
ok( !lstrcmpA( buf, "1: " ), "Expected '1: ', got %s\n", buf );
|
|
|
|
|
|
|
|
/* environment variable exists */
|
|
|
|
size = MAX_PATH;
|
|
|
|
SetEnvironmentVariableA( "crazyvar", "crazyval" );
|
|
|
|
MsiRecordSetStringA( hrec, 1, "[%crazyvar]" );
|
|
|
|
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
|
|
|
|
ok( !lstrcmpA( buf, "1: crazyval " ), "Expected '1: crazyval ', got %s\n", buf );
|
|
|
|
|
|
|
|
/* file key before CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
MsiRecordSetStringA( hrec, 1, "[#frontal_file]" );
|
|
|
|
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
|
|
|
|
ok( !lstrcmpA( buf, "1: " ), "Expected '1: ', got %s\n", buf );
|
|
|
|
|
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
|
|
|
|
|
|
|
r = MsiDoActionA(hpkg, "CostInitialize");
|
|
|
|
ok( r == ERROR_SUCCESS, "CostInitialize failed: %d\n", r);
|
|
|
|
|
|
|
|
r = MsiDoActionA(hpkg, "FileCost");
|
|
|
|
ok( r == ERROR_SUCCESS, "FileCost failed: %d\n", r);
|
|
|
|
|
|
|
|
r = MsiDoActionA(hpkg, "CostFinalize");
|
|
|
|
ok( r == ERROR_SUCCESS, "CostFinalize failed: %d\n", r);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
MsiGetPropertyA( hpkg, "ROOTDRIVE", root, &size );
|
|
|
|
|
|
|
|
sprintf( expected, "1: %sfrontal.txt ", root);
|
|
|
|
|
|
|
|
/* frontal full file key */
|
|
|
|
size = MAX_PATH;
|
|
|
|
MsiRecordSetStringA( hrec, 1, "[#frontal_file]" );
|
|
|
|
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
|
|
|
|
ok( !lstrcmpA( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
|
|
|
|
|
|
|
|
/* frontal short file key */
|
|
|
|
size = MAX_PATH;
|
|
|
|
MsiRecordSetStringA( hrec, 1, "[!frontal_file]" );
|
|
|
|
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
|
|
|
|
ok( !lstrcmpA( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
|
|
|
|
|
|
|
|
sprintf( expected, "1: %sI am a really long directory\\temporal.txt ", root);
|
|
|
|
|
|
|
|
/* temporal full file key */
|
|
|
|
size = MAX_PATH;
|
|
|
|
MsiRecordSetStringA( hrec, 1, "[#temporal_file]" );
|
|
|
|
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
|
|
|
|
ok( !lstrcmpA( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
|
|
|
|
|
|
|
|
/* temporal short file key */
|
|
|
|
size = MAX_PATH;
|
|
|
|
MsiRecordSetStringA( hrec, 1, "[!temporal_file]" );
|
|
|
|
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
|
|
|
|
ok( !lstrcmpA( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
|
|
|
|
|
|
|
|
/* custom action 51, files don't exist */
|
|
|
|
r = MsiDoActionA( hpkg, "MyCustom" );
|
|
|
|
ok( r == ERROR_SUCCESS, "MyCustom failed: %d\n", r);
|
|
|
|
|
|
|
|
sprintf( expected, "%sI am a really long directory\\temporal.txt", root);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA( hpkg, "prop", buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
|
|
|
|
ok( !lstrcmpA( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
|
|
|
|
|
|
|
|
sprintf( buf, "%sI am a really long directory", root );
|
|
|
|
CreateDirectoryA( buf, NULL );
|
|
|
|
|
|
|
|
lstrcatA( buf, "\\temporal.txt" );
|
|
|
|
create_test_file( buf );
|
|
|
|
|
|
|
|
/* custom action 51, files exist */
|
|
|
|
r = MsiDoActionA( hpkg, "MyCustom" );
|
|
|
|
ok( r == ERROR_SUCCESS, "MyCustom failed: %d\n", r);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA( hpkg, "prop", buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok( !lstrcmpA( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* custom action 51, escaped text 1 */
|
|
|
|
r = MsiDoActionA( hpkg, "EscapeIt1" );
|
|
|
|
ok( r == ERROR_SUCCESS, "EscapeIt1 failed: %d\n", r);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA( hpkg, "prop", buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
|
|
|
|
ok( !lstrcmpA( buf, "[Bracket Text]" ), "Expected '[Bracket Text]', got %s\n", buf);
|
|
|
|
|
|
|
|
/* custom action 51, escaped text 2 */
|
|
|
|
r = MsiDoActionA( hpkg, "EscapeIt2" );
|
|
|
|
ok( r == ERROR_SUCCESS, "EscapeIt2 failed: %d\n", r);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA( hpkg, "prop", buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
|
|
|
|
ok( !lstrcmpA( buf, "x" ), "Expected 'x', got %s\n", buf);
|
|
|
|
|
|
|
|
/* custom action 51, escaped text 3 */
|
|
|
|
r = MsiDoActionA( hpkg, "EscapeIt3" );
|
|
|
|
ok( r == ERROR_SUCCESS, "EscapeIt3 failed: %d\n", r);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA( hpkg, "prop", buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
|
|
|
|
ok( !lstrcmpA( buf, "" ), "Expected '', got %s\n", buf);
|
|
|
|
|
|
|
|
/* custom action 51, embedded null */
|
|
|
|
r = MsiDoActionA( hpkg, "EmbedNull" );
|
|
|
|
ok( r == ERROR_SUCCESS, "EmbedNull failed: %d\n", r);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
memset( buf, 'a', sizeof(buf) );
|
|
|
|
r = MsiGetPropertyA( hpkg, "prop", buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
|
|
|
|
ok( !memcmp( buf, "\0np", sizeof("\0np") ), "wrong value\n");
|
|
|
|
ok( size == sizeof("\0np") - 1, "got %u\n", size );
|
|
|
|
|
|
|
|
r = MsiSetPropertyA( hpkg, "prop", "[~]np" );
|
|
|
|
ok( r == ERROR_SUCCESS, "cannot set property: %d\n", r);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
memset( buf, 'a', sizeof(buf) );
|
|
|
|
r = MsiGetPropertyA( hpkg, "prop", buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
|
|
|
|
ok( !lstrcmpA( buf, "[~]np" ), "Expected '[~]np', got %s\n", buf);
|
|
|
|
|
|
|
|
sprintf( expected, "1: %sI am a really long directory\\ ", root);
|
|
|
|
|
|
|
|
/* component with INSTALLSTATE_LOCAL */
|
|
|
|
size = MAX_PATH;
|
|
|
|
MsiRecordSetStringA( hrec, 1, "[$temporal]" );
|
|
|
|
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
|
|
|
|
ok( !lstrcmpA( buf, expected ), "Expected \"%s\", got \"%s\"\n", expected, buf);
|
|
|
|
|
|
|
|
r = MsiSetComponentStateA( hpkg, "temporal", INSTALLSTATE_SOURCE );
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to set install state: %d\n", r);
|
|
|
|
|
|
|
|
/* component with INSTALLSTATE_SOURCE */
|
|
|
|
lstrcpyA( expected, "1: " );
|
|
|
|
lstrcatA( expected, curr_dir );
|
|
|
|
if (strlen(curr_dir) > 3) lstrcatA( expected, "\\" );
|
|
|
|
lstrcatA( expected, " " );
|
|
|
|
size = MAX_PATH;
|
|
|
|
MsiRecordSetStringA( hrec, 1, "[$parietal]" );
|
|
|
|
r = MsiFormatRecordA( hpkg, hrec, buf, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
|
|
|
|
ok( !lstrcmpA( buf, expected ), "Expected '%s', got '%s'\n", expected, buf);
|
|
|
|
|
|
|
|
sprintf( buf, "%sI am a really long directory\\temporal.txt", root );
|
|
|
|
DeleteFileA( buf );
|
|
|
|
|
|
|
|
sprintf( buf, "%sI am a really long directory", root );
|
|
|
|
RemoveDirectoryA( buf );
|
|
|
|
|
|
|
|
MsiCloseHandle( hrec );
|
|
|
|
MsiCloseHandle( hpkg );
|
|
|
|
DeleteFileA( msifile );
|
|
|
|
}
|
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
static void test_feature_states( UINT line, MSIHANDLE package, const char *feature, UINT error,
|
2014-04-23 14:49:34 +00:00
|
|
|
INSTALLSTATE expected_state, INSTALLSTATE expected_action, BOOL todo )
|
2012-05-14 21:41:45 +00:00
|
|
|
{
|
|
|
|
UINT r;
|
|
|
|
INSTALLSTATE state = 0xdeadbee;
|
|
|
|
INSTALLSTATE action = 0xdeadbee;
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetFeatureStateA( package, feature, &state, &action );
|
2012-05-14 21:41:45 +00:00
|
|
|
ok( r == error, "%u: expected %d got %d\n", line, error, r );
|
|
|
|
if (r == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
ok( state == expected_state, "%u: expected state %d got %d\n",
|
|
|
|
line, expected_state, state );
|
2016-06-25 11:28:00 +00:00
|
|
|
todo_wine_if (todo)
|
2012-05-14 21:41:45 +00:00
|
|
|
ok( action == expected_action, "%u: expected action %d got %d\n",
|
|
|
|
line, expected_action, action );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ok( state == 0xdeadbee, "%u: expected state 0xdeadbee got %d\n", line, state );
|
2016-06-25 11:28:00 +00:00
|
|
|
todo_wine_if (todo)
|
2012-05-14 21:41:45 +00:00
|
|
|
ok( action == 0xdeadbee, "%u: expected action 0xdeadbee got %d\n", line, action );
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_component_states( UINT line, MSIHANDLE package, const char *component, UINT error,
|
2014-04-23 14:49:34 +00:00
|
|
|
INSTALLSTATE expected_state, INSTALLSTATE expected_action, BOOL todo )
|
2012-05-14 21:41:45 +00:00
|
|
|
{
|
|
|
|
UINT r;
|
|
|
|
INSTALLSTATE state = 0xdeadbee;
|
|
|
|
INSTALLSTATE action = 0xdeadbee;
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetComponentStateA( package, component, &state, &action );
|
2012-05-14 21:41:45 +00:00
|
|
|
ok( r == error, "%u: expected %d got %d\n", line, error, r );
|
|
|
|
if (r == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
ok( state == expected_state, "%u: expected state %d got %d\n",
|
|
|
|
line, expected_state, state );
|
2016-06-25 11:28:00 +00:00
|
|
|
todo_wine_if (todo)
|
2012-05-14 21:41:45 +00:00
|
|
|
ok( action == expected_action, "%u: expected action %d got %d\n",
|
|
|
|
line, expected_action, action );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ok( state == 0xdeadbee, "%u: expected state 0xdeadbee got %d\n",
|
|
|
|
line, state );
|
2016-06-25 11:28:00 +00:00
|
|
|
todo_wine_if (todo)
|
2012-05-14 21:41:45 +00:00
|
|
|
ok( action == 0xdeadbee, "%u: expected action 0xdeadbee got %d\n",
|
|
|
|
line, action );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
static void test_states(void)
|
|
|
|
{
|
2014-04-23 14:49:34 +00:00
|
|
|
static const char msifile2[] = "winetest2-package.msi";
|
|
|
|
static const char msifile3[] = "winetest3-package.msi";
|
|
|
|
static const char msifile4[] = "winetest4-package.msi";
|
|
|
|
static const WCHAR msifile2W[] =
|
|
|
|
{'w','i','n','e','t','e','s','t','2','-','p','a','c','k','a','g','e','.','m','s','i',0};
|
|
|
|
static const WCHAR msifile3W[] =
|
|
|
|
{'w','i','n','e','t','e','s','t','3','-','p','a','c','k','a','g','e','.','m','s','i',0};
|
|
|
|
static const WCHAR msifile4W[] =
|
|
|
|
{'w','i','n','e','t','e','s','t','4','-','p','a','c','k','a','g','e','.','m','s','i',0};
|
2018-01-20 11:30:30 +00:00
|
|
|
char msi_cache_file[MAX_PATH];
|
|
|
|
DWORD cache_file_name_len;
|
2014-09-23 18:33:25 +00:00
|
|
|
INSTALLSTATE state;
|
2007-03-06 11:59:18 +00:00
|
|
|
MSIHANDLE hpkg;
|
|
|
|
UINT r;
|
|
|
|
MSIHANDLE hdb;
|
2018-01-20 11:30:30 +00:00
|
|
|
BOOL is_broken;
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
if (is_process_limited())
|
|
|
|
{
|
|
|
|
skip("process is limited\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
hdb = create_package_db();
|
|
|
|
ok ( hdb, "failed to create package database\n" );
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_property_table( hdb );
|
|
|
|
add_property_entry( hdb, "'ProductCode', '{7262AC98-EEBD-4364-8CE3-D654F6A425B9}'" );
|
|
|
|
add_property_entry( hdb, "'ProductLanguage', '1033'" );
|
|
|
|
add_property_entry( hdb, "'ProductName', 'MSITEST'" );
|
|
|
|
add_property_entry( hdb, "'ProductVersion', '1.1.1'" );
|
|
|
|
add_property_entry( hdb, "'MSIFASTINSTALL', '1'" );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_install_execute_sequence_table( hdb );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1400'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'InstallInitialize', '', '1500'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'ProcessComponents', '', '1600'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'UnpublishFeatures', '', '1800'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'RegisterProduct', '', '6100'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'PublishFeatures', '', '6300'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'PublishProduct', '', '6400'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'InstallFinalize', '', '6600'" );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_media_table( hdb );
|
|
|
|
add_media_entry( hdb, "'1', '3', '', '', 'DISK1', ''");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_feature_table( hdb );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_component_table( hdb );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorLocal */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'alpha', '{467EC132-739D-4784-A37B-677AA43DBC94}', 'TARGETDIR', 0, '', 'alpha_file'" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'beta', '{2C1F189C-24A6-4C34-B26B-994A6C026506}', 'TARGETDIR', 1, '', 'beta_file'" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'gamma', '{C271E2A4-DE2E-4F70-86D1-6984AF7DE2CA}', 'TARGETDIR', 2, '', 'gamma_file'" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSharedDllRefCount */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'theta', '{4EB3129D-81A8-48D5-9801-75600FED3DD9}', 'TARGETDIR', 8, '', 'theta_file'" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorSource */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'two', '', '', '', 2, 1, '', 1" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'delta', '{938FD4F2-C648-4259-A03C-7AA3B45643F3}', 'TARGETDIR', 0, '', 'delta_file'" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'epsilon', '{D59713B6-C11D-47F2-A395-1E5321781190}', 'TARGETDIR', 1, '', 'epsilon_file'" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'zeta', '{377D33AB-2FAA-42B9-A629-0C0DAE9B9C7A}', 'TARGETDIR', 2, '', 'zeta_file'" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorSource:msidbComponentAttributesSharedDllRefCount */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'iota', '{5D36F871-B5ED-4801-9E0F-C46B9E5C9669}', 'TARGETDIR', 8, '', 'iota_file'" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorSource */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'three', '', '', '', 2, 1, '', 1" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
/* msidbFeatureAttributesFavorLocal */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'four', '', '', '', 2, 1, '', 0" );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
/* disabled */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'five', '', '', '', 2, 0, '', 1" );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
/* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
/* no feature parent:msidbComponentAttributesLocalOnly */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
/* msidbFeatureAttributesFavorLocal:removed */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'six', '', '', '', 2, 1, '', 0" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
/* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesLocalOnly */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'lambda', '{6528C5E4-02A4-4636-A214-7A66A6C35B64}', 'TARGETDIR', 0, '', 'lambda_file'" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
/* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSourceOnly */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'mu', '{97014BAB-6C56-4013-9A63-2BF913B42519}', 'TARGETDIR', 1, '', 'mu_file'" );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesOptional */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'nu', '{943DD0D8-5808-4954-8526-3B8493FEDDCD}', 'TARGETDIR', 2, '', 'nu_file'" );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorLocal:removed:msidbComponentAttributesSharedDllRefCount */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'xi', '{D6CF9EF7-6FCF-4930-B34B-F938AEFF9BDB}', 'TARGETDIR', 8, '', 'xi_file'" );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorSource:removed */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'seven', '', '', '', 2, 1, '', 1" );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesLocalOnly */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'omicron', '{7B57521D-15DB-4141-9AA6-01D934A4433F}', 'TARGETDIR', 0, '', 'omicron_file'" );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSourceOnly */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'pi', '{FB85346B-378E-4492-8769-792305471C81}', 'TARGETDIR', 1, '', 'pi_file'" );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesOptional */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'rho', '{798F2047-7B0C-4783-8BB0-D703E554114B}', 'TARGETDIR', 2, '', 'rho_file'" );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorSource:removed:msidbComponentAttributesSharedDllRefCount */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'sigma', '{5CE9DDA8-B67B-4736-9D93-99D61C5B93E7}', 'TARGETDIR', 8, '', 'sigma_file'" );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2009-05-17 07:05:22 +00:00
|
|
|
/* msidbFeatureAttributesFavorLocal */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'eight', '', '', '', 2, 1, '', 0" );
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'tau', '{07DEB510-677C-4A6F-A0A6-7CD8EFEA77ED}', 'TARGETDIR', 1, '', 'tau_file'" );
|
2009-05-17 07:05:22 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorSource */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'nine', '', '', '', 2, 1, '', 1" );
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'phi', '{9F0594C5-35AD-43EA-94DD-8DF73FAA664D}', 'TARGETDIR', 1, '', 'phi_file'" );
|
2009-05-17 07:05:22 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorAdvertise */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'ten', '', '', '', 2, 1, '', 4" );
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'chi', '{E6B539AB-5DA9-4236-A2D2-E341A50B4C38}', 'TARGETDIR', 1, '', 'chi_file'" );
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
/* msidbFeatureAttributesUIDisallowAbsent */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'eleven', '', '', '', 2, 1, '', 16" );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'psi', '{A06B23B5-746B-427A-8A6E-FD6AC8F46A95}', 'TARGETDIR', 1, '', 'psi_file'" );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
/* high install level */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'twelve', '', '', '', 2, 2, '', 0" );
|
2014-09-23 18:33:25 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'upsilon', '{557e0c04-ceba-4c58-86a9-4a73352e8cf6}', 'TARGETDIR', 1, '', 'upsilon_file'" );
|
2014-09-23 18:33:25 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFollowParent */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'thirteen', '', '', '', 2, 2, '', 2" );
|
|
|
|
|
|
|
|
create_feature_components_table( hdb );
|
|
|
|
add_feature_components_entry( hdb, "'one', 'alpha'" );
|
|
|
|
add_feature_components_entry( hdb, "'one', 'beta'" );
|
|
|
|
add_feature_components_entry( hdb, "'one', 'gamma'" );
|
|
|
|
add_feature_components_entry( hdb, "'one', 'theta'" );
|
|
|
|
add_feature_components_entry( hdb, "'two', 'delta'" );
|
|
|
|
add_feature_components_entry( hdb, "'two', 'epsilon'" );
|
|
|
|
add_feature_components_entry( hdb, "'two', 'zeta'" );
|
|
|
|
add_feature_components_entry( hdb, "'two', 'iota'" );
|
|
|
|
add_feature_components_entry( hdb, "'three', 'eta'" );
|
|
|
|
add_feature_components_entry( hdb, "'four', 'eta'" );
|
|
|
|
add_feature_components_entry( hdb, "'five', 'eta'" );
|
|
|
|
add_feature_components_entry( hdb, "'six', 'lambda'" );
|
|
|
|
add_feature_components_entry( hdb, "'six', 'mu'" );
|
|
|
|
add_feature_components_entry( hdb, "'six', 'nu'" );
|
|
|
|
add_feature_components_entry( hdb, "'six', 'xi'" );
|
|
|
|
add_feature_components_entry( hdb, "'seven', 'omicron'" );
|
|
|
|
add_feature_components_entry( hdb, "'seven', 'pi'" );
|
|
|
|
add_feature_components_entry( hdb, "'seven', 'rho'" );
|
|
|
|
add_feature_components_entry( hdb, "'seven', 'sigma'" );
|
|
|
|
add_feature_components_entry( hdb, "'eight', 'tau'" );
|
|
|
|
add_feature_components_entry( hdb, "'nine', 'phi'" );
|
|
|
|
add_feature_components_entry( hdb, "'ten', 'chi'" );
|
|
|
|
add_feature_components_entry( hdb, "'eleven', 'psi'" );
|
|
|
|
add_feature_components_entry( hdb, "'twelve', 'upsilon'" );
|
|
|
|
add_feature_components_entry( hdb, "'thirteen', 'upsilon'" );
|
|
|
|
|
|
|
|
create_file_table( hdb );
|
|
|
|
add_file_entry( hdb, "'alpha_file', 'alpha', 'alpha.txt', 100, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'beta_file', 'beta', 'beta.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'gamma_file', 'gamma', 'gamma.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'theta_file', 'theta', 'theta.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'delta_file', 'delta', 'delta.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'epsilon_file', 'epsilon', 'epsilon.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'zeta_file', 'zeta', 'zeta.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'iota_file', 'iota', 'iota.txt', 0, '', '1033', 8192, 1" );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* compressed file */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_file_entry( hdb, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" );
|
|
|
|
|
|
|
|
add_file_entry( hdb, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'lambda_file', 'lambda', 'lambda.txt', 100, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'mu_file', 'mu', 'mu.txt', 100, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'nu_file', 'nu', 'nu.txt', 100, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'xi_file', 'xi', 'xi.txt', 100, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'omicron_file', 'omicron', 'omicron.txt', 100, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'pi_file', 'pi', 'pi.txt', 100, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'rho_file', 'rho', 'rho.txt', 100, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'sigma_file', 'sigma', 'sigma.txt', 100, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'tau_file', 'tau', 'tau.txt', 100, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'phi_file', 'phi', 'phi.txt', 100, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'chi_file', 'chi', 'chi.txt', 100, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'psi_file', 'psi', 'psi.txt', 100, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'upsilon_file', 'upsilon', 'upsilon.txt', 0, '', '1033', 16384, 1" );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
r = MsiDatabaseCommit(hdb);
|
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
/* these properties must not be in the saved msi file */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
|
|
|
|
add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
|
|
|
|
add_property_entry( hdb, "'REMOVE', 'six,seven'");
|
|
|
|
add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
|
|
|
|
add_property_entry( hdb, "'REINSTALLMODE', 'omus'");
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db( hdb, &hpkg );
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
CopyFileA(msifile, msifile2, FALSE);
|
|
|
|
CopyFileA(msifile, msifile3, FALSE);
|
2009-05-17 07:05:22 +00:00
|
|
|
CopyFileA(msifile, msifile4, FALSE);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_UNKNOWN_FEATURE, 0, 0, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_UNKNOWN_COMPONENT, 0, 0, FALSE );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostInitialize");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "cost init failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "FileCost");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostFinalize");
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "two", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "three", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "four", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "five", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "six", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "seven", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "eight", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "nine", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "ten", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "eleven", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
2014-09-23 18:33:25 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "twelve", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "thirteen", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
2014-04-23 14:49:34 +00:00
|
|
|
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "beta", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "gamma", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "theta", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "delta", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "epsilon", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "zeta", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "iota", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "eta", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "kappa", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "lambda", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "mu", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "nu", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "xi", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "omicron", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "pi", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "rho", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "sigma", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "tau", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "phi", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "chi", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "psi", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
2014-09-23 18:33:25 +00:00
|
|
|
test_component_states( __LINE__, hpkg, "upsilon", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
MsiCloseHandle( hpkg );
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
/* publish the features and components */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiInstallProductA(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven REINSTALL=eight,nine,ten");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_DIRECT, &hdb);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
|
|
|
|
|
|
|
|
/* these properties must not be in the saved msi file */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_property_entry( hdb, "'ADDLOCAL', 'one,four'");
|
|
|
|
add_property_entry( hdb, "'ADDSOURCE', 'two,three'");
|
|
|
|
add_property_entry( hdb, "'REMOVE', 'six,seven'");
|
|
|
|
add_property_entry( hdb, "'REINSTALL', 'eight,nine,ten'");
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db( hdb, &hpkg );
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_UNKNOWN_FEATURE, 0, 0, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_UNKNOWN_COMPONENT, 0, 0, FALSE );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostInitialize");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "cost init failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "FileCost");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostFinalize");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "two", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "three", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "four", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "five", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "six", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "seven", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "eight", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "nine", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "ten", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "eleven", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
2014-09-23 18:33:25 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "twelve", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "thirteen", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
2014-04-23 14:49:34 +00:00
|
|
|
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "beta", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "gamma", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "theta", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "delta", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "epsilon", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "zeta", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "iota", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "eta", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "kappa", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "lambda", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "mu", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "nu", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "xi", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "omicron", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "pi", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "rho", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "sigma", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "tau", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "phi", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "chi", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "psi", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
2014-09-23 18:33:25 +00:00
|
|
|
test_component_states( __LINE__, hpkg, "upsilon", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
|
|
|
|
/* uninstall the product */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiInstallProductA(msifile, "REMOVE=ALL");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "five");
|
|
|
|
ok(state == INSTALLSTATE_UNKNOWN, "state = %d\n", state);
|
|
|
|
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "twelve");
|
|
|
|
ok(state == INSTALLSTATE_UNKNOWN, "state = %d\n", state);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* all features installed locally */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiInstallProductA(msifile2, "ADDLOCAL=ALL");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "five");
|
|
|
|
ok(state == INSTALLSTATE_UNKNOWN, "state = %d\n", state);
|
|
|
|
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "twelve");
|
|
|
|
ok(state == INSTALLSTATE_LOCAL, "state = %d\n", state);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenDatabaseW(msifile2W, MSIDBOPEN_DIRECT, &hdb);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* these properties must not be in the saved msi file */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_property_entry( hdb, "'ADDLOCAL', 'one,two,three,four,five,six,seven,eight,nine,ten,twelve'");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db( hdb, &hpkg );
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_UNKNOWN_FEATURE, 0, 0, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_UNKNOWN_COMPONENT, 0, 0, FALSE );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostInitialize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "cost init failed\n");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostFinalize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "two", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "three", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "four", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "five", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "six", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "seven", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "eight", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, TRUE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "nine", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, TRUE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "ten", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, TRUE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "eleven", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, TRUE );
|
2014-09-23 18:33:25 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "twelve", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "thirteen", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_UNKNOWN, FALSE );
|
2014-04-23 14:49:34 +00:00
|
|
|
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "beta", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "gamma", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "theta", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "delta", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "epsilon", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "zeta", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "iota", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "eta", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "kappa", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "lambda", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "mu", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "nu", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "xi", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "omicron", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "pi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "rho", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "sigma", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "tau", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, TRUE );
|
|
|
|
test_component_states( __LINE__, hpkg, "phi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, TRUE );
|
|
|
|
test_component_states( __LINE__, hpkg, "chi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, TRUE );
|
|
|
|
test_component_states( __LINE__, hpkg, "psi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
2014-09-23 18:33:25 +00:00
|
|
|
test_component_states( __LINE__, hpkg, "upsilon", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
|
|
|
|
/* uninstall the product */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiInstallProductA(msifile2, "REMOVE=ALL");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
/* all features installed from source */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiInstallProductA(msifile3, "ADDSOURCE=ALL");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "five");
|
|
|
|
ok(state == INSTALLSTATE_UNKNOWN, "state = %d\n", state);
|
|
|
|
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "twelve");
|
|
|
|
ok(state == INSTALLSTATE_LOCAL, "state = %d\n", state);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenDatabaseW(msifile3W, MSIDBOPEN_DIRECT, &hdb);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
|
|
|
|
|
|
|
|
/* this property must not be in the saved msi file */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db( hdb, &hpkg );
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_UNKNOWN_FEATURE, 0, 0, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_UNKNOWN_COMPONENT, 0, 0, FALSE );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostInitialize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "cost init failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "FileCost");
|
2009-05-17 07:05:22 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostFinalize");
|
2009-05-17 07:05:22 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "two", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "three", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "four", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "five", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "six", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "seven", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "eight", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "nine", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "ten", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "eleven", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, TRUE );
|
2014-09-23 18:33:25 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "twelve", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "thirteen", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_UNKNOWN, FALSE );
|
2014-04-23 14:49:34 +00:00
|
|
|
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "beta", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "gamma", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "theta", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "delta", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "epsilon", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "zeta", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "iota", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "eta", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "kappa", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "lambda", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "mu", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "nu", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "xi", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "omicron", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "pi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "rho", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "sigma", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "tau", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "phi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "chi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "psi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
2018-01-20 11:30:30 +00:00
|
|
|
test_component_states( __LINE__, hpkg, "upsilon", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
2009-05-17 07:05:22 +00:00
|
|
|
|
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
|
|
|
|
/* reinstall the product */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiInstallProductA(msifile3, "REINSTALL=ALL");
|
2018-01-20 11:30:30 +00:00
|
|
|
is_broken = (r == ERROR_INSTALL_FAILURE);
|
|
|
|
ok(r == ERROR_SUCCESS || broken(is_broken) /* win2k3 */, "Expected ERROR_SUCCESS, got %d\n", r);
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "five");
|
|
|
|
ok(state == INSTALLSTATE_UNKNOWN, "state = %d\n", state);
|
|
|
|
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "twelve");
|
|
|
|
ok(state == INSTALLSTATE_LOCAL, "state = %d\n", state);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenDatabaseW(msifile4W, MSIDBOPEN_DIRECT, &hdb);
|
2009-05-17 07:05:22 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
|
|
|
|
|
|
|
|
/* this property must not be in the saved msi file */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_property_entry( hdb, "'ADDSOURCE', 'one,two,three,four,five,six,seven,eight,nine,ten'");
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db( hdb, &hpkg );
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_UNKNOWN_FEATURE, 0, 0, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_UNKNOWN_COMPONENT, 0, 0, FALSE );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostInitialize");
|
2009-05-17 07:05:22 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "cost init failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "FileCost");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostFinalize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "two", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "three", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "four", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "five", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "six", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "seven", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "eight", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "nine", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "ten", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "eleven", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, TRUE );
|
2014-09-23 18:33:25 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "twelve", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "thirteen", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_UNKNOWN, FALSE );
|
2014-04-23 14:49:34 +00:00
|
|
|
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "beta", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "gamma", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "theta", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "delta", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "epsilon", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "zeta", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "iota", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "eta", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "kappa", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "lambda", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "mu", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "nu", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "xi", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "omicron", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "pi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "rho", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "sigma", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "tau", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "phi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "chi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "psi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
2018-01-20 11:30:30 +00:00
|
|
|
test_component_states( __LINE__, hpkg, "upsilon", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
/* test source only install */
|
|
|
|
r = MsiInstallProductA(msifile, "REMOVE=ALL");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2018-01-20 11:30:30 +00:00
|
|
|
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "one");
|
|
|
|
ok(state == INSTALLSTATE_UNKNOWN, "state = %d\n", state);
|
|
|
|
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "two");
|
|
|
|
ok(state == INSTALLSTATE_UNKNOWN, "state = %d\n", state);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
r = MsiInstallProductA(msifile, "ADDSOURCE=one");
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "one");
|
|
|
|
ok(state == INSTALLSTATE_SOURCE, "state = %d\n", state);
|
|
|
|
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "two");
|
|
|
|
ok(state == INSTALLSTATE_ABSENT, "state = %d\n", state);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
/* no arguments test */
|
|
|
|
cache_file_name_len = sizeof(msi_cache_file);
|
|
|
|
r = MsiGetProductInfoA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}",
|
|
|
|
INSTALLPROPERTY_LOCALPACKAGEA, msi_cache_file, &cache_file_name_len);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
r = MsiOpenDatabaseA(msi_cache_file, (const char*)MSIDBOPEN_DIRECT, &hdb);
|
|
|
|
ok(r == ERROR_SUCCESS, "failed to open database: %d\n", r);
|
|
|
|
|
|
|
|
create_custom_action_table( hdb );
|
|
|
|
add_custom_action_entry( hdb, "'ConditionCheck1', 19, '', 'Condition check failed (1)'" );
|
|
|
|
add_custom_action_entry( hdb, "'ConditionCheck2', 19, '', 'Condition check failed (2)'" );
|
|
|
|
add_custom_action_entry( hdb, "'ConditionCheck3', 19, '', 'Condition check failed (3)'" );
|
|
|
|
add_custom_action_entry( hdb, "'ConditionCheck4', 19, '', 'Condition check failed (4)'" );
|
|
|
|
add_custom_action_entry( hdb, "'ConditionCheck5', 19, '', 'Condition check failed (5)'" );
|
|
|
|
add_custom_action_entry( hdb, "'ConditionCheck6', 19, '', 'Condition check failed (6)'" );
|
|
|
|
add_custom_action_entry( hdb, "'ConditionCheck7', 19, '', 'Condition check failed (7)'" );
|
|
|
|
add_custom_action_entry( hdb, "'ConditionCheck8', 19, '', 'Condition check failed (8)'" );
|
|
|
|
|
|
|
|
add_install_execute_sequence_entry( hdb, "'ConditionCheck1', 'REINSTALL', '798'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'ConditionCheck2', 'NOT REMOVE AND Preselected', '799'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'ConditionCheck3', 'REINSTALL', '6598'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'ConditionCheck4', 'NOT REMOVE AND Preselected', '6599'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'ConditionCheck5', 'REINSTALL', '6601'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'ConditionCheck6', 'NOT REMOVE AND Preselected', '6601'" );
|
|
|
|
/* Add "one" feature action tests */
|
|
|
|
add_install_execute_sequence_entry( hdb, "'ConditionCheck7', 'NOT REMOVE AND NOT(&one=-1)', '1501'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'ConditionCheck8', 'NOT REMOVE AND NOT(&one=-1)', '6602'" );
|
|
|
|
r = MsiDatabaseCommit(hdb);
|
|
|
|
ok(r == ERROR_SUCCESS, "MsiDatabaseCommit failed: %d\n", r);
|
|
|
|
r = package_from_db( hdb, &hpkg );
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
|
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
|
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_UNKNOWN_FEATURE, 0, 0, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "two", ERROR_UNKNOWN_FEATURE, 0, 0, FALSE );
|
|
|
|
r = MsiDoActionA( hpkg, "CostInitialize");
|
|
|
|
ok( r == ERROR_SUCCESS, "CostInitialize failed\n");
|
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "two", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
|
|
|
|
r = MsiDoActionA( hpkg, "FileCost");
|
|
|
|
ok( r == ERROR_SUCCESS, "FileCost failed\n");
|
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "two", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
|
|
|
|
r = MsiDoActionA( hpkg, "CostFinalize");
|
|
|
|
ok( r == ERROR_SUCCESS, "CostFinalize failed\n");
|
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "two", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "alpha", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "beta", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "gamma", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "theta", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "delta", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "epsilon", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "zeta", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "iota", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "eta", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "kappa", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "lambda", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "mu", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "nu", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "xi", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "omicron", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "pi", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "rho", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "sigma", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "tau", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "phi", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "chi", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "psi", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "upsilon", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
|
|
|
|
r = MsiDoActionA( hpkg, "InstallValidate");
|
|
|
|
ok( r == ERROR_SUCCESS, "InstallValidate failed %d\n", r);
|
|
|
|
test_feature_states( __LINE__, hpkg, "one", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "two", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
MsiCloseHandle( hpkg );
|
|
|
|
|
|
|
|
r = MsiInstallProductA(msifile, "");
|
|
|
|
ok(r == ERROR_SUCCESS || (is_broken && r == ERROR_INSTALL_FAILURE) /* win2k3 */,
|
|
|
|
"Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "one");
|
|
|
|
ok(state == INSTALLSTATE_SOURCE, "state = %d\n", state);
|
|
|
|
state = MsiQueryFeatureStateA("{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "two");
|
|
|
|
ok(state == INSTALLSTATE_ABSENT, "state = %d\n", state);
|
|
|
|
|
|
|
|
/* uninstall the product */
|
|
|
|
r = MsiInstallProductA(msifile4, "REMOVE=ALL");
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
DeleteFileA(msifile);
|
|
|
|
DeleteFileA(msifile2);
|
|
|
|
DeleteFileA(msifile3);
|
|
|
|
DeleteFileA(msifile4);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_getproperty(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hPackage = 0;
|
|
|
|
char prop[100];
|
|
|
|
static CHAR empty[] = "";
|
2008-12-28 10:25:32 +00:00
|
|
|
DWORD size;
|
|
|
|
UINT r;
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(create_package_db(), &hPackage);
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( r == ERROR_SUCCESS, "Failed to create package %u\n", r );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* set the property */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA(hPackage, "Name", "Value");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
/* retrieve the size, NULL pointer */
|
|
|
|
size = 0;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hPackage, "Name", NULL, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok( size == 5, "Expected 5, got %d\n", size);
|
|
|
|
|
|
|
|
/* retrieve the size, empty string */
|
|
|
|
size = 0;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hPackage, "Name", empty, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
|
|
|
|
ok( size == 5, "Expected 5, got %d\n", size);
|
|
|
|
|
|
|
|
/* don't change size */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hPackage, "Name", prop, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
|
|
|
|
ok( size == 5, "Expected 5, got %d\n", size);
|
2014-04-23 14:49:34 +00:00
|
|
|
ok( !lstrcmpA(prop, "Valu"), "Expected Valu, got %s\n", prop);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* increase the size by 1 */
|
|
|
|
size++;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hPackage, "Name", prop, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok( size == 5, "Expected 5, got %d\n", size);
|
2014-04-23 14:49:34 +00:00
|
|
|
ok( !lstrcmpA(prop, "Value"), "Expected Value, got %s\n", prop);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
r = MsiCloseHandle( hPackage);
|
|
|
|
ok( r == ERROR_SUCCESS , "Failed to close package\n" );
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2008-12-28 10:25:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_removefiles(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hpkg;
|
|
|
|
UINT r;
|
|
|
|
MSIHANDLE hdb;
|
2012-01-21 17:21:57 +00:00
|
|
|
INSTALLSTATE installed, action;
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok ( hdb, "failed to create package database\n" );
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'");
|
|
|
|
|
|
|
|
create_feature_table( hdb );
|
|
|
|
add_feature_entry( hdb, "'one', '', '', '', 2, 1, '', 0" );
|
|
|
|
|
|
|
|
create_component_table( hdb );
|
|
|
|
add_component_entry( hdb, "'hydrogen', '', 'TARGETDIR', 0, '', 'hydrogen_file'" );
|
|
|
|
add_component_entry( hdb, "'helium', '', 'TARGETDIR', 0, '', 'helium_file'" );
|
|
|
|
add_component_entry( hdb, "'lithium', '', 'TARGETDIR', 0, '', 'lithium_file'" );
|
|
|
|
add_component_entry( hdb, "'beryllium', '', 'TARGETDIR', 0, '', 'beryllium_file'" );
|
|
|
|
add_component_entry( hdb, "'boron', '', 'TARGETDIR', 0, '', 'boron_file'" );
|
|
|
|
add_component_entry( hdb, "'carbon', '', 'TARGETDIR', 0, '', 'carbon_file'" );
|
|
|
|
add_component_entry( hdb, "'oxygen', '', 'TARGETDIR', 0, '0', 'oxygen_file'" );
|
|
|
|
|
|
|
|
create_feature_components_table( hdb );
|
|
|
|
add_feature_components_entry( hdb, "'one', 'hydrogen'" );
|
|
|
|
add_feature_components_entry( hdb, "'one', 'helium'" );
|
|
|
|
add_feature_components_entry( hdb, "'one', 'lithium'" );
|
|
|
|
add_feature_components_entry( hdb, "'one', 'beryllium'" );
|
|
|
|
add_feature_components_entry( hdb, "'one', 'boron'" );
|
|
|
|
add_feature_components_entry( hdb, "'one', 'carbon'" );
|
|
|
|
add_feature_components_entry( hdb, "'one', 'oxygen'" );
|
|
|
|
|
|
|
|
create_file_table( hdb );
|
|
|
|
add_file_entry( hdb, "'hydrogen_file', 'hydrogen', 'hydrogen.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'helium_file', 'helium', 'helium.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'lithium_file', 'lithium', 'lithium.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'beryllium_file', 'beryllium', 'beryllium.txt', 0, '', '1033', 16384, 1" );
|
|
|
|
add_file_entry( hdb, "'boron_file', 'boron', 'boron.txt', 0, '', '1033', 16384, 1" );
|
|
|
|
add_file_entry( hdb, "'carbon_file', 'carbon', 'carbon.txt', 0, '', '1033', 16384, 1" );
|
|
|
|
add_file_entry( hdb, "'oxygen_file', 'oxygen', 'oxygen.txt', 0, '', '1033', 16384, 1" );
|
|
|
|
|
|
|
|
create_remove_file_table( hdb );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db( hdb, &hpkg );
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
MsiCloseHandle( hdb );
|
|
|
|
|
|
|
|
create_test_file( "hydrogen.txt" );
|
|
|
|
create_test_file( "helium.txt" );
|
|
|
|
create_test_file( "lithium.txt" );
|
|
|
|
create_test_file( "beryllium.txt" );
|
|
|
|
create_test_file( "boron.txt" );
|
|
|
|
create_test_file( "carbon.txt" );
|
2012-01-21 17:21:57 +00:00
|
|
|
create_test_file( "oxygen.txt" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA( hpkg, "TARGETDIR", CURR_DIR );
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "set property failed\n");
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetComponentStateA( hpkg, "oxygen", &installed, &action );
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_UNKNOWN_COMPONENT, "expected ERROR_UNKNOWN_COMPONENT, got %u\n", r );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostInitialize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "cost init failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "FileCost");
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
|
|
|
installed = action = 0xdeadbeef;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetComponentStateA( hpkg, "oxygen", &installed, &action );
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get component state %u\n", r );
|
|
|
|
ok( installed == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", installed );
|
|
|
|
ok( action == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", action );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostFinalize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "cost finalize failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "InstallValidate");
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "install validate failed\n");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetComponentStateA( hpkg, "hydrogen", INSTALLSTATE_ABSENT );
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
installed = action = 0xdeadbeef;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetComponentStateA( hpkg, "hydrogen", &installed, &action );
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get component state %u\n", r );
|
|
|
|
ok( installed == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", installed );
|
|
|
|
todo_wine ok( action == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", action );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetComponentStateA( hpkg, "helium", INSTALLSTATE_LOCAL );
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetComponentStateA( hpkg, "lithium", INSTALLSTATE_SOURCE );
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetComponentStateA( hpkg, "beryllium", INSTALLSTATE_ABSENT );
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetComponentStateA( hpkg, "boron", INSTALLSTATE_LOCAL );
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetComponentStateA( hpkg, "carbon", INSTALLSTATE_SOURCE );
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
installed = action = 0xdeadbeef;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetComponentStateA( hpkg, "oxygen", &installed, &action );
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get component state %u\n", r );
|
|
|
|
ok( installed == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", installed );
|
|
|
|
ok( action == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", action );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetComponentStateA( hpkg, "oxygen", INSTALLSTATE_ABSENT );
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
|
|
|
|
|
|
|
|
installed = action = 0xdeadbeef;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetComponentStateA( hpkg, "oxygen", &installed, &action );
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get component state %u\n", r );
|
|
|
|
ok( installed == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", installed );
|
|
|
|
ok( action == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", action );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "RemoveFiles");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "remove files failed\n");
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
installed = action = 0xdeadbeef;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetComponentStateA( hpkg, "oxygen", &installed, &action );
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get component state %u\n", r );
|
|
|
|
ok( installed == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", installed );
|
|
|
|
ok( action == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", action );
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
|
|
|
|
ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
|
|
|
|
ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
|
|
|
|
ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
|
|
|
|
ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
|
|
|
|
ok(DeleteFileA("boron.txt"), "Expected boron.txt to exist\n");
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(DeleteFileA("oxygen.txt"), "Expected oxygen.txt to exist\n");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
MsiCloseHandle( hpkg );
|
|
|
|
DeleteFileA(msifile);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_appsearch(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hpkg;
|
|
|
|
UINT r;
|
|
|
|
MSIHANDLE hdb;
|
|
|
|
CHAR prop[MAX_PATH];
|
2012-01-21 17:21:57 +00:00
|
|
|
DWORD size;
|
2014-09-23 18:33:25 +00:00
|
|
|
HKEY hkey;
|
|
|
|
const char reg_expand_value[] = "%systemroot%\\system32\\notepad.exe";
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok ( hdb, "failed to create package database\n" );
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_appsearch_table( hdb );
|
|
|
|
add_appsearch_entry( hdb, "'WEBBROWSERPROG', 'NewSignature1'" );
|
|
|
|
add_appsearch_entry( hdb, "'NOTEPAD', 'NewSignature2'" );
|
|
|
|
add_appsearch_entry( hdb, "'REGEXPANDVAL', 'NewSignature3'" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_reglocator_table( hdb );
|
|
|
|
add_reglocator_entry( hdb, "NewSignature1", 0, "htmlfile\\shell\\open\\command", "", 1 );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
r = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Winetest_msi", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL);
|
|
|
|
ok( r == ERROR_SUCCESS, "Could not create key: %d.\n", r );
|
|
|
|
r = RegSetValueExA(hkey, NULL, 0, REG_EXPAND_SZ, (const BYTE*)reg_expand_value, strlen(reg_expand_value) + 1);
|
|
|
|
ok( r == ERROR_SUCCESS, "Could not set key value: %d.\n", r);
|
|
|
|
RegCloseKey(hkey);
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry( hdb, "NewSignature3", 1, "Software\\Winetest_msi", "", 1 );
|
2014-09-23 18:33:25 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_drlocator_table( hdb );
|
|
|
|
add_drlocator_entry( hdb, "'NewSignature2', 0, 'c:\\windows\\system32', 0" );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_signature_table( hdb );
|
|
|
|
add_signature_entry( hdb, "'NewSignature1', 'FileName', '', '', '', '', '', '', ''" );
|
|
|
|
add_signature_entry( hdb, "'NewSignature2', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
|
|
|
|
add_signature_entry( hdb, "'NewSignature3', 'NOTEPAD.EXE|notepad.exe', '', '', '', '', '', '', ''" );
|
2014-09-23 18:33:25 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db( hdb, &hpkg );
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
|
2008-12-28 10:25:32 +00:00
|
|
|
MsiCloseHandle( hdb );
|
2012-01-21 17:21:57 +00:00
|
|
|
if (r != ERROR_SUCCESS)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "AppSearch" );
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r);
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
size = sizeof(prop);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA( hpkg, "WEBBROWSERPROG", prop, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
|
|
|
|
|
|
|
|
size = sizeof(prop);
|
|
|
|
r = MsiGetPropertyA( hpkg, "NOTEPAD", prop, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
size = sizeof(prop);
|
|
|
|
r = MsiGetPropertyA( hpkg, "REGEXPANDVAL", prop, &size );
|
|
|
|
ok( r == ERROR_SUCCESS, "get property failed: %d\n", r);
|
|
|
|
ok( lstrlenA(prop) != 0, "Expected non-zero length\n");
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
done:
|
2008-12-28 10:25:32 +00:00
|
|
|
MsiCloseHandle( hpkg );
|
|
|
|
DeleteFileA(msifile);
|
2014-09-23 18:33:25 +00:00
|
|
|
RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Winetest_msi");
|
2008-12-28 10:25:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_appsearch_complocator(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hpkg, hdb;
|
2014-09-23 18:33:25 +00:00
|
|
|
char path[MAX_PATH], expected[MAX_PATH], prop[MAX_PATH];
|
2008-12-28 10:25:32 +00:00
|
|
|
LPSTR usersid;
|
|
|
|
DWORD size;
|
|
|
|
UINT r;
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
if (!(usersid = get_user_sid()))
|
2008-12-28 10:25:32 +00:00
|
|
|
return;
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
if (is_process_limited())
|
|
|
|
{
|
|
|
|
skip("process is limited\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
create_test_file("FileName1");
|
|
|
|
create_test_file("FileName4");
|
|
|
|
set_component_path("FileName1", MSIINSTALLCONTEXT_MACHINE,
|
|
|
|
"{A8AE6692-96BA-4198-8399-145D7D1D0D0E}", NULL, FALSE);
|
|
|
|
|
|
|
|
create_test_file("FileName2");
|
|
|
|
set_component_path("FileName2", MSIINSTALLCONTEXT_USERUNMANAGED,
|
|
|
|
"{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}", usersid, FALSE);
|
|
|
|
|
|
|
|
create_test_file("FileName3");
|
|
|
|
set_component_path("FileName3", MSIINSTALLCONTEXT_USERMANAGED,
|
|
|
|
"{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}", usersid, FALSE);
|
|
|
|
|
|
|
|
create_test_file("FileName5");
|
|
|
|
set_component_path("FileName5", MSIINSTALLCONTEXT_MACHINE,
|
|
|
|
"{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}", NULL, TRUE);
|
|
|
|
|
|
|
|
create_test_file("FileName6");
|
|
|
|
set_component_path("FileName6", MSIINSTALLCONTEXT_MACHINE,
|
|
|
|
"{C0ECD96F-7898-4410-9667-194BD8C1B648}", NULL, TRUE);
|
|
|
|
|
|
|
|
create_test_file("FileName7");
|
|
|
|
set_component_path("FileName7", MSIINSTALLCONTEXT_MACHINE,
|
|
|
|
"{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}", NULL, FALSE);
|
|
|
|
|
|
|
|
/* dir is FALSE, but we're pretending it's a directory */
|
|
|
|
set_component_path("IDontExist\\", MSIINSTALLCONTEXT_MACHINE,
|
|
|
|
"{91B7359B-07F2-4221-AA8D-DE102BB87A5F}", NULL, FALSE);
|
|
|
|
|
|
|
|
create_file_with_version("FileName8.dll", MAKELONG(2, 1), MAKELONG(4, 3));
|
|
|
|
set_component_path("FileName8.dll", MSIINSTALLCONTEXT_MACHINE,
|
|
|
|
"{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}", NULL, FALSE);
|
|
|
|
|
|
|
|
create_file_with_version("FileName9.dll", MAKELONG(1, 2), MAKELONG(3, 4));
|
|
|
|
set_component_path("FileName9.dll", MSIINSTALLCONTEXT_MACHINE,
|
|
|
|
"{A204DF48-7346-4635-BA2E-66247DBAC9DF}", NULL, FALSE);
|
|
|
|
|
|
|
|
create_file_with_version("FileName10.dll", MAKELONG(2, 1), MAKELONG(4, 3));
|
|
|
|
set_component_path("FileName10.dll", MSIINSTALLCONTEXT_MACHINE,
|
|
|
|
"{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}", NULL, FALSE);
|
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok(hdb, "Expected a valid database handle\n");
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_appsearch_table(hdb);
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
|
|
|
|
|
|
|
|
create_complocator_table(hdb);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* published component, machine, file, signature, misdbLocatorTypeFile */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_complocator_entry(hdb, "'NewSignature1', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 1");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* published component, user-unmanaged, file, signature, misdbLocatorTypeFile */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_complocator_entry(hdb, "'NewSignature2', '{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}', 1");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* published component, user-managed, file, signature, misdbLocatorTypeFile */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_complocator_entry(hdb, "'NewSignature3', '{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}', 1");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* published component, machine, file, signature, misdbLocatorTypeDirectory */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_complocator_entry(hdb, "'NewSignature4', '{A8AE6692-96BA-4198-8399-145D7D1D0D0E}', 0");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* published component, machine, dir, signature, misdbLocatorTypeDirectory */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_complocator_entry(hdb, "'NewSignature5', '{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}', 0");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* published component, machine, dir, no signature, misdbLocatorTypeDirectory */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_complocator_entry(hdb, "'NewSignature6', '{C0ECD96F-7898-4410-9667-194BD8C1B648}', 0");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* published component, machine, file, no signature, misdbLocatorTypeFile */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_complocator_entry(hdb, "'NewSignature7', '{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}', 1");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* unpublished component, no signature, misdbLocatorTypeDir */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_complocator_entry(hdb, "'NewSignature8', '{FB671D5B-5083-4048-90E0-481C48D8F3A5}', 0");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* published component, no signature, dir does not exist misdbLocatorTypeDir */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_complocator_entry(hdb, "'NewSignature9', '{91B7359B-07F2-4221-AA8D-DE102BB87A5F}', 0");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* published component, signature w/ ver, misdbLocatorTypeFile */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_complocator_entry(hdb, "'NewSignature10', '{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}', 1");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* published component, signature w/ ver, ver > max, misdbLocatorTypeFile */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_complocator_entry(hdb, "'NewSignature11', '{A204DF48-7346-4635-BA2E-66247DBAC9DF}', 1");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* published component, signature w/ ver, sig->name ignored, misdbLocatorTypeFile */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_complocator_entry(hdb, "'NewSignature12', '{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}', 1");
|
|
|
|
|
|
|
|
create_signature_table(hdb);
|
|
|
|
add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature2', 'FileName2', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature3', 'FileName3', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature4', 'FileName4', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature5', 'FileName5', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature10', 'FileName8.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature11', 'FileName9.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(hdb, &hpkg);
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
r = MsiSetPropertyA(hpkg, "SIGPROP8", "october");
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "AppSearch");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
strcpy(expected, CURR_DIR);
|
|
|
|
if (is_root(CURR_DIR)) expected[2] = 0;
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName1", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName2", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName3", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName4", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName5", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, "october"), "Expected \"october\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName8.dll", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName10.dll", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
delete_component_path("{A8AE6692-96BA-4198-8399-145D7D1D0D0E}",
|
|
|
|
MSIINSTALLCONTEXT_MACHINE, NULL);
|
|
|
|
delete_component_path("{1D2CE6F3-E81C-4949-AB81-78D7DAD2AF2E}",
|
|
|
|
MSIINSTALLCONTEXT_USERUNMANAGED, usersid);
|
|
|
|
delete_component_path("{19E0B999-85F5-4973-A61B-DBE4D66ECB1D}",
|
|
|
|
MSIINSTALLCONTEXT_USERMANAGED, usersid);
|
|
|
|
delete_component_path("{F0CCA976-27A3-4808-9DDD-1A6FD50A0D5A}",
|
|
|
|
MSIINSTALLCONTEXT_MACHINE, NULL);
|
|
|
|
delete_component_path("{C0ECD96F-7898-4410-9667-194BD8C1B648}",
|
|
|
|
MSIINSTALLCONTEXT_MACHINE, NULL);
|
|
|
|
delete_component_path("{DB20F535-9C26-4127-9C2B-CC45A8B51DA1}",
|
|
|
|
MSIINSTALLCONTEXT_MACHINE, NULL);
|
|
|
|
delete_component_path("{91B7359B-07F2-4221-AA8D-DE102BB87A5F}",
|
|
|
|
MSIINSTALLCONTEXT_MACHINE, NULL);
|
|
|
|
delete_component_path("{4A2E1B5B-4034-4177-833B-8CC35F1B3EF1}",
|
|
|
|
MSIINSTALLCONTEXT_MACHINE, NULL);
|
|
|
|
delete_component_path("{A204DF48-7346-4635-BA2E-66247DBAC9DF}",
|
|
|
|
MSIINSTALLCONTEXT_MACHINE, NULL);
|
|
|
|
delete_component_path("{EC30CE73-4CF9-4908-BABD-1ED82E1515FD}",
|
|
|
|
MSIINSTALLCONTEXT_MACHINE, NULL);
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
|
|
|
|
error:
|
2008-12-28 10:25:32 +00:00
|
|
|
DeleteFileA("FileName1");
|
|
|
|
DeleteFileA("FileName2");
|
|
|
|
DeleteFileA("FileName3");
|
|
|
|
DeleteFileA("FileName4");
|
|
|
|
DeleteFileA("FileName5");
|
|
|
|
DeleteFileA("FileName6");
|
|
|
|
DeleteFileA("FileName7");
|
|
|
|
DeleteFileA("FileName8.dll");
|
|
|
|
DeleteFileA("FileName9.dll");
|
|
|
|
DeleteFileA("FileName10.dll");
|
|
|
|
DeleteFileA(msifile);
|
2009-10-25 11:06:38 +00:00
|
|
|
LocalFree(usersid);
|
2008-12-28 10:25:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_appsearch_reglocator(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hpkg, hdb;
|
2014-09-23 18:33:25 +00:00
|
|
|
char path[MAX_PATH], expected[MAX_PATH], prop[MAX_PATH];
|
2012-01-21 17:21:57 +00:00
|
|
|
DWORD binary[2], size, val;
|
|
|
|
BOOL space, version, is_64bit = sizeof(void *) > sizeof(int);
|
|
|
|
HKEY hklm, classes, hkcu, users;
|
|
|
|
LPSTR pathdata, pathvar, ptr;
|
2008-12-28 10:25:32 +00:00
|
|
|
LONG res;
|
2012-01-21 17:21:57 +00:00
|
|
|
UINT r, type = 0;
|
|
|
|
SYSTEM_INFO si;
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
version = TRUE;
|
|
|
|
if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
|
|
|
|
version = FALSE;
|
|
|
|
|
|
|
|
DeleteFileA("test.dll");
|
|
|
|
|
|
|
|
res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes);
|
2012-01-21 17:21:57 +00:00
|
|
|
if (res == ERROR_ACCESS_DENIED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
|
|
|
return;
|
|
|
|
}
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
res = RegSetValueExA(classes, "Value1", 0, REG_SZ,
|
|
|
|
(const BYTE *)"regszdata", 10);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
res = RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine", &hkcu);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
res = RegSetValueExA(hkcu, "Value1", 0, REG_SZ,
|
|
|
|
(const BYTE *)"regszdata", 10);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
users = 0;
|
|
|
|
res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
|
|
|
|
ok(res == ERROR_SUCCESS ||
|
|
|
|
broken(res == ERROR_INVALID_PARAMETER),
|
|
|
|
"Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
if (res == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
res = RegSetValueExA(users, "Value1", 0, REG_SZ,
|
|
|
|
(const BYTE *)"regszdata", 10);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
}
|
|
|
|
|
|
|
|
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine", &hklm);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
res = RegSetValueA(hklm, NULL, REG_SZ, "defvalue", 8);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
res = RegSetValueExA(hklm, "Value1", 0, REG_SZ,
|
|
|
|
(const BYTE *)"regszdata", 10);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
val = 42;
|
|
|
|
res = RegSetValueExA(hklm, "Value2", 0, REG_DWORD,
|
|
|
|
(const BYTE *)&val, sizeof(DWORD));
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
val = -42;
|
|
|
|
res = RegSetValueExA(hklm, "Value3", 0, REG_DWORD,
|
|
|
|
(const BYTE *)&val, sizeof(DWORD));
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
res = RegSetValueExA(hklm, "Value4", 0, REG_EXPAND_SZ,
|
|
|
|
(const BYTE *)"%PATH%", 7);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
res = RegSetValueExA(hklm, "Value5", 0, REG_EXPAND_SZ,
|
|
|
|
(const BYTE *)"my%NOVAR%", 10);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
res = RegSetValueExA(hklm, "Value6", 0, REG_MULTI_SZ,
|
|
|
|
(const BYTE *)"one\0two\0", 9);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
binary[0] = 0x1234abcd;
|
|
|
|
binary[1] = 0x567890ef;
|
|
|
|
res = RegSetValueExA(hklm, "Value7", 0, REG_BINARY,
|
|
|
|
(const BYTE *)binary, sizeof(binary));
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
res = RegSetValueExA(hklm, "Value8", 0, REG_SZ,
|
|
|
|
(const BYTE *)"#regszdata", 11);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
strcpy(expected, CURR_DIR);
|
|
|
|
if (is_root(CURR_DIR)) expected[2] = 0;
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
create_test_file("FileName1");
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName1", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
res = RegSetValueExA(hklm, "Value9", 0, REG_SZ,
|
|
|
|
(const BYTE *)path, lstrlenA(path) + 1);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName2", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
res = RegSetValueExA(hklm, "Value10", 0, REG_SZ,
|
|
|
|
(const BYTE *)path, lstrlenA(path) + 1);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
lstrcpyA(path, expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
res = RegSetValueExA(hklm, "Value11", 0, REG_SZ,
|
|
|
|
(const BYTE *)path, lstrlenA(path) + 1);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
res = RegSetValueExA(hklm, "Value12", 0, REG_SZ,
|
|
|
|
(const BYTE *)"", 1);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName3.dll", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
res = RegSetValueExA(hklm, "Value13", 0, REG_SZ,
|
|
|
|
(const BYTE *)path, lstrlenA(path) + 1);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName4.dll", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
res = RegSetValueExA(hklm, "Value14", 0, REG_SZ,
|
|
|
|
(const BYTE *)path, lstrlenA(path) + 1);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
|
|
|
create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName5.dll", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
res = RegSetValueExA(hklm, "Value15", 0, REG_SZ,
|
|
|
|
(const BYTE *)path, lstrlenA(path) + 1);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "\"%s\\FileName1\" -option", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
res = RegSetValueExA(hklm, "value16", 0, REG_SZ,
|
|
|
|
(const BYTE *)path, lstrlenA(path) + 1);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( res == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", res);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
space = strchr(expected, ' ') != NULL;
|
|
|
|
sprintf(path, "%s\\FileName1 -option", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
res = RegSetValueExA(hklm, "value17", 0, REG_SZ,
|
|
|
|
(const BYTE *)path, lstrlenA(path) + 1);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( res == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", res);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok(hdb, "Expected a valid database handle\n");
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_appsearch_table(hdb);
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP14', 'NewSignature14'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP15', 'NewSignature15'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP16', 'NewSignature16'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP17', 'NewSignature17'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP18', 'NewSignature18'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP19', 'NewSignature19'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP20', 'NewSignature20'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP21', 'NewSignature21'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP22', 'NewSignature22'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP23', 'NewSignature23'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP24', 'NewSignature24'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP25', 'NewSignature25'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP26', 'NewSignature26'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP27', 'NewSignature27'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP28', 'NewSignature28'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP29', 'NewSignature29'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP30', 'NewSignature30'");
|
|
|
|
|
|
|
|
create_reglocator_table(hdb);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
type = msidbLocatorTypeRawValue;
|
|
|
|
if (is_64bit)
|
|
|
|
type |= msidbLocatorType64bit;
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* HKLM, msidbLocatorTypeRawValue, REG_SZ */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature1", 2, "Software\\Wine", "Value1", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeRawValue, positive DWORD */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature2", 2, "Software\\Wine", "Value2", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeRawValue, negative DWORD */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature3", 2, "Software\\Wine", "Value3", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature4", 2, "Software\\Wine", "Value4", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeRawValue, REG_EXPAND_SZ */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature5", 2, "Software\\Wine", "Value5", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeRawValue, REG_MULTI_SZ */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature6", 2, "Software\\Wine", "Value6", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeRawValue, REG_BINARY */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature7", 2, "Software\\Wine", "Value7", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeRawValue, REG_SZ first char is # */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature8", 2, "Software\\Wine", "Value8", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
type = msidbLocatorTypeFileName;
|
|
|
|
if (is_64bit)
|
|
|
|
type |= msidbLocatorType64bit;
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* HKLM, msidbLocatorTypeFileName, signature, file exists */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature9", 2, "Software\\Wine", "Value9", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeFileName, signature, file does not exist */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature10", 2, "Software\\Wine", "Value10", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeFileName, no signature */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature11", 2, "Software\\Wine", "Value9", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
type = msidbLocatorTypeDirectory;
|
|
|
|
if (is_64bit)
|
|
|
|
type |= msidbLocatorType64bit;
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* HKLM, msidbLocatorTypeDirectory, no signature, file exists */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature12", 2, "Software\\Wine", "Value9", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeDirectory, no signature, directory exists */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature13", 2, "Software\\Wine", "Value11", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeDirectory, signature, file exists */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature14", 2, "Software\\Wine", "Value9", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
type = msidbLocatorTypeRawValue;
|
|
|
|
if (is_64bit)
|
|
|
|
type |= msidbLocatorType64bit;
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* HKCR, msidbLocatorTypeRawValue, REG_SZ */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature15", 0, "Software\\Wine", "Value1", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKCU, msidbLocatorTypeRawValue, REG_SZ */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature16", 1, "Software\\Wine", "Value1", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKU, msidbLocatorTypeRawValue, REG_SZ */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature17", 3, "S-1-5-18\\Software\\Wine", "Value1", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeRawValue, REG_SZ, NULL Name */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature18", 2, "Software\\Wine", "", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeRawValue, REG_SZ, key does not exist */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature19", 2, "Software\\IDontExist", "", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeRawValue, REG_SZ, value is empty */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature20", 2, "Software\\Wine", "Value12", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
type = msidbLocatorTypeFileName;
|
|
|
|
if (is_64bit)
|
|
|
|
type |= msidbLocatorType64bit;
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* HKLM, msidbLocatorTypeFileName, signature, file exists w/ version */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature21", 2, "Software\\Wine", "Value13", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeFileName, file exists w/ version, version > max */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature22", 2, "Software\\Wine", "Value14", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeFileName, file exists w/ version, sig->name ignored */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature23", 2, "Software\\Wine", "Value15", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeFileName, no signature, directory exists */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature24", 2, "Software\\Wine", "Value11", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeFileName, no signature, file does not exist */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature25", 2, "Software\\Wine", "Value10", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
type = msidbLocatorTypeDirectory;
|
|
|
|
if (is_64bit)
|
|
|
|
type |= msidbLocatorType64bit;
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* HKLM, msidbLocatorTypeDirectory, signature, directory exists */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature26", 2, "Software\\Wine", "Value11", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeDirectory, signature, file does not exist */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature27", 2, "Software\\Wine", "Value10", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeDirectory, no signature, file does not exist */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature28", 2, "Software\\Wine", "Value10", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
type = msidbLocatorTypeFileName;
|
|
|
|
if (is_64bit)
|
|
|
|
type |= msidbLocatorType64bit;
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* HKLM, msidbLocatorTypeFile, file exists, in quotes */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature29", 2, "Software\\Wine", "Value16", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* HKLM, msidbLocatorTypeFile, file exists, no quotes */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature30", 2, "Software\\Wine", "Value17", type);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_signature_table(hdb);
|
|
|
|
add_signature_entry(hdb, "'NewSignature9', 'FileName1', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature10', 'FileName2', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature14', 'FileName1', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature21', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature22', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature23', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
if (!is_root(CURR_DIR))
|
|
|
|
{
|
|
|
|
ptr = strrchr(expected, '\\') + 1;
|
|
|
|
sprintf(path, "'NewSignature26', '%s', '', '', '', '', '', '', ''", ptr);
|
2018-01-20 11:30:30 +00:00
|
|
|
add_signature_entry(hdb, path);
|
2014-09-23 18:33:25 +00:00
|
|
|
}
|
2018-01-20 11:30:30 +00:00
|
|
|
add_signature_entry(hdb, "'NewSignature27', 'FileName2', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature29', 'FileName1', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature30', 'FileName1', '', '', '', '', '', '', ''");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(hdb, &hpkg);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
|
|
|
|
|
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "AppSearch");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, "regszdata"),
|
|
|
|
"Expected \"regszdata\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, "#42"), "Expected \"#42\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, "#-42"), "Expected \"#-42\", got \"%s\"\n", prop);
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
memset(&si, 0, sizeof(si));
|
|
|
|
if (pGetNativeSystemInfo) pGetNativeSystemInfo(&si);
|
|
|
|
|
|
|
|
if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
|
2009-05-17 07:05:22 +00:00
|
|
|
{
|
2012-01-21 17:21:57 +00:00
|
|
|
size = ExpandEnvironmentStringsA("%PATH%", NULL, 0);
|
|
|
|
pathvar = HeapAlloc(GetProcessHeap(), 0, size);
|
|
|
|
ExpandEnvironmentStringsA("%PATH%", pathvar, size);
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
size = 0;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP4", NULL, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
pathdata = HeapAlloc(GetProcessHeap(), 0, ++size);
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP4", pathdata, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(pathdata, pathvar),
|
|
|
|
"Expected \"%s\", got \"%s\"\n", pathvar, pathdata);
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, pathvar);
|
|
|
|
HeapFree(GetProcessHeap(), 0, pathdata);
|
|
|
|
}
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop,
|
|
|
|
"my%NOVAR%"), "Expected \"my%%NOVAR%%\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(!memcmp(prop, "\0one\0two\0\0", 10),
|
|
|
|
"Expected \"\\0one\\0two\\0\\0\"\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "#xCDAB3412EF907856");
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, "##regszdata"),
|
|
|
|
"Expected \"##regszdata\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName1", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP14", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP15", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, "regszdata"),
|
|
|
|
"Expected \"regszdata\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP16", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, "regszdata"),
|
|
|
|
"Expected \"regszdata\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
if (users)
|
|
|
|
{
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP17", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, "regszdata"),
|
|
|
|
"Expected \"regszdata\", got \"%s\"\n", prop);
|
|
|
|
}
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP18", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, "defvalue"),
|
|
|
|
"Expected \"defvalue\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP19", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP20", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
if (version)
|
|
|
|
{
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName3.dll", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP21", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP22", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName5.dll", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP23", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
}
|
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
if (!is_root(CURR_DIR))
|
|
|
|
{
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, expected);
|
|
|
|
ptr = strrchr(path, '\\') + 1;
|
|
|
|
*ptr = '\0';
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP24", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
}
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP25", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP26", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2014-09-23 18:33:25 +00:00
|
|
|
if (is_root(CURR_DIR))
|
|
|
|
ok(!lstrcmpA(prop, CURR_DIR), "Expected \"%s\", got \"%s\"\n", CURR_DIR, prop);
|
|
|
|
else
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP27", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP28", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName1", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP29", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName1", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP30", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
if (space)
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
else
|
|
|
|
todo_wine ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
RegSetValueA(hklm, NULL, REG_SZ, "", 0);
|
|
|
|
RegDeleteValueA(hklm, "Value1");
|
|
|
|
RegDeleteValueA(hklm, "Value2");
|
|
|
|
RegDeleteValueA(hklm, "Value3");
|
|
|
|
RegDeleteValueA(hklm, "Value4");
|
|
|
|
RegDeleteValueA(hklm, "Value5");
|
|
|
|
RegDeleteValueA(hklm, "Value6");
|
|
|
|
RegDeleteValueA(hklm, "Value7");
|
|
|
|
RegDeleteValueA(hklm, "Value8");
|
|
|
|
RegDeleteValueA(hklm, "Value9");
|
|
|
|
RegDeleteValueA(hklm, "Value10");
|
|
|
|
RegDeleteValueA(hklm, "Value11");
|
|
|
|
RegDeleteValueA(hklm, "Value12");
|
|
|
|
RegDeleteValueA(hklm, "Value13");
|
|
|
|
RegDeleteValueA(hklm, "Value14");
|
|
|
|
RegDeleteValueA(hklm, "Value15");
|
|
|
|
RegDeleteValueA(hklm, "Value16");
|
|
|
|
RegDeleteValueA(hklm, "Value17");
|
2014-04-23 14:49:34 +00:00
|
|
|
RegDeleteKeyA(hklm, "");
|
2008-12-28 10:25:32 +00:00
|
|
|
RegCloseKey(hklm);
|
|
|
|
|
|
|
|
RegDeleteValueA(classes, "Value1");
|
|
|
|
RegDeleteKeyA(classes, "");
|
|
|
|
RegCloseKey(classes);
|
|
|
|
|
|
|
|
RegDeleteValueA(hkcu, "Value1");
|
|
|
|
RegDeleteKeyA(hkcu, "");
|
|
|
|
RegCloseKey(hkcu);
|
|
|
|
|
|
|
|
RegDeleteValueA(users, "Value1");
|
|
|
|
RegDeleteKeyA(users, "");
|
|
|
|
RegCloseKey(users);
|
|
|
|
|
|
|
|
DeleteFileA("FileName1");
|
|
|
|
DeleteFileA("FileName3.dll");
|
|
|
|
DeleteFileA("FileName4.dll");
|
|
|
|
DeleteFileA("FileName5.dll");
|
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
DeleteFileA(msifile);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void delete_win_ini(LPCSTR file)
|
|
|
|
{
|
|
|
|
CHAR path[MAX_PATH];
|
|
|
|
|
|
|
|
GetWindowsDirectoryA(path, MAX_PATH);
|
|
|
|
lstrcatA(path, "\\");
|
|
|
|
lstrcatA(path, file);
|
|
|
|
|
|
|
|
DeleteFileA(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_appsearch_inilocator(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hpkg, hdb;
|
2014-09-23 18:33:25 +00:00
|
|
|
char path[MAX_PATH], expected[MAX_PATH], prop[MAX_PATH];
|
2008-12-28 10:25:32 +00:00
|
|
|
BOOL version;
|
|
|
|
LPSTR ptr;
|
|
|
|
DWORD size;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
version = TRUE;
|
|
|
|
if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
|
|
|
|
version = FALSE;
|
|
|
|
|
|
|
|
DeleteFileA("test.dll");
|
|
|
|
|
|
|
|
WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
|
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
strcpy(expected, CURR_DIR);
|
|
|
|
if (is_root(CURR_DIR)) expected[2] = 0;
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
create_test_file("FileName1");
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName1", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
WritePrivateProfileStringA("Section", "Key2", path, "IniFile.ini");
|
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
WritePrivateProfileStringA("Section", "Key3", expected, "IniFile.ini");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\IDontExist", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
WritePrivateProfileStringA("Section", "Key4", path, "IniFile.ini");
|
|
|
|
|
|
|
|
create_file_with_version("FileName2.dll", MAKELONG(2, 1), MAKELONG(4, 3));
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName2.dll", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
WritePrivateProfileStringA("Section", "Key5", path, "IniFile.ini");
|
|
|
|
|
|
|
|
create_file_with_version("FileName3.dll", MAKELONG(1, 2), MAKELONG(3, 4));
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName3.dll", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
WritePrivateProfileStringA("Section", "Key6", path, "IniFile.ini");
|
|
|
|
|
|
|
|
create_file_with_version("FileName4.dll", MAKELONG(2, 1), MAKELONG(4, 3));
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName4.dll", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
WritePrivateProfileStringA("Section", "Key7", path, "IniFile.ini");
|
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok(hdb, "Expected a valid database handle\n");
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_appsearch_table(hdb);
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP12', 'NewSignature12'");
|
|
|
|
|
|
|
|
create_inilocator_table(hdb);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbLocatorTypeRawValue, field 1 */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_inilocator_entry(hdb, "'NewSignature1', 'IniFile.ini', 'Section', 'Key', 1, 2");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbLocatorTypeRawValue, field 2 */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_inilocator_entry(hdb, "'NewSignature2', 'IniFile.ini', 'Section', 'Key', 2, 2");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbLocatorTypeRawValue, entire field */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_inilocator_entry(hdb, "'NewSignature3', 'IniFile.ini', 'Section', 'Key', 0, 2");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbLocatorTypeFile */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_inilocator_entry(hdb, "'NewSignature4', 'IniFile.ini', 'Section', 'Key2', 1, 1");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbLocatorTypeDirectory, file */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_inilocator_entry(hdb, "'NewSignature5', 'IniFile.ini', 'Section', 'Key2', 1, 0");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbLocatorTypeDirectory, directory */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_inilocator_entry(hdb, "'NewSignature6', 'IniFile.ini', 'Section', 'Key3', 1, 0");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbLocatorTypeFile, file, no signature */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_inilocator_entry(hdb, "'NewSignature7', 'IniFile.ini', 'Section', 'Key2', 1, 1");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbLocatorTypeFile, dir, no signature */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_inilocator_entry(hdb, "'NewSignature8', 'IniFile.ini', 'Section', 'Key3', 1, 1");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbLocatorTypeFile, file does not exist */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_inilocator_entry(hdb, "'NewSignature9', 'IniFile.ini', 'Section', 'Key4', 1, 1");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbLocatorTypeFile, signature with version */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_inilocator_entry(hdb, "'NewSignature10', 'IniFile.ini', 'Section', 'Key5', 1, 1");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbLocatorTypeFile, signature with version, ver > max */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_inilocator_entry(hdb, "'NewSignature11', 'IniFile.ini', 'Section', 'Key6', 1, 1");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbLocatorTypeFile, signature with version, sig->name ignored */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_inilocator_entry(hdb, "'NewSignature12', 'IniFile.ini', 'Section', 'Key7', 1, 1");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_signature_table(hdb);
|
|
|
|
add_signature_entry(hdb, "'NewSignature4', 'FileName1', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature9', 'IDontExist', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature10', 'FileName2.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature11', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature12', 'ignored', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(hdb, &hpkg);
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
|
|
|
|
|
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "AppSearch");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, "keydata"), "Expected \"keydata\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, "field2"), "Expected \"field2\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, "keydata,field2"),
|
|
|
|
"Expected \"keydata,field2\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName1", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
if (!is_root(CURR_DIR))
|
|
|
|
{
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, expected);
|
|
|
|
ptr = strrchr(path, '\\');
|
|
|
|
*(ptr + 1) = 0;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
}
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
if (version)
|
|
|
|
{
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName2.dll", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName4.dll", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
}
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
|
|
|
|
error:
|
2008-12-28 10:25:32 +00:00
|
|
|
delete_win_ini("IniFile.ini");
|
|
|
|
DeleteFileA("FileName1");
|
|
|
|
DeleteFileA("FileName2.dll");
|
|
|
|
DeleteFileA("FileName3.dll");
|
|
|
|
DeleteFileA("FileName4.dll");
|
|
|
|
DeleteFileA(msifile);
|
|
|
|
}
|
|
|
|
|
2009-05-17 07:05:22 +00:00
|
|
|
/*
|
|
|
|
* MSI AppSearch action on DrLocator table always returns absolute paths.
|
|
|
|
* If a relative path was set, it returns the first absolute path that
|
|
|
|
* matches or an empty string if it didn't find anything.
|
|
|
|
* This helper function replicates this behaviour.
|
|
|
|
*/
|
|
|
|
static void search_absolute_directory(LPSTR absolute, LPCSTR relative)
|
|
|
|
{
|
|
|
|
int i, size;
|
|
|
|
DWORD attr, drives;
|
|
|
|
|
|
|
|
size = lstrlenA(relative);
|
|
|
|
drives = GetLogicalDrives();
|
|
|
|
lstrcpyA(absolute, "A:\\");
|
|
|
|
for (i = 0; i < 26; absolute[0] = '\0', i++)
|
|
|
|
{
|
|
|
|
if (!(drives & (1 << i)))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
absolute[0] = 'A' + i;
|
2014-04-23 14:49:34 +00:00
|
|
|
if (GetDriveTypeA(absolute) != DRIVE_FIXED)
|
2009-05-17 07:05:22 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
lstrcpynA(absolute + 3, relative, size + 1);
|
|
|
|
attr = GetFileAttributesA(absolute);
|
|
|
|
if (attr != INVALID_FILE_ATTRIBUTES &&
|
|
|
|
(attr & FILE_ATTRIBUTE_DIRECTORY))
|
|
|
|
{
|
|
|
|
if (absolute[3 + size - 1] != '\\')
|
|
|
|
lstrcatA(absolute, "\\");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
absolute[3] = '\0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
static void test_appsearch_drlocator(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hpkg, hdb;
|
2014-09-23 18:33:25 +00:00
|
|
|
char path[MAX_PATH], expected[MAX_PATH], prop[MAX_PATH];
|
2008-12-28 10:25:32 +00:00
|
|
|
BOOL version;
|
|
|
|
DWORD size;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
version = TRUE;
|
|
|
|
if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
|
|
|
|
version = FALSE;
|
|
|
|
|
|
|
|
DeleteFileA("test.dll");
|
|
|
|
|
|
|
|
create_test_file("FileName1");
|
|
|
|
CreateDirectoryA("one", NULL);
|
|
|
|
CreateDirectoryA("one\\two", NULL);
|
|
|
|
CreateDirectoryA("one\\two\\three", NULL);
|
|
|
|
create_test_file("one\\two\\three\\FileName2");
|
|
|
|
CreateDirectoryA("another", NULL);
|
|
|
|
create_file_with_version("FileName3.dll", MAKELONG(2, 1), MAKELONG(4, 3));
|
|
|
|
create_file_with_version("FileName4.dll", MAKELONG(1, 2), MAKELONG(3, 4));
|
|
|
|
create_file_with_version("FileName5.dll", MAKELONG(2, 1), MAKELONG(4, 3));
|
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok(hdb, "Expected a valid database handle\n");
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_appsearch_table(hdb);
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP1', 'NewSignature1'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP2', 'NewSignature2'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP3', 'NewSignature3'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP4', 'NewSignature4'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP5', 'NewSignature5'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP6', 'NewSignature6'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP7', 'NewSignature7'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP8', 'NewSignature8'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP9', 'NewSignature9'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP10', 'NewSignature10'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP11', 'NewSignature11'");
|
|
|
|
add_appsearch_entry(hdb, "'SIGPROP13', 'NewSignature13'");
|
|
|
|
|
|
|
|
create_drlocator_table(hdb);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
strcpy(expected, CURR_DIR);
|
|
|
|
if (is_root(CURR_DIR)) expected[2] = 0;
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* no parent, full path, depth 0, signature */
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "'NewSignature1', '', '%s', 0", expected);
|
2018-01-20 11:30:30 +00:00
|
|
|
add_drlocator_entry(hdb, path);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* no parent, full path, depth 0, no signature */
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "'NewSignature2', '', '%s', 0", expected);
|
2018-01-20 11:30:30 +00:00
|
|
|
add_drlocator_entry(hdb, path);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* no parent, relative path, depth 0, no signature */
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "'NewSignature3', '', '%s', 0", expected + 3);
|
2018-01-20 11:30:30 +00:00
|
|
|
add_drlocator_entry(hdb, path);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* no parent, full path, depth 2, signature */
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "'NewSignature4', '', '%s', 2", expected);
|
2018-01-20 11:30:30 +00:00
|
|
|
add_drlocator_entry(hdb, path);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* no parent, full path, depth 3, signature */
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "'NewSignature5', '', '%s', 3", expected);
|
2018-01-20 11:30:30 +00:00
|
|
|
add_drlocator_entry(hdb, path);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* no parent, full path, depth 1, signature is dir */
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "'NewSignature6', '', '%s', 1", expected);
|
2018-01-20 11:30:30 +00:00
|
|
|
add_drlocator_entry(hdb, path);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* parent is in DrLocator, relative path, depth 0, signature */
|
|
|
|
sprintf(path, "'NewSignature7', 'NewSignature1', 'one\\two\\three', 1");
|
2018-01-20 11:30:30 +00:00
|
|
|
add_drlocator_entry(hdb, path);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* no parent, full path, depth 0, signature w/ version */
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "'NewSignature8', '', '%s', 0", expected);
|
2018-01-20 11:30:30 +00:00
|
|
|
add_drlocator_entry(hdb, path);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* no parent, full path, depth 0, signature w/ version, ver > max */
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "'NewSignature9', '', '%s', 0", expected);
|
2018-01-20 11:30:30 +00:00
|
|
|
add_drlocator_entry(hdb, path);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* no parent, full path, depth 0, signature w/ version, sig->name not ignored */
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "'NewSignature10', '', '%s', 0", expected);
|
2018-01-20 11:30:30 +00:00
|
|
|
add_drlocator_entry(hdb, path);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2009-05-17 07:05:22 +00:00
|
|
|
/* no parent, relative empty path, depth 0, no signature */
|
|
|
|
sprintf(path, "'NewSignature11', '', '', 0");
|
2018-01-20 11:30:30 +00:00
|
|
|
add_drlocator_entry(hdb, path);
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_reglocator_table(hdb);
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
|
|
|
|
/* parent */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_reglocator_entry(hdb, "NewSignature12", 2, "htmlfile\\shell\\open\\nonexistent", "", 1);
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
|
|
|
|
/* parent is in RegLocator, no path, depth 0, no signature */
|
|
|
|
sprintf(path, "'NewSignature13', 'NewSignature12', '', 0");
|
2018-01-20 11:30:30 +00:00
|
|
|
add_drlocator_entry(hdb, path);
|
|
|
|
|
|
|
|
create_signature_table(hdb);
|
|
|
|
add_signature_entry(hdb, "'NewSignature1', 'FileName1', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature4', 'FileName2', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature5', 'FileName2', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature6', 'another', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature7', 'FileName2', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature8', 'FileName3.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature9', 'FileName4.dll', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'NewSignature10', 'necessary', '1.1.1.1', '2.1.1.1', '', '', '', '', ''");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(hdb, &hpkg);
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r);
|
|
|
|
|
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "AppSearch");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName1", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP1", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP2", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
search_absolute_directory(path, expected + 3);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP3", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP4", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\one\\two\\three\\FileName2", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP5", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP6", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\one\\two\\three\\FileName2", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP7", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
if (version)
|
|
|
|
{
|
|
|
|
size = MAX_PATH;
|
2014-09-23 18:33:25 +00:00
|
|
|
sprintf(path, "%s\\FileName3.dll", expected);
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
}
|
|
|
|
|
2009-05-17 07:05:22 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
search_absolute_directory(path, "");
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(!lstrcmpiA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
|
2009-05-17 07:05:22 +00:00
|
|
|
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
strcpy(path, "c:\\");
|
|
|
|
r = MsiGetPropertyA(hpkg, "SIGPROP13", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!prop[0], "Expected \"\", got \"%s\"\n", prop);
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
|
|
|
|
error:
|
2008-12-28 10:25:32 +00:00
|
|
|
DeleteFileA("FileName1");
|
|
|
|
DeleteFileA("FileName3.dll");
|
|
|
|
DeleteFileA("FileName4.dll");
|
|
|
|
DeleteFileA("FileName5.dll");
|
|
|
|
DeleteFileA("one\\two\\three\\FileName2");
|
|
|
|
RemoveDirectoryA("one\\two\\three");
|
|
|
|
RemoveDirectoryA("one\\two");
|
|
|
|
RemoveDirectoryA("one");
|
|
|
|
RemoveDirectoryA("another");
|
|
|
|
DeleteFileA(msifile);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_featureparents(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hpkg;
|
|
|
|
UINT r;
|
|
|
|
MSIHANDLE hdb;
|
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok ( hdb, "failed to create package database\n" );
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_feature_table( hdb );
|
|
|
|
create_component_table( hdb );
|
|
|
|
create_feature_components_table( hdb );
|
|
|
|
create_file_table( hdb );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorLocal */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'zodiac', '', '', '', 2, 1, '', 0" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorSource */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'perseus', '', '', '', 2, 1, '', 1" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorLocal */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'orion', '', '', '', 2, 1, '', 0" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
/* msidbFeatureAttributesUIDisallowAbsent */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'lyra', '', '', '', 2, 1, '', 16" );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* disabled because of install level */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'waters', '', '', '', 15, 101, '', 9" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* child feature of disabled feature */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_feature_entry( hdb, "'bayer', 'waters', '', '', 14, 1, '', 9" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* component of disabled feature (install level) */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'delphinus', '', 'TARGETDIR', 0, '', 'delphinus_file'" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* component of disabled child feature (install level) */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'hydrus', '', 'TARGETDIR', 0, '', 'hydrus_file'" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'leo', '', 'TARGETDIR', 0, '', 'leo_file'" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'virgo', '', 'TARGETDIR', 1, '', 'virgo_file'" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'libra', '', 'TARGETDIR', 2, '', 'libra_file'" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorSource:msidbComponentAttributesLocalOnly */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'cassiopeia', '', 'TARGETDIR', 0, '', 'cassiopeia_file'" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'cepheus', '', 'TARGETDIR', 1, '', 'cepheus_file'" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorSource:msidbComponentAttributesOptional */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'andromeda', '', 'TARGETDIR', 2, '', 'andromeda_file'" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorLocal:msidbComponentAttributesLocalOnly */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'canis', '', 'TARGETDIR', 0, '', 'canis_file'" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorLocal:msidbComponentAttributesSourceOnly */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'monoceros', '', 'TARGETDIR', 1, '', 'monoceros_file'" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* msidbFeatureAttributesFavorLocal:msidbComponentAttributesOptional */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_component_entry( hdb, "'lepus', '', 'TARGETDIR', 2, '', 'lepus_file'" );
|
|
|
|
|
|
|
|
add_feature_components_entry( hdb, "'zodiac', 'leo'" );
|
|
|
|
add_feature_components_entry( hdb, "'zodiac', 'virgo'" );
|
|
|
|
add_feature_components_entry( hdb, "'zodiac', 'libra'" );
|
|
|
|
add_feature_components_entry( hdb, "'perseus', 'cassiopeia'" );
|
|
|
|
add_feature_components_entry( hdb, "'perseus', 'cepheus'" );
|
|
|
|
add_feature_components_entry( hdb, "'perseus', 'andromeda'" );
|
|
|
|
add_feature_components_entry( hdb, "'orion', 'leo'" );
|
|
|
|
add_feature_components_entry( hdb, "'orion', 'virgo'" );
|
|
|
|
add_feature_components_entry( hdb, "'orion', 'libra'" );
|
|
|
|
add_feature_components_entry( hdb, "'orion', 'cassiopeia'" );
|
|
|
|
add_feature_components_entry( hdb, "'orion', 'cepheus'" );
|
|
|
|
add_feature_components_entry( hdb, "'orion', 'andromeda'" );
|
|
|
|
add_feature_components_entry( hdb, "'orion', 'canis'" );
|
|
|
|
add_feature_components_entry( hdb, "'orion', 'monoceros'" );
|
|
|
|
add_feature_components_entry( hdb, "'orion', 'lepus'" );
|
|
|
|
add_feature_components_entry( hdb, "'waters', 'delphinus'" );
|
|
|
|
add_feature_components_entry( hdb, "'bayer', 'hydrus'" );
|
|
|
|
|
|
|
|
add_file_entry( hdb, "'leo_file', 'leo', 'leo.txt', 100, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'virgo_file', 'virgo', 'virgo.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'libra_file', 'libra', 'libra.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'cassiopeia_file', 'cassiopeia', 'cassiopeia.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'cepheus_file', 'cepheus', 'cepheus.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'andromeda_file', 'andromeda', 'andromeda.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'canis_file', 'canis', 'canis.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'monoceros_file', 'monoceros', 'monoceros.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'lepus_file', 'lepus', 'lepus.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'delphinus_file', 'delphinus', 'delphinus.txt', 0, '', '1033', 8192, 1" );
|
|
|
|
add_file_entry( hdb, "'hydrus_file', 'hydrus', 'hydrus.txt', 0, '', '1033', 8192, 1" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db( hdb, &hpkg );
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
MsiCloseHandle( hdb );
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostInitialize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "cost init failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "FileCost");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostFinalize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "cost finalize failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "zodiac", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "perseus", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "orion", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "lyra", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "waters", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "bayer", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
|
|
|
|
test_component_states( __LINE__, hpkg, "leo", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "virgo", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "libra", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "cassiopeia", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "cepheus", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "andromeda", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "canis", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "monoceros", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "lepus", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "delphinus", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "hydrus", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
|
|
|
|
r = MsiSetFeatureStateA(hpkg, "orion", INSTALLSTATE_ABSENT);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetFeatureStateA(hpkg, "lyra", INSTALLSTATE_ABSENT);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to set feature state: %d\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetFeatureStateA(hpkg, "nosuchfeature", INSTALLSTATE_ABSENT);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %u\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
test_feature_states( __LINE__, hpkg, "zodiac", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "perseus", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "orion", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_ABSENT, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "lyra", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_ABSENT, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "waters", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_feature_states( __LINE__, hpkg, "bayer", ERROR_SUCCESS, INSTALLSTATE_ABSENT, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
|
|
|
|
test_component_states( __LINE__, hpkg, "leo", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "virgo", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "libra", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "cassiopeia", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_LOCAL, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "cepheus", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "andromeda", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_SOURCE, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "canis", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "monoceros", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "lepus", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "delphinus", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
|
|
|
test_component_states( __LINE__, hpkg, "hydrus", ERROR_SUCCESS, INSTALLSTATE_UNKNOWN, INSTALLSTATE_UNKNOWN, FALSE );
|
2012-05-14 21:41:45 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
DeleteFileA(msifile);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_installprops(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hpkg, hdb;
|
2012-01-21 17:21:57 +00:00
|
|
|
CHAR path[MAX_PATH], buf[MAX_PATH];
|
2008-12-28 10:25:32 +00:00
|
|
|
DWORD size, type;
|
|
|
|
LANGID langid;
|
|
|
|
HKEY hkey1, hkey2;
|
|
|
|
int res;
|
|
|
|
UINT r;
|
2012-01-21 17:21:57 +00:00
|
|
|
REGSAM access = KEY_ALL_ACCESS;
|
|
|
|
SYSTEM_INFO si;
|
2012-05-14 21:41:45 +00:00
|
|
|
INSTALLUILEVEL uilevel;
|
2012-01-21 17:21:57 +00:00
|
|
|
|
|
|
|
if (is_wow64)
|
|
|
|
access |= KEY_WOW64_64KEY;
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2014-09-23 18:33:25 +00:00
|
|
|
lstrcpyA(path, CURR_DIR);
|
|
|
|
if (!is_root(CURR_DIR)) lstrcatA(path, "\\");
|
2014-04-23 14:49:34 +00:00
|
|
|
lstrcatA(path, msifile);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
uilevel = MsiSetInternalUI(INSTALLUILEVEL_BASIC|INSTALLUILEVEL_SOURCERESONLY, NULL);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
hdb = create_package_db();
|
|
|
|
ok( hdb, "failed to create database\n");
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(hdb, &hpkg);
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2012-05-14 21:41:45 +00:00
|
|
|
MsiSetInternalUI(uilevel, NULL);
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "UILevel", buf, &size);
|
2012-05-14 21:41:45 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
2014-04-23 14:49:34 +00:00
|
|
|
ok( !lstrcmpA(buf, "3"), "Expected \"3\", got \"%s\"\n", buf);
|
2012-05-14 21:41:45 +00:00
|
|
|
|
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "UILevel", buf, &size);
|
2012-05-14 21:41:45 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
2014-04-23 14:49:34 +00:00
|
|
|
ok( !lstrcmpA(buf, "3"), "Expected \"3\", got \"%s\"\n", buf);
|
2012-05-14 21:41:45 +00:00
|
|
|
|
|
|
|
buf[0] = 0;
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "DATABASE", buf, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
2014-04-23 14:49:34 +00:00
|
|
|
ok( !lstrcmpA(buf, path), "Expected %s, got %s\n", path, buf);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\MS Setup (ACME)\\User Info", &hkey1);
|
|
|
|
RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, access, &hkey2);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
type = REG_SZ;
|
|
|
|
*path = '\0';
|
2014-04-23 14:49:34 +00:00
|
|
|
if (RegQueryValueExA(hkey1, "DefName", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
|
2008-12-28 10:25:32 +00:00
|
|
|
{
|
|
|
|
size = MAX_PATH;
|
|
|
|
type = REG_SZ;
|
2014-04-23 14:49:34 +00:00
|
|
|
RegQueryValueExA(hkey2, "RegisteredOwner", NULL, &type, (LPBYTE)path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
}
|
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
buf[0] = 0;
|
2012-01-21 17:21:57 +00:00
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "USERNAME", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
2014-04-23 14:49:34 +00:00
|
|
|
ok( !lstrcmpA(buf, path), "Expected %s, got %s\n", path, buf);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
type = REG_SZ;
|
|
|
|
*path = '\0';
|
2014-04-23 14:49:34 +00:00
|
|
|
if (RegQueryValueExA(hkey1, "DefCompany", NULL, &type, (LPBYTE)path, &size) != ERROR_SUCCESS)
|
2008-12-28 10:25:32 +00:00
|
|
|
{
|
|
|
|
size = MAX_PATH;
|
|
|
|
type = REG_SZ;
|
2014-04-23 14:49:34 +00:00
|
|
|
RegQueryValueExA(hkey2, "RegisteredOrganization", NULL, &type, (LPBYTE)path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (*path)
|
|
|
|
{
|
2012-05-14 21:41:45 +00:00
|
|
|
buf[0] = 0;
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "COMPANYNAME", buf, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
2014-04-23 14:49:34 +00:00
|
|
|
ok( !lstrcmpA(buf, path), "Expected %s, got %s\n", path, buf);
|
2008-12-28 10:25:32 +00:00
|
|
|
}
|
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
buf[0] = 0;
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "VersionDatabase", buf, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
trace("VersionDatabase = %s\n", buf);
|
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
buf[0] = 0;
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "VersionMsi", buf, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
trace("VersionMsi = %s\n", buf);
|
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
buf[0] = 0;
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "Date", buf, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
trace("Date = %s\n", buf);
|
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
buf[0] = 0;
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "Time", buf, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
trace("Time = %s\n", buf);
|
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
buf[0] = 0;
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "PackageCode", buf, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
trace("PackageCode = %s\n", buf);
|
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
buf[0] = 0;
|
2012-01-21 17:21:57 +00:00
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "ComputerName", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
|
|
|
|
trace("ComputerName = %s\n", buf);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
langid = GetUserDefaultLangID();
|
|
|
|
sprintf(path, "%d", langid);
|
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
buf[0] = 0;
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "UserLanguageID", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( !lstrcmpA(buf, path), "Expected \"%s\", got \"%s\"\n", path, buf);
|
|
|
|
|
|
|
|
res = GetSystemMetrics(SM_CXSCREEN);
|
2012-05-14 21:41:45 +00:00
|
|
|
buf[0] = 0;
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "ScreenX", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
|
|
|
|
|
|
|
|
res = GetSystemMetrics(SM_CYSCREEN);
|
2012-05-14 21:41:45 +00:00
|
|
|
buf[0] = 0;
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "ScreenY", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
if (pGetSystemInfo && pSHGetFolderPathA)
|
|
|
|
{
|
|
|
|
pGetSystemInfo(&si);
|
|
|
|
if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
|
|
|
|
{
|
2012-05-14 21:41:45 +00:00
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "Intel", buf, &size);
|
2012-05-14 21:41:45 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
ok(buf[0], "property not set\n");
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "MsiAMD64", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
ok(buf[0], "property not set\n");
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "Msix64", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
ok(buf[0], "property not set\n");
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "System64Folder", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
GetSystemDirectoryA(path, MAX_PATH);
|
|
|
|
if (size) buf[size - 1] = 0;
|
|
|
|
ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SystemFolder", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
pGetSystemWow64DirectoryA(path, MAX_PATH);
|
|
|
|
if (size) buf[size - 1] = 0;
|
|
|
|
ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "ProgramFiles64Folder", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES, NULL, 0, path);
|
|
|
|
if (size) buf[size - 1] = 0;
|
|
|
|
ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "ProgramFilesFolder", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILESX86, NULL, 0, path);
|
|
|
|
if (size) buf[size - 1] = 0;
|
|
|
|
ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "CommonFiles64Folder", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES_COMMON, NULL, 0, path);
|
|
|
|
if (size) buf[size - 1] = 0;
|
|
|
|
ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "CommonFilesFolder", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES_COMMONX86, NULL, 0, path);
|
|
|
|
if (size) buf[size - 1] = 0;
|
|
|
|
ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "VersionNT64", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
ok(buf[0], "property not set\n");
|
|
|
|
}
|
|
|
|
else if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
|
|
|
|
{
|
|
|
|
if (!is_wow64)
|
|
|
|
{
|
2012-05-14 21:41:45 +00:00
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "Intel", buf, &size);
|
2012-05-14 21:41:45 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
ok(buf[0], "property not set\n");
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "MsiAMD64", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
ok(!buf[0], "property set\n");
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "Msix64", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
ok(!buf[0], "property set\n");
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "System64Folder", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
ok(!buf[0], "property set\n");
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SystemFolder", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
GetSystemDirectoryA(path, MAX_PATH);
|
|
|
|
if (size) buf[size - 1] = 0;
|
|
|
|
ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "ProgramFiles64Folder", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
ok(!buf[0], "property set\n");
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "ProgramFilesFolder", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES, NULL, 0, path);
|
|
|
|
if (size) buf[size - 1] = 0;
|
|
|
|
ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "CommonFiles64Folder", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
ok(!buf[0], "property set\n");
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "CommonFilesFolder", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES_COMMON, NULL, 0, path);
|
|
|
|
if (size) buf[size - 1] = 0;
|
|
|
|
ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "VersionNT64", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
ok(!buf[0], "property set\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-05-14 21:41:45 +00:00
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "Intel", buf, &size);
|
2012-05-14 21:41:45 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
ok(buf[0], "property not set\n");
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "MsiAMD64", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
ok(buf[0], "property not set\n");
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "Msix64", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
ok(buf[0], "property not set\n");
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "System64Folder", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
GetSystemDirectoryA(path, MAX_PATH);
|
|
|
|
if (size) buf[size - 1] = 0;
|
|
|
|
ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SystemFolder", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
pGetSystemWow64DirectoryA(path, MAX_PATH);
|
|
|
|
if (size) buf[size - 1] = 0;
|
|
|
|
ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "ProgramFilesFolder64", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
ok(!buf[0], "property set\n");
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "ProgramFilesFolder", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILESX86, NULL, 0, path);
|
|
|
|
if (size) buf[size - 1] = 0;
|
|
|
|
ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "CommonFilesFolder64", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
ok(!buf[0], "property set\n");
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "CommonFilesFolder", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
pSHGetFolderPathA(NULL, CSIDL_PROGRAM_FILES_COMMONX86, NULL, 0, path);
|
|
|
|
if (size) buf[size - 1] = 0;
|
|
|
|
ok(!lstrcmpiA(path, buf), "expected \"%s\", got \"%s\"\n", path, buf);
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "VersionNT64", buf, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "failed to get property: %d\n", r);
|
|
|
|
ok(buf[0], "property not set\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
CloseHandle(hkey1);
|
|
|
|
CloseHandle(hkey2);
|
|
|
|
MsiCloseHandle(hpkg);
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-05-14 21:41:45 +00:00
|
|
|
MsiSetInternalUI(uilevel, NULL);
|
2008-12-28 10:25:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_launchconditions(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hpkg;
|
|
|
|
MSIHANDLE hdb;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok( hdb, "failed to create package database\n" );
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_launchcondition_table( hdb );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
add_launchcondition_entry( hdb, "'X = \"1\"', 'one'" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* invalid condition */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_launchcondition_entry( hdb, "'X != \"1\"', 'one'" );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db( hdb, &hpkg );
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( r == ERROR_SUCCESS, "failed to create package %u\n", r );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
MsiCloseHandle( hdb );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA( hpkg, "X", "1" );
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to set property\n" );
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* invalid conditions are ignored */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "LaunchConditions" );
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "cost init failed\n" );
|
|
|
|
|
|
|
|
/* verify LaunchConditions still does some verification */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA( hpkg, "X", "2" );
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "failed to set property\n" );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "LaunchConditions" );
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r );
|
|
|
|
|
|
|
|
MsiCloseHandle( hpkg );
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA( msifile );
|
2008-12-28 10:25:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_ccpsearch(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hdb, hpkg;
|
|
|
|
CHAR prop[MAX_PATH];
|
|
|
|
DWORD size = MAX_PATH;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok(hdb, "failed to create package database\n");
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_ccpsearch_table(hdb);
|
|
|
|
add_ccpsearch_entry(hdb, "'CCP_random'");
|
|
|
|
add_ccpsearch_entry(hdb, "'RMCCP_random'");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_reglocator_table(hdb);
|
|
|
|
add_reglocator_entry(hdb, "CCP_random", 0, "htmlfile\\shell\\open\\nonexistent", "", 1);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_drlocator_table(hdb);
|
|
|
|
add_drlocator_entry(hdb, "'RMCCP_random', '', 'C:\\', '0'");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_signature_table(hdb);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(hdb, &hpkg);
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "CCPSearch");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
r = MsiGetPropertyA(hpkg, "CCP_Success", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, "1"), "Expected 1, got %s\n", prop);
|
|
|
|
|
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
DeleteFileA(msifile);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_complocator(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hdb, hpkg;
|
|
|
|
UINT r;
|
|
|
|
CHAR prop[MAX_PATH];
|
|
|
|
CHAR expected[MAX_PATH];
|
|
|
|
DWORD size = MAX_PATH;
|
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok(hdb, "failed to create package database\n");
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_appsearch_table(hdb);
|
|
|
|
add_appsearch_entry(hdb, "'ABELISAURUS', 'abelisaurus'");
|
|
|
|
add_appsearch_entry(hdb, "'BACTROSAURUS', 'bactrosaurus'");
|
|
|
|
add_appsearch_entry(hdb, "'CAMELOTIA', 'camelotia'");
|
|
|
|
add_appsearch_entry(hdb, "'DICLONIUS', 'diclonius'");
|
|
|
|
add_appsearch_entry(hdb, "'ECHINODON', 'echinodon'");
|
|
|
|
add_appsearch_entry(hdb, "'FALCARIUS', 'falcarius'");
|
|
|
|
add_appsearch_entry(hdb, "'GALLIMIMUS', 'gallimimus'");
|
|
|
|
add_appsearch_entry(hdb, "'HAGRYPHUS', 'hagryphus'");
|
|
|
|
add_appsearch_entry(hdb, "'IGUANODON', 'iguanodon'");
|
|
|
|
add_appsearch_entry(hdb, "'JOBARIA', 'jobaria'");
|
|
|
|
add_appsearch_entry(hdb, "'KAKURU', 'kakuru'");
|
|
|
|
add_appsearch_entry(hdb, "'LABOCANIA', 'labocania'");
|
|
|
|
add_appsearch_entry(hdb, "'MEGARAPTOR', 'megaraptor'");
|
|
|
|
add_appsearch_entry(hdb, "'NEOSODON', 'neosodon'");
|
|
|
|
add_appsearch_entry(hdb, "'OLOROTITAN', 'olorotitan'");
|
|
|
|
add_appsearch_entry(hdb, "'PANTYDRACO', 'pantydraco'");
|
|
|
|
|
|
|
|
create_complocator_table(hdb);
|
|
|
|
add_complocator_entry(hdb, "'abelisaurus', '{E3619EED-305A-418C-B9C7-F7D7377F0934}', 1");
|
|
|
|
add_complocator_entry(hdb, "'bactrosaurus', '{D56B688D-542F-42Ef-90FD-B6DA76EE8119}', 0");
|
|
|
|
add_complocator_entry(hdb, "'camelotia', '{8211BE36-2466-47E3-AFB7-6AC72E51AED2}', 1");
|
|
|
|
add_complocator_entry(hdb, "'diclonius', '{5C767B20-A33C-45A4-B80B-555E512F01AE}', 0");
|
|
|
|
add_complocator_entry(hdb, "'echinodon', '{A19E16C5-C75D-4699-8111-C4338C40C3CB}', 1");
|
|
|
|
add_complocator_entry(hdb, "'falcarius', '{17762FA1-A7AE-4CC6-8827-62873C35361D}', 0");
|
|
|
|
add_complocator_entry(hdb, "'gallimimus', '{75EBF568-C959-41E0-A99E-9050638CF5FB}', 1");
|
|
|
|
add_complocator_entry(hdb, "'hagrphus', '{D4969B72-17D9-4AB6-BE49-78F2FEE857AC}', 0");
|
|
|
|
add_complocator_entry(hdb, "'iguanodon', '{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}', 1");
|
|
|
|
add_complocator_entry(hdb, "'jobaria', '{243C22B1-8C51-4151-B9D1-1AE5265E079E}', 0");
|
|
|
|
add_complocator_entry(hdb, "'kakuru', '{5D0F03BA-50BC-44F2-ABB1-72C972F4E514}', 1");
|
|
|
|
add_complocator_entry(hdb, "'labocania', '{C7DDB60C-7828-4046-A6F8-699D5E92F1ED}', 0");
|
|
|
|
add_complocator_entry(hdb, "'megaraptor', '{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}', 1");
|
|
|
|
add_complocator_entry(hdb, "'neosodon', '{0B499649-197A-48EF-93D2-AF1C17ED6E90}', 0");
|
|
|
|
add_complocator_entry(hdb, "'olorotitan', '{54E9E91F-AED2-46D5-A25A-7E50AFA24513}', 1");
|
|
|
|
add_complocator_entry(hdb, "'pantydraco', '{2A989951-5565-4FA7-93A7-E800A3E67D71}', 0");
|
|
|
|
|
|
|
|
create_signature_table(hdb);
|
|
|
|
add_signature_entry(hdb, "'abelisaurus', 'abelisaurus', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'bactrosaurus', 'bactrosaurus', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'camelotia', 'camelotia', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'diclonius', 'diclonius', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'iguanodon', 'iguanodon', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'jobaria', 'jobaria', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'kakuru', 'kakuru', '', '', '', '', '', '', ''");
|
|
|
|
add_signature_entry(hdb, "'labocania', 'labocania', '', '', '', '', '', '', ''");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(hdb, &hpkg);
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
|
|
|
|
create_test_file("abelisaurus");
|
|
|
|
create_test_file("bactrosaurus");
|
|
|
|
create_test_file("camelotia");
|
|
|
|
create_test_file("diclonius");
|
|
|
|
create_test_file("echinodon");
|
|
|
|
create_test_file("falcarius");
|
|
|
|
create_test_file("gallimimus");
|
|
|
|
create_test_file("hagryphus");
|
|
|
|
CreateDirectoryA("iguanodon", NULL);
|
|
|
|
CreateDirectoryA("jobaria", NULL);
|
|
|
|
CreateDirectoryA("kakuru", NULL);
|
|
|
|
CreateDirectoryA("labocania", NULL);
|
|
|
|
CreateDirectoryA("megaraptor", NULL);
|
|
|
|
CreateDirectoryA("neosodon", NULL);
|
|
|
|
CreateDirectoryA("olorotitan", NULL);
|
|
|
|
CreateDirectoryA("pantydraco", NULL);
|
|
|
|
|
|
|
|
set_component_path("abelisaurus", MSIINSTALLCONTEXT_MACHINE,
|
|
|
|
"{E3619EED-305A-418C-B9C7-F7D7377F0934}", NULL, FALSE);
|
|
|
|
set_component_path("bactrosaurus", MSIINSTALLCONTEXT_MACHINE,
|
|
|
|
"{D56B688D-542F-42Ef-90FD-B6DA76EE8119}", NULL, FALSE);
|
|
|
|
set_component_path("echinodon", MSIINSTALLCONTEXT_MACHINE,
|
|
|
|
"{A19E16C5-C75D-4699-8111-C4338C40C3CB}", NULL, FALSE);
|
|
|
|
set_component_path("falcarius", MSIINSTALLCONTEXT_MACHINE,
|
|
|
|
"{17762FA1-A7AE-4CC6-8827-62873C35361D}", NULL, FALSE);
|
|
|
|
set_component_path("iguanodon", MSIINSTALLCONTEXT_MACHINE,
|
|
|
|
"{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}", NULL, FALSE);
|
|
|
|
set_component_path("jobaria", MSIINSTALLCONTEXT_MACHINE,
|
|
|
|
"{243C22B1-8C51-4151-B9D1-1AE5265E079E}", NULL, FALSE);
|
|
|
|
set_component_path("megaraptor", MSIINSTALLCONTEXT_MACHINE,
|
|
|
|
"{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}", NULL, FALSE);
|
|
|
|
set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE,
|
|
|
|
"{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL, FALSE);
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "AppSearch");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "ABELISAURUS", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
lstrcpyA(expected, CURR_DIR);
|
2014-09-23 18:33:25 +00:00
|
|
|
if (!is_root(CURR_DIR)) lstrcatA(expected, "\\");
|
|
|
|
lstrcatA(expected, "abelisaurus");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
|
|
|
|
"Expected %s or empty string, got %s\n", expected, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "BACTROSAURUS", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "CAMELOTIA", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "DICLONIUS", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "ECHINODON", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
lstrcpyA(expected, CURR_DIR);
|
2014-09-23 18:33:25 +00:00
|
|
|
if (!is_root(CURR_DIR)) lstrcatA(expected, "\\");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
|
|
|
|
"Expected %s or empty string, got %s\n", expected, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "FALCARIUS", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "GALLIMIMUS", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "HAGRYPHUS", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "IGUANODON", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "JOBARIA", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "KAKURU", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "LABOCANIA", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "MEGARAPTOR", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
lstrcpyA(expected, CURR_DIR);
|
2014-09-23 18:33:25 +00:00
|
|
|
if (!is_root(CURR_DIR)) lstrcatA(expected, "\\");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
|
|
|
|
"Expected %s or empty string, got %s\n", expected, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "NEOSODON", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
lstrcpyA(expected, CURR_DIR);
|
2014-09-23 18:33:25 +00:00
|
|
|
if (!is_root(CURR_DIR)) lstrcatA(expected, "\\");
|
|
|
|
lstrcatA(expected, "neosodon\\");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(prop, expected) || !lstrcmpA(prop, ""),
|
|
|
|
"Expected %s or empty string, got %s\n", expected, prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "OLOROTITAN", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "PANTYDRACO", prop, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(prop, ""), "Expected , got %s\n", prop);
|
|
|
|
|
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
DeleteFileA("abelisaurus");
|
|
|
|
DeleteFileA("bactrosaurus");
|
|
|
|
DeleteFileA("camelotia");
|
|
|
|
DeleteFileA("diclonius");
|
|
|
|
DeleteFileA("echinodon");
|
|
|
|
DeleteFileA("falcarius");
|
|
|
|
DeleteFileA("gallimimus");
|
|
|
|
DeleteFileA("hagryphus");
|
|
|
|
RemoveDirectoryA("iguanodon");
|
|
|
|
RemoveDirectoryA("jobaria");
|
|
|
|
RemoveDirectoryA("kakuru");
|
|
|
|
RemoveDirectoryA("labocania");
|
|
|
|
RemoveDirectoryA("megaraptor");
|
|
|
|
RemoveDirectoryA("neosodon");
|
|
|
|
RemoveDirectoryA("olorotitan");
|
|
|
|
RemoveDirectoryA("pantydraco");
|
|
|
|
delete_component_path("{E3619EED-305A-418C-B9C7-F7D7377F0934}",
|
|
|
|
MSIINSTALLCONTEXT_MACHINE, NULL);
|
|
|
|
delete_component_path("{D56B688D-542F-42Ef-90FD-B6DA76EE8119}",
|
|
|
|
MSIINSTALLCONTEXT_MACHINE, NULL);
|
|
|
|
delete_component_path("{A19E16C5-C75D-4699-8111-C4338C40C3CB}",
|
|
|
|
MSIINSTALLCONTEXT_MACHINE, NULL);
|
|
|
|
delete_component_path("{17762FA1-A7AE-4CC6-8827-62873C35361D}",
|
|
|
|
MSIINSTALLCONTEXT_MACHINE, NULL);
|
|
|
|
delete_component_path("{8E0DA02E-F6A7-4A8F-B25D-6F564C492308}",
|
|
|
|
MSIINSTALLCONTEXT_MACHINE, NULL);
|
|
|
|
delete_component_path("{243C22B1-8C51-4151-B9D1-1AE5265E079E}",
|
|
|
|
MSIINSTALLCONTEXT_MACHINE, NULL);
|
|
|
|
delete_component_path("{8B1034B7-BD5E-41ac-B52C-0105D3DFD74D}",
|
|
|
|
MSIINSTALLCONTEXT_MACHINE, NULL);
|
|
|
|
delete_component_path("{0B499649-197A-48EF-93D2-AF1C17ED6E90}",
|
|
|
|
MSIINSTALLCONTEXT_MACHINE, NULL);
|
|
|
|
DeleteFileA(msifile);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void set_suminfo_prop(MSIHANDLE db, DWORD prop, DWORD val)
|
|
|
|
{
|
|
|
|
MSIHANDLE summary;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
r = MsiSummaryInfoSetPropertyA(summary, prop, VT_I4, val, NULL, NULL);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
r = MsiSummaryInfoPersist(summary);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
|
|
|
|
|
|
|
|
MsiCloseHandle(summary);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_MsiGetSourcePath(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hdb, hpkg;
|
|
|
|
CHAR path[MAX_PATH];
|
|
|
|
CHAR cwd[MAX_PATH];
|
|
|
|
CHAR subsrc[MAX_PATH];
|
|
|
|
CHAR sub2[MAX_PATH];
|
|
|
|
DWORD size;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
lstrcpyA(cwd, CURR_DIR);
|
2014-09-23 18:33:25 +00:00
|
|
|
if (!is_root(CURR_DIR)) lstrcatA(cwd, "\\");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
lstrcpyA(subsrc, cwd);
|
|
|
|
lstrcatA(subsrc, "subsource");
|
|
|
|
lstrcatA(subsrc, "\\");
|
|
|
|
|
|
|
|
lstrcpyA(sub2, subsrc);
|
|
|
|
lstrcatA(sub2, "sub2");
|
|
|
|
lstrcatA(sub2, "\\");
|
|
|
|
|
|
|
|
/* uncompressed source */
|
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok( hdb, "failed to create database\n");
|
|
|
|
|
|
|
|
set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
|
|
|
|
add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'subtarget:subsource'");
|
|
|
|
add_directory_entry(hdb, "'SubDir2', 'SubDir', 'sub2'");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
r = MsiDatabaseCommit(hdb);
|
|
|
|
ok(r == ERROR_SUCCESS , "Failed to commit database\n");
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(hdb, &hpkg);
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
|
|
|
|
/* invalid database handle */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(-1, "TARGETDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_INVALID_HANDLE,
|
|
|
|
"Expected ERROR_INVALID_HANDLE, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
|
|
|
/* NULL szFolder */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, NULL, path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_INVALID_PARAMETER,
|
|
|
|
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
|
|
|
/* empty szFolder */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
|
|
|
/* try TARGETDIR */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "TARGETDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try SourceDir */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
|
|
|
/* try SOURCEDIR */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
|
|
|
/* source path does not exist, but the property exists */
|
2012-01-21 17:21:57 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
|
|
|
|
|
|
|
/* try SubDir */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
|
|
|
/* try SubDir2 */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir2", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "CostInitialize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "cost init failed\n");
|
|
|
|
|
|
|
|
/* try TARGETDIR after CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "TARGETDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* try SourceDir after CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* try SOURCEDIR after CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
|
|
|
/* source path does not exist, but the property exists */
|
2012-05-14 21:41:45 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2012-05-14 21:41:45 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2012-05-14 21:41:45 +00:00
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* try SubDir after CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try SubDir2 after CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir2", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
|
|
|
|
ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "ResolveSource");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try TARGETDIR after ResolveSource */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "TARGETDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try SourceDir after ResolveSource */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try SOURCEDIR after ResolveSource */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
|
|
|
/* source path does not exist, but the property exists */
|
2012-05-14 21:41:45 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2012-05-14 21:41:45 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try SubDir after ResolveSource */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2008-04-04 16:43:16 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try SubDir2 after ResolveSource */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir2", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
|
|
|
|
ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "FileCost");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try TARGETDIR after FileCost */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "TARGETDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try SourceDir after FileCost */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try SOURCEDIR after FileCost */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
2009-06-06 15:59:11 +00:00
|
|
|
/* source path does not exist, but the property exists */
|
2012-05-14 21:41:45 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2012-05-14 21:41:45 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
2009-06-06 15:59:11 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try SubDir after FileCost */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try SubDir2 after FileCost */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir2", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
|
|
|
|
ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "CostFinalize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
|
|
|
/* try TARGETDIR after CostFinalize */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "TARGETDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try SourceDir after CostFinalize */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try SOURCEDIR after CostFinalize */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
2009-06-06 15:59:11 +00:00
|
|
|
/* source path does not exist, but the property exists */
|
2012-05-14 21:41:45 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2012-05-14 21:41:45 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
2009-06-06 15:59:11 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try SubDir after CostFinalize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try SubDir2 after CostFinalize */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir2", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, sub2), "Expected \"%s\", got \"%s\"\n", sub2, path);
|
|
|
|
ok(size == lstrlenA(sub2), "Expected %d, got %d\n", lstrlenA(sub2), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* nonexistent directory */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "IDontExist", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
|
|
|
/* NULL szPathBuf */
|
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", NULL, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* NULL pcchPathBuf */
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", path, NULL);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_INVALID_PARAMETER,
|
|
|
|
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
|
|
|
|
/* pcchPathBuf is 0 */
|
|
|
|
size = 0;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* pcchPathBuf does not have room for NULL terminator */
|
|
|
|
size = lstrlenA(cwd);
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
|
|
|
|
ok(!strncmp(path, cwd, lstrlenA(cwd) - 1),
|
|
|
|
"Expected path with no backslash, got \"%s\"\n", path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* pcchPathBuf has room for NULL terminator */
|
|
|
|
size = lstrlenA(cwd) + 1;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
/* remove property */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA(hpkg, "SourceDir", NULL);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
/* try SourceDir again */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", path, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* set property to a valid directory */
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiSetPropertyA(hpkg, "SOURCEDIR", cwd);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
/* try SOURCEDIR again */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SOURCEDIR", path, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
MsiCloseHandle(hpkg);
|
2008-04-04 16:43:16 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* compressed source */
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_DIRECT, &hdb);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeCompressed);
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(hdb, &hpkg);
|
|
|
|
ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2009-06-06 15:59:11 +00:00
|
|
|
/* try TARGETDIR */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "TARGETDIR", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
|
|
|
/* try SourceDir */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
|
|
|
/* try SOURCEDIR */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SOURCEDIR", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
|
|
|
/* source path nor the property exist */
|
2012-05-14 21:41:45 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2012-05-14 21:41:45 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
|
|
|
|
2009-06-06 15:59:11 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
|
|
|
|
|
|
|
/* try SubDir */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
|
|
|
/* try SubDir2 */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir2", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "CostInitialize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2009-06-06 15:59:11 +00:00
|
|
|
|
|
|
|
/* try TARGETDIR after CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "TARGETDIR", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* try SourceDir after CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* try SOURCEDIR after CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SOURCEDIR", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* source path does not exist, but the property exists */
|
2012-05-14 21:41:45 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2012-05-14 21:41:45 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
2009-06-06 15:59:11 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2012-05-14 21:41:45 +00:00
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
2009-06-06 15:59:11 +00:00
|
|
|
|
|
|
|
/* try SubDir after CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* try SubDir2 after CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir2", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "ResolveSource");
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
|
|
|
/* try TARGETDIR after ResolveSource */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "TARGETDIR", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* try SourceDir after ResolveSource */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* try SOURCEDIR after ResolveSource */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SOURCEDIR", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* source path and the property exist */
|
2012-05-14 21:41:45 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2012-05-14 21:41:45 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
2009-06-06 15:59:11 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* try SubDir after ResolveSource */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* try SubDir2 after ResolveSource */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir2", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "FileCost");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2009-06-06 15:59:11 +00:00
|
|
|
|
|
|
|
/* try TARGETDIR after CostFinalize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "TARGETDIR", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* try SourceDir after CostFinalize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* try SOURCEDIR after CostFinalize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SOURCEDIR", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* source path and the property exist */
|
2012-05-14 21:41:45 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2012-05-14 21:41:45 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
2009-06-06 15:59:11 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* try SubDir after CostFinalize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* try SubDir2 after CostFinalize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir2", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "CostFinalize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
/* try TARGETDIR after CostFinalize */
|
2008-04-04 16:43:16 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "TARGETDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
2008-04-04 16:43:16 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try SourceDir after CostFinalize */
|
2008-05-17 19:46:54 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
2008-05-17 19:46:54 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try SOURCEDIR after CostFinalize */
|
2008-05-17 19:46:54 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
}
|
|
|
|
|
2009-06-06 15:59:11 +00:00
|
|
|
/* source path and the property exist */
|
2012-05-14 21:41:45 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2012-05-14 21:41:45 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
2009-06-06 15:59:11 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2009-06-06 15:59:11 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* try SubDir after CostFinalize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* try SubDir2 after CostFinalize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir2", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
2008-05-17 19:46:54 +00:00
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
MsiCloseHandle(hpkg);
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2008-02-10 13:22:36 +00:00
|
|
|
}
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
static void test_shortlongsource(void)
|
2008-02-10 13:22:36 +00:00
|
|
|
{
|
2008-12-28 10:25:32 +00:00
|
|
|
MSIHANDLE hdb, hpkg;
|
2008-02-10 13:22:36 +00:00
|
|
|
CHAR path[MAX_PATH];
|
2008-12-28 10:25:32 +00:00
|
|
|
CHAR cwd[MAX_PATH];
|
|
|
|
CHAR subsrc[MAX_PATH];
|
2008-02-10 13:22:36 +00:00
|
|
|
DWORD size;
|
|
|
|
UINT r;
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(cwd, CURR_DIR);
|
2014-09-23 18:33:25 +00:00
|
|
|
if (!is_root(CURR_DIR)) lstrcatA(cwd, "\\");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
lstrcpyA(subsrc, cwd);
|
|
|
|
lstrcatA(subsrc, "long");
|
|
|
|
lstrcatA(subsrc, "\\");
|
|
|
|
|
|
|
|
/* long file names */
|
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
hdb = create_package_db();
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( hdb, "failed to create database\n");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
set_suminfo_prop(hdb, PID_WORDCOUNT, 0);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
|
|
|
|
add_directory_entry(hdb, "'SubDir', 'TARGETDIR', 'short|long'");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* CostInitialize:short */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_directory_entry(hdb, "'SubDir2', 'TARGETDIR', 'one|two'");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* CostInitialize:long */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_directory_entry(hdb, "'SubDir3', 'TARGETDIR', 'three|four'");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* FileCost:short */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_directory_entry(hdb, "'SubDir4', 'TARGETDIR', 'five|six'");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* FileCost:long */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_directory_entry(hdb, "'SubDir5', 'TARGETDIR', 'seven|eight'");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* CostFinalize:short */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_directory_entry(hdb, "'SubDir6', 'TARGETDIR', 'nine|ten'");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
/* CostFinalize:long */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_directory_entry(hdb, "'SubDir7', 'TARGETDIR', 'eleven|twelve'");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
r = MsiDatabaseCommit(hdb);
|
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(hdb, &hpkg);
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
|
|
|
|
CreateDirectoryA("one", NULL);
|
|
|
|
CreateDirectoryA("four", NULL);
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "CostInitialize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
CreateDirectoryA("five", NULL);
|
|
|
|
CreateDirectoryA("eight", NULL);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "FileCost");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
CreateDirectoryA("nine", NULL);
|
|
|
|
CreateDirectoryA("twelve", NULL);
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "CostFinalize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
|
|
|
/* neither short nor long source directories exist */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
CreateDirectoryA("short", NULL);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* short source directory exists */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
|
|
|
|
|
|
|
CreateDirectoryA("long", NULL);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* both short and long source directories exist */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(subsrc, cwd);
|
|
|
|
lstrcatA(subsrc, "two");
|
|
|
|
lstrcatA(subsrc, "\\");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* short dir exists before CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir2", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
|
|
|
|
|
|
|
lstrcpyA(subsrc, cwd);
|
|
|
|
lstrcatA(subsrc, "four");
|
|
|
|
lstrcatA(subsrc, "\\");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* long dir exists before CostInitialize */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir3", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(subsrc, cwd);
|
|
|
|
lstrcatA(subsrc, "six");
|
|
|
|
lstrcatA(subsrc, "\\");
|
|
|
|
|
|
|
|
/* short dir exists before FileCost */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir4", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
|
|
|
|
|
|
|
lstrcpyA(subsrc, cwd);
|
|
|
|
lstrcatA(subsrc, "eight");
|
|
|
|
lstrcatA(subsrc, "\\");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* long dir exists before FileCost */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir5", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(subsrc, cwd);
|
|
|
|
lstrcatA(subsrc, "ten");
|
|
|
|
lstrcatA(subsrc, "\\");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* short dir exists before CostFinalize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir6", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(subsrc, cwd);
|
|
|
|
lstrcatA(subsrc, "twelve");
|
|
|
|
lstrcatA(subsrc, "\\");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* long dir exists before CostFinalize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir7", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
RemoveDirectoryA("short");
|
|
|
|
RemoveDirectoryA("long");
|
|
|
|
RemoveDirectoryA("one");
|
|
|
|
RemoveDirectoryA("four");
|
|
|
|
RemoveDirectoryA("five");
|
|
|
|
RemoveDirectoryA("eight");
|
|
|
|
RemoveDirectoryA("nine");
|
|
|
|
RemoveDirectoryA("twelve");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* short file names */
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_DIRECT, &hdb);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
set_suminfo_prop(hdb, PID_WORDCOUNT, msidbSumInfoSourceTypeSFN);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(hdb, &hpkg);
|
|
|
|
ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
MsiCloseHandle(hdb);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
CreateDirectoryA("one", NULL);
|
|
|
|
CreateDirectoryA("four", NULL);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "CostInitialize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
CreateDirectoryA("five", NULL);
|
|
|
|
CreateDirectoryA("eight", NULL);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "FileCost");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
CreateDirectoryA("nine", NULL);
|
|
|
|
CreateDirectoryA("twelve", NULL);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "CostFinalize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(subsrc, cwd);
|
|
|
|
lstrcatA(subsrc, "short");
|
|
|
|
lstrcatA(subsrc, "\\");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* neither short nor long source directories exist */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
CreateDirectoryA("short", NULL);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* short source directory exists */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
CreateDirectoryA("long", NULL);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* both short and long source directories exist */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(subsrc, cwd);
|
|
|
|
lstrcatA(subsrc, "one");
|
|
|
|
lstrcatA(subsrc, "\\");
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* short dir exists before CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir2", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(subsrc, cwd);
|
|
|
|
lstrcatA(subsrc, "three");
|
|
|
|
lstrcatA(subsrc, "\\");
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* long dir exists before CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir3", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(subsrc, cwd);
|
|
|
|
lstrcatA(subsrc, "five");
|
|
|
|
lstrcatA(subsrc, "\\");
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* short dir exists before FileCost */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir4", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(subsrc, cwd);
|
|
|
|
lstrcatA(subsrc, "seven");
|
|
|
|
lstrcatA(subsrc, "\\");
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* long dir exists before FileCost */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir5", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(subsrc, cwd);
|
|
|
|
lstrcatA(subsrc, "nine");
|
|
|
|
lstrcatA(subsrc, "\\");
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* short dir exists before CostFinalize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir6", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(subsrc, cwd);
|
|
|
|
lstrcatA(subsrc, "eleven");
|
|
|
|
lstrcatA(subsrc, "\\");
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* long dir exists before CostFinalize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SubDir7", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, subsrc), "Expected \"%s\", got \"%s\"\n", subsrc, path);
|
|
|
|
ok(size == lstrlenA(subsrc), "Expected %d, got %d\n", lstrlenA(subsrc), size);
|
|
|
|
|
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
RemoveDirectoryA("short");
|
|
|
|
RemoveDirectoryA("long");
|
|
|
|
RemoveDirectoryA("one");
|
|
|
|
RemoveDirectoryA("four");
|
|
|
|
RemoveDirectoryA("five");
|
|
|
|
RemoveDirectoryA("eight");
|
|
|
|
RemoveDirectoryA("nine");
|
|
|
|
RemoveDirectoryA("twelve");
|
|
|
|
DeleteFileA(msifile);
|
2008-02-10 13:22:36 +00:00
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
static void test_sourcedir(void)
|
2008-02-10 13:22:36 +00:00
|
|
|
{
|
|
|
|
MSIHANDLE hdb, hpkg;
|
2012-01-21 17:21:57 +00:00
|
|
|
CHAR package[12];
|
2008-12-28 10:25:32 +00:00
|
|
|
CHAR path[MAX_PATH];
|
|
|
|
CHAR cwd[MAX_PATH];
|
|
|
|
CHAR subsrc[MAX_PATH];
|
|
|
|
DWORD size;
|
2008-02-10 13:22:36 +00:00
|
|
|
UINT r;
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(cwd, CURR_DIR);
|
2014-09-23 18:33:25 +00:00
|
|
|
if (!is_root(CURR_DIR)) lstrcatA(cwd, "\\");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
lstrcpyA(subsrc, cwd);
|
|
|
|
lstrcatA(subsrc, "long");
|
|
|
|
lstrcatA(subsrc, "\\");
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
hdb = create_package_db();
|
2008-12-28 10:25:32 +00:00
|
|
|
ok( hdb, "failed to create database\n");
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
add_directory_entry(hdb, "'TARGETDIR', '', 'SourceDir'");
|
2008-12-28 10:25:32 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
sprintf(package, "#%u", hdb);
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenPackageA(package, &hpkg);
|
2012-01-21 17:21:57 +00:00
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
|
|
|
goto error;
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* properties only */
|
|
|
|
|
|
|
|
/* SourceDir prop */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* SOURCEDIR prop */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "CostInitialize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
|
|
|
/* SourceDir after CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* SOURCEDIR after CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "FileCost");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
|
|
|
/* SourceDir after FileCost */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* SOURCEDIR after FileCost */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "CostFinalize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
|
|
|
/* SourceDir after CostFinalize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* SOURCEDIR after CostFinalize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SOURCEDIR", path, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"), "Expected \"kiwi\", got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
|
|
|
|
|
|
|
|
/* SOURCEDIR after calling MsiGetSourcePath */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
todo_wine {
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
}
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "ResolveSource");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* SourceDir after ResolveSource */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* SOURCEDIR after ResolveSource */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* random casing */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SoUrCeDiR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
MsiCloseHandle(hpkg);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* reset the package state */
|
2009-01-18 09:03:44 +00:00
|
|
|
sprintf(package, "#%i", hdb);
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenPackageA(package, &hpkg);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* test how MsiGetSourcePath affects the properties */
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* SourceDir prop */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
todo_wine
|
2008-02-10 13:22:36 +00:00
|
|
|
{
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
2008-02-10 13:22:36 +00:00
|
|
|
}
|
2008-12-28 10:25:32 +00:00
|
|
|
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
|
|
|
/* SourceDir after MsiGetSourcePath */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
todo_wine
|
2008-02-10 13:22:36 +00:00
|
|
|
{
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
2008-02-10 13:22:36 +00:00
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* SOURCEDIR prop */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
|
|
|
/* SOURCEDIR prop after MsiGetSourcePath */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
|
|
|
}
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "CostInitialize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* SourceDir after CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* SourceDir after MsiGetSourcePath */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* SOURCEDIR after CostInitialize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* SOURCEDIR source path still does not exist */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "FileCost");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
|
|
|
/* SourceDir after FileCost */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* SOURCEDIR after FileCost */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* SOURCEDIR source path still does not exist */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "CostFinalize");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
|
|
|
/* SourceDir after CostFinalize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* SOURCEDIR after CostFinalize */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* SOURCEDIR source path still does not exist */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA(hpkg, "ResolveSource");
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "file cost failed\n");
|
|
|
|
|
|
|
|
/* SourceDir after ResolveSource */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SourceDir", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* SOURCEDIR after ResolveSource */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetPropertyA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, cwd), "Expected \"%s\", got \"%s\"\n", cwd, path);
|
|
|
|
ok(size == lstrlenA(cwd), "Expected %d, got %d\n", lstrlenA(cwd), size);
|
|
|
|
|
|
|
|
/* SOURCEDIR source path still does not exist */
|
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyA(path, "kiwi");
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiGetSourcePathA(hpkg, "SOURCEDIR", path, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(r == ERROR_DIRECTORY, "Expected ERROR_DIRECTORY, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(path, "kiwi"),
|
|
|
|
"Expected path to be unchanged, got \"%s\"\n", path);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
MsiCloseHandle(hpkg);
|
2012-01-21 17:21:57 +00:00
|
|
|
|
|
|
|
error:
|
|
|
|
MsiCloseHandle(hdb);
|
2008-12-28 10:25:32 +00:00
|
|
|
DeleteFileA(msifile);
|
2008-02-10 13:22:36 +00:00
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
struct access_res
|
2008-02-10 13:22:36 +00:00
|
|
|
{
|
2008-12-28 10:25:32 +00:00
|
|
|
BOOL gothandle;
|
|
|
|
DWORD lasterr;
|
|
|
|
BOOL ignore;
|
|
|
|
};
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
static const struct access_res create[16] =
|
|
|
|
{
|
|
|
|
{ TRUE, ERROR_SUCCESS, TRUE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, TRUE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, TRUE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, TRUE }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct access_res create_commit[16] =
|
|
|
|
{
|
|
|
|
{ TRUE, ERROR_SUCCESS, TRUE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, TRUE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, TRUE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ FALSE, ERROR_SHARING_VIOLATION, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, TRUE }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct access_res create_close[16] =
|
|
|
|
{
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS, FALSE },
|
|
|
|
{ TRUE, ERROR_SUCCESS }
|
|
|
|
};
|
|
|
|
|
|
|
|
static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD line)
|
|
|
|
{
|
|
|
|
DWORD access = 0, share = 0;
|
|
|
|
DWORD lasterr;
|
|
|
|
HANDLE hfile;
|
|
|
|
int i, j, idx = 0;
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
if (i == 0) access = 0;
|
|
|
|
if (i == 1) access = GENERIC_READ;
|
|
|
|
if (i == 2) access = GENERIC_WRITE;
|
|
|
|
if (i == 3) access = GENERIC_READ | GENERIC_WRITE;
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
for (j = 0; j < 4; j++)
|
|
|
|
{
|
|
|
|
if (ares[idx].ignore)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (j == 0) share = 0;
|
|
|
|
if (j == 1) share = FILE_SHARE_READ;
|
|
|
|
if (j == 2) share = FILE_SHARE_WRITE;
|
|
|
|
if (j == 3) share = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING,
|
|
|
|
FILE_ATTRIBUTE_NORMAL, 0);
|
|
|
|
lasterr = GetLastError();
|
|
|
|
|
|
|
|
ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
|
|
|
|
"(%d, handle, %d): Expected %d, got %d\n",
|
|
|
|
line, idx, ares[idx].gothandle,
|
|
|
|
(hfile != INVALID_HANDLE_VALUE));
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
ok(lasterr == ares[idx].lasterr, "(%d, lasterr, %d): Expected %d, got %d\n",
|
2008-12-28 10:25:32 +00:00
|
|
|
line, idx, ares[idx].lasterr, lasterr);
|
|
|
|
|
|
|
|
CloseHandle(hfile);
|
|
|
|
idx++;
|
|
|
|
}
|
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
#define test_file_access(file, ares) _test_file_access(file, ares, __LINE__)
|
|
|
|
|
|
|
|
static void test_access(void)
|
2007-03-06 11:59:18 +00:00
|
|
|
{
|
2008-12-28 10:25:32 +00:00
|
|
|
MSIHANDLE hdb;
|
2007-03-06 11:59:18 +00:00
|
|
|
UINT r;
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
test_file_access(msifile, create);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiDatabaseCommit(hdb);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
test_file_access(msifile, create_commit);
|
|
|
|
MsiCloseHandle(hdb);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
test_file_access(msifile, create_close);
|
|
|
|
DeleteFileA(msifile);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATEDIRECT, &hdb);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
test_file_access(msifile, create);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiDatabaseCommit(hdb);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
test_file_access(msifile, create_commit);
|
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
|
|
|
|
test_file_access(msifile, create_close);
|
|
|
|
DeleteFileA(msifile);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_emptypackage(void)
|
|
|
|
{
|
2009-06-06 15:59:11 +00:00
|
|
|
MSIHANDLE hpkg = 0, hdb = 0, hsuminfo = 0;
|
|
|
|
MSIHANDLE hview = 0, hrec = 0;
|
2008-12-28 10:25:32 +00:00
|
|
|
MSICONDITION condition;
|
|
|
|
CHAR buffer[MAX_PATH];
|
|
|
|
DWORD size;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
r = MsiOpenPackageA("", &hpkg);
|
2012-01-21 17:21:57 +00:00
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
|
|
|
return;
|
|
|
|
}
|
2008-12-28 10:25:32 +00:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
}
|
|
|
|
|
|
|
|
hdb = MsiGetActiveDatabase(hpkg);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(hdb != 0, "Expected a valid database handle\n");
|
|
|
|
}
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `_Tables`", &hview);
|
2008-12-28 10:25:32 +00:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
}
|
|
|
|
r = MsiViewExecute(hview, 0);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiViewFetch(hview, &hrec);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2009-10-25 11:06:38 +00:00
|
|
|
buffer[0] = 0;
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiRecordGetStringA(hrec, 1, buffer, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(buffer, "_Property"),
|
|
|
|
"Expected \"_Property\", got \"%s\"\n", buffer);
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
MsiCloseHandle(hrec);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiViewFetch(hview, &hrec);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
size = MAX_PATH;
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiRecordGetStringA(hrec, 1, buffer, &size);
|
2008-12-28 10:25:32 +00:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(buffer, "#_FolderCache"),
|
|
|
|
"Expected \"_Property\", got \"%s\"\n", buffer);
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
MsiCloseHandle(hrec);
|
|
|
|
MsiViewClose(hview);
|
|
|
|
MsiCloseHandle(hview);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
condition = MsiDatabaseIsTablePersistentA(hdb, "_Property");
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(condition == MSICONDITION_FALSE,
|
|
|
|
"Expected MSICONDITION_FALSE, got %d\n", condition);
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `_Property`", &hview);
|
2008-12-28 10:25:32 +00:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
}
|
|
|
|
r = MsiViewExecute(hview, 0);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* _Property table is not empty */
|
|
|
|
r = MsiViewFetch(hview, &hrec);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
MsiCloseHandle(hrec);
|
|
|
|
MsiViewClose(hview);
|
|
|
|
MsiCloseHandle(hview);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
condition = MsiDatabaseIsTablePersistentA(hdb, "#_FolderCache");
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(condition == MSICONDITION_FALSE,
|
|
|
|
"Expected MSICONDITION_FALSE, got %d\n", condition);
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `#_FolderCache`", &hview);
|
2008-12-28 10:25:32 +00:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
}
|
|
|
|
r = MsiViewExecute(hview, 0);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* #_FolderCache is not empty */
|
|
|
|
r = MsiViewFetch(hview, &hrec);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
MsiCloseHandle(hrec);
|
|
|
|
MsiViewClose(hview);
|
|
|
|
MsiCloseHandle(hview);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `_Streams`", &hview);
|
2008-12-28 10:25:32 +00:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_BAD_QUERY_SYNTAX,
|
|
|
|
"Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDatabaseOpenViewA(hdb, "SELECT * FROM `_Storages`", &hview);
|
2008-12-28 10:25:32 +00:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_BAD_QUERY_SYNTAX,
|
|
|
|
"Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetSummaryInformationA(hdb, NULL, 0, &hsuminfo);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_INSTALL_PACKAGE_INVALID,
|
|
|
|
"Expected ERROR_INSTALL_PACKAGE_INVALID, got %d\n", r);
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
MsiCloseHandle(hsuminfo);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiDatabaseCommit(hdb);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
}
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
static void test_MsiGetProductProperty(void)
|
|
|
|
{
|
2017-03-05 20:45:43 +00:00
|
|
|
static const WCHAR prodcode_propW[] = {'P','r','o','d','u','c','t','C','o','d','e',0};
|
|
|
|
static const WCHAR nonexistentW[] = {'I','D','o','n','t','E','x','i','s','t',0};
|
|
|
|
static const WCHAR newpropW[] = {'N','e','w','P','r','o','p','e','r','t','y',0};
|
|
|
|
static const WCHAR appleW[] = {'a','p','p','l','e',0};
|
|
|
|
static const WCHAR emptyW[] = {0};
|
|
|
|
WCHAR valW[MAX_PATH];
|
2008-12-28 10:25:32 +00:00
|
|
|
MSIHANDLE hprod, hdb;
|
|
|
|
CHAR val[MAX_PATH];
|
|
|
|
CHAR path[MAX_PATH];
|
|
|
|
CHAR query[MAX_PATH];
|
|
|
|
CHAR keypath[MAX_PATH*2];
|
|
|
|
CHAR prodcode[MAX_PATH];
|
2017-03-05 20:45:43 +00:00
|
|
|
WCHAR prodcodeW[MAX_PATH];
|
2008-12-28 10:25:32 +00:00
|
|
|
CHAR prod_squashed[MAX_PATH];
|
2017-03-05 20:45:43 +00:00
|
|
|
WCHAR prod_squashedW[MAX_PATH];
|
2008-12-28 10:25:32 +00:00
|
|
|
HKEY prodkey, userkey, props;
|
|
|
|
DWORD size;
|
|
|
|
LONG res;
|
|
|
|
UINT r;
|
2012-01-21 17:21:57 +00:00
|
|
|
REGSAM access = KEY_ALL_ACCESS;
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
GetCurrentDirectoryA(MAX_PATH, path);
|
|
|
|
lstrcatA(path, "\\");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
create_test_guid(prodcode, prod_squashed);
|
2017-03-05 20:45:43 +00:00
|
|
|
MultiByteToWideChar(CP_ACP, 0, prodcode, -1, prodcodeW, MAX_PATH);
|
|
|
|
squash_guid(prodcodeW, prod_squashedW);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
if (is_wow64)
|
|
|
|
access |= KEY_WOW64_64KEY;
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiDatabaseCommit(hdb);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
r = set_summary_info(hdb);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
r = run_query(hdb,
|
|
|
|
"CREATE TABLE `Directory` ( "
|
|
|
|
"`Directory` CHAR(255) NOT NULL, "
|
|
|
|
"`Directory_Parent` CHAR(255), "
|
|
|
|
"`DefaultDir` CHAR(255) NOT NULL "
|
|
|
|
"PRIMARY KEY `Directory`)");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_property_table(hdb);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
sprintf(query, "'ProductCode', '%s'", prodcode);
|
|
|
|
r = add_property_entry(hdb, query);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiDatabaseCommit(hdb);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
|
|
|
|
lstrcatA(keypath, prod_squashed);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL);
|
|
|
|
if (res == ERROR_ACCESS_DENIED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\");
|
|
|
|
lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
|
|
|
|
lstrcatA(keypath, prod_squashed);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &userkey, NULL);
|
2009-01-18 09:03:44 +00:00
|
|
|
if (res == ERROR_ACCESS_DENIED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
|
|
|
RegDeleteKeyA(prodkey, "");
|
|
|
|
RegCloseKey(prodkey);
|
|
|
|
return;
|
|
|
|
}
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
res = RegCreateKeyExA(userkey, "InstallProperties", 0, NULL, 0, access, NULL, &props, NULL);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(val, path);
|
2009-12-22 09:14:17 +00:00
|
|
|
lstrcatA(val, "\\");
|
|
|
|
lstrcatA(val, msifile);
|
2008-12-28 10:25:32 +00:00
|
|
|
res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
|
|
|
|
(const BYTE *)val, lstrlenA(val) + 1);
|
|
|
|
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
hprod = 0xdeadbeef;
|
|
|
|
r = MsiOpenProductA(prodcode, &hprod);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(hprod != 0 && hprod != 0xdeadbeef, "Expected a valid product handle\n");
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* hProduct is invalid */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(val, "apple");
|
|
|
|
r = MsiGetProductPropertyA(0xdeadbeef, "ProductCode", val, &size);
|
|
|
|
ok(r == ERROR_INVALID_HANDLE,
|
|
|
|
"Expected ERROR_INVALID_HANDLE, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(val, "apple"),
|
|
|
|
"Expected val to be unchanged, got \"%s\"\n", val);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
2017-03-05 20:45:43 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyW(valW, appleW);
|
|
|
|
r = MsiGetProductPropertyW(0xdeadbeef, prodcode_propW, valW, &size);
|
|
|
|
ok(r == ERROR_INVALID_HANDLE,
|
|
|
|
"Expected ERROR_INVALID_HANDLE, got %d\n", r);
|
|
|
|
ok(!lstrcmpW(valW, appleW),
|
|
|
|
"Expected val to be unchanged, got %s\n", wine_dbgstr_w(valW));
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* szProperty is NULL */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(val, "apple");
|
|
|
|
r = MsiGetProductPropertyA(hprod, NULL, val, &size);
|
|
|
|
ok(r == ERROR_INVALID_PARAMETER,
|
|
|
|
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(val, "apple"),
|
|
|
|
"Expected val to be unchanged, got \"%s\"\n", val);
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
2017-03-05 20:45:43 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyW(valW, appleW);
|
|
|
|
r = MsiGetProductPropertyW(hprod, NULL, valW, &size);
|
|
|
|
ok(r == ERROR_INVALID_PARAMETER,
|
|
|
|
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
|
|
|
ok(!lstrcmpW(valW, appleW),
|
|
|
|
"Expected val to be unchanged, got %s\n", wine_dbgstr_w(valW));
|
|
|
|
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* szProperty is empty */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(val, "apple");
|
|
|
|
r = MsiGetProductPropertyA(hprod, "", val, &size);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2017-03-05 20:45:43 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyW(valW, appleW);
|
|
|
|
r = MsiGetProductPropertyW(hprod, emptyW, valW, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(*valW == 0, "Expected \"\", got %s\n", wine_dbgstr_w(valW));
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* get the property */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(val, "apple");
|
|
|
|
r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(val, prodcode),
|
|
|
|
"Expected \"%s\", got \"%s\"\n", prodcode, val);
|
|
|
|
ok(size == lstrlenA(prodcode),
|
|
|
|
"Expected %d, got %d\n", lstrlenA(prodcode), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2017-03-05 20:45:43 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyW(valW, appleW);
|
|
|
|
r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpW(valW, prodcodeW),
|
|
|
|
"Expected %s, got %s\n", wine_dbgstr_w(prodcodeW), wine_dbgstr_w(valW));
|
|
|
|
ok(size == lstrlenW(prodcodeW),
|
|
|
|
"Expected %d, got %d\n", lstrlenW(prodcodeW), size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* lpValueBuf is NULL */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiGetProductPropertyA(hprod, "ProductCode", NULL, &size);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(size == lstrlenA(prodcode),
|
|
|
|
"Expected %d, got %d\n", lstrlenA(prodcode), size);
|
|
|
|
|
2017-03-05 20:45:43 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetProductPropertyW(hprod, prodcode_propW, NULL, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(size == lstrlenW(prodcodeW),
|
|
|
|
"Expected %d, got %d\n", lstrlenW(prodcodeW), size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* pcchValueBuf is NULL */
|
|
|
|
lstrcpyA(val, "apple");
|
|
|
|
r = MsiGetProductPropertyA(hprod, "ProductCode", val, NULL);
|
|
|
|
ok(r == ERROR_INVALID_PARAMETER,
|
|
|
|
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(val, "apple"),
|
|
|
|
"Expected val to be unchanged, got \"%s\"\n", val);
|
|
|
|
ok(size == lstrlenA(prodcode),
|
|
|
|
"Expected %d, got %d\n", lstrlenA(prodcode), size);
|
|
|
|
|
2017-03-05 20:45:43 +00:00
|
|
|
lstrcpyW(valW, appleW);
|
|
|
|
r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, NULL);
|
|
|
|
ok(r == ERROR_INVALID_PARAMETER,
|
|
|
|
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
|
|
|
ok(!lstrcmpW(valW, appleW),
|
|
|
|
"Expected val to be unchanged, got %s\n", wine_dbgstr_w(valW));
|
|
|
|
ok(size == lstrlenW(prodcodeW),
|
|
|
|
"Expected %d, got %d\n", lstrlenW(prodcodeW), size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* pcchValueBuf is too small */
|
|
|
|
size = 4;
|
|
|
|
lstrcpyA(val, "apple");
|
|
|
|
r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
|
|
|
|
ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
|
|
|
|
ok(!strncmp(val, prodcode, 3),
|
|
|
|
"Expected first 3 chars of \"%s\", got \"%s\"\n", prodcode, val);
|
|
|
|
ok(size == lstrlenA(prodcode),
|
|
|
|
"Expected %d, got %d\n", lstrlenA(prodcode), size);
|
|
|
|
|
2017-03-05 20:45:43 +00:00
|
|
|
size = 4;
|
|
|
|
lstrcpyW(valW, appleW);
|
|
|
|
r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, &size);
|
|
|
|
ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
|
|
|
|
ok(!memcmp(valW, prodcodeW, 3 * sizeof(WCHAR)),
|
|
|
|
"Expected first 3 chars of %s, got %s\n", wine_dbgstr_w(prodcodeW), wine_dbgstr_w(valW));
|
|
|
|
ok(size == lstrlenW(prodcodeW),
|
|
|
|
"Expected %d, got %d\n", lstrlenW(prodcodeW), size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* pcchValueBuf does not leave room for NULL terminator */
|
|
|
|
size = lstrlenA(prodcode);
|
|
|
|
lstrcpyA(val, "apple");
|
|
|
|
r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
|
|
|
|
ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
|
|
|
|
ok(!strncmp(val, prodcode, lstrlenA(prodcode) - 1),
|
|
|
|
"Expected first 37 chars of \"%s\", got \"%s\"\n", prodcode, val);
|
|
|
|
ok(size == lstrlenA(prodcode),
|
|
|
|
"Expected %d, got %d\n", lstrlenA(prodcode), size);
|
|
|
|
|
2017-03-05 20:45:43 +00:00
|
|
|
size = lstrlenW(prodcodeW);
|
|
|
|
lstrcpyW(valW, appleW);
|
|
|
|
r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, &size);
|
|
|
|
ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
|
|
|
|
ok(!memcmp(valW, prodcodeW, lstrlenW(prodcodeW) - 1),
|
|
|
|
"Expected first 37 chars of %s, got %s\n", wine_dbgstr_w(prodcodeW), wine_dbgstr_w(valW));
|
|
|
|
ok(size == lstrlenW(prodcodeW),
|
|
|
|
"Expected %d, got %d\n", lstrlenW(prodcodeW), size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* pcchValueBuf has enough room for NULL terminator */
|
|
|
|
size = lstrlenA(prodcode) + 1;
|
|
|
|
lstrcpyA(val, "apple");
|
|
|
|
r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(val, prodcode),
|
|
|
|
"Expected \"%s\", got \"%s\"\n", prodcode, val);
|
|
|
|
ok(size == lstrlenA(prodcode),
|
|
|
|
"Expected %d, got %d\n", lstrlenA(prodcode), size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2017-03-05 20:45:43 +00:00
|
|
|
size = lstrlenW(prodcodeW) + 1;
|
|
|
|
lstrcpyW(valW, appleW);
|
|
|
|
r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpW(valW, prodcodeW),
|
|
|
|
"Expected %s, got %s\n", wine_dbgstr_w(prodcodeW), wine_dbgstr_w(valW));
|
|
|
|
ok(size == lstrlenW(prodcodeW),
|
|
|
|
"Expected %d, got %d\n", lstrlenW(prodcodeW), size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* nonexistent property */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(val, "apple");
|
|
|
|
r = MsiGetProductPropertyA(hprod, "IDontExist", val, &size);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2017-03-05 20:45:43 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyW(valW, appleW);
|
|
|
|
r = MsiGetProductPropertyW(hprod, nonexistentW, valW, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpW(valW, emptyW), "Expected \"\", got %s\n", wine_dbgstr_w(valW));
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiSetPropertyA(hprod, "NewProperty", "value");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* non-product property set */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(val, "apple");
|
|
|
|
r = MsiGetProductPropertyA(hprod, "NewProperty", val, &size);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
2008-02-10 13:22:36 +00:00
|
|
|
|
2017-03-05 20:45:43 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyW(valW, appleW);
|
|
|
|
r = MsiGetProductPropertyW(hprod, newpropW, valW, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpW(valW, emptyW), "Expected \"\", got %s\n", wine_dbgstr_w(valW));
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
r = MsiSetPropertyA(hprod, "ProductCode", "value");
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
/* non-product property that is also a product property set */
|
2008-02-10 13:22:36 +00:00
|
|
|
size = MAX_PATH;
|
2008-12-28 10:25:32 +00:00
|
|
|
lstrcpyA(val, "apple");
|
|
|
|
r = MsiGetProductPropertyA(hprod, "ProductCode", val, &size);
|
2008-02-10 13:22:36 +00:00
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
2008-12-28 10:25:32 +00:00
|
|
|
ok(!lstrcmpA(val, prodcode),
|
|
|
|
"Expected \"%s\", got \"%s\"\n", prodcode, val);
|
|
|
|
ok(size == lstrlenA(prodcode),
|
|
|
|
"Expected %d, got %d\n", lstrlenA(prodcode), size);
|
|
|
|
|
2017-03-05 20:45:43 +00:00
|
|
|
size = MAX_PATH;
|
|
|
|
lstrcpyW(valW, appleW);
|
|
|
|
r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpW(valW, prodcodeW),
|
|
|
|
"Expected %s, got %s\n", wine_dbgstr_w(prodcodeW), wine_dbgstr_w(valW));
|
|
|
|
ok(size == lstrlenW(prodcodeW),
|
|
|
|
"Expected %d, got %d\n", lstrlenW(prodcodeW), size);
|
|
|
|
|
2008-12-28 10:25:32 +00:00
|
|
|
MsiCloseHandle(hprod);
|
|
|
|
|
|
|
|
RegDeleteValueA(props, "LocalPackage");
|
2012-01-21 17:21:57 +00:00
|
|
|
delete_key(props, "", access);
|
2008-12-28 10:25:32 +00:00
|
|
|
RegCloseKey(props);
|
2012-01-21 17:21:57 +00:00
|
|
|
delete_key(userkey, "", access);
|
2008-12-28 10:25:32 +00:00
|
|
|
RegCloseKey(userkey);
|
2012-01-21 17:21:57 +00:00
|
|
|
delete_key(prodkey, "", access);
|
2008-12-28 10:25:32 +00:00
|
|
|
RegCloseKey(prodkey);
|
2007-03-06 11:59:18 +00:00
|
|
|
DeleteFileA(msifile);
|
|
|
|
}
|
|
|
|
|
2009-05-17 07:05:22 +00:00
|
|
|
static void test_MsiSetProperty(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hpkg, hdb, hrec;
|
|
|
|
CHAR buf[MAX_PATH];
|
|
|
|
LPCSTR query;
|
|
|
|
DWORD size;
|
|
|
|
UINT r;
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
r = package_from_db(create_package_db(), &hpkg);
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
2014-04-23 14:49:34 +00:00
|
|
|
DeleteFileA(msifile);
|
2012-01-21 17:21:57 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected a valid package %u\n", r);
|
2009-05-17 07:05:22 +00:00
|
|
|
|
|
|
|
/* invalid hInstall */
|
|
|
|
r = MsiSetPropertyA(0, "Prop", "Val");
|
|
|
|
ok(r == ERROR_INVALID_HANDLE,
|
|
|
|
"Expected ERROR_INVALID_HANDLE, got %d\n", r);
|
|
|
|
|
|
|
|
/* invalid hInstall */
|
|
|
|
r = MsiSetPropertyA(0xdeadbeef, "Prop", "Val");
|
|
|
|
ok(r == ERROR_INVALID_HANDLE,
|
|
|
|
"Expected ERROR_INVALID_HANDLE, got %d\n", r);
|
|
|
|
|
|
|
|
/* szName is NULL */
|
|
|
|
r = MsiSetPropertyA(hpkg, NULL, "Val");
|
|
|
|
ok(r == ERROR_INVALID_PARAMETER,
|
|
|
|
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
|
|
|
|
|
|
|
/* both szName and szValue are NULL */
|
|
|
|
r = MsiSetPropertyA(hpkg, NULL, NULL);
|
|
|
|
ok(r == ERROR_INVALID_PARAMETER,
|
|
|
|
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
|
|
|
|
|
|
|
/* szName is empty */
|
|
|
|
r = MsiSetPropertyA(hpkg, "", "Val");
|
|
|
|
ok(r == ERROR_FUNCTION_FAILED,
|
|
|
|
"Expected ERROR_FUNCTION_FAILED, got %d\n", r);
|
|
|
|
|
|
|
|
/* szName is empty and szValue is NULL */
|
|
|
|
r = MsiSetPropertyA(hpkg, "", NULL);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
/* set a property */
|
|
|
|
r = MsiSetPropertyA(hpkg, "Prop", "Val");
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
/* get the property */
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(buf, "Val"), "Expected \"Val\", got \"%s\"\n", buf);
|
|
|
|
ok(size == 3, "Expected 3, got %d\n", size);
|
|
|
|
|
|
|
|
/* update the property */
|
|
|
|
r = MsiSetPropertyA(hpkg, "Prop", "Nuvo");
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
/* get the property */
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(buf, "Nuvo"), "Expected \"Nuvo\", got \"%s\"\n", buf);
|
|
|
|
ok(size == 4, "Expected 4, got %d\n", size);
|
|
|
|
|
|
|
|
hdb = MsiGetActiveDatabase(hpkg);
|
|
|
|
ok(hdb != 0, "Expected a valid database handle\n");
|
|
|
|
|
|
|
|
/* set prop is not in the _Property table */
|
|
|
|
query = "SELECT * FROM `_Property` WHERE `Property` = 'Prop'";
|
|
|
|
r = do_query(hdb, query, &hrec);
|
|
|
|
ok(r == ERROR_BAD_QUERY_SYNTAX,
|
|
|
|
"Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
|
|
|
|
|
|
|
|
/* set prop is not in the Property table */
|
|
|
|
query = "SELECT * FROM `Property` WHERE `Property` = 'Prop'";
|
|
|
|
r = do_query(hdb, query, &hrec);
|
|
|
|
ok(r == ERROR_BAD_QUERY_SYNTAX,
|
|
|
|
"Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r);
|
|
|
|
|
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
|
|
|
|
/* szValue is an empty string */
|
|
|
|
r = MsiSetPropertyA(hpkg, "Prop", "");
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
/* try to get the property */
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
|
|
|
|
|
|
|
/* reset the property */
|
|
|
|
r = MsiSetPropertyA(hpkg, "Prop", "BlueTap");
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
/* delete the property */
|
|
|
|
r = MsiSetPropertyA(hpkg, "Prop", NULL);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
/* try to get the property */
|
|
|
|
size = MAX_PATH;
|
|
|
|
r = MsiGetPropertyA(hpkg, "Prop", buf, &size);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
|
|
|
|
ok(size == 0, "Expected 0, got %d\n", size);
|
|
|
|
|
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
DeleteFileA(msifile);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_MsiApplyMultiplePatches(void)
|
|
|
|
{
|
2014-04-23 14:49:34 +00:00
|
|
|
UINT r, type = GetDriveTypeW(NULL);
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2017-10-08 08:15:09 +00:00
|
|
|
r = MsiApplyMultiplePatchesA(NULL, NULL, NULL);
|
2009-05-17 07:05:22 +00:00
|
|
|
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
|
|
|
|
|
2017-10-08 08:15:09 +00:00
|
|
|
r = MsiApplyMultiplePatchesA("", NULL, NULL);
|
2009-05-17 07:05:22 +00:00
|
|
|
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
|
|
|
|
|
2017-10-08 08:15:09 +00:00
|
|
|
r = MsiApplyMultiplePatchesA(";", NULL, NULL);
|
2012-01-21 17:21:57 +00:00
|
|
|
if (type == DRIVE_FIXED)
|
|
|
|
todo_wine ok(r == ERROR_PATH_NOT_FOUND, "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
|
|
|
|
else
|
|
|
|
ok(r == ERROR_INVALID_NAME, "Expected ERROR_INVALID_NAME, got %u\n", r);
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2017-10-08 08:15:09 +00:00
|
|
|
r = MsiApplyMultiplePatchesA(" ;", NULL, NULL);
|
2012-01-21 17:21:57 +00:00
|
|
|
if (type == DRIVE_FIXED)
|
|
|
|
todo_wine ok(r == ERROR_PATCH_PACKAGE_OPEN_FAILED, "Expected ERROR_PATCH_PACKAGE_OPEN_FAILED, got %u\n", r);
|
|
|
|
else
|
|
|
|
ok(r == ERROR_INVALID_NAME, "Expected ERROR_INVALID_NAME, got %u\n", r);
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2017-10-08 08:15:09 +00:00
|
|
|
r = MsiApplyMultiplePatchesA(";;", NULL, NULL);
|
2012-01-21 17:21:57 +00:00
|
|
|
if (type == DRIVE_FIXED)
|
|
|
|
todo_wine ok(r == ERROR_PATH_NOT_FOUND, "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
|
|
|
|
else
|
|
|
|
ok(r == ERROR_INVALID_NAME, "Expected ERROR_INVALID_NAME, got %u\n", r);
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2017-10-08 08:15:09 +00:00
|
|
|
r = MsiApplyMultiplePatchesA("nosuchpatchpackage;", NULL, NULL);
|
2009-05-17 07:05:22 +00:00
|
|
|
todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
|
|
|
|
|
2017-10-08 08:15:09 +00:00
|
|
|
r = MsiApplyMultiplePatchesA(";nosuchpatchpackage", NULL, NULL);
|
2012-01-21 17:21:57 +00:00
|
|
|
if (type == DRIVE_FIXED)
|
|
|
|
todo_wine ok(r == ERROR_PATH_NOT_FOUND, "Expected ERROR_PATH_NOT_FOUND, got %u\n", r);
|
|
|
|
else
|
|
|
|
ok(r == ERROR_INVALID_NAME, "Expected ERROR_INVALID_NAME, got %u\n", r);
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2017-10-08 08:15:09 +00:00
|
|
|
r = MsiApplyMultiplePatchesA("nosuchpatchpackage;nosuchpatchpackage", NULL, NULL);
|
2009-05-17 07:05:22 +00:00
|
|
|
todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
|
|
|
|
|
2017-10-08 08:15:09 +00:00
|
|
|
r = MsiApplyMultiplePatchesA(" nosuchpatchpackage ; nosuchpatchpackage ", NULL, NULL);
|
2009-05-17 07:05:22 +00:00
|
|
|
todo_wine ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_MsiApplyPatch(void)
|
|
|
|
{
|
|
|
|
UINT r;
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiApplyPatchA(NULL, NULL, INSTALLTYPE_DEFAULT, NULL);
|
2009-05-17 07:05:22 +00:00
|
|
|
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiApplyPatchA("", NULL, INSTALLTYPE_DEFAULT, NULL);
|
2009-05-17 07:05:22 +00:00
|
|
|
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r);
|
|
|
|
}
|
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
static void test_MsiEnumComponentCosts(void)
|
|
|
|
{
|
|
|
|
MSIHANDLE hdb, hpkg;
|
|
|
|
char package[12], drive[3];
|
|
|
|
DWORD len;
|
|
|
|
UINT r;
|
|
|
|
int cost, temp;
|
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok( hdb, "failed to create database\n" );
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_property_table( hdb );
|
|
|
|
add_property_entry( hdb, "'ProductCode', '{379B1C47-40C1-42FA-A9BB-BEBB6F1B0172}'" );
|
|
|
|
add_property_entry( hdb, "'MSIFASTINSTALL', '1'" );
|
|
|
|
add_directory_entry( hdb, "'TARGETDIR', '', 'SourceDir'" );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_media_table( hdb );
|
|
|
|
add_media_entry( hdb, "'1', '2', 'cabinet', '', '', ''");
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_file_table( hdb );
|
|
|
|
add_file_entry( hdb, "'one.txt', 'one', 'one.txt', 4096, '', '', 8192, 1" );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_component_table( hdb );
|
|
|
|
add_component_entry( hdb, "'one', '{B2F86B9D-8447-4BC5-8883-750C45AA31CA}', 'TARGETDIR', 0, '', 'one.txt'" );
|
|
|
|
add_component_entry( hdb, "'two', '{62A09F6E-0B74-4829-BDB7-CAB66F42CCE8}', 'TARGETDIR', 0, '', ''" );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_feature_table( hdb );
|
|
|
|
add_feature_entry( hdb, "'one', '', '', '', 0, 1, '', 0" );
|
|
|
|
add_feature_entry( hdb, "'two', '', '', '', 0, 1, '', 0" );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_feature_components_table( hdb );
|
|
|
|
add_feature_components_entry( hdb, "'one', 'one'" );
|
|
|
|
add_feature_components_entry( hdb, "'two', 'two'" );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_install_execute_sequence_table( hdb );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'CostInitialize', '', '800'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'FileCost', '', '900'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'CostFinalize', '', '1000'" );
|
|
|
|
add_install_execute_sequence_entry( hdb, "'InstallValidate', '', '1100'" );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
r = MsiDatabaseCommit( hdb );
|
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
|
2012-01-21 17:21:57 +00:00
|
|
|
|
|
|
|
sprintf( package, "#%u", hdb );
|
|
|
|
r = MsiOpenPackageA( package, &hpkg );
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
|
|
|
|
|
|
|
|
r = MsiEnumComponentCostsA( 0, NULL, 0, INSTALLSTATE_UNKNOWN, NULL, NULL, NULL, NULL );
|
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
|
|
|
|
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, NULL, 0, INSTALLSTATE_UNKNOWN, NULL, NULL, NULL, NULL );
|
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
|
|
|
|
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, NULL, 0, INSTALLSTATE_UNKNOWN, NULL, NULL, NULL, NULL );
|
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
|
|
|
|
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "", 0, INSTALLSTATE_UNKNOWN, NULL, NULL, NULL, NULL );
|
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
|
|
|
|
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_UNKNOWN, NULL, NULL, NULL, NULL );
|
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
|
|
|
|
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, NULL, NULL, NULL, NULL );
|
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
|
|
|
|
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, NULL, NULL, NULL );
|
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
|
|
|
|
|
|
|
|
len = sizeof(drive);
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, &len, NULL, NULL );
|
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
|
|
|
|
|
|
|
|
len = sizeof(drive);
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, NULL );
|
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
|
|
|
|
|
|
|
|
len = sizeof(drive);
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
|
|
|
|
todo_wine ok( r == ERROR_INVALID_HANDLE_STATE, "Expected ERROR_INVALID_HANDLE_STATE, got %u\n", r );
|
|
|
|
|
|
|
|
len = sizeof(drive);
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, NULL, &len, &cost, &temp );
|
|
|
|
ok( r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %u\n", r );
|
|
|
|
|
|
|
|
MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostInitialize" );
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "CostInitialize failed %u\n", r );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "FileCost" );
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "FileCost failed %u\n", r );
|
|
|
|
|
|
|
|
len = sizeof(drive);
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
|
|
|
|
ok( r == ERROR_FUNCTION_NOT_CALLED, "Expected ERROR_FUNCTION_NOT_CALLED, got %u\n", r );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "CostFinalize" );
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "CostFinalize failed %u\n", r );
|
|
|
|
|
|
|
|
/* contrary to what msdn says InstallValidate must be called too */
|
|
|
|
len = sizeof(drive);
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
|
|
|
|
todo_wine ok( r == ERROR_FUNCTION_NOT_CALLED, "Expected ERROR_FUNCTION_NOT_CALLED, got %u\n", r );
|
|
|
|
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiDoActionA( hpkg, "InstallValidate" );
|
2012-01-21 17:21:57 +00:00
|
|
|
ok( r == ERROR_SUCCESS, "InstallValidate failed %u\n", r );
|
|
|
|
|
|
|
|
len = 0;
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "three", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
|
|
|
|
ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %u\n", r );
|
|
|
|
|
|
|
|
len = 0;
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
|
|
|
|
ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %u\n", r );
|
|
|
|
ok( len == 2, "expected len == 2, got %u\n", len );
|
|
|
|
|
|
|
|
len = 2;
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
|
|
|
|
ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %u\n", r );
|
|
|
|
ok( len == 2, "expected len == 2, got %u\n", len );
|
|
|
|
|
|
|
|
len = 2;
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_UNKNOWN, drive, &len, &cost, &temp );
|
|
|
|
ok( r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %u\n", r );
|
|
|
|
ok( len == 2, "expected len == 2, got %u\n", len );
|
|
|
|
|
|
|
|
/* install state doesn't seem to matter */
|
|
|
|
len = sizeof(drive);
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_UNKNOWN, drive, &len, &cost, &temp );
|
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
|
|
|
|
|
|
|
|
len = sizeof(drive);
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_ABSENT, drive, &len, &cost, &temp );
|
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
|
|
|
|
|
|
|
|
len = sizeof(drive);
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_SOURCE, drive, &len, &cost, &temp );
|
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
|
|
|
|
|
|
|
|
len = sizeof(drive);
|
|
|
|
drive[0] = 0;
|
|
|
|
cost = temp = 0xdead;
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "one", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
|
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
|
|
|
|
ok( len == 2, "expected len == 2, got %u\n", len );
|
|
|
|
ok( drive[0], "expected a drive\n" );
|
|
|
|
ok( cost && cost != 0xdead, "expected cost > 0, got %d\n", cost );
|
|
|
|
ok( !temp, "expected temp == 0, got %d\n", temp );
|
|
|
|
|
|
|
|
len = sizeof(drive);
|
|
|
|
drive[0] = 0;
|
|
|
|
cost = temp = 0xdead;
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "two", 0, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
|
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
|
|
|
|
ok( len == 2, "expected len == 2, got %u\n", len );
|
|
|
|
ok( drive[0], "expected a drive\n" );
|
|
|
|
ok( !cost, "expected cost == 0, got %d\n", cost );
|
|
|
|
ok( !temp, "expected temp == 0, got %d\n", temp );
|
|
|
|
|
|
|
|
len = sizeof(drive);
|
|
|
|
drive[0] = 0;
|
|
|
|
cost = temp = 0xdead;
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "", 0, INSTALLSTATE_UNKNOWN, drive, &len, &cost, &temp );
|
|
|
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r );
|
|
|
|
ok( len == 2, "expected len == 2, got %u\n", len );
|
|
|
|
ok( drive[0], "expected a drive\n" );
|
|
|
|
ok( !cost, "expected cost == 0, got %d\n", cost );
|
|
|
|
ok( temp && temp != 0xdead, "expected temp > 0, got %d\n", temp );
|
|
|
|
|
|
|
|
/* increased index */
|
|
|
|
len = sizeof(drive);
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "one", 1, INSTALLSTATE_LOCAL, drive, &len, &cost, &temp );
|
|
|
|
ok( r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %u\n", r );
|
|
|
|
|
|
|
|
len = sizeof(drive);
|
|
|
|
r = MsiEnumComponentCostsA( hpkg, "", 1, INSTALLSTATE_UNKNOWN, drive, &len, &cost, &temp );
|
|
|
|
ok( r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %u\n", r );
|
|
|
|
|
|
|
|
MsiCloseHandle( hpkg );
|
|
|
|
error:
|
|
|
|
MsiCloseHandle( hdb );
|
|
|
|
DeleteFileA( msifile );
|
|
|
|
}
|
|
|
|
|
2012-05-14 21:41:45 +00:00
|
|
|
static void test_MsiDatabaseCommit(void)
|
|
|
|
{
|
|
|
|
UINT r;
|
|
|
|
MSIHANDLE hdb, hpkg = 0;
|
|
|
|
char buf[32], package[12];
|
|
|
|
DWORD sz;
|
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok( hdb, "failed to create database\n" );
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_property_table( hdb );
|
2012-05-14 21:41:45 +00:00
|
|
|
|
|
|
|
sprintf( package, "#%u", hdb );
|
2014-04-23 14:49:34 +00:00
|
|
|
r = MsiOpenPackageA( package, &hpkg );
|
2012-05-14 21:41:45 +00:00
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
ok( r == ERROR_SUCCESS, "got %u\n", r );
|
|
|
|
|
|
|
|
r = MsiSetPropertyA( hpkg, "PROP", "value" );
|
|
|
|
ok( r == ERROR_SUCCESS, "got %u\n", r );
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
sz = sizeof(buf);
|
|
|
|
r = MsiGetPropertyA( hpkg, "PROP", buf, &sz );
|
|
|
|
ok( r == ERROR_SUCCESS, "MsiGetPropertyA returned %u\n", r );
|
|
|
|
ok( !lstrcmpA( buf, "value" ), "got \"%s\"\n", buf );
|
|
|
|
|
|
|
|
r = MsiDatabaseCommit( hdb );
|
|
|
|
ok( r == ERROR_SUCCESS, "MsiDatabaseCommit returned %u\n", r );
|
|
|
|
|
|
|
|
buf[0] = 0;
|
|
|
|
sz = sizeof(buf);
|
|
|
|
r = MsiGetPropertyA( hpkg, "PROP", buf, &sz );
|
|
|
|
ok( r == ERROR_SUCCESS, "MsiGetPropertyA returned %u\n", r );
|
|
|
|
ok( !lstrcmpA( buf, "value" ), "got \"%s\"\n", buf );
|
|
|
|
|
|
|
|
MsiCloseHandle( hpkg );
|
|
|
|
error:
|
|
|
|
MsiCloseHandle( hdb );
|
|
|
|
DeleteFileA( msifile );
|
|
|
|
}
|
|
|
|
|
2017-10-08 08:15:09 +00:00
|
|
|
static int externalui_ran;
|
|
|
|
|
|
|
|
static INT CALLBACK externalui_callback(void *context, UINT message_type, LPCSTR message)
|
|
|
|
{
|
|
|
|
externalui_ran = 1;
|
|
|
|
ok(message_type == INSTALLMESSAGE_USER, "expected INSTALLMESSAGE_USER, got %08x\n", message_type);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int externalui_record_ran;
|
|
|
|
|
|
|
|
static INT CALLBACK externalui_record_callback(void *context, UINT message_type, MSIHANDLE hrecord)
|
|
|
|
{
|
|
|
|
INT retval = context ? *((INT *)context) : 0;
|
|
|
|
UINT r;
|
|
|
|
externalui_record_ran = 1;
|
|
|
|
ok(message_type == INSTALLMESSAGE_USER, "expected INSTALLMESSAGE_USER, got %08x\n", message_type);
|
|
|
|
r = MsiRecordGetFieldCount(hrecord);
|
|
|
|
ok(r == 1, "expected 1, got %u\n", r);
|
|
|
|
r = MsiRecordGetInteger(hrecord, 1);
|
|
|
|
ok(r == 12345, "expected 12345, got %u\n", r);
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_externalui(void)
|
|
|
|
{
|
|
|
|
/* test that external UI handlers work correctly */
|
|
|
|
|
|
|
|
INSTALLUI_HANDLERA prev;
|
|
|
|
INSTALLUI_HANDLER_RECORD prev_record;
|
|
|
|
MSIHANDLE hpkg, hrecord;
|
|
|
|
UINT r;
|
|
|
|
INT retval = 0;
|
|
|
|
|
|
|
|
prev = MsiSetExternalUIA(externalui_callback, INSTALLLOGMODE_USER, NULL);
|
|
|
|
|
|
|
|
r = package_from_db(create_package_db(), &hpkg);
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
|
|
|
DeleteFileA(msifile);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected a valid package %u\n", r);
|
|
|
|
|
|
|
|
hrecord = MsiCreateRecord(1);
|
|
|
|
ok(hrecord, "Expected a valid record\n");
|
|
|
|
r = MsiRecordSetStringA(hrecord, 0, "test message [1]");
|
|
|
|
ok(r == ERROR_SUCCESS, "MsiSetString failed %u\n", r);
|
|
|
|
r = MsiRecordSetInteger(hrecord, 1, 12345);
|
|
|
|
ok(r == ERROR_SUCCESS, "MsiSetInteger failed %u\n", r);
|
|
|
|
|
|
|
|
externalui_ran = 0;
|
|
|
|
r = MsiProcessMessage(hpkg, INSTALLMESSAGE_USER, hrecord);
|
|
|
|
ok(r == 0, "expected 0, got %u\n", r);
|
|
|
|
ok(externalui_ran == 1, "external UI callback did not run\n");
|
|
|
|
|
|
|
|
prev = MsiSetExternalUIA(prev, 0, NULL);
|
|
|
|
ok(prev == externalui_callback, "wrong callback function %p\n", prev);
|
|
|
|
r = MsiSetExternalUIRecord(externalui_record_callback, INSTALLLOGMODE_USER, &retval, &prev_record);
|
|
|
|
ok(r == ERROR_SUCCESS, "MsiSetExternalUIRecord failed %u\n", r);
|
|
|
|
|
|
|
|
externalui_ran = externalui_record_ran = 0;
|
|
|
|
r = MsiProcessMessage(hpkg, INSTALLMESSAGE_USER, hrecord);
|
|
|
|
ok(r == 0, "expected 0, got %u\n", r);
|
|
|
|
ok(externalui_ran == 0, "external UI callback should not have run\n");
|
|
|
|
ok(externalui_record_ran == 1, "external UI record callback did not run\n");
|
|
|
|
|
|
|
|
MsiSetExternalUIA(externalui_callback, INSTALLLOGMODE_USER, NULL);
|
|
|
|
|
|
|
|
externalui_ran = externalui_record_ran = 0;
|
|
|
|
r = MsiProcessMessage(hpkg, INSTALLMESSAGE_USER, hrecord);
|
|
|
|
ok(r == 0, "expected 0, got %u\n", r);
|
|
|
|
ok(externalui_ran == 1, "external UI callback did not run\n");
|
|
|
|
ok(externalui_record_ran == 1, "external UI record callback did not run\n");
|
|
|
|
|
|
|
|
retval = 1;
|
|
|
|
externalui_ran = externalui_record_ran = 0;
|
|
|
|
r = MsiProcessMessage(hpkg, INSTALLMESSAGE_USER, hrecord);
|
|
|
|
ok(r == 1, "expected 1, got %u\n", r);
|
|
|
|
ok(externalui_ran == 0, "external UI callback should not have run\n");
|
|
|
|
ok(externalui_record_ran == 1, "external UI record callback did not run\n");
|
|
|
|
|
|
|
|
/* filter and context should be kept separately */
|
|
|
|
r = MsiSetExternalUIRecord(externalui_record_callback, INSTALLLOGMODE_ERROR, &retval, &prev_record);
|
|
|
|
ok(r == ERROR_SUCCESS, "MsiSetExternalUIRecord failed %u\n", r);
|
|
|
|
|
|
|
|
externalui_ran = externalui_record_ran = 0;
|
|
|
|
r = MsiProcessMessage(hpkg, INSTALLMESSAGE_USER, hrecord);
|
|
|
|
ok(r == 0, "expected 0, got %u\n", r);
|
|
|
|
ok(externalui_ran == 1, "external UI callback did not run\n");
|
|
|
|
ok(externalui_record_ran == 0, "external UI record callback should not have run\n");
|
|
|
|
|
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
DeleteFileA(msifile);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct externalui_message {
|
|
|
|
UINT message;
|
|
|
|
int field_count;
|
|
|
|
char field[4][100];
|
|
|
|
int match[4]; /* should we test for a match */
|
|
|
|
int optional;
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct externalui_message *sequence;
|
|
|
|
static int sequence_count, sequence_size;
|
|
|
|
|
|
|
|
static void add_message(const struct externalui_message *msg)
|
|
|
|
{
|
|
|
|
if (!sequence)
|
|
|
|
{
|
|
|
|
sequence_size = 10;
|
|
|
|
sequence = HeapAlloc(GetProcessHeap(), 0, sequence_size * sizeof(*sequence));
|
|
|
|
}
|
|
|
|
if (sequence_count == sequence_size)
|
|
|
|
{
|
|
|
|
sequence_size *= 2;
|
|
|
|
sequence = HeapReAlloc(GetProcessHeap(), 0, sequence, sequence_size * sizeof(*sequence));
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(sequence);
|
|
|
|
|
|
|
|
sequence[sequence_count++] = *msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void flush_sequence(void)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, sequence);
|
|
|
|
sequence = NULL;
|
|
|
|
sequence_count = sequence_size = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ok_sequence_(const struct externalui_message *expected, const char *context, BOOL todo,
|
|
|
|
const char *file, int line)
|
|
|
|
{
|
|
|
|
static const struct externalui_message end_of_sequence = {0};
|
|
|
|
const struct externalui_message *actual;
|
|
|
|
int failcount = 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
add_message(&end_of_sequence);
|
|
|
|
|
|
|
|
actual = sequence;
|
|
|
|
|
|
|
|
while (expected->message && actual->message)
|
|
|
|
{
|
|
|
|
if (expected->message == actual->message)
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
if (expected->field_count < actual->field_count)
|
2017-10-08 08:15:09 +00:00
|
|
|
{
|
|
|
|
todo_wine_if (todo)
|
|
|
|
ok_(file, line) (FALSE, "%s: in msg 0x%08x expecting field count %d got %d\n",
|
|
|
|
context, expected->message, expected->field_count, actual->field_count);
|
|
|
|
failcount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i <= actual->field_count; i++)
|
|
|
|
{
|
|
|
|
if (expected->match[i] && strcmp(expected->field[i], actual->field[i]))
|
|
|
|
{
|
|
|
|
todo_wine_if (todo)
|
|
|
|
ok_(file, line) (FALSE, "%s: in msg 0x%08x field %d: expected \"%s\", got \"%s\"\n",
|
|
|
|
context, expected->message, i, expected->field[i], actual->field[i]);
|
|
|
|
failcount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
expected++;
|
|
|
|
actual++;
|
|
|
|
}
|
2018-01-20 11:30:30 +00:00
|
|
|
else if (expected->optional)
|
|
|
|
{
|
|
|
|
expected++;
|
|
|
|
}
|
2017-10-08 08:15:09 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
todo_wine_if (todo)
|
|
|
|
ok_(file, line) (FALSE, "%s: the msg 0x%08x was expected, but got msg 0x%08x instead\n",
|
|
|
|
context, expected->message, actual->message);
|
|
|
|
failcount++;
|
|
|
|
if (todo)
|
|
|
|
goto done;
|
|
|
|
expected++;
|
|
|
|
actual++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (expected->message || actual->message)
|
|
|
|
{
|
|
|
|
todo_wine_if (todo)
|
|
|
|
ok_(file, line) (FALSE, "%s: the msg sequence is not complete: expected %08x - actual %08x\n",
|
|
|
|
context, expected->message, actual->message);
|
|
|
|
failcount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(todo && !failcount) /* succeeded yet marked todo */
|
|
|
|
{
|
|
|
|
todo_wine
|
|
|
|
ok_(file, line)(TRUE, "%s: marked \"todo_wine\" but succeeds\n", context);
|
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
flush_sequence();
|
|
|
|
}
|
|
|
|
|
|
|
|
#define ok_sequence(exp, contx, todo) \
|
|
|
|
ok_sequence_((exp), (contx), (todo), __FILE__, __LINE__)
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
/* don't use PROGRESS, which is timing-dependent,
|
|
|
|
* or SHOWDIALOG, which due to a bug causes a hang on XP */
|
|
|
|
static const INSTALLLOGMODE MSITEST_INSTALLLOGMODE =
|
|
|
|
INSTALLLOGMODE_FATALEXIT |
|
|
|
|
INSTALLLOGMODE_ERROR |
|
|
|
|
INSTALLLOGMODE_WARNING |
|
|
|
|
INSTALLLOGMODE_USER |
|
|
|
|
INSTALLLOGMODE_INFO |
|
|
|
|
INSTALLLOGMODE_FILESINUSE |
|
|
|
|
INSTALLLOGMODE_RESOLVESOURCE |
|
|
|
|
INSTALLLOGMODE_OUTOFDISKSPACE |
|
|
|
|
INSTALLLOGMODE_ACTIONSTART |
|
|
|
|
INSTALLLOGMODE_ACTIONDATA |
|
|
|
|
INSTALLLOGMODE_COMMONDATA |
|
|
|
|
INSTALLLOGMODE_INITIALIZE |
|
|
|
|
INSTALLLOGMODE_TERMINATE |
|
|
|
|
INSTALLLOGMODE_RMFILESINUSE |
|
|
|
|
INSTALLLOGMODE_INSTALLSTART |
|
|
|
|
INSTALLLOGMODE_INSTALLEND;
|
|
|
|
|
2017-10-08 08:15:09 +00:00
|
|
|
static const struct externalui_message empty_sequence[] = {
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message openpackage_nonexistent_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_INITIALIZE, -1},
|
|
|
|
{INSTALLMESSAGE_TERMINATE, -1},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message openpackage_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_INITIALIZE, -1},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "0", "1033", "1252"}, {1, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO|MB_ICONHAND, 0, {""}, {0}},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "0", "1033", "1252"}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "1", "", ""}, {0, 1, 0, 0}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message processmessage_info_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_INFO, 3, {"zero", "one", "two", "three"}, {1, 1, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message processmessage_actionstart_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "name", "description", "template"}, {0, 1, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message processmessage_actiondata_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_ACTIONDATA, 3, {"{{name: }}template", "cherry", "banana", "guava"}, {1, 1, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message processmessage_error_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_USER, 3, {"", "1311", "banana", "guava"}, {0, 1, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message processmessage_internal_error_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_INFO, 3, {"DEBUG: Error [1]: Action not found: [2]", "2726", "banana", "guava"}, {1, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_USER, 3, {"internal error", "2726", "banana", "guava"}, {1, 1, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message processmessage_error_format_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_USER, 3, {"", "2726", "banana", "guava"}, {0, 1, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message doaction_costinitialize_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "CostInitialize", "cost description", "cost template"}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "CostInitialize", ""}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "CostInitialize", "1"}, {0, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message doaction_custom_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "custom", "description", "template"}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "custom", "1"}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "custom", "0"}, {0, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message doaction_custom_fullui_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "custom", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "custom", ""}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_SHOWDIALOG, 0, {"custom"}, {1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "custom", "1"}, {0, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message doaction_custom_cancel_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "custom", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message doaction_dialog_nonexistent_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "custom", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "custom", "1"}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_SHOWDIALOG, 0, {"custom"}, {1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"DEBUG: Error [1]: Action not found: [2]", "2726", "custom"}, {1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "2726", "custom"}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "custom", "0"}, {0, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message doaction_dialog_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "dialog", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "dialog", "0"}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_SHOWDIALOG, 0, {"dialog"}, {1}},
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 2, {"", "dialog", "Dialog created"}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "dialog", "1"}, {0, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message doaction_dialog_error_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "error", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "error", "1"}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_SHOWDIALOG, 0, {"error"}, {1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message doaction_dialog_3_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "dialog", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "dialog", "0"}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_SHOWDIALOG, 0, {"dialog"}, {1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "dialog", "3"}, {0, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message doaction_dialog_12345_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "dialog", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "dialog", "3"}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_SHOWDIALOG, 0, {"dialog"}, {1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "dialog", "12345"}, {0, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message closehandle_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_TERMINATE, -1},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static INT CALLBACK externalui_message_string_callback(void *context, UINT message, LPCSTR string)
|
|
|
|
{
|
|
|
|
INT retval = context ? *((INT *)context) : 0;
|
|
|
|
struct externalui_message msg;
|
|
|
|
|
|
|
|
msg.message = message;
|
|
|
|
msg.field_count = 0;
|
|
|
|
strcpy(msg.field[0], string);
|
|
|
|
add_message(&msg);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static INT CALLBACK externalui_message_callback(void *context, UINT message, MSIHANDLE hrecord)
|
|
|
|
{
|
|
|
|
INT retval = context ? *((INT *)context) : 0;
|
|
|
|
struct externalui_message msg;
|
2018-01-20 11:30:30 +00:00
|
|
|
char buffer[256];
|
|
|
|
DWORD length;
|
|
|
|
UINT r;
|
2017-10-08 08:15:09 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
msg.message = message;
|
|
|
|
if (message == INSTALLMESSAGE_TERMINATE)
|
|
|
|
{
|
|
|
|
/* trying to access the record seems to hang on some versions of Windows */
|
|
|
|
msg.field_count = -1;
|
|
|
|
add_message(&msg);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
msg.field_count = MsiRecordGetFieldCount(hrecord);
|
|
|
|
for (i = 0; i <= msg.field_count; i++)
|
|
|
|
{
|
2018-01-20 11:30:30 +00:00
|
|
|
length = sizeof(buffer);
|
|
|
|
r = MsiRecordGetStringA(hrecord, i, buffer, &length);
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
|
2017-10-08 08:15:09 +00:00
|
|
|
memcpy(msg.field[i], buffer, min(100, length+1));
|
|
|
|
}
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
/* top-level actions dump a list of all set properties; skip them since they're inconsistent */
|
|
|
|
if (message == (INSTALLMESSAGE_INFO|MB_ICONHAND) && msg.field_count > 0 && !strncmp(msg.field[0], "Property", 8))
|
|
|
|
return retval;
|
|
|
|
|
2017-10-08 08:15:09 +00:00
|
|
|
add_message(&msg);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_externalui_message(void)
|
|
|
|
{
|
|
|
|
/* test that events trigger the correct sequence of messages */
|
|
|
|
|
|
|
|
INSTALLUI_HANDLER_RECORD prev;
|
|
|
|
MSIHANDLE hdb, hpkg, hrecord;
|
|
|
|
INT retval = 1;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
|
|
|
|
|
|
|
|
MsiSetExternalUIA(externalui_message_string_callback, INSTALLLOGMODE_SHOWDIALOG, &retval);
|
2018-01-20 11:30:30 +00:00
|
|
|
r = MsiSetExternalUIRecord(externalui_message_callback, MSITEST_INSTALLLOGMODE, &retval, &prev);
|
2017-10-08 08:15:09 +00:00
|
|
|
|
|
|
|
flush_sequence();
|
|
|
|
|
|
|
|
CoInitialize(NULL);
|
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok(hdb, "failed to create database\n");
|
|
|
|
|
|
|
|
create_file_data("forcecodepage.idt", "\r\n\r\n1252\t_ForceCodepage\r\n");
|
|
|
|
r = MsiDatabaseImportA(hdb, CURR_DIR, "forcecodepage.idt");
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
r = run_query(hdb, "CREATE TABLE `Error` (`Error` SHORT NOT NULL, `Message` CHAR(0) PRIMARY KEY `Error`)");
|
|
|
|
ok(r == ERROR_SUCCESS, "Failed to create Error table: %u\n", r);
|
|
|
|
r = run_query(hdb, "INSERT INTO `Error` (`Error`, `Message`) VALUES (5, 'internal error')");
|
|
|
|
ok(r == ERROR_SUCCESS, "Failed to insert into Error table: %u\n", r);
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_actiontext_table(hdb);
|
|
|
|
add_actiontext_entry(hdb, "'custom', 'description', 'template'");
|
|
|
|
add_actiontext_entry(hdb, "'CostInitialize', 'cost description', 'cost template'");
|
2017-10-08 08:15:09 +00:00
|
|
|
|
|
|
|
r = MsiOpenPackageA(NULL, &hpkg);
|
|
|
|
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
|
|
|
ok_sequence(empty_sequence, "MsiOpenPackage with NULL db", FALSE);
|
|
|
|
|
|
|
|
r = MsiOpenPackageA("nonexistent", &hpkg);
|
|
|
|
ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", r);
|
|
|
|
ok_sequence(openpackage_nonexistent_sequence, "MsiOpenPackage with nonexistent db", FALSE);
|
|
|
|
|
|
|
|
r = package_from_db(hdb, &hpkg);
|
|
|
|
if (r == ERROR_INSTALL_PACKAGE_REJECTED)
|
|
|
|
{
|
|
|
|
skip("Not enough rights to perform tests\n");
|
|
|
|
DeleteFileA(msifile);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
|
|
|
|
ok_sequence(openpackage_sequence, "MsiOpenPackage with valid db", FALSE);
|
|
|
|
|
|
|
|
/* Test MsiProcessMessage */
|
|
|
|
hrecord = MsiCreateRecord(3);
|
|
|
|
ok(hrecord, "failed to create record\n");
|
|
|
|
|
|
|
|
MsiRecordSetStringA(hrecord, 0, "zero");
|
|
|
|
MsiRecordSetStringA(hrecord, 1, "one");
|
|
|
|
MsiRecordSetStringA(hrecord, 2, "two");
|
|
|
|
MsiRecordSetStringA(hrecord, 3, "three");
|
|
|
|
r = MsiProcessMessage(hpkg, INSTALLMESSAGE_INFO, hrecord);
|
|
|
|
ok(r == 1, "Expected 1, got %d\n", r);
|
|
|
|
ok_sequence(processmessage_info_sequence, "MsiProcessMessage(INSTALLMESSAGE_INFO)", FALSE);
|
|
|
|
|
|
|
|
MsiRecordSetStringA(hrecord, 1, "name");
|
|
|
|
MsiRecordSetStringA(hrecord, 2, "description");
|
|
|
|
MsiRecordSetStringA(hrecord, 3, "template");
|
|
|
|
r = MsiProcessMessage(hpkg, INSTALLMESSAGE_ACTIONSTART, hrecord);
|
|
|
|
ok(r == 1, "Expected 1, got %d\n", r);
|
|
|
|
ok_sequence(processmessage_actionstart_sequence, "MsiProcessMessage(INSTALLMESSAGE_ACTIONSTART)", FALSE);
|
|
|
|
|
|
|
|
MsiRecordSetStringA(hrecord, 0, "apple");
|
|
|
|
MsiRecordSetStringA(hrecord, 1, "cherry");
|
|
|
|
MsiRecordSetStringA(hrecord, 2, "banana");
|
|
|
|
MsiRecordSetStringA(hrecord, 3, "guava");
|
|
|
|
r = MsiProcessMessage(hpkg, INSTALLMESSAGE_ACTIONDATA, hrecord);
|
|
|
|
ok(r == 1, "Expected 1, got %d\n", r);
|
|
|
|
ok_sequence(processmessage_actiondata_sequence, "MsiProcessMessage(INSTALLMESSAGE_ACTIONDATA)", FALSE);
|
|
|
|
|
|
|
|
/* non-internal error */
|
|
|
|
MsiRecordSetStringA(hrecord, 0, NULL);
|
|
|
|
MsiRecordSetInteger(hrecord, 1, 1311);
|
|
|
|
r = MsiProcessMessage(hpkg, INSTALLMESSAGE_USER, hrecord);
|
|
|
|
ok(r == 1, "Expected 1, got %d\n", r);
|
|
|
|
ok_sequence(processmessage_error_sequence, "MsiProcessMessage non-internal error", FALSE);
|
|
|
|
|
|
|
|
/* internal error */
|
|
|
|
MsiRecordSetStringA(hrecord, 0, NULL);
|
|
|
|
MsiRecordSetInteger(hrecord, 1, 2726);
|
|
|
|
r = MsiProcessMessage(hpkg, INSTALLMESSAGE_USER, hrecord);
|
|
|
|
ok(r == 0, "Expected 0, got %d\n", r);
|
|
|
|
ok_sequence(processmessage_internal_error_sequence, "MsiProcessMessage internal error", FALSE);
|
|
|
|
|
|
|
|
/* with format field */
|
|
|
|
MsiRecordSetStringA(hrecord, 0, "starfruit");
|
|
|
|
r = MsiProcessMessage(hpkg, INSTALLMESSAGE_USER, hrecord);
|
|
|
|
ok(r == 1, "Expected 1, got %d\n", r);
|
|
|
|
ok_sequence(processmessage_error_format_sequence, "MsiProcessMessage error", FALSE);
|
|
|
|
|
|
|
|
/* Test a standard action */
|
|
|
|
r = MsiDoActionA(hpkg, "CostInitialize");
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok_sequence(doaction_costinitialize_sequence, "MsiDoAction(\"CostInitialize\")", FALSE);
|
|
|
|
|
|
|
|
/* Test a custom action */
|
|
|
|
r = MsiDoActionA(hpkg, "custom");
|
|
|
|
ok(r == ERROR_FUNCTION_NOT_CALLED, "Expected ERROR_FUNCTION_NOT_CALLED, got %d\n", r);
|
|
|
|
ok_sequence(doaction_custom_sequence, "MsiDoAction(\"custom\")", FALSE);
|
|
|
|
|
|
|
|
/* close the package */
|
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
ok_sequence(closehandle_sequence, "MsiCloseHandle()", FALSE);
|
|
|
|
|
|
|
|
/* Test dialogs */
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok(hdb, "failed to create database\n");
|
|
|
|
|
|
|
|
r = MsiDatabaseImportA(hdb, CURR_DIR, "forcecodepage.idt");
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_dialog_table(hdb);
|
|
|
|
add_dialog_entry(hdb, "'dialog', 50, 50, 100, 100, 0, 'dummy'");
|
2017-10-08 08:15:09 +00:00
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_control_table(hdb);
|
|
|
|
add_control_entry(hdb, "'dialog', 'dummy', 'Text', 5, 5, 5, 5, 3, 'dummy'");
|
2017-10-08 08:15:09 +00:00
|
|
|
|
|
|
|
r = package_from_db(hdb, &hpkg);
|
|
|
|
ok(r == ERROR_SUCCESS, "failed to create package %u\n", r);
|
|
|
|
ok_sequence(openpackage_sequence, "MsiOpenPackage with valid db", FALSE);
|
|
|
|
|
|
|
|
/* Test a custom action */
|
|
|
|
r = MsiDoActionA(hpkg, "custom");
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok_sequence(doaction_custom_fullui_sequence, "MsiDoAction(\"custom\")", FALSE);
|
|
|
|
|
|
|
|
retval = 2;
|
|
|
|
r = MsiDoActionA(hpkg, "custom");
|
|
|
|
ok(r == ERROR_INSTALL_USEREXIT, "Expected ERROR_INSTALL_USEREXIT, got %d\n", r);
|
|
|
|
ok_sequence(doaction_custom_cancel_sequence, "MsiDoAction(\"custom\")", FALSE);
|
|
|
|
|
|
|
|
retval = 0;
|
|
|
|
r = MsiDoActionA(hpkg, "custom");
|
|
|
|
ok(r == ERROR_FUNCTION_NOT_CALLED, "Expected ERROR_FUNCTION_NOT_CALLED, got %d\n", r);
|
|
|
|
ok_sequence(doaction_dialog_nonexistent_sequence, "MsiDoAction(\"custom\")", FALSE);
|
|
|
|
|
|
|
|
r = MsiDoActionA(hpkg, "dialog");
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok_sequence(doaction_dialog_sequence, "MsiDoAction(\"dialog\")", FALSE);
|
|
|
|
|
|
|
|
retval = -1;
|
|
|
|
r = MsiDoActionA(hpkg, "error");
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok_sequence(doaction_dialog_error_sequence, "MsiDoAction(\"error\")", FALSE);
|
|
|
|
|
|
|
|
r = MsiDoActionA(hpkg, "error");
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
ok_sequence(doaction_dialog_error_sequence, "MsiDoAction(\"error\")", FALSE);
|
|
|
|
|
|
|
|
retval = -2;
|
|
|
|
r = MsiDoActionA(hpkg, "custom");
|
|
|
|
ok(r == ERROR_FUNCTION_NOT_CALLED, "Expected ERROR_FUNCTION_NOT_CALLED, got %d\n", r);
|
|
|
|
ok_sequence(doaction_dialog_nonexistent_sequence, "MsiDoAction(\"custom\")", FALSE);
|
|
|
|
|
|
|
|
retval = 3;
|
|
|
|
r = MsiDoActionA(hpkg, "dialog");
|
|
|
|
ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %d\n", r);
|
|
|
|
ok_sequence(doaction_dialog_3_sequence, "MsiDoAction(\"dialog\")", FALSE);
|
|
|
|
|
|
|
|
retval = 12345;
|
|
|
|
r = MsiDoActionA(hpkg, "dialog");
|
|
|
|
ok(r == ERROR_FUNCTION_FAILED, "Expected ERROR_INSTALL_FAILURE, got %d\n", r);
|
|
|
|
ok_sequence(doaction_dialog_12345_sequence, "MsiDoAction(\"dialog\")", FALSE);
|
|
|
|
|
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
ok_sequence(closehandle_sequence, "MsiCloseHandle()", FALSE);
|
|
|
|
|
|
|
|
MsiCloseHandle(hrecord);
|
|
|
|
CoUninitialize();
|
|
|
|
DeleteFileA(msifile);
|
|
|
|
DeleteFileA("forcecodepage.idt");
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct externalui_message controlevent_spawn_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "spawn", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "spawn", ""}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_SHOWDIALOG, 0, {"spawn"}, {1}},
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 2, {"", "spawn", "Dialog created"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "custom", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "custom", ""}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "custom", "1"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 2, {"", "child1", "Dialog created"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "spawn", "2"}, {0, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message controlevent_spawn2_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "spawn2", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "spawn2", "2"}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_SHOWDIALOG, 0, {"spawn2"}, {1}},
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 2, {"", "spawn2", "Dialog created"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "custom", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "custom", "2"}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "custom", "1"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 2, {"", "child2", "Dialog created"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "spawn2", "2"}, {0, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static void test_controlevent(void)
|
|
|
|
{
|
|
|
|
INSTALLUI_HANDLER_RECORD prev;
|
|
|
|
MSIHANDLE hdb, hpkg;
|
|
|
|
UINT r;
|
|
|
|
|
|
|
|
if (!winetest_interactive)
|
|
|
|
{
|
|
|
|
skip("interactive ControlEvent tests\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
|
|
|
|
|
|
|
|
MsiSetExternalUIA(externalui_message_string_callback, INSTALLLOGMODE_SHOWDIALOG, NULL);
|
2018-01-20 11:30:30 +00:00
|
|
|
r = MsiSetExternalUIRecord(externalui_message_callback, MSITEST_INSTALLLOGMODE, NULL, &prev);
|
2017-10-08 08:15:09 +00:00
|
|
|
|
|
|
|
flush_sequence();
|
|
|
|
|
|
|
|
CoInitialize(NULL);
|
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok(hdb, "failed to create database\n");
|
|
|
|
|
|
|
|
create_file_data("forcecodepage.idt", "\r\n\r\n1252\t_ForceCodepage\r\n");
|
|
|
|
r = MsiDatabaseImportA(hdb, CURR_DIR, "forcecodepage.idt");
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
create_dialog_table(hdb);
|
|
|
|
add_dialog_entry(hdb, "'spawn', 50, 50, 100, 100, 3, 'button'");
|
|
|
|
add_dialog_entry(hdb, "'spawn2', 50, 50, 100, 100, 3, 'button'");
|
|
|
|
add_dialog_entry(hdb, "'child1', 50, 50, 80, 40, 3, 'exit'");
|
|
|
|
add_dialog_entry(hdb, "'child2', 50, 50, 80, 40, 3, 'exit'");
|
|
|
|
|
|
|
|
create_control_table(hdb);
|
|
|
|
add_control_entry(hdb, "'spawn', 'button', 'PushButton', 10, 10, 66, 17, 3, 'Click me'");
|
|
|
|
add_control_entry(hdb, "'spawn2', 'button', 'PushButton', 10, 10, 66, 17, 3, 'Click me'");
|
|
|
|
add_control_entry(hdb, "'child1', 'exit', 'PushButton', 10, 10, 66, 17, 3, 'Click me'");
|
|
|
|
add_control_entry(hdb, "'child2', 'exit', 'PushButton', 10, 10, 66, 17, 3, 'Click me'");
|
|
|
|
|
|
|
|
create_controlevent_table(hdb);
|
|
|
|
add_controlevent_entry(hdb, "'child1', 'exit', 'EndDialog', 'Exit', 1, 1");
|
|
|
|
add_controlevent_entry(hdb, "'child2', 'exit', 'EndDialog', 'Exit', 1, 1");
|
|
|
|
|
|
|
|
create_custom_action_table(hdb);
|
|
|
|
add_custom_action_entry(hdb, "'custom', 51, 'dummy', 'dummy value'");
|
2017-10-08 08:15:09 +00:00
|
|
|
|
|
|
|
/* SpawnDialog and EndDialog should trigger after all other events */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_controlevent_entry(hdb, "'spawn', 'button', 'SpawnDialog', 'child1', 1, 1");
|
|
|
|
add_controlevent_entry(hdb, "'spawn', 'button', 'DoAction', 'custom', 1, 2");
|
2017-10-08 08:15:09 +00:00
|
|
|
|
|
|
|
/* Multiple dialog events cause only the last one to be triggered */
|
2018-01-20 11:30:30 +00:00
|
|
|
add_controlevent_entry(hdb, "'spawn2', 'button', 'SpawnDialog', 'child1', 1, 1");
|
|
|
|
add_controlevent_entry(hdb, "'spawn2', 'button', 'SpawnDialog', 'child2', 1, 2");
|
|
|
|
add_controlevent_entry(hdb, "'spawn2', 'button', 'DoAction', 'custom', 1, 3");
|
2017-10-08 08:15:09 +00:00
|
|
|
|
|
|
|
r = package_from_db(hdb, &hpkg);
|
|
|
|
ok(r == ERROR_SUCCESS, "failed to create package: %u\n", r);
|
|
|
|
ok_sequence(openpackage_sequence, "MsiOpenPackage()", FALSE);
|
|
|
|
|
|
|
|
r = MsiDoActionA(hpkg, "spawn");
|
|
|
|
ok(r == ERROR_INSTALL_USEREXIT, "expected ERROR_INSTALL_USEREXIT, got %u\n", r);
|
|
|
|
ok_sequence(controlevent_spawn_sequence, "control event: spawn", FALSE);
|
|
|
|
|
|
|
|
r = MsiDoActionA(hpkg, "spawn2");
|
|
|
|
ok(r == ERROR_INSTALL_USEREXIT, "expected ERROR_INSTALL_USEREXIT, got %u\n", r);
|
|
|
|
ok_sequence(controlevent_spawn2_sequence, "control event: spawn2", FALSE);
|
|
|
|
|
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
ok_sequence(closehandle_sequence, "MsiCloseHandle()", FALSE);
|
|
|
|
|
|
|
|
CoUninitialize();
|
|
|
|
DeleteFileA(msifile);
|
|
|
|
DeleteFileA("forcecodepage.idt");
|
|
|
|
}
|
|
|
|
|
2018-01-20 11:30:30 +00:00
|
|
|
static const struct externalui_message toplevel_install_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "INSTALL", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "INSTALL", ""}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "0", "1033", "1252"}, {1, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "0", "1033", "1252"}, {1, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO|MB_ICONHAND, 0, {""}, {0}},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "0", "1033", "1252"}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "1", "", ""}, {0, 1, 0, 0}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "INSTALL", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "INSTALL", ""}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INSTALLSTART, 2, {"", "", "{7262AC98-EEBD-4364-8CE3-D654F6A425B9}"}, {1, 1, 1}, 1},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "CostInitialize", "", ""}, {0, 1, 0, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "CostInitialize", ""}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "CostInitialize", "1"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "FileCost", "", ""}, {0, 1, 0, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "FileCost", "1"}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "FileCost", "1"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "CostFinalize", "", ""}, {0, 1, 0, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "CostFinalize", "1"}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "CostFinalize", "1"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "INSTALL", "1"}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INSTALLEND, 3, {"", "", "{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "1"}, {1, 1, 1, 1}, 1},
|
|
|
|
|
|
|
|
/* property dump */
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 2, {"", "2", "0"}, {0, 1, 1}, 1},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 2, {"", "2", "1"}, {0, 1, 1}, 1},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "INSTALL", "1"}, {0, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message toplevel_install_ui_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "INSTALL", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "INSTALL", ""}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "AppSearch", "", ""}, {0, 1, 0, 0}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "AppSearch", ""}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "AppSearch", "0"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "INSTALL", "1"}, {0, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message toplevel_executeaction_install_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "ExecuteAction", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "ExecuteAction", "1"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "0", "1033", "1252"}, {1, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "0", "1033", "1252"}, {1, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "0", "1033", "1252"}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "1", "", ""}, {0, 1, 0, 0}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "INSTALL", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "INSTALL", ""}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INSTALLSTART, 2, {"", "", "{7262AC98-EEBD-4364-8CE3-D654F6A425B9}"}, {1, 1, 1}, 1},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "CostInitialize", "", ""}, {0, 1, 0, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "CostInitialize"}, {0, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "CostInitialize", "1"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "FileCost", "", ""}, {0, 1, 0, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "FileCost", "1"}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "FileCost", "1"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "CostFinalize", "", ""}, {0, 1, 0, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "CostFinalize", "1"}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "CostFinalize", "1"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "INSTALL", "1"}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INSTALLEND, 3, {"", "", "{7262AC98-EEBD-4364-8CE3-D654F6A425B9}", "1"}, {1, 1, 1, 1}, 1},
|
|
|
|
|
|
|
|
/* property dump */
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 2, {"", "2", "0"}, {0, 1, 1}, 1},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 2, {"", "2", "1"}, {0, 1, 1}, 1},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "ExecuteAction", "1"}, {0, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message toplevel_executeaction_costinitialize_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "ExecuteAction", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "ExecuteAction", "1"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "0", "1033", "1252"}, {1, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "0", "1033", "1252"}, {1, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "0", "1033", "1252"}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "1", "", ""}, {0, 1, 0, 0}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "CostInitialize", "", ""}, {0, 1, 0, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "CostInitialize", ""}, {0, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "CostInitialize", "1"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
/* property dump */
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 2, {"", "2", "0"}, {0, 1, 1}, 1},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 2, {"", "2", "1"}, {0, 1, 1}, 1},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "ExecuteAction", "1"}, {0, 1, 1}},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message toplevel_msiinstallproduct_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_INITIALIZE, -1},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "0", "1033", "1252"}, {1, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "0", "1033", "1252"}, {1, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO|MB_ICONHAND, 0, {""}, {0}},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "0", "1033", "1252"}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "1", "", ""}, {0, 1, 0, 0}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "INSTALL", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "INSTALL", ""}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "AppSearch", "", ""}, {0, 1, 0, 0}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "AppSearch", ""}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "AppSearch", "0"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "INSTALL", "1"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
/* property dump */
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_INFO|MB_ICONHAND, 0, {""}, {0}},
|
|
|
|
{INSTALLMESSAGE_TERMINATE, -1},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct externalui_message toplevel_msiinstallproduct_custom_sequence[] = {
|
|
|
|
{INSTALLMESSAGE_INITIALIZE, -1},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "0", "1033", "1252"}, {1, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "0", "1033", "1252"}, {1, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO|MB_ICONHAND, 0, {""}, {0}},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "0", "1033", "1252"}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_COMMONDATA, 3, {"", "1", "", ""}, {0, 1, 0, 0}},
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_ACTIONSTART, 3, {"", "CUSTOM", "", ""}, {0, 1, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "CUSTOM", ""}, {0, 1, 1}},
|
|
|
|
{INSTALLMESSAGE_INFO, 2, {"", "CUSTOM", "0"}, {0, 1, 1}},
|
|
|
|
|
|
|
|
/* property dump */
|
|
|
|
|
|
|
|
{INSTALLMESSAGE_INFO|MB_ICONHAND, 0, {""}, {0}},
|
|
|
|
{INSTALLMESSAGE_TERMINATE, -1},
|
|
|
|
{0}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* tests involving top-level actions: INSTALL, ExecuteAction */
|
|
|
|
static void test_top_level_action(void)
|
|
|
|
{
|
|
|
|
INSTALLUI_HANDLER_RECORD prev;
|
|
|
|
MSIHANDLE hdb, hpkg;
|
|
|
|
UINT r;
|
|
|
|
char msifile_absolute[MAX_PATH];
|
|
|
|
|
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
|
|
|
|
|
|
|
|
MsiSetExternalUIA(externalui_message_string_callback, INSTALLLOGMODE_SHOWDIALOG, NULL);
|
|
|
|
r = MsiSetExternalUIRecord(externalui_message_callback, MSITEST_INSTALLLOGMODE, NULL, &prev);
|
|
|
|
|
|
|
|
flush_sequence();
|
|
|
|
|
|
|
|
CoInitialize(NULL);
|
|
|
|
|
|
|
|
hdb = create_package_db();
|
|
|
|
ok(hdb, "failed to create database\n");
|
|
|
|
|
|
|
|
create_file_data("forcecodepage.idt", "\r\n\r\n1252\t_ForceCodepage\r\n");
|
|
|
|
r = MsiDatabaseImportA(hdb, CURR_DIR, "forcecodepage.idt");
|
|
|
|
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
|
|
|
|
|
|
|
create_property_table(hdb);
|
|
|
|
add_property_entry(hdb, "'ProductCode', '{7262AC98-EEBD-4364-8CE3-D654F6A425B9}'");
|
|
|
|
|
|
|
|
create_install_execute_sequence_table(hdb);
|
|
|
|
add_install_execute_sequence_entry(hdb, "'CostInitialize', '', 1");
|
|
|
|
add_install_execute_sequence_entry(hdb, "'FileCost', '', 2");
|
|
|
|
add_install_execute_sequence_entry(hdb, "'CostFinalize', '', 3");
|
|
|
|
|
|
|
|
create_install_ui_sequence_table(hdb);
|
|
|
|
add_install_ui_sequence_entry(hdb, "'AppSearch', '', 1");
|
|
|
|
|
|
|
|
MsiDatabaseCommit(hdb);
|
|
|
|
|
|
|
|
/* for some reason we have to open the package from file using an absolute path */
|
|
|
|
MsiCloseHandle(hdb);
|
|
|
|
GetFullPathNameA(msifile, MAX_PATH, msifile_absolute, NULL);
|
|
|
|
r = MsiOpenPackageA(msifile_absolute, &hpkg);
|
|
|
|
ok(r == ERROR_SUCCESS, "failed to create package: %u\n", r);
|
|
|
|
ok_sequence(openpackage_sequence, "MsiOpenPackage()", FALSE);
|
|
|
|
|
|
|
|
/* test INSTALL */
|
|
|
|
r = MsiDoActionA(hpkg, "INSTALL");
|
|
|
|
ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
|
|
|
|
ok_sequence(toplevel_install_sequence, "INSTALL (no UI)", FALSE);
|
|
|
|
|
|
|
|
/* test INSTALL with reduced+ UI */
|
|
|
|
/* for some reason we need to re-open the package to change the internal UI */
|
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
ok_sequence(closehandle_sequence, "MsiCloseHandle()", FALSE);
|
|
|
|
MsiSetInternalUI(INSTALLUILEVEL_REDUCED, NULL);
|
|
|
|
r = MsiOpenPackageA(msifile_absolute, &hpkg);
|
|
|
|
ok(r == ERROR_SUCCESS, "failed to create package: %u\n", r);
|
|
|
|
ok_sequence(openpackage_sequence, "MsiOpenPackage()", FALSE);
|
|
|
|
|
|
|
|
r = MsiDoActionA(hpkg, "INSTALL");
|
|
|
|
ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
|
|
|
|
ok_sequence(toplevel_install_ui_sequence, "INSTALL (reduced+ UI)", TRUE);
|
|
|
|
|
|
|
|
/* test ExecuteAction with EXECUTEACTION property unset */
|
|
|
|
MsiSetPropertyA(hpkg, "EXECUTEACTION", NULL);
|
|
|
|
r = MsiDoActionA(hpkg, "ExecuteAction");
|
|
|
|
ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
|
|
|
|
ok_sequence(toplevel_executeaction_install_sequence, "ExecuteAction: INSTALL", FALSE);
|
|
|
|
|
|
|
|
/* test ExecuteAction with EXECUTEACTION property set */
|
|
|
|
MsiSetPropertyA(hpkg, "EXECUTEACTION", "CostInitialize");
|
|
|
|
r = MsiDoActionA(hpkg, "ExecuteAction");
|
|
|
|
ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
|
|
|
|
ok_sequence(toplevel_executeaction_costinitialize_sequence, "ExecuteAction: CostInitialize", FALSE);
|
|
|
|
|
|
|
|
MsiCloseHandle(hpkg);
|
|
|
|
ok_sequence(closehandle_sequence, "MsiCloseHandle()", FALSE);
|
|
|
|
|
|
|
|
/* test MsiInstallProduct() */
|
|
|
|
r = MsiInstallProductA(msifile_absolute, NULL);
|
|
|
|
ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
|
|
|
|
ok_sequence(toplevel_msiinstallproduct_sequence, "MsiInstallProduct()", TRUE);
|
|
|
|
|
|
|
|
r = MsiInstallProductA(msifile_absolute, "ACTION=custom");
|
|
|
|
todo_wine
|
|
|
|
ok(r == ERROR_INSTALL_FAILURE, "expected ERROR_INSTALL_FAILURE, got %u\n", r);
|
|
|
|
ok_sequence(toplevel_msiinstallproduct_custom_sequence, "MsiInstallProduct(ACTION=custom)", TRUE);
|
|
|
|
|
|
|
|
CoUninitialize();
|
|
|
|
DeleteFileA(msifile);
|
|
|
|
DeleteFileA("forcecodepage.idt");
|
|
|
|
}
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
START_TEST(package)
|
|
|
|
{
|
2009-10-19 21:11:46 +00:00
|
|
|
STATEMGRSTATUS status;
|
|
|
|
BOOL ret = FALSE;
|
|
|
|
|
2009-06-06 15:59:11 +00:00
|
|
|
init_functionpointers();
|
2009-05-17 07:05:22 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
if (pIsWow64Process)
|
|
|
|
pIsWow64Process(GetCurrentProcess(), &is_wow64);
|
|
|
|
|
2008-02-10 13:22:36 +00:00
|
|
|
GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
|
|
|
|
|
2009-10-19 21:11:46 +00:00
|
|
|
/* Create a restore point ourselves so we circumvent the multitude of restore points
|
|
|
|
* that would have been created by all the installation and removal tests.
|
2012-01-21 17:21:57 +00:00
|
|
|
*
|
|
|
|
* This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
|
|
|
|
* creation of restore points.
|
2009-10-19 21:11:46 +00:00
|
|
|
*/
|
2012-01-21 17:21:57 +00:00
|
|
|
if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
|
2009-10-19 21:11:46 +00:00
|
|
|
{
|
|
|
|
memset(&status, 0, sizeof(status));
|
|
|
|
ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
|
|
|
|
}
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
test_createpackage();
|
|
|
|
test_doaction();
|
|
|
|
test_gettargetpath_bad();
|
|
|
|
test_settargetpath();
|
|
|
|
test_props();
|
2008-02-10 13:22:36 +00:00
|
|
|
test_property_table();
|
2007-03-06 11:59:18 +00:00
|
|
|
test_condition();
|
|
|
|
test_msipackage();
|
|
|
|
test_formatrecord2();
|
2018-01-20 11:30:30 +00:00
|
|
|
test_formatrecord_tables();
|
2007-03-06 11:59:18 +00:00
|
|
|
test_states();
|
|
|
|
test_getproperty();
|
|
|
|
test_removefiles();
|
|
|
|
test_appsearch();
|
2008-12-28 10:25:32 +00:00
|
|
|
test_appsearch_complocator();
|
|
|
|
test_appsearch_reglocator();
|
|
|
|
test_appsearch_inilocator();
|
|
|
|
test_appsearch_drlocator();
|
2008-02-10 13:22:36 +00:00
|
|
|
test_featureparents();
|
|
|
|
test_installprops();
|
|
|
|
test_launchconditions();
|
|
|
|
test_ccpsearch();
|
|
|
|
test_complocator();
|
2008-12-28 10:25:32 +00:00
|
|
|
test_MsiGetSourcePath();
|
|
|
|
test_shortlongsource();
|
|
|
|
test_sourcedir();
|
|
|
|
test_access();
|
|
|
|
test_emptypackage();
|
|
|
|
test_MsiGetProductProperty();
|
2009-05-17 07:05:22 +00:00
|
|
|
test_MsiSetProperty();
|
|
|
|
test_MsiApplyMultiplePatches();
|
|
|
|
test_MsiApplyPatch();
|
2012-01-21 17:21:57 +00:00
|
|
|
test_MsiEnumComponentCosts();
|
2012-05-14 21:41:45 +00:00
|
|
|
test_MsiDatabaseCommit();
|
2017-10-08 08:15:09 +00:00
|
|
|
test_externalui();
|
|
|
|
test_externalui_message();
|
|
|
|
test_controlevent();
|
2018-01-20 11:30:30 +00:00
|
|
|
test_top_level_action();
|
2009-10-19 21:11:46 +00:00
|
|
|
|
2012-01-21 17:21:57 +00:00
|
|
|
if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
|
2009-10-19 21:11:46 +00:00
|
|
|
{
|
|
|
|
ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
|
|
|
|
if (ret)
|
|
|
|
remove_restore_point(status.llSequenceNumber);
|
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|