Re: oleaut32: [Patch 1/2] VarCat must use localized names for VT_BOOL

2009-04-17 Thread Paul Vriens

Paul Vriens wrote:

Detlef Riekenberg wrote:

On Mi, 2009-04-15 at 13:37 +0200, Paul Vriens wrote:

The lstrcpyW and lstrcatW additions to init() in the tests don't work 
on   Win95. I guess that's where the new failures come from:


I removed a "broken(hres == VARCMP_GT)", and that's what VarCmp on 
your w95 machine returned.

My second Patch for oleaut32/tests/vartest.c was not applied, otherwise
we
would have seen the reason in the log.

Can you please use the attached diff and post the result?
Thanks



Here it is:

vartest.c:127: Tests skipped: No support for I8 and UI8 data types
vartest.c:5452: got 0x0 and VT_BSTR(12True) for VT_INT(12), VT_BOOL(1)
vartest.c:5455: got 0x2 for VT_BSTR(12True), VT_BSTR()
vartest.c:5456: Test failed: Expected VARCMP_EQ, got 0002 for 
VT_BSTR(12True), VT_BSTR()

vartest.c:5471: got 0x0 and VT_BSTR(12False) for VT_INT(12), VT_BOOL(0)
vartest.c:5474: got 0x2 for VT_BSTR(12False), VT_BSTR()
vartest.c:5475: Test failed: Expected VARCMP_EQ, got 0002 for 
VT_BSTR(12False), VT_BSTR()

vartest: 1025087 tests executed (0 marked as todo, 2 failures), 1 skipped.

As said. I think the reason for sz12_true being empty is that you are 
using W-functions in the init() function.



The attached patch fixes 'my' issue on Win95 so it's indeed the use of
W-functions.

--
Cheers,

Paul.

diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c
index 24ef171..ef1ecf2 100644
--- a/dlls/oleaut32/tests/vartest.c
+++ b/dlls/oleaut32/tests/vartest.c
@@ -102,19 +102,25 @@ static void init(void)
 {
 BSTR bstr;
 HRESULT res;
+CHAR localbool[32];
+CHAR sz12_trueA[32], sz12_falseA[32];
 
 res = VarBstrFromBool(VARIANT_TRUE, LANG_USER_DEFAULT, VAR_LOCALBOOL, 
&bstr);
-ok(SUCCEEDED(res) && (lstrlenW(bstr) > 0),
+WideCharToMultiByte(CP_ACP, 0, bstr, -1, localbool, sizeof(localbool), 
NULL, NULL);
+ok(SUCCEEDED(res) && (lstrlenA(localbool) > 0),
 "Expected localized string for 'True'\n");
-lstrcpyW(sz12_true, sz12);
-if (bstr) lstrcatW(sz12_true, bstr);
+lstrcpyA(sz12_trueA, "12");
+if (bstr) lstrcatA(sz12_trueA, localbool);
+MultiByteToWideChar(CP_ACP, 0, sz12_trueA, -1, sz12_true, 
sizeof(sz12_true)/sizeof(WCHAR));
 SysFreeString(bstr);
 
 res = VarBstrFromBool(VARIANT_FALSE, LANG_USER_DEFAULT, VAR_LOCALBOOL, 
&bstr);
-ok(SUCCEEDED(res) && (lstrlenW(bstr) > 0),
+WideCharToMultiByte(CP_ACP, 0, bstr, -1, localbool, sizeof(localbool), 
NULL, NULL);
+ok(SUCCEEDED(res) && (lstrlenA(localbool) > 0),
 "Expected localized string for 'False'\n");
-lstrcpyW(sz12_false, sz12);
-if (bstr) lstrcatW(sz12_false, bstr);
+lstrcpyA(sz12_falseA, "12");
+if (bstr) lstrcatA(sz12_falseA, localbool);
+MultiByteToWideChar(CP_ACP, 0, sz12_falseA, -1, sz12_false, 
sizeof(sz12_false)/sizeof(WCHAR));
 SysFreeString(bstr);
 
 hOleaut32 = GetModuleHandle("oleaut32.dll");




Re: oleaut32: [Patch 1/2] VarCat must use localized names for VT_BOOL

2009-04-17 Thread Paul Vriens

Detlef Riekenberg wrote:

On Mi, 2009-04-15 at 13:37 +0200, Paul Vriens wrote:

The lstrcpyW and lstrcatW additions to init() in the tests don't work on 
  Win95. I guess that's where the new failures come from:


I removed a "broken(hres == VARCMP_GT)", and that's what 
VarCmp on your w95 machine returned.

My second Patch for oleaut32/tests/vartest.c was not applied, otherwise
we
would have seen the reason in the log.

Can you please use the attached diff and post the result?
Thanks



Here it is:

vartest.c:127: Tests skipped: No support for I8 and UI8 data types
vartest.c:5452: got 0x0 and VT_BSTR(12True) for VT_INT(12), VT_BOOL(1)
vartest.c:5455: got 0x2 for VT_BSTR(12True), VT_BSTR()
vartest.c:5456: Test failed: Expected VARCMP_EQ, got 0002 for 
VT_BSTR(12True), VT_BSTR()

vartest.c:5471: got 0x0 and VT_BSTR(12False) for VT_INT(12), VT_BOOL(0)
vartest.c:5474: got 0x2 for VT_BSTR(12False), VT_BSTR()
vartest.c:5475: Test failed: Expected VARCMP_EQ, got 0002 for 
VT_BSTR(12False), VT_BSTR()

vartest: 1025087 tests executed (0 marked as todo, 2 failures), 1 skipped.

As said. I think the reason for sz12_true being empty is that you are 
using W-functions in the init() function.


--
Cheers,

Paul.




Re: oleaut32: [Patch 1/2] VarCat must use localized names for VT_BOOL

2009-04-16 Thread Detlef Riekenberg
On Mi, 2009-04-15 at 13:37 +0200, Paul Vriens wrote:

> The lstrcpyW and lstrcatW additions to init() in the tests don't work on 
>   Win95. I guess that's where the new failures come from:

I removed a "broken(hres == VARCMP_GT)", and that's what 
VarCmp on your w95 machine returned.
My second Patch for oleaut32/tests/vartest.c was not applied, otherwise
we
would have seen the reason in the log.

Can you please use the attached diff and post the result?
Thanks

-- 
 
By by ... Detlef
diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c
index 24ef171..f1abae7 100644
--- a/dlls/oleaut32/tests/vartest.c
+++ b/dlls/oleaut32/tests/vartest.c
@@ -257,6 +257,25 @@ static const char *variantstr( const VARIANT *var )
 sprintf( vtstr_buffer[vtstr_current], "VT_CY(%x%08x)", S(V_CY(var)).Hi, S(V_CY(var)).Lo ); break;
 case VT_DATE:
 sprintf( vtstr_buffer[vtstr_current], "VT_DATE(%g)", V_DATE(var) ); break;
+case VT_BOOL:
+sprintf( vtstr_buffer[vtstr_current], "VT_BOOL(%d)", V_BOOL(var)); break;
+case VT_BSTR:
+if (HIWORD(V_BSTR(var))) {
+LPSTR data;
+DWORD len;
+
+len = WideCharToMultiByte(CP_ACP, 0, V_BSTR(var), -1, NULL, 0, NULL, NULL);
+data = HeapAlloc(GetProcessHeap(), 0, len);
+WideCharToMultiByte(CP_ACP, 0, V_BSTR(var), -1, data, len, NULL, NULL);
+sprintf( vtstr_buffer[vtstr_current], "VT_BSTR(%s)", data);
+HeapFree(GetProcessHeap(), 0, data);
+}
+else
+{
+sprintf( vtstr_buffer[vtstr_current], "VT_BSTR(0x%x)", LOWORD(V_BSTR(var)));
+}
+break;
+
 default:
 return vtstr(V_VT(var));
 }
@@ -5430,8 +5449,10 @@ static void test_VarCat(void)
 V_BOOL(&right) = TRUE;
 V_BSTR(&expected) = SysAllocString(sz12_true);
 hres = VarCat(&left,&right,&result);
+trace("got 0x%x and %s for %s, %s\n", hres, variantstr(&result), variantstr(&left), variantstr(&right));
 ok(hres == S_OK, "VarCat failed with error 0x%08x\n", hres);
 hres = VarCmp(&result,&expected,lcid,0);
+trace("got 0x%x for %s, %s\n", hres, variantstr(&result), variantstr(&expected));
 ok(hres == VARCMP_EQ, "Expected VARCMP_EQ, got %08x for %s, %s\n",
 hres, variantstr(&result), variantstr(&expected));
 
@@ -5447,8 +5468,10 @@ static void test_VarCat(void)
 V_BOOL(&right) = FALSE;
 V_BSTR(&expected) = SysAllocString(sz12_false);
 hres = VarCat(&left,&right,&result);
+trace("got 0x%x and %s for %s, %s\n", hres, variantstr(&result), variantstr(&left), variantstr(&right));
 ok(hres == S_OK, "VarCat failed with error 0x%08x\n", hres);
 hres = VarCmp(&result,&expected,lcid,0);
+trace("got 0x%x for %s, %s\n", hres, variantstr(&result), variantstr(&expected));
 ok(hres == VARCMP_EQ, "Expected VARCMP_EQ, got %08x for %s, %s\n",
 hres, variantstr(&result), variantstr(&expected));
 



Re: oleaut32: [Patch 1/2] VarCat must use localized names for VT_BOOL

2009-04-15 Thread Paul Vriens

Detlef Riekenberg wrote:

http://test.winehq.org/data/f212579ae9a1b770ebd34cec20f95e1977bb57f0/xp_dr-asus/oleaut32:vartest.html

While reading the code for a test failure on all of my Windows
installations,
the current code was already strange:

5436 ok(hres == VARCMP_EQ ||
5437broken(hres == VARCMP_GT), "Expected VARCMP_EQ, got %08x\n",
hres);

I feel bad for adding a "broken(hres == VARCMP_LT)".

Extending vartest and inserting a trace made the localization error
obvisious:
VARCMP_LT was returned when comparing "12Falsch" and "12False".

The failure for the similar test (VT_BOOL with True: "12Wahr" >
"12True")
was hidden by the wrong "broken(hres == VARCMP_GT)".

We have also another XP Machine that produced this failure.
(xp-home-SP2-czech)








Hi Detlef,

The lstrcpyW and lstrcatW additions to init() in the tests don't work on 
 Win95. I guess that's where the new failures come from:


http://test.winehq.org/data/ed74088d7ddf0c389e7596237add7cb751b17a0a/95_W95/oleaut32:vartest.html

Could you have a look?

--
Cheers,

Paul.