Commit 996b35f2 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

ole32: The unknown constant at the start of the persisted data is the number of…

ole32: The unknown constant at the start of the persisted data is the number of monikers in the generic composite. Fix the pointer passed into IEnumMoniker_Release in CompositeMonikerImpl_Save.
parent c8c93e66
...@@ -202,9 +202,8 @@ static HRESULT WINAPI ...@@ -202,9 +202,8 @@ static HRESULT WINAPI
CompositeMonikerImpl_Load(IMoniker* iface,IStream* pStm) CompositeMonikerImpl_Load(IMoniker* iface,IStream* pStm)
{ {
HRESULT res; HRESULT res;
DWORD constant; DWORD moniker_count;
CLSID clsid; DWORD i;
WCHAR string[1]={0};
CompositeMonikerImpl *This = (CompositeMonikerImpl *)iface; CompositeMonikerImpl *This = (CompositeMonikerImpl *)iface;
...@@ -212,54 +211,20 @@ CompositeMonikerImpl_Load(IMoniker* iface,IStream* pStm) ...@@ -212,54 +211,20 @@ CompositeMonikerImpl_Load(IMoniker* iface,IStream* pStm)
/* this function call OleLoadFromStream function for each moniker within this object */ /* this function call OleLoadFromStream function for each moniker within this object */
/* read the a constant written by CompositeMonikerImpl_Save (see CompositeMonikerImpl_Save for more details)*/ res=IStream_Read(pStm,&moniker_count,sizeof(DWORD),NULL);
res=IStream_Read(pStm,&constant,sizeof(DWORD),NULL); if (res != S_OK)
{
if (SUCCEEDED(res)&& constant!=3) ERR("couldn't reading moniker count from stream\n");
return E_FAIL; return E_FAIL;
}
while(1){ for (i = 0; i < moniker_count; i++)
#if 0 {
res=OleLoadFromStream(pStm,&IID_IMoniker,(void**)&This->tabMoniker[This->tabLastIndex]); res=OleLoadFromStream(pStm,&IID_IMoniker,(void**)&This->tabMoniker[This->tabLastIndex]);
#endif
res=ReadClassStm(pStm,&clsid);
DPRINTF("res=%ld",res);
if (FAILED(res)) if (FAILED(res))
break;
if (IsEqualIID(&clsid,&CLSID_FileMoniker)){
res=CreateFileMoniker(string,&This->tabMoniker[This->tabLastIndex]);
if (FAILED(res))
break;
res=IMoniker_Load(This->tabMoniker[This->tabLastIndex],pStm);
if (FAILED(res))
break;
}
else if (IsEqualIID(&clsid,&CLSID_ItemMoniker)){
CreateItemMoniker(string,string,&This->tabMoniker[This->tabLastIndex]);
if (res!=S_OK)
break;
IMoniker_Load(This->tabMoniker[This->tabLastIndex],pStm);
if (FAILED(res))
break;
}
else if (IsEqualIID(&clsid,&CLSID_AntiMoniker)){
CreateAntiMoniker(&This->tabMoniker[This->tabLastIndex]);
if (FAILED(res))
break;
IMoniker_Load(This->tabMoniker[This->tabLastIndex],pStm);
if (FAILED(res))
break;
}
else if (IsEqualIID(&clsid,&CLSID_CompositeMoniker))
return E_FAIL;
else
{ {
FIXME("()\n"); ERR("couldn't load moniker from stream, res = 0x%08lx\n", res);
/* FIXME: To whoever wrote this code: It's either return or break. it cannot be both! */
break; break;
return E_NOTIMPL;
} }
/* resize the table if needed */ /* resize the table if needed */
...@@ -282,10 +247,11 @@ CompositeMonikerImpl_Load(IMoniker* iface,IStream* pStm) ...@@ -282,10 +247,11 @@ CompositeMonikerImpl_Load(IMoniker* iface,IStream* pStm)
static HRESULT WINAPI static HRESULT WINAPI
CompositeMonikerImpl_Save(IMoniker* iface,IStream* pStm,BOOL fClearDirty) CompositeMonikerImpl_Save(IMoniker* iface,IStream* pStm,BOOL fClearDirty)
{ {
CompositeMonikerImpl *This = (CompositeMonikerImpl *)iface;
HRESULT res; HRESULT res;
IEnumMoniker *enumMk; IEnumMoniker *enumMk;
IMoniker *pmk; IMoniker *pmk;
DWORD constant=3; DWORD moniker_count = This->tabLastIndex;
TRACE("(%p,%p,%d)\n",iface,pStm,fClearDirty); TRACE("(%p,%p,%d)\n",iface,pStm,fClearDirty);
...@@ -295,7 +261,8 @@ CompositeMonikerImpl_Save(IMoniker* iface,IStream* pStm,BOOL fClearDirty) ...@@ -295,7 +261,8 @@ CompositeMonikerImpl_Save(IMoniker* iface,IStream* pStm,BOOL fClearDirty)
* at the beginning of the stream. I don't known why (there's no * at the beginning of the stream. I don't known why (there's no
* indication in the specification) ! * indication in the specification) !
*/ */
res=IStream_Write(pStm,&constant,sizeof(constant),NULL); res=IStream_Write(pStm,&moniker_count,sizeof(moniker_count),NULL);
if (FAILED(res)) return res;
IMoniker_Enum(iface,TRUE,&enumMk); IMoniker_Enum(iface,TRUE,&enumMk);
...@@ -307,7 +274,7 @@ CompositeMonikerImpl_Save(IMoniker* iface,IStream* pStm,BOOL fClearDirty) ...@@ -307,7 +274,7 @@ CompositeMonikerImpl_Save(IMoniker* iface,IStream* pStm,BOOL fClearDirty)
if (FAILED(res)){ if (FAILED(res)){
IEnumMoniker_Release(pmk); IEnumMoniker_Release(enumMk);
return res; return res;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment