Commit fd0d1d07 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

urlmon: Added CopyStgMedium implementation.

parent 53c6cdf9
......@@ -18,6 +18,7 @@
#define COBJMACROS
#define CONST_VTABLE
#define NONAMELESSUNION
#include <wine/test.h>
#include <stdarg.h>
......@@ -1177,6 +1178,37 @@ static void test_ReleaseBindInfo(void)
ok(bi.pUnk == &unk, "bi.pUnk=%p, expected %p\n", bi.pUnk, &unk);
}
static void test_CopyStgMedium(void)
{
STGMEDIUM src, dst;
HRESULT hres;
memset(&src, 0xf0, sizeof(src));
memset(&dst, 0xe0, sizeof(dst));
src.tymed = TYMED_NULL;
src.pUnkForRelease = NULL;
hres = CopyStgMedium(&src, &dst);
ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
ok(dst.tymed == TYMED_NULL, "tymed=%d\n", dst.tymed);
ok(dst.u.hGlobal == (void*)0xf0f0f0f0, "u=%p\n", dst.u.hGlobal);
ok(!dst.pUnkForRelease, "pUnkForRelease=%p, expected NULL\n", dst.pUnkForRelease);
memset(&dst, 0xe0, sizeof(dst));
src.tymed = TYMED_ISTREAM;
src.u.pstm = NULL;
src.pUnkForRelease = NULL;
hres = CopyStgMedium(&src, &dst);
ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
ok(dst.tymed == TYMED_ISTREAM, "tymed=%d\n", dst.tymed);
ok(!dst.u.pstm, "pstm=%p\n", dst.u.pstm);
ok(!dst.pUnkForRelease, "pUnkForRelease=%p, expected NULL\n", dst.pUnkForRelease);
hres = CopyStgMedium(&src, NULL);
ok(hres == E_POINTER, "CopyStgMedium failed: %08x, expected E_POINTER\n", hres);
hres = CopyStgMedium(NULL, &dst);
ok(hres == E_POINTER, "CopyStgMedium failed: %08x, expected E_POINTER\n", hres);
}
static void test_UrlMkGetSessionOption(void)
{
DWORD encoding, size;
......@@ -1339,6 +1371,7 @@ START_TEST(misc)
test_NameSpace();
test_MimeFilter();
test_ReleaseBindInfo();
test_CopyStgMedium();
test_UrlMkGetSessionOption();
test_ObtainUserAgentString();
test_MkParseDisplayNameEx();
......
......@@ -21,7 +21,7 @@
@ stdcall CoInternetQueryInfo(ptr long long ptr long ptr long)
@ stub CompareSecurityIds
@ stub CopyBindInfo
@ stub CopyStgMedium
@ stdcall CopyStgMedium(ptr ptr)
@ stdcall CreateAsyncBindCtx(long ptr ptr ptr)
@ stdcall CreateAsyncBindCtxEx(ptr long ptr ptr ptr long)
@ stdcall CreateFormatEnumerator(long ptr ptr)
......
......@@ -406,6 +406,39 @@ void WINAPI ReleaseBindInfo(BINDINFO* pbindinfo)
pbindinfo->cbSize = size;
}
/***********************************************************************
* CopyStgMedium (URLMON.@)
*/
HRESULT WINAPI CopyStgMedium(const STGMEDIUM *src, STGMEDIUM *dst)
{
TRACE("(%p %p)\n", src, dst);
if(!src || !dst)
return E_POINTER;
memcpy(dst, src, sizeof(STGMEDIUM));
switch(dst->tymed) {
case TYMED_NULL:
break;
case TYMED_ISTREAM:
if(dst->u.pstm)
IStream_AddRef(dst->u.pstm);
break;
case TYMED_ISTORAGE:
if(dst->u.pstg)
IStorage_AddRef(dst->u.pstg);
break;
default:
FIXME("Unimplemented tymed %d\n", src->tymed);
}
if(dst->pUnkForRelease)
IUnknown_AddRef(dst->pUnkForRelease);
return S_OK;
}
static BOOL text_richtext_filter(const BYTE *b, DWORD size)
{
return size > 5 && !memcmp(b, "{\\rtf", 5);
......
......@@ -1279,6 +1279,7 @@ cpp_quote("HRESULT WINAPI ObtainUserAgentString(DWORD,LPSTR,DWORD*);")
cpp_quote("HRESULT WINAPI RegisterFormatEnumerator(LPBC,IEnumFORMATETC*,DWORD);")
cpp_quote("HRESULT WINAPI RevokeFormatEnumerator(LPBC,IEnumFORMATETC*);")
cpp_quote("HRESULT WINAPI RevokeBindStatusCallback(LPBC,IBindStatusCallback*);")
cpp_quote("HRESULT WINAPI CopyStgMedium(const STGMEDIUM*,STGMEDIUM*);")
cpp_quote("void WINAPI ReleaseBindInfo(BINDINFO*);")
cpp_quote("HRESULT WINAPI UrlMkGetSessionOption(DWORD,LPVOID,DWORD,DWORD*,DWORD);")
cpp_quote("HRESULT WINAPI UrlMkSetSessionOption(DWORD,LPVOID,DWORD,DWORD);")
......
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