mirror of
https://github.com/reactos/wine.git
synced 2024-11-24 20:30:01 +00:00
urlmon: Added TYMED_FILE support to CopyStgMedium.
This commit is contained in:
parent
d2243989ca
commit
74b0897cf0
@ -1183,6 +1183,8 @@ static void test_CopyStgMedium(void)
|
||||
STGMEDIUM src, dst;
|
||||
HRESULT hres;
|
||||
|
||||
static WCHAR fileW[] = {'f','i','l','e',0};
|
||||
|
||||
memset(&src, 0xf0, sizeof(src));
|
||||
memset(&dst, 0xe0, sizeof(dst));
|
||||
src.tymed = TYMED_NULL;
|
||||
@ -1203,6 +1205,17 @@ static void test_CopyStgMedium(void)
|
||||
ok(!dst.u.pstm, "pstm=%p\n", dst.u.pstm);
|
||||
ok(!dst.pUnkForRelease, "pUnkForRelease=%p, expected NULL\n", dst.pUnkForRelease);
|
||||
|
||||
memset(&dst, 0xe0, sizeof(dst));
|
||||
src.tymed = TYMED_FILE;
|
||||
src.u.lpszFileName = fileW;
|
||||
src.pUnkForRelease = NULL;
|
||||
hres = CopyStgMedium(&src, &dst);
|
||||
ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
|
||||
ok(dst.tymed == TYMED_FILE, "tymed=%d\n", dst.tymed);
|
||||
ok(dst.u.lpszFileName && dst.u.lpszFileName != fileW, "lpszFileName=%p\n", dst.u.lpszFileName);
|
||||
ok(!lstrcmpW(dst.u.lpszFileName, fileW), "wrong file name\n");
|
||||
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);
|
||||
|
@ -398,7 +398,6 @@ void WINAPI ReleaseBindInfo(BINDINFO* pbindinfo)
|
||||
if(offsetof(BINDINFO, szExtraInfo) < size)
|
||||
CoTaskMemFree(pbindinfo->szCustomVerb);
|
||||
|
||||
|
||||
if(pbindinfo->pUnk && offsetof(BINDINFO, pUnk) < size)
|
||||
IUnknown_Release(pbindinfo->pUnk);
|
||||
|
||||
@ -421,6 +420,13 @@ HRESULT WINAPI CopyStgMedium(const STGMEDIUM *src, STGMEDIUM *dst)
|
||||
switch(dst->tymed) {
|
||||
case TYMED_NULL:
|
||||
break;
|
||||
case TYMED_FILE:
|
||||
if(src->u.lpszFileName && !src->pUnkForRelease) {
|
||||
DWORD size = (strlenW(src->u.lpszFileName)+1)*sizeof(WCHAR);
|
||||
dst->u.lpszFileName = CoTaskMemAlloc(size);
|
||||
memcpy(dst->u.lpszFileName, src->u.lpszFileName, size);
|
||||
}
|
||||
break;
|
||||
case TYMED_ISTREAM:
|
||||
if(dst->u.pstm)
|
||||
IStream_AddRef(dst->u.pstm);
|
||||
|
Loading…
Reference in New Issue
Block a user