Skip to content

Commit bd9a83b

Browse files
committed
[SHLWAPI_APITEST] Fix interface pointer type mismatch
If you query an IPropertyBag2, then your object pointer better be an IPropertyBag2*! Fixes RTC failure with WinDbg on x86.
1 parent 936c0e7 commit bd9a83b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

modules/rostests/apitests/shlwapi/SHPropertyBag.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -619,28 +619,34 @@ static void SHPropertyBag_OnRegKey(void)
619619
pPropBag->Release();
620620

621621
// Create as write-only IPropertyBag2
622+
IPropertyBag2 *pPropBag2;
622623
hr = SHCreatePropertyBagOnRegKey(hKey, L"PropBagTest", STGM_WRITE,
623-
IID_IPropertyBag2, (void **)&pPropBag);
624+
IID_IPropertyBag2, (void **)&pPropBag2);
624625
ok_long(hr, S_OK);
625626

626627
// Write UI4
628+
PROPBAG2 propBag2 = {};
629+
propBag2.dwType = PROPBAG2_TYPE_DATA;
630+
propBag2.vt = VT_UI4;
631+
propBag2.pstrName = const_cast<LPOLESTR>(L"Name1");
627632
VariantInit(&vari);
628633
V_VT(&vari) = VT_UI4;
629634
V_UI4(&vari) = 0xDEADFACE;
630-
hr = pPropBag->Write(L"Name3", &vari);
635+
hr = pPropBag2->Write(1, &propBag2, &vari);
631636
ok_long(hr, E_NOTIMPL);
632637
VariantClear(&vari);
633638

634639
// Read UI4
635640
VariantInit(&vari);
636641
V_UI4(&vari) = 0xFEEDF00D;
637-
hr = pPropBag->Read(L"Name3", &vari, NULL);
642+
HRESULT hrPropBag;
643+
hr = pPropBag2->Read(1, &propBag2, NULL, &vari, &hrPropBag);
638644
ok_long(hr, E_NOTIMPL);
639645
ok_int(V_VT(&vari), VT_EMPTY);
640646
ok_long(V_UI4(&vari), 0xFEEDF00D);
641647
VariantClear(&vari);
642648

643-
pPropBag->Release();
649+
pPropBag2->Release();
644650

645651
// Clean up
646652
RegDeleteKeyW(hKey, L"PropBagTest");

0 commit comments

Comments
 (0)