Hi,
as I'm still working on a resolution to bug #9575 I have digged into several directions. My current opinion is that IStorage_CreateStorage for some unkown reason increments the reference pointer of the associated IStorage object. In native Windows this is not the case.
My 37th try in writing a Wine testcase resulted in the following code that hopefully shows the difference between the two environments. I put it somewhere in the storage32 tests to get it running. No warranty for side effects.
static const WCHAR yyy[] = { 'x','.','t','x','t',0 }; r = StgOpenStorage( yyy, NULL, STGM_TRANSACTED | STGM_SHARE_EXCLUSIVE | STGM_READWRITE , NULL, 0, &stg); ok(r==S_OK, "StgCreateStorage failed\n"); if(stg) { static const WCHAR xxx[] = { 'D','a','t','a','S','p','a','c','e','I','n','f','o',0 }; IStorage_CreateStorage(stg,xxx,STGM_READWRITE | STGM_SHARE_EXCLUSIVE,0,0,&stg2); if (stg2) { r = IStorage_AddRef(stg); ok(r == 2, "WINE ERROR: refcount should be 2\n"); IStorage_Release(stg2); while ( r ) r=IStorage_Release(stg); } else { ok( 1 == 2, "IStorage::CreateStorage failed\n"); IStorage_Release(stg); } }
If I got everything in the right place this test should fail on Wine wheres it will be ok in Windows. Before doing further research I hope someone of the experts can check if the test really reveals the source of the above mentioned bug.
Thanks in advance.