* Dont forget that the REFIID corresponds to the interface you want:
IID_IPropertySetStorage wants IPropertySetStorage*
IID_IStorage wants IStorage*
* Dont forget to release interfaces after usage.
* Dont forget use interfaces only valid if the return value (HRESULT) == S_OK.
This looks better:
IStorage* pStorage;
IStream* pStream;
HRESULT hr;
hr = StgOpenStorageEx
(
L"E:\\Root.stg",
STGM_READ|STGM_SHARE_DENY_WRITE,
STGFMT_DOCFILE,
0, NULL, 0,
IID_IStorage,
(void**)&pStorage
);
if(S_OK==hr)
{
printf("Storage opened");
if(S_OK==pStorage->OpenStream(L"Rodies.mp3",NULL,STGM_DIRECT | STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE,0,(void**)&pStream))
{
printf("Stream opened");
pStream->Release();
}
else
{
printf("Not Opened");
}
pStorage->Release();
}
_getch();
Good luck.