- Add error messages on failure in file moniker load function.
- Fix incorrect pointer check in both monikers. - Fix max size calculation of item moniker to match native.
This commit is contained in:
parent
27d73d6115
commit
8d6a673cf7
|
@ -198,31 +198,46 @@ FileMonikerImpl_Load(IMoniker* iface,IStream* pStm)
|
||||||
/* first WORD is non significative */
|
/* first WORD is non significative */
|
||||||
res=IStream_Read(pStm,&wbuffer,sizeof(WORD),&bread);
|
res=IStream_Read(pStm,&wbuffer,sizeof(WORD),&bread);
|
||||||
if (bread!=sizeof(WORD) || wbuffer!=0)
|
if (bread!=sizeof(WORD) || wbuffer!=0)
|
||||||
|
{
|
||||||
|
ERR("Couldn't read 0 word\n");
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
/* read filePath string length (plus one) */
|
/* read filePath string length (plus one) */
|
||||||
res=IStream_Read(pStm,&length,sizeof(DWORD),&bread);
|
res=IStream_Read(pStm,&length,sizeof(DWORD),&bread);
|
||||||
if (bread != sizeof(DWORD))
|
if (bread != sizeof(DWORD))
|
||||||
|
{
|
||||||
|
ERR("Couldn't read file string length\n");
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
/* read filePath string */
|
/* read filePath string */
|
||||||
filePathA=HeapAlloc(GetProcessHeap(),0,length);
|
filePathA=HeapAlloc(GetProcessHeap(),0,length);
|
||||||
res=IStream_Read(pStm,filePathA,length,&bread);
|
res=IStream_Read(pStm,filePathA,length,&bread);
|
||||||
HeapFree(GetProcessHeap(),0,filePathA);
|
HeapFree(GetProcessHeap(),0,filePathA);
|
||||||
if (bread != length)
|
if (bread != length)
|
||||||
|
{
|
||||||
|
ERR("Couldn't read file path string\n");
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
/* read the first constant */
|
/* read the first constant */
|
||||||
IStream_Read(pStm,&dwbuffer,sizeof(DWORD),&bread);
|
IStream_Read(pStm,&dwbuffer,sizeof(DWORD),&bread);
|
||||||
if (bread != sizeof(DWORD) || dwbuffer != 0xDEADFFFF)
|
if (bread != sizeof(DWORD) || dwbuffer != 0xDEADFFFF)
|
||||||
|
{
|
||||||
|
ERR("Couldn't read 0xDEADFFFF constant\n");
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
length--;
|
length--;
|
||||||
|
|
||||||
for(i=0;i<10;i++){
|
for(i=0;i<10;i++){
|
||||||
res=IStream_Read(pStm,&wbuffer,sizeof(WORD),&bread);
|
res=IStream_Read(pStm,&wbuffer,sizeof(WORD),&bread);
|
||||||
if (bread!=sizeof(WORD) || wbuffer!=0)
|
if (bread!=sizeof(WORD) || wbuffer!=0)
|
||||||
|
{
|
||||||
|
ERR("Couldn't read 0 padding\n");
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length>8)
|
if (length>8)
|
||||||
|
@ -364,7 +379,7 @@ FileMonikerImpl_GetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize)
|
||||||
|
|
||||||
TRACE("(%p,%p)\n",iface,pcbSize);
|
TRACE("(%p,%p)\n",iface,pcbSize);
|
||||||
|
|
||||||
if (pcbSize!=NULL)
|
if (!pcbSize)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
/* for more details see FileMonikerImpl_Save coments */
|
/* for more details see FileMonikerImpl_Save coments */
|
||||||
|
|
|
@ -369,17 +369,16 @@ HRESULT WINAPI ItemMonikerImpl_GetSizeMax(IMoniker* iface,
|
||||||
|
|
||||||
TRACE("(%p,%p)\n",iface,pcbSize);
|
TRACE("(%p,%p)\n",iface,pcbSize);
|
||||||
|
|
||||||
if (pcbSize!=NULL)
|
if (!pcbSize)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
/* for more details see ItemMonikerImpl_Save coments */
|
/* for more details see ItemMonikerImpl_Save coments */
|
||||||
|
|
||||||
pcbSize->u.LowPart = sizeof(DWORD) + /* DWORD which contains delimiter length */
|
pcbSize->u.LowPart = sizeof(DWORD) + /* DWORD which contains delimiter length */
|
||||||
delimiterLength + /* item delimiter string */
|
delimiterLength*4 + /* item delimiter string */
|
||||||
sizeof(DWORD) + /* DWORD which contains item name length */
|
sizeof(DWORD) + /* DWORD which contains item name length */
|
||||||
nameLength + /* item name string */
|
nameLength*4 + /* item name string */
|
||||||
34; /* this constant was added ! because when I tested this function it usually */
|
18; /* strange, but true */
|
||||||
/* returns 34 bytes more than the number of bytes used by IMoniker::Save function */
|
|
||||||
pcbSize->u.HighPart=0;
|
pcbSize->u.HighPart=0;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
Loading…
Reference in New Issue