Author: akhaldi
Date: Sun Mar 5 20:45:43 2017
New Revision: 74088
URL:
http://svn.reactos.org/svn/reactos?rev=74088&view=rev
Log:
[MSI_WINETEST] Sync with Wine Staging 2.2. CORE-12823
Modified:
trunk/rostests/winetests/msi/package.c
Modified: trunk/rostests/winetests/msi/package.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msi/package.c?r…
==============================================================================
--- trunk/rostests/winetests/msi/package.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/msi/package.c [iso-8859-1] Sun Mar 5 20:45:43 2017
@@ -8293,13 +8293,21 @@
static void test_MsiGetProductProperty(void)
{
+ 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];
MSIHANDLE hprod, hdb;
CHAR val[MAX_PATH];
CHAR path[MAX_PATH];
CHAR query[MAX_PATH];
CHAR keypath[MAX_PATH*2];
CHAR prodcode[MAX_PATH];
+ WCHAR prodcodeW[MAX_PATH];
CHAR prod_squashed[MAX_PATH];
+ WCHAR prod_squashedW[MAX_PATH];
HKEY prodkey, userkey, props;
DWORD size;
LONG res;
@@ -8310,6 +8318,8 @@
lstrcatA(path, "\\");
create_test_guid(prodcode, prod_squashed);
+ MultiByteToWideChar(CP_ACP, 0, prodcode, -1, prodcodeW, MAX_PATH);
+ squash_guid(prodcodeW, prod_squashedW);
if (is_wow64)
access |= KEY_WOW64_64KEY;
@@ -8400,6 +8410,15 @@
"Expected val to be unchanged, got \"%s\"\n", val);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+ 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);
+
/* szProperty is NULL */
size = MAX_PATH;
lstrcpyA(val, "apple");
@@ -8410,12 +8429,28 @@
"Expected val to be unchanged, got \"%s\"\n", val);
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
+ 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);
+
/* szProperty is empty */
size = MAX_PATH;
lstrcpyA(val, "apple");
r = MsiGetProductPropertyA(hprod, "", val, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(val, ""), "Expected \"\", got
\"%s\"\n", val);
+ ok(size == 0, "Expected 0, got %d\n", size);
+
+ 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);
/* get the property */
@@ -8428,12 +8463,27 @@
ok(size == lstrlenA(prodcode),
"Expected %d, got %d\n", lstrlenA(prodcode), size);
+ 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);
+
/* lpValueBuf is NULL */
size = MAX_PATH;
r = MsiGetProductPropertyA(hprod, "ProductCode", NULL, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(size == lstrlenA(prodcode),
"Expected %d, got %d\n", lstrlenA(prodcode), size);
+
+ 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);
/* pcchValueBuf is NULL */
lstrcpyA(val, "apple");
@@ -8445,6 +8495,15 @@
ok(size == lstrlenA(prodcode),
"Expected %d, got %d\n", lstrlenA(prodcode), size);
+ 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);
+
/* pcchValueBuf is too small */
size = 4;
lstrcpyA(val, "apple");
@@ -8455,6 +8514,15 @@
ok(size == lstrlenA(prodcode),
"Expected %d, got %d\n", lstrlenA(prodcode), size);
+ 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);
+
/* pcchValueBuf does not leave room for NULL terminator */
size = lstrlenA(prodcode);
lstrcpyA(val, "apple");
@@ -8465,6 +8533,15 @@
ok(size == lstrlenA(prodcode),
"Expected %d, got %d\n", lstrlenA(prodcode), size);
+ 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);
+
/* pcchValueBuf has enough room for NULL terminator */
size = lstrlenA(prodcode) + 1;
lstrcpyA(val, "apple");
@@ -8475,6 +8552,15 @@
ok(size == lstrlenA(prodcode),
"Expected %d, got %d\n", lstrlenA(prodcode), size);
+ 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);
+
/* nonexistent property */
size = MAX_PATH;
lstrcpyA(val, "apple");
@@ -8483,6 +8569,13 @@
ok(!lstrcmpA(val, ""), "Expected \"\", got
\"%s\"\n", val);
ok(size == 0, "Expected 0, got %d\n", size);
+ 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);
+
r = MsiSetPropertyA(hprod, "NewProperty", "value");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
@@ -8492,6 +8585,13 @@
r = MsiGetProductPropertyA(hprod, "NewProperty", val, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(val, ""), "Expected \"\", got
\"%s\"\n", val);
+ ok(size == 0, "Expected 0, got %d\n", size);
+
+ 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);
r = MsiSetPropertyA(hprod, "ProductCode", "value");
@@ -8506,6 +8606,15 @@
"Expected \"%s\", got \"%s\"\n", prodcode, val);
ok(size == lstrlenA(prodcode),
"Expected %d, got %d\n", lstrlenA(prodcode), size);
+
+ 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);
MsiCloseHandle(hprod);