/* ok-like statement which takes two unicode strings or one unicode and one ANSI string as arguments */
static CHAR string1[MAX_PATH], string2[MAX_PATH];
+/* lstrcmpW is not supported on Win9x */
+static int strcmp_ww(const WCHAR* str1, const WCHAR* str2)
+{
+ CHAR str1A[MAX_PATH], str2A[MAX_PATH];
+
+ WideCharToMultiByte(CP_ACP, 0, str1, -1, str1A, MAX_PATH, NULL, NULL); \
+ WideCharToMultiByte(CP_ACP, 0, str2, -1, str2A, MAX_PATH, NULL, NULL); \
+
+ return lstrcmpA(str1A, str2A);
+}
+
#define ok_w2(format, szString1, szString2) \
\
- if (lstrcmpW(szString1, szString2) != 0) \
- { \
- WideCharToMultiByte(CP_ACP, 0, szString1, -1, string1, MAX_PATH, NULL, NULL); \
- WideCharToMultiByte(CP_ACP, 0, szString2, -1, string2, MAX_PATH, NULL, NULL); \
+ do { \
+ WideCharToMultiByte(CP_ACP, 0, szString1, -1, string1, MAX_PATH, NULL, NULL); \
+ WideCharToMultiByte(CP_ACP, 0, szString2, -1, string2, MAX_PATH, NULL, NULL); \
+ if (lstrcmpA(string1, string2) != 0) \
ok(0, format, string1, string2); \
- }
+ } while(0);
#define ok_w2n(format, szString1, szString2, len) \
\
V_BSTR(&vararg) = SysAllocString(szValue);
hr = Installer_RegistryValue(hkey, szKey, vararg, &varresult, VT_BSTR);
- if (V_BSTR(&varresult)) lstrcpyW(szString, V_BSTR(&varresult));
+ if (V_BSTR(&varresult))
+ /* lstrcpyW is not implemented on Win95 (lstrlenW is though) */
+ memcpy(szString, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR));
VariantClear(&varresult);
return hr;
}
V_I4(&vararg) = iValue;
hr = Installer_RegistryValue(hkey, szKey, vararg, &varresult, vtResult);
- if (SUCCEEDED(hr) && vtResult == VT_BSTR) lstrcpyW(szString, V_BSTR(&varresult));
+ if (SUCCEEDED(hr) && vtResult == VT_BSTR)
+ memcpy(szString, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR));
VariantClear(&varresult);
return hr;
}
V_BSTR(&vararg[0]) = SysAllocString(szAttribute);
hr = invoke(pInstaller, "ProductInfo", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR);
- if (V_BSTR(&varresult)) lstrcpyW(szString, V_BSTR(&varresult));
+ if (V_BSTR(&varresult))
+ memcpy(szString, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR));
VariantClear(&varresult);
return hr;
}
HRESULT hr;
hr = invoke(pInstaller, "Version", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR);
- if (V_BSTR(&varresult)) lstrcpyW(szVersion, V_BSTR(&varresult));
+ if (V_BSTR(&varresult))
+ memcpy(szVersion, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR));
VariantClear(&varresult);
return hr;
}
V_BSTR(&vararg[0]) = SysAllocString(szName);
hr = invoke(pSession, "Property", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR);
- if (V_BSTR(&varresult)) lstrcpyW(szReturn, V_BSTR(&varresult));
+ if (V_BSTR(&varresult))
+ memcpy(szReturn, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR));
VariantClear(&varresult);
return hr;
}
V_I4(&vararg[0]) = iField;
hr = invoke(pRecord, "StringData", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR);
- if (V_BSTR(&varresult)) lstrcpyW(szString, V_BSTR(&varresult));
+ if (V_BSTR(&varresult))
+ memcpy(szString, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR));
VariantClear(&varresult);
return hr;
}
V_I4(&vararg[0]) = iIndex;
hr = invoke(pStringList, "Item", DISPATCH_PROPERTYGET, &dispparams, &varresult, VT_BSTR);
- if (V_BSTR(&varresult)) lstrcpyW(szString, V_BSTR(&varresult));
+ if (V_BSTR(&varresult))
+ memcpy(szString, V_BSTR(&varresult), (lstrlenW(V_BSTR(&varresult)) + 1) * sizeof(WCHAR));
VariantClear(&varresult);
return hr;
}
memset(stringw, 0, sizeof(stringw));
hr = Session_PropertyGet(pSession, szProductName, stringw);
ok(hr == S_OK, "Session_PropertyGet failed, hresult 0x%08x\n", hr);
- if (lstrcmpW(stringw, szMSITEST) != 0)
+ if (strcmp_ww(stringw, szMSITEST) != 0)
{
len = WideCharToMultiByte(CP_ACP, 0, stringw, -1, string, MAX_PATH, NULL, NULL);
ok(len, "WideCharToMultiByteChar returned error %d\n", GetLastError());
memset(stringw, 0, sizeof(stringw));
hr = Session_PropertyGet(pSession, szProductName, stringw);
ok(hr == S_OK, "Session_PropertyGet failed, hresult 0x%08x\n", hr);
- if (lstrcmpW(stringw, szProductName) != 0)
+ if (strcmp_ww(stringw, szProductName) != 0)
{
len = WideCharToMultiByte(CP_ACP, 0, stringw, -1, string, MAX_PATH, NULL, NULL);
ok(len, "WideCharToMultiByteChar returned error %d\n", GetLastError());
ok(iValue == INSTALLSTATE_DEFAULT || iValue == INSTALLSTATE_ADVERTISED, "Installer_ProductState returned %d, expected %d or %d\n", iValue, INSTALLSTATE_DEFAULT, INSTALLSTATE_ADVERTISED);
/* Not found our product code yet? Check */
- if (!bProductFound && !lstrcmpW(szString, szProductCode))
+ if (!bProductFound && !strcmp_ww(szString, szProductCode))
bProductFound = TRUE;
/* IEnumVARIANT::Next */