Am Freitag, den 02.10.2009, 12:56 +0200 schrieb Michael Stefaniuc: > The best thing is to write a test for this behavior and test it on > different Windows versions. If even Windows 7 behaves that way I figure > we'll have to provide that "feature" too. Else the application is buggy > and won't work on all Windows versions either. > > bye > michael
Hi, nothing easier than this. But I guess it will not help us very much because we are testing bad application behaviour that only works because of Windows internal caching. I have attached a testcase and hope it shows the expected behaviour - at least it fails in my Wine git. Hopefully we can collect the results of all Windows versions (including 7). Markus
--- git/dlls/oleaut32/tests/vartest.c 2009-09-20 18:07:17.000000000 +0200 +++ wine/dlls/oleaut32/tests/vartest.c 2009-10-02 13:46:23.000000000 +0200 @@ -8555,10 +8555,41 @@ SysFreeString(true_str); } +static void test_SomethingStrange(void) +{ + BSTR s1,s2; + int i; + + const WCHAR sz99[] = {'1','2','3','4','5','6','7','8','9','0', + '1','2','3','4','5','6','7','8','9','0', + '1','2','3','4','5','6','7','8','9','0', + '1','2','3','4','5','6','7','8','9','0', + '1','2','3','4','5','6','7','8','9','0', + '1','2','3','4','5','6','7','8','9','0', + '1','2','3','4','5','6','7','8','9','0', + '1','2','3','4','5','6','7','8','9','0', + '1','2','3','4','5','6','7','8','9','0', + '1','2','3','4','5','6','7','8','9','0', + '1','2','3','4','5','6','7','8','9','0', + '1','2','3','4','5','6','7','8','9','0', + '1','2','\0'}; + + s1 = SysAllocString(sz12); + i = SysStringLen(s1); + ok(i == 2, "string length should be 2\n"); + SysFreeString(s1); + s2 = SysAllocString(sz99); /* simulate heap allocation */ + SysFreeString(s2); + i = SysStringLen(s1); + ok(i == 2, "string was overwritten after SysFreeString\n"); +} + + START_TEST(vartest) { init(); + test_SomethingStrange(); test_VariantInit(); test_VariantClear(); test_VariantCopy(); @@ -8590,5 +8621,5 @@ test_VarAnd(); test_VarDiv(); test_VarIdiv(); - test_VarImp(); + test_VarImp(); }