mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-28 04:13:35 +00:00
Winesync to Wine-0.9.55.
svn path=/trunk/; revision=32262
This commit is contained in:
File diff suppressed because it is too large
Load Diff
+4283
-122
File diff suppressed because it is too large
Load Diff
+1183
-126
File diff suppressed because it is too large
Load Diff
+3174
-204
File diff suppressed because it is too large
Load Diff
+1919
-70
File diff suppressed because it is too large
Load Diff
@@ -1,18 +1,30 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||
<group>
|
||||
<module name="msi_winetest" type="win32cui" installbase="bin" installname="msi_winetest.exe" allowwarnings="true">
|
||||
<include base="msi_winetest">.</include>
|
||||
<define name="__USE_W32API" />
|
||||
<library>cabinet</library>
|
||||
<library>msi</library>
|
||||
<library>ole32</library>
|
||||
<library>advapi32</library>
|
||||
<library>kernel32</library>
|
||||
<library>ntdll</library>
|
||||
<file>db.c</file>
|
||||
<file>format.c</file>
|
||||
<file>install.c</file>
|
||||
<file>msi.c</file>
|
||||
<file>package.c</file>
|
||||
<file>record.c</file>
|
||||
<file>suminfo.c</file>
|
||||
<file>testlist.c</file>
|
||||
<include base="msi_winetest">.</include>
|
||||
<define name="WINVER">0x600</define>
|
||||
<define name="_WIN32_WINNT">0x600</define>
|
||||
<file>automation.c</file>
|
||||
<file>db.c</file>
|
||||
<file>format.c</file>
|
||||
<file>install.c</file>
|
||||
<file>msi.c</file>
|
||||
<file>package.c</file>
|
||||
<file>record.c</file>
|
||||
<file>source.c</file>
|
||||
<file>suminfo.c</file>
|
||||
<file>testlist.c</file>
|
||||
<library>wine</library>
|
||||
<library>cabinet</library>
|
||||
<library>msi</library>
|
||||
<library>shell32</library>
|
||||
<library>ole32</library>
|
||||
<library>oleaut32</library>
|
||||
<library>advapi32</library>
|
||||
<library>kernel32</library>
|
||||
<library>version</library>
|
||||
<library>uuid</library>
|
||||
<library>ntdll</library>
|
||||
</module>
|
||||
</group>
|
||||
|
||||
+3348
-240
File diff suppressed because it is too large
Load Diff
@@ -30,11 +30,11 @@ static BOOL create_temp_file(char *name)
|
||||
unsigned char buffer[26], i;
|
||||
DWORD sz;
|
||||
HANDLE handle;
|
||||
|
||||
|
||||
r = GetTempFileName(".", "msitest",0,name);
|
||||
if(!r)
|
||||
return r;
|
||||
handle = CreateFile(name, GENERIC_READ|GENERIC_WRITE,
|
||||
handle = CreateFile(name, GENERIC_READ|GENERIC_WRITE,
|
||||
0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if(handle==INVALID_HANDLE_VALUE)
|
||||
return 0;
|
||||
@@ -234,10 +234,26 @@ static void test_msirecord(void)
|
||||
ok(i == ERROR_SUCCESS, "Failed to set string at 0\n");
|
||||
i = MsiRecordGetInteger(h, 0);
|
||||
ok(i == 1, "should get one\n");
|
||||
i = MsiRecordSetString(h,0,"foo");
|
||||
ok(i == ERROR_SUCCESS, "Failed to set string at 0\n");
|
||||
i = MsiRecordGetInteger(h, 0);
|
||||
ok(i == MSI_NULL_INTEGER, "should get zero\n");
|
||||
i = MsiRecordSetString(h,0,"");
|
||||
ok(i == ERROR_SUCCESS, "Failed to set string at 0\n");
|
||||
i = MsiRecordGetInteger(h, 0);
|
||||
ok(i == MSI_NULL_INTEGER, "should get zero\n");
|
||||
i = MsiRecordSetString(h,0,"+1");
|
||||
ok(i == ERROR_SUCCESS, "Failed to set string at 0\n");
|
||||
i = MsiRecordGetInteger(h, 0);
|
||||
ok(i == MSI_NULL_INTEGER, "should get zero\n");
|
||||
|
||||
/* same record, try converting integers to strings */
|
||||
r = MsiRecordSetInteger(h, 0, 32);
|
||||
ok(r == ERROR_SUCCESS, "Failed to set integer at 0 to 32\n");
|
||||
sz = 1;
|
||||
r = MsiRecordGetString(h, 0, NULL, &sz);
|
||||
ok(r == ERROR_SUCCESS, "failed to get string from integer\n");
|
||||
ok(sz == 2, "length wrong\n");
|
||||
buf[0]=0;
|
||||
sz = sizeof buf;
|
||||
r = MsiRecordGetString(h, 0, buf, &sz);
|
||||
@@ -246,10 +262,15 @@ static void test_msirecord(void)
|
||||
r = MsiRecordSetInteger(h, 0, -32);
|
||||
ok(r == ERROR_SUCCESS, "Failed to set integer at 0 to 32\n");
|
||||
buf[0]=0;
|
||||
sz = 1;
|
||||
r = MsiRecordGetString(h, 0, NULL, &sz);
|
||||
ok(r == ERROR_SUCCESS, "failed to get string from integer\n");
|
||||
ok(sz == 3, "length wrong\n");
|
||||
sz = sizeof buf;
|
||||
r = MsiRecordGetString(h, 0, buf, &sz);
|
||||
ok(r == ERROR_SUCCESS, "failed to get string from integer\n");
|
||||
ok(0==strcmp(buf,"-32"), "failed to get string from integer\n");
|
||||
buf[0]=0;
|
||||
|
||||
/* same record, now try streams */
|
||||
r = MsiRecordSetStream(h, 0, NULL);
|
||||
@@ -268,7 +289,7 @@ static void test_msirecord(void)
|
||||
ok(r == ERROR_SUCCESS, "Failed to close handle\n");
|
||||
|
||||
/* now try streams in a new record - need to create a file to play with */
|
||||
r = create_temp_file(filename);
|
||||
r = create_temp_file(filename);
|
||||
if(!r)
|
||||
return;
|
||||
|
||||
|
||||
@@ -0,0 +1,725 @@
|
||||
/*
|
||||
* Tests for MSI Source functions
|
||||
*
|
||||
* Copyright (C) 2006 James Hawkins
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#define _WIN32_MSI 300
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include <msiquery.h>
|
||||
#include <msidefs.h>
|
||||
#include <msi.h>
|
||||
#include <sddl.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
|
||||
static UINT (WINAPI *pMsiSourceListGetInfoA)
|
||||
(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD);
|
||||
static UINT (WINAPI *pMsiSourceListAddSourceExA)
|
||||
(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, DWORD);
|
||||
|
||||
static void init_functionpointers(void)
|
||||
{
|
||||
HMODULE hmsi = GetModuleHandleA("msi.dll");
|
||||
HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
|
||||
|
||||
#define GET_PROC(dll, func) \
|
||||
p ## func = (void *)GetProcAddress(dll, #func); \
|
||||
if(!p ## func) \
|
||||
trace("GetProcAddress(%s) failed\n", #func);
|
||||
|
||||
GET_PROC(hmsi, MsiSourceListAddSourceExA)
|
||||
GET_PROC(hmsi, MsiSourceListGetInfoA)
|
||||
|
||||
GET_PROC(hadvapi32, ConvertSidToStringSidA)
|
||||
|
||||
#undef GET_PROC
|
||||
}
|
||||
|
||||
/* copied from dlls/msi/registry.c */
|
||||
static BOOL squash_guid(LPCWSTR in, LPWSTR out)
|
||||
{
|
||||
DWORD i,n=1;
|
||||
GUID guid;
|
||||
|
||||
if (FAILED(CLSIDFromString((LPOLESTR)in, &guid)))
|
||||
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);
|
||||
|
||||
size = StringFromGUID2(&guid, (LPOLESTR)guidW, MAX_PATH);
|
||||
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 get_user_sid(LPSTR *usersid)
|
||||
{
|
||||
HANDLE token;
|
||||
BYTE buf[1024];
|
||||
DWORD size;
|
||||
PTOKEN_USER user;
|
||||
|
||||
OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
|
||||
size = sizeof(buf);
|
||||
GetTokenInformation(token, TokenUser, (void *)buf, size, &size);
|
||||
user = (PTOKEN_USER)buf;
|
||||
pConvertSidToStringSidA(user->User.Sid, usersid);
|
||||
}
|
||||
|
||||
static void test_MsiSourceListGetInfo(void)
|
||||
{
|
||||
CHAR prodcode[MAX_PATH];
|
||||
CHAR prod_squashed[MAX_PATH];
|
||||
CHAR keypath[MAX_PATH*2];
|
||||
CHAR value[MAX_PATH];
|
||||
LPSTR usersid;
|
||||
LPCSTR data;
|
||||
LONG res;
|
||||
UINT r;
|
||||
HKEY userkey, hkey;
|
||||
DWORD size;
|
||||
|
||||
if (!pMsiSourceListGetInfoA)
|
||||
{
|
||||
skip("Skipping MsiSourceListGetInfoA tests\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_guid(prodcode, prod_squashed);
|
||||
get_user_sid(&usersid);
|
||||
|
||||
/* NULL szProductCodeOrPatchCode */
|
||||
r = pMsiSourceListGetInfoA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, NULL);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* empty szProductCodeOrPatchCode */
|
||||
r = pMsiSourceListGetInfoA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, NULL);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* garbage szProductCodeOrPatchCode */
|
||||
r = pMsiSourceListGetInfoA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, NULL);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* szProductCodeOrPatchCode */
|
||||
r = pMsiSourceListGetInfoA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, NULL);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* guid without brackets */
|
||||
r = pMsiSourceListGetInfoA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, NULL);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* guid with brackets */
|
||||
r = pMsiSourceListGetInfoA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, NULL);
|
||||
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
|
||||
|
||||
/* same length as guid, but random */
|
||||
r = pMsiSourceListGetInfoA("ADKD-2KSDFF2-DKK1KNFJASD9GLKWME-1I3KAD", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, NULL);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* invalid context */
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_NONE,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, NULL);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* another invalid context */
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_ALLUSERMANAGED,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, NULL);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* yet another invalid context */
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_ALL,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, NULL);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* mix two valid contexts */
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED | MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, NULL);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* invalid option */
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
4, INSTALLPROPERTY_PACKAGENAME, NULL, NULL);
|
||||
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
|
||||
|
||||
/* NULL property */
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, NULL, NULL, NULL);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* empty property */
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, "", NULL, NULL);
|
||||
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
|
||||
|
||||
/* value is non-NULL while size is NULL */
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, NULL);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* size is non-NULL while value is NULL */
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
|
||||
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
|
||||
|
||||
lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
|
||||
lstrcatA(keypath, prod_squashed);
|
||||
|
||||
res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &userkey);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
|
||||
/* user product key exists */
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
|
||||
ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
|
||||
|
||||
res = RegCreateKeyA(userkey, "SourceList", &hkey);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
|
||||
/* SourceList key exists */
|
||||
size = 0xdeadbeef;
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
ok(size == 0, "Expected 0, got %d\n", size);
|
||||
|
||||
data = "msitest.msi";
|
||||
res = RegSetValueExA(hkey, "PackageName", 0, REG_SZ, (const BYTE *)data, lstrlenA(data) + 1);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
|
||||
/* PackageName value exists */
|
||||
size = 0xdeadbeef;
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
ok(size == 11, "Expected 11, got %d\n", size);
|
||||
|
||||
/* read the value, don't change size */
|
||||
lstrcpyA(value, "aaa");
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
|
||||
ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
|
||||
ok(!lstrcmpA(value, "aaa"), "Expected 'aaa', got %s\n", value);
|
||||
ok(size == 11, "Expected 11, got %d\n", size);
|
||||
|
||||
/* read the value, fix size */
|
||||
size++;
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
|
||||
ok(size == 11, "Expected 11, got %d\n", size);
|
||||
|
||||
/* empty property now that product key exists */
|
||||
size = 0xdeadbeef;
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, "", NULL, &size);
|
||||
ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
|
||||
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
|
||||
|
||||
/* nonexistent property now that product key exists */
|
||||
size = 0xdeadbeef;
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, "nonexistent", NULL, &size);
|
||||
ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
|
||||
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
|
||||
|
||||
data = "tester";
|
||||
res = RegSetValueExA(hkey, "nonexistent", 0, REG_SZ, (const BYTE *)data, lstrlenA(data) + 1);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
|
||||
/* nonexistent property now that nonexistent value exists */
|
||||
size = 0xdeadbeef;
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, "nonexistent", NULL, &size);
|
||||
ok(r == ERROR_UNKNOWN_PROPERTY, "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r);
|
||||
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
|
||||
|
||||
/* invalid option now that product key exists */
|
||||
size = 0xdeadbeef;
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
4, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
ok(size == 11, "Expected 11, got %d\n", size);
|
||||
|
||||
RegDeleteValueA(hkey, "nonexistent");
|
||||
RegDeleteValueA(hkey, "PackageName");
|
||||
RegDeleteKeyA(hkey, "");
|
||||
RegDeleteKeyA(userkey, "");
|
||||
RegCloseKey(hkey);
|
||||
RegCloseKey(userkey);
|
||||
|
||||
/* try a patch */
|
||||
size = 0xdeadbeef;
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PATCH, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
|
||||
ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r);
|
||||
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
|
||||
|
||||
lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Patches\\");
|
||||
lstrcatA(keypath, prod_squashed);
|
||||
|
||||
res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &userkey);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
|
||||
/* patch key exists
|
||||
* NOTE: using prodcode guid, but it really doesn't matter
|
||||
*/
|
||||
size = 0xdeadbeef;
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PATCH, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
|
||||
ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
|
||||
ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
|
||||
|
||||
res = RegCreateKeyA(userkey, "SourceList", &hkey);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
|
||||
/* SourceList key exists */
|
||||
size = 0xdeadbeef;
|
||||
r = pMsiSourceListGetInfoA(prodcode, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PATCH, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
ok(size == 0, "Expected 0, got %d\n", size);
|
||||
|
||||
RegDeleteKeyA(hkey, "");
|
||||
RegDeleteKeyA(userkey, "");
|
||||
RegCloseKey(hkey);
|
||||
RegCloseKey(userkey);
|
||||
}
|
||||
|
||||
static void test_MsiSourceListAddSourceEx(void)
|
||||
{
|
||||
CHAR prodcode[MAX_PATH];
|
||||
CHAR prod_squashed[MAX_PATH];
|
||||
CHAR keypath[MAX_PATH*2];
|
||||
CHAR value[MAX_PATH];
|
||||
LPSTR usersid;
|
||||
LONG res;
|
||||
UINT r;
|
||||
HKEY prodkey, userkey, hkey;
|
||||
HKEY url, net;
|
||||
DWORD size;
|
||||
|
||||
if (!pMsiSourceListAddSourceExA)
|
||||
{
|
||||
skip("Skipping MsiSourceListAddSourceExA tests\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_test_guid(prodcode, prod_squashed);
|
||||
get_user_sid(&usersid);
|
||||
|
||||
/* GetLastError is not set by the function */
|
||||
|
||||
/* NULL szProductCodeOrPatchCode */
|
||||
r = pMsiSourceListAddSourceExA(NULL, usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* empty szProductCodeOrPatchCode */
|
||||
r = pMsiSourceListAddSourceExA("", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* garbage szProductCodeOrPatchCode */
|
||||
r = pMsiSourceListAddSourceExA("garbage", usersid, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* guid without brackets */
|
||||
r = pMsiSourceListAddSourceExA("51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA", usersid,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* guid with brackets */
|
||||
r = pMsiSourceListAddSourceExA("{51CD2AD5-0482-4C46-8DDD-0ED1022AA1AA}", usersid,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
|
||||
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
|
||||
|
||||
/* MSIINSTALLCONTEXT_USERUNMANAGED */
|
||||
|
||||
r = pMsiSourceListAddSourceExA(prodcode, usersid,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
|
||||
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
|
||||
|
||||
lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\");
|
||||
lstrcatA(keypath, prod_squashed);
|
||||
|
||||
res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &userkey);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
|
||||
/* user product key exists */
|
||||
r = pMsiSourceListAddSourceExA(prodcode, usersid,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
|
||||
ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
|
||||
|
||||
res = RegCreateKeyA(userkey, "SourceList", &url);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
RegCloseKey(url);
|
||||
|
||||
/* SourceList key exists */
|
||||
r = pMsiSourceListAddSourceExA(prodcode, usersid,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
|
||||
res = RegOpenKeyA(userkey, "SourceList\\URL", &url);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "1", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value);
|
||||
ok(size == 11, "Expected 11, got %d\n", size);
|
||||
|
||||
/* add another source, index 0 */
|
||||
r = pMsiSourceListAddSourceExA(prodcode, usersid,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "another", 0);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "1", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value);
|
||||
ok(size == 11, "Expected 11, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "2", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "another/"), "Expected 'another/', got %s\n", value);
|
||||
ok(size == 9, "Expected 9, got %d\n", size);
|
||||
|
||||
/* add another source, index 1 */
|
||||
r = pMsiSourceListAddSourceExA(prodcode, usersid,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "third/", 1);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "1", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "third/"), "Expected 'third/', got %s\n", value);
|
||||
ok(size == 7, "Expected 7, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "2", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value);
|
||||
ok(size == 11, "Expected 11, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "3", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "another/"), "Expected 'another/', got %s\n", value);
|
||||
ok(size == 9, "Expected 9, got %d\n", size);
|
||||
|
||||
/* add another source, index > N */
|
||||
r = pMsiSourceListAddSourceExA(prodcode, usersid,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "last/", 5);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "1", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "third/"), "Expected 'third/', got %s\n", value);
|
||||
ok(size == 7, "Expected 7, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "2", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value);
|
||||
ok(size == 11, "Expected 11, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "3", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "another/"), "Expected 'another/', got %s\n", value);
|
||||
ok(size == 9, "Expected 9, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "4", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "last/"), "Expected 'last/', got %s\n", value);
|
||||
ok(size == 6, "Expected 6, got %d\n", size);
|
||||
|
||||
/* just MSISOURCETYPE_NETWORK */
|
||||
r = pMsiSourceListAddSourceExA(prodcode, usersid,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSISOURCETYPE_NETWORK, "source", 0);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
|
||||
res = RegOpenKeyA(userkey, "SourceList\\Net", &net);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(net, "1", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "source\\"), "Expected 'source\\', got %s\n", value);
|
||||
ok(size == 8, "Expected 8, got %d\n", size);
|
||||
|
||||
/* just MSISOURCETYPE_URL */
|
||||
r = pMsiSourceListAddSourceExA(prodcode, usersid,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSISOURCETYPE_URL, "source", 0);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "1", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "third/"), "Expected 'third/', got %s\n", value);
|
||||
ok(size == 7, "Expected 7, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "2", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value);
|
||||
ok(size == 11, "Expected 11, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "3", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "another/"), "Expected 'another/', got %s\n", value);
|
||||
ok(size == 9, "Expected 9, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "4", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "last/"), "Expected 'last/', got %s\n", value);
|
||||
ok(size == 6, "Expected 6, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "5", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "source/"), "Expected 'source/', got %s\n", value);
|
||||
ok(size == 8, "Expected 8, got %d\n", size);
|
||||
|
||||
/* NULL szUserSid */
|
||||
r = pMsiSourceListAddSourceExA(prodcode, NULL,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSISOURCETYPE_NETWORK, "nousersid", 0);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(net, "1", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "source\\"), "Expected 'source\\', got %s\n", value);
|
||||
ok(size == 8, "Expected 8, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(net, "2", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "nousersid\\"), "Expected 'nousersid\\', got %s\n", value);
|
||||
ok(size == 11, "Expected 11, got %d\n", size);
|
||||
|
||||
/* invalid options, must have source type */
|
||||
r = pMsiSourceListAddSourceExA(prodcode, usersid,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PRODUCT, "source", 0);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
r = pMsiSourceListAddSourceExA(prodcode, usersid,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSICODE_PATCH, "source", 0);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* NULL szSource */
|
||||
r = pMsiSourceListAddSourceExA(prodcode, usersid,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSISOURCETYPE_URL, NULL, 1);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* empty szSource */
|
||||
r = pMsiSourceListAddSourceExA(prodcode, usersid,
|
||||
MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||
MSISOURCETYPE_URL, "", 1);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
/* MSIINSTALLCONTEXT_USERMANAGED, non-NULL szUserSid */
|
||||
|
||||
r = pMsiSourceListAddSourceExA(prodcode, usersid,
|
||||
MSIINSTALLCONTEXT_USERMANAGED,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
|
||||
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
|
||||
|
||||
lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\");
|
||||
lstrcatA(keypath, usersid);
|
||||
lstrcatA(keypath, "\\Installer\\Products\\");
|
||||
lstrcatA(keypath, prod_squashed);
|
||||
|
||||
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
|
||||
/* product key exists */
|
||||
r = pMsiSourceListAddSourceExA(prodcode, usersid,
|
||||
MSIINSTALLCONTEXT_USERMANAGED,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
|
||||
ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
|
||||
|
||||
res = RegCreateKeyA(prodkey, "SourceList", &hkey);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
RegCloseKey(hkey);
|
||||
|
||||
/* SourceList exists */
|
||||
r = pMsiSourceListAddSourceExA(prodcode, usersid,
|
||||
MSIINSTALLCONTEXT_USERMANAGED,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
|
||||
res = RegOpenKeyA(prodkey, "SourceList\\URL", &url);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "1", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value);
|
||||
ok(size == 11, "Expected 11, got %d\n", size);
|
||||
|
||||
RegCloseKey(url);
|
||||
|
||||
/* MSIINSTALLCONTEXT_USERMANAGED, NULL szUserSid */
|
||||
|
||||
r = pMsiSourceListAddSourceExA(prodcode, NULL,
|
||||
MSIINSTALLCONTEXT_USERMANAGED,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "another", 0);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
|
||||
res = RegOpenKeyA(prodkey, "SourceList\\URL", &url);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "1", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value);
|
||||
ok(size == 11, "Expected 11, got %d\n", size);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "2", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "another/"), "Expected 'another/', got %s\n", value);
|
||||
ok(size == 9, "Expected 9, got %d\n", size);
|
||||
|
||||
RegCloseKey(url);
|
||||
RegCloseKey(prodkey);
|
||||
|
||||
/* MSIINSTALLCONTEXT_MACHINE */
|
||||
|
||||
/* szUserSid must be NULL for MSIINSTALLCONTEXT_MACHINE */
|
||||
r = pMsiSourceListAddSourceExA(prodcode, usersid,
|
||||
MSIINSTALLCONTEXT_MACHINE,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
|
||||
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
r = pMsiSourceListAddSourceExA(prodcode, NULL,
|
||||
MSIINSTALLCONTEXT_MACHINE,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
|
||||
ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
|
||||
|
||||
lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\");
|
||||
lstrcatA(keypath, prod_squashed);
|
||||
|
||||
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
|
||||
/* product key exists */
|
||||
r = pMsiSourceListAddSourceExA(prodcode, NULL,
|
||||
MSIINSTALLCONTEXT_MACHINE,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
|
||||
ok(r == ERROR_BAD_CONFIGURATION, "Expected ERROR_BAD_CONFIGURATION, got %d\n", r);
|
||||
|
||||
res = RegCreateKeyA(prodkey, "SourceList", &hkey);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
RegCloseKey(hkey);
|
||||
|
||||
/* SourceList exists */
|
||||
r = pMsiSourceListAddSourceExA(prodcode, NULL,
|
||||
MSIINSTALLCONTEXT_MACHINE,
|
||||
MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
|
||||
res = RegOpenKeyA(prodkey, "SourceList\\URL", &url);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
|
||||
size = MAX_PATH;
|
||||
res = RegQueryValueExA(url, "1", NULL, NULL, (LPBYTE)value, &size);
|
||||
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
|
||||
ok(!lstrcmpA(value, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value);
|
||||
ok(size == 11, "Expected 11, got %d\n", size);
|
||||
|
||||
RegCloseKey(url);
|
||||
RegCloseKey(prodkey);
|
||||
HeapFree(GetProcessHeap(), 0, usersid);
|
||||
}
|
||||
|
||||
START_TEST(source)
|
||||
{
|
||||
init_functionpointers();
|
||||
|
||||
test_MsiSourceListGetInfo();
|
||||
test_MsiSourceListAddSourceEx();
|
||||
}
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <windows.h>
|
||||
#include <msi.h>
|
||||
#include <msiquery.h>
|
||||
#include <objidl.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
@@ -62,7 +63,7 @@
|
||||
#define PID_MSISOURCE PID_WORDCOUNT
|
||||
#define PID_MSIRESTRICT PID_CHARCOUNT
|
||||
|
||||
START_TEST(suminfo)
|
||||
static void test_suminfo(void)
|
||||
{
|
||||
const char *msifile = "winetest.msi";
|
||||
MSIHANDLE hdb = 0, hsuminfo;
|
||||
@@ -98,6 +99,12 @@ START_TEST(suminfo)
|
||||
r = MsiSummaryInfoGetProperty(hsuminfo, 0, NULL, NULL, NULL, 0, NULL);
|
||||
ok(r == ERROR_SUCCESS, "getpropcount failed\n");
|
||||
|
||||
r = MsiSummaryInfoGetProperty(hsuminfo, -1, NULL, NULL, NULL, 0, NULL);
|
||||
ok(r == ERROR_UNKNOWN_PROPERTY, "MsiSummaryInfoGetProperty wrong error\n");
|
||||
|
||||
r = MsiSummaryInfoGetProperty(hsuminfo, PID_SECURITY+1, NULL, NULL, NULL, 0, NULL);
|
||||
ok(r == ERROR_UNKNOWN_PROPERTY, "MsiSummaryInfoGetProperty wrong error\n");
|
||||
|
||||
type = -1;
|
||||
r = MsiSummaryInfoGetProperty(hsuminfo, 0, &type, NULL, NULL, 0, NULL);
|
||||
ok(r == ERROR_SUCCESS, "getpropcount failed\n");
|
||||
@@ -235,3 +242,180 @@ START_TEST(suminfo)
|
||||
r = DeleteFile(msifile);
|
||||
ok(r, "DeleteFile failed\n");
|
||||
}
|
||||
|
||||
static const WCHAR tb[] = { 0x4840, 0x3f7f, 0x4164, 0x422f, 0x4836, 0 }; /* _Tables */
|
||||
static const WCHAR sd[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
|
||||
static const WCHAR sp[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
|
||||
|
||||
#define LOSE_CONST(x) ((LPSTR)(UINT_PTR)(x))
|
||||
|
||||
static void test_create_database_binary(void)
|
||||
{
|
||||
static const CLSID CLSID_MsiDatabase =
|
||||
{ 0xc1084, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46 } };
|
||||
static const CLSID IID_IPropertySetStorage =
|
||||
{ 0x13a, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46 } };
|
||||
static const CLSID FMTID_SummaryInformation =
|
||||
{ 0xf29f85e0, 0x4ff9, 0x1068, {0xab, 0x91, 0x08, 0x00, 0x2b, 0x27, 0xb3, 0xd9}};
|
||||
DWORD mode = STGM_CREATE | STGM_READWRITE | STGM_DIRECT | STGM_SHARE_EXCLUSIVE;
|
||||
static const WCHAR msifile[] = {
|
||||
'w','i','n','e','t','e','s','t','.','m','s','i',0 };
|
||||
IPropertySetStorage *pss = NULL;
|
||||
IPropertyStorage *ps = NULL;
|
||||
IStorage *stg = NULL;
|
||||
IStream *stm = NULL;
|
||||
HRESULT r;
|
||||
PROPSPEC propspec[10];
|
||||
PROPVARIANT propvar[10];
|
||||
USHORT data[2] = { 0, 0 };
|
||||
|
||||
r = StgCreateDocfile( msifile, mode, 0, &stg );
|
||||
ok( r == S_OK, "failed to create database\n");
|
||||
|
||||
r = IStorage_SetClass( stg, &CLSID_MsiDatabase );
|
||||
ok( r == S_OK, "failed to set clsid\n");
|
||||
|
||||
/* create the _StringData stream */
|
||||
r = IStorage_CreateStream( stg, sd, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm );
|
||||
ok( r == S_OK, "failed to create stream\n");
|
||||
|
||||
IStream_Release( stm );
|
||||
|
||||
/* create the _StringPool stream */
|
||||
r = IStorage_CreateStream( stg, sp, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm );
|
||||
ok( r == S_OK, "failed to create stream\n");
|
||||
|
||||
r = IStream_Write( stm, data, sizeof data, NULL );
|
||||
ok( r == S_OK, "failed to write stream\n");
|
||||
|
||||
IStream_Release( stm );
|
||||
|
||||
/* create the _Tables stream */
|
||||
r = IStorage_CreateStream( stg, tb, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm );
|
||||
ok( r == S_OK, "failed to create stream\n");
|
||||
|
||||
IStream_Release( stm );
|
||||
|
||||
r = IStorage_QueryInterface( stg, &IID_IPropertySetStorage, (void**) &pss );
|
||||
ok( r == S_OK, "failed to set clsid\n");
|
||||
|
||||
r = IPropertySetStorage_Create( pss, &FMTID_SummaryInformation, NULL, 0, mode, &ps );
|
||||
ok( r == S_OK, "failed to create property set\n");
|
||||
|
||||
r = IPropertyStorage_SetClass( ps, &FMTID_SummaryInformation );
|
||||
ok( r == S_OK, "failed to set class\n");
|
||||
|
||||
propspec[0].ulKind = PRSPEC_PROPID;
|
||||
U(propspec[0]).propid = PID_TITLE;
|
||||
propvar[0].vt = VT_LPSTR;
|
||||
U(propvar[0]).pszVal = LOSE_CONST("test title");
|
||||
|
||||
propspec[1].ulKind = PRSPEC_PROPID;
|
||||
U(propspec[1]).propid = PID_SUBJECT;
|
||||
propvar[1].vt = VT_LPSTR;
|
||||
U(propvar[1]).pszVal = LOSE_CONST("msi suminfo / property storage test");
|
||||
|
||||
propspec[2].ulKind = PRSPEC_PROPID;
|
||||
U(propspec[2]).propid = PID_AUTHOR;
|
||||
propvar[2].vt = VT_LPSTR;
|
||||
U(propvar[2]).pszVal = LOSE_CONST("mike_m");
|
||||
|
||||
propspec[3].ulKind = PRSPEC_PROPID;
|
||||
U(propspec[3]).propid = PID_TEMPLATE;
|
||||
propvar[3].vt = VT_LPSTR;
|
||||
U(propvar[3]).pszVal = LOSE_CONST(";1033"); /* actually the string table's codepage */
|
||||
|
||||
propspec[4].ulKind = PRSPEC_PROPID;
|
||||
U(propspec[4]).propid = PID_REVNUMBER;
|
||||
propvar[4].vt = VT_LPSTR;
|
||||
U(propvar[4]).pszVal = LOSE_CONST("{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}");
|
||||
|
||||
propspec[5].ulKind = PRSPEC_PROPID;
|
||||
U(propspec[5]).propid = PID_PAGECOUNT;
|
||||
propvar[5].vt = VT_I4;
|
||||
U(propvar[5]).lVal = 100;
|
||||
|
||||
propspec[6].ulKind = PRSPEC_PROPID;
|
||||
U(propspec[6]).propid = PID_WORDCOUNT;
|
||||
propvar[6].vt = VT_I4;
|
||||
U(propvar[6]).lVal = 0;
|
||||
|
||||
/* MSDN says that PID_LASTPRINTED should be a VT_FILETIME... */
|
||||
propspec[7].ulKind = PRSPEC_PROPID;
|
||||
U(propspec[7]).propid = PID_LASTPRINTED;
|
||||
propvar[7].vt = VT_LPSTR;
|
||||
U(propvar[7]).pszVal = LOSE_CONST("7/1/1999 5:17");
|
||||
|
||||
r = IPropertyStorage_WriteMultiple( ps, 8, propspec, propvar, PID_FIRST_USABLE );
|
||||
ok( r == S_OK, "failed to write properties\n");
|
||||
|
||||
IPropertyStorage_Commit( ps, STGC_DEFAULT );
|
||||
|
||||
IPropertyStorage_Release( ps );
|
||||
IPropertySetStorage_Release( pss );
|
||||
|
||||
IStorage_Commit( stg, STGC_DEFAULT );
|
||||
IStorage_Release( stg );
|
||||
}
|
||||
|
||||
static void test_summary_binary(void)
|
||||
{
|
||||
const char *msifile = "winetest.msi";
|
||||
MSIHANDLE hdb = 0, hsuminfo = 0;
|
||||
UINT r, type, count;
|
||||
INT ival;
|
||||
DWORD sz;
|
||||
char sval[20];
|
||||
|
||||
DeleteFile( msifile );
|
||||
|
||||
test_create_database_binary();
|
||||
|
||||
ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes(msifile), "file doesn't exist!\n");
|
||||
|
||||
/* just MsiOpenDatabase should not create a file */
|
||||
r = MsiOpenDatabase(msifile, MSIDBOPEN_READONLY, &hdb);
|
||||
ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
|
||||
|
||||
r = MsiGetSummaryInformation(hdb, NULL, 0, &hsuminfo);
|
||||
ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed\n");
|
||||
|
||||
/*
|
||||
* Check what reading PID_LASTPRINTED does...
|
||||
* The string value is written to the msi file
|
||||
* but it appears that we're not allowed to read it back again.
|
||||
* We can still read its type though...?
|
||||
*/
|
||||
sz = sizeof sval;
|
||||
sval[0] = 0;
|
||||
type = 0;
|
||||
r = MsiSummaryInfoGetProperty(hsuminfo, PID_LASTPRINTED, &type, NULL, NULL, sval, &sz);
|
||||
ok(r == ERROR_SUCCESS, "MsiSummaryInfoGetProperty failed\n");
|
||||
ok(!strcmp(sval, ""), "Expected empty string, got %s\n", sval);
|
||||
todo_wine {
|
||||
ok(type == VT_LPSTR, "Expected VT_LPSTR, got %d\n", type);
|
||||
ok(sz == 0, "Expected 0, got %d\n", sz);
|
||||
}
|
||||
|
||||
ival = -1;
|
||||
r = MsiSummaryInfoGetProperty(hsuminfo, PID_WORDCOUNT, &type, &ival, NULL, NULL, NULL);
|
||||
ok(r == ERROR_SUCCESS, "MsiSummaryInfoGetProperty failed\n");
|
||||
todo_wine ok( ival == 0, "value incorrect\n");
|
||||
|
||||
/* looks like msi adds some of its own values in here */
|
||||
count = 0;
|
||||
r = MsiSummaryInfoGetPropertyCount( hsuminfo, &count );
|
||||
ok(r == ERROR_SUCCESS, "getpropcount failed\n");
|
||||
todo_wine ok(count == 10, "prop count incorrect\n");
|
||||
|
||||
MsiCloseHandle( hsuminfo );
|
||||
MsiCloseHandle( hdb );
|
||||
|
||||
DeleteFile( msifile );
|
||||
}
|
||||
|
||||
START_TEST(suminfo)
|
||||
{
|
||||
test_suminfo();
|
||||
test_summary_binary();
|
||||
}
|
||||
|
||||
@@ -1,25 +1,31 @@
|
||||
/* Automatically generated file; DO NOT EDIT!! */
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#define STANDALONE
|
||||
#include "wine/test.h"
|
||||
|
||||
extern void func_automation(void);
|
||||
extern void func_db(void);
|
||||
extern void func_format(void);
|
||||
extern void func_install(void);
|
||||
extern void func_msi(void);
|
||||
extern void func_package(void);
|
||||
extern void func_record(void);
|
||||
extern void func_source(void);
|
||||
extern void func_suminfo(void);
|
||||
|
||||
const struct test winetest_testlist[] =
|
||||
{
|
||||
{ "automation", func_automation },
|
||||
{ "db", func_db },
|
||||
{ "format", func_format },
|
||||
{ "install", func_install },
|
||||
{ "msi", func_msi },
|
||||
{ "package", func_package },
|
||||
{ "record", func_record },
|
||||
{ "source", func_source },
|
||||
{ "suminfo", func_suminfo },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user