urlmon: Added CopyBindInfo implementation.

This commit is contained in:
Piotr Caban 2012-03-08 13:45:12 +01:00 committed by Alexandre Julliard
parent 3d5db7a7f5
commit 7f0b7c5ce3
2 changed files with 66 additions and 1 deletions

View File

@ -28,7 +28,7 @@
@ stdcall CoInternetQueryInfo(ptr long long ptr long ptr long) @ stdcall CoInternetQueryInfo(ptr long long ptr long ptr long)
@ stdcall CoInternetSetFeatureEnabled(long long long) @ stdcall CoInternetSetFeatureEnabled(long long long)
@ stdcall CompareSecurityIds(ptr long ptr long long) @ stdcall CompareSecurityIds(ptr long ptr long long)
@ stub CopyBindInfo @ stdcall CopyBindInfo(ptr ptr)
@ stdcall CopyStgMedium(ptr ptr) @ stdcall CopyStgMedium(ptr ptr)
@ stdcall CreateAsyncBindCtx(long ptr ptr ptr) @ stdcall CreateAsyncBindCtx(long ptr ptr ptr)
@ stdcall CreateAsyncBindCtxEx(ptr long ptr ptr ptr long) @ stdcall CreateAsyncBindCtxEx(ptr long ptr ptr ptr long)

View File

@ -533,6 +533,8 @@ HRESULT WINAPI CopyStgMedium(const STGMEDIUM *src, STGMEDIUM *dst)
if(src->u.lpszFileName && !src->pUnkForRelease) { if(src->u.lpszFileName && !src->pUnkForRelease) {
DWORD size = (strlenW(src->u.lpszFileName)+1)*sizeof(WCHAR); DWORD size = (strlenW(src->u.lpszFileName)+1)*sizeof(WCHAR);
dst->u.lpszFileName = CoTaskMemAlloc(size); dst->u.lpszFileName = CoTaskMemAlloc(size);
if(!dst->u.lpszFileName)
return E_OUTOFMEMORY;
memcpy(dst->u.lpszFileName, src->u.lpszFileName, size); memcpy(dst->u.lpszFileName, src->u.lpszFileName, size);
} }
break; break;
@ -554,6 +556,69 @@ HRESULT WINAPI CopyStgMedium(const STGMEDIUM *src, STGMEDIUM *dst)
return S_OK; return S_OK;
} }
/***********************************************************************
* CopyBindInfo (URLMON.@)
*/
HRESULT WINAPI CopyBindInfo(const BINDINFO *pcbiSrc, BINDINFO *pcbiDest)
{
DWORD size;
HRESULT hres;
TRACE("(%p %p)\n", pcbiSrc, pcbiDest);
if(!pcbiSrc || !pcbiDest)
return E_POINTER;
if(!pcbiSrc->cbSize || !pcbiDest->cbSize)
return E_INVALIDARG;
size = pcbiDest->cbSize;
if(size > pcbiSrc->cbSize) {
memcpy(pcbiDest, pcbiSrc, pcbiSrc->cbSize);
memset((char*)pcbiDest+pcbiSrc->cbSize, 0, size-pcbiSrc->cbSize);
} else {
memcpy(pcbiDest, pcbiSrc, size);
}
pcbiDest->cbSize = size;
size = FIELD_OFFSET(BINDINFO, szExtraInfo)+sizeof(void*);
if(pcbiSrc->cbSize>=size && pcbiDest->cbSize>=size && pcbiSrc->szExtraInfo) {
size = (strlenW(pcbiSrc->szExtraInfo)+1)*sizeof(WCHAR);
pcbiDest->szExtraInfo = CoTaskMemAlloc(size);
if(!pcbiDest->szExtraInfo)
return E_OUTOFMEMORY;
memcpy(pcbiDest->szExtraInfo, pcbiSrc->szExtraInfo, size);
}
size = FIELD_OFFSET(BINDINFO, stgmedData)+sizeof(STGMEDIUM);
if(pcbiSrc->cbSize>=size && pcbiDest->cbSize>=size) {
hres = CopyStgMedium(&pcbiSrc->stgmedData, &pcbiDest->stgmedData);
if(FAILED(hres)) {
CoTaskMemFree(pcbiDest->szExtraInfo);
return hres;
}
}
size = FIELD_OFFSET(BINDINFO, szCustomVerb)+sizeof(void*);
if(pcbiSrc->cbSize>=size && pcbiDest->cbSize>=size && pcbiSrc->szCustomVerb) {
size = (strlenW(pcbiSrc->szCustomVerb)+1)*sizeof(WCHAR);
pcbiDest->szCustomVerb = CoTaskMemAlloc(size);
if(!pcbiDest->szCustomVerb) {
CoTaskMemFree(pcbiDest->szExtraInfo);
ReleaseStgMedium(&pcbiDest->stgmedData);
return E_OUTOFMEMORY;
}
}
size = FIELD_OFFSET(BINDINFO, securityAttributes)+sizeof(SECURITY_ATTRIBUTES);
if(pcbiDest->cbSize >= size)
memset(&pcbiDest->securityAttributes, 0, sizeof(SECURITY_ATTRIBUTES));
if(pcbiSrc->pUnk)
IUnknown_AddRef(pcbiDest->pUnk);
return S_OK;
}
static BOOL text_richtext_filter(const BYTE *b, DWORD size) static BOOL text_richtext_filter(const BYTE *b, DWORD size)
{ {
return size > 5 && !memcmp(b, "{\\rtf", 5); return size > 5 && !memcmp(b, "{\\rtf", 5);