Module: wine Branch: master Commit: d82c456e5f94fcdb07040eedd2bec04bffddbd1d URL: http://source.winehq.org/git/wine.git/?a=commit;h=d82c456e5f94fcdb07040eedd2...
Author: Rob Shearman rob@codeweavers.com Date: Wed May 23 19:05:24 2007 +0100
urlmon: The persisted version of URL monikers should be size of URL including nul-terminating character (4-bytes), followed by the URL string including nul-terminating character.
---
dlls/urlmon/umon.c | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/dlls/urlmon/umon.c b/dlls/urlmon/umon.c index 0f86b83..5c795f0 100644 --- a/dlls/urlmon/umon.c +++ b/dlls/urlmon/umon.c @@ -410,23 +410,23 @@ static HRESULT WINAPI URLMonikerImpl_Load(IMoniker* iface,IStream* pStm) URLMonikerImpl *This = (URLMonikerImpl *)iface;
HRESULT res; - ULONG len; + ULONG size; ULONG got; TRACE("(%p,%p)\n",This,pStm);
if(!pStm) return E_INVALIDARG;
- res = IStream_Read(pStm, &len, sizeof(ULONG), &got); + res = IStream_Read(pStm, &size, sizeof(ULONG), &got); if(SUCCEEDED(res)) { if(got == sizeof(ULONG)) { HeapFree(GetProcessHeap(), 0, This->URLName); - This->URLName=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(len+1)); + This->URLName=HeapAlloc(GetProcessHeap(),0,size); if(!This->URLName) res = E_OUTOFMEMORY; else { - res = IStream_Read(pStm, This->URLName, len, NULL); - This->URLName[len] = 0; + res = IStream_Read(pStm, This->URLName, size, NULL); + This->URLName[size/sizeof(WCHAR) - 1] = 0; } } else @@ -445,16 +445,16 @@ static HRESULT WINAPI URLMonikerImpl_Save(IMoniker* iface, URLMonikerImpl *This = (URLMonikerImpl *)iface;
HRESULT res; - ULONG len; + ULONG size; TRACE("(%p,%p,%d)\n",This,pStm,fClearDirty);
if(!pStm) return E_INVALIDARG;
- len = strlenW(This->URLName); - res=IStream_Write(pStm,&len,sizeof(ULONG),NULL); + size = (strlenW(This->URLName) + 1)*sizeof(WCHAR); + res=IStream_Write(pStm,&size,sizeof(ULONG),NULL); if(SUCCEEDED(res)) - res=IStream_Write(pStm,This->URLName,len*sizeof(WCHAR),NULL); + res=IStream_Write(pStm,This->URLName,size,NULL); return res;
} @@ -472,8 +472,7 @@ static HRESULT WINAPI URLMonikerImpl_GetSizeMax(IMoniker* iface, if(!pcbSize) return E_INVALIDARG;
- pcbSize->u.LowPart = sizeof(ULONG) + (strlenW(This->URLName) * sizeof(WCHAR)); - pcbSize->u.HighPart = 0; + pcbSize->QuadPart = sizeof(ULONG) + ((strlenW(This->URLName)+1) * sizeof(WCHAR)); return S_OK; }