Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
6c4bdf3b
Commit
6c4bdf3b
authored
May 19, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Implement TYMED_HGLOBAL case for CopyStgMedium.
parent
6542c708
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
1 deletion
+47
-1
misc.c
dlls/urlmon/tests/misc.c
+32
-1
urlmon_main.c
dlls/urlmon/urlmon_main.c
+15
-0
No files found.
dlls/urlmon/tests/misc.c
View file @
6c4bdf3b
...
...
@@ -1219,8 +1219,10 @@ static void test_ReleaseBindInfo(void)
static
void
test_CopyStgMedium
(
void
)
{
STGMEDIUM
src
,
dst
;
HGLOBAL
empty
;
HGLOBAL
empty
,
hg
;
char
*
ptr1
,
*
ptr2
;
HRESULT
hres
;
int
size
;
static
WCHAR
fileW
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
0
};
...
...
@@ -1257,6 +1259,35 @@ static void test_CopyStgMedium(void)
ok
(
!
dst
.
pUnkForRelease
,
"pUnkForRelease=%p, expected NULL
\n
"
,
dst
.
pUnkForRelease
);
ReleaseStgMedium
(
&
dst
);
/* TYMED_HGLOBAL */
hg
=
GlobalAlloc
(
GMEM_MOVEABLE
,
10
);
ptr1
=
GlobalLock
(
hg
);
memset
(
ptr1
,
0xfa
,
10
);
memset
(
&
dst
,
0xe0
,
sizeof
(
dst
));
src
.
tymed
=
TYMED_HGLOBAL
;
src
.
u
.
hGlobal
=
hg
;
hres
=
pCopyStgMedium
(
&
src
,
&
dst
);
ok
(
hres
==
S_OK
,
"CopyStgMedium failed: %08x
\n
"
,
hres
);
ok
(
dst
.
tymed
==
TYMED_HGLOBAL
,
"tymed=%d
\n
"
,
dst
.
tymed
);
ok
(
dst
.
u
.
hGlobal
!=
hg
,
"got %p, %p
\n
"
,
dst
.
u
.
hGlobal
,
hg
);
size
=
GlobalSize
(
dst
.
u
.
hGlobal
);
ok
(
size
==
10
,
"got size %d
\n
"
,
size
);
/* compare contents */
ptr2
=
GlobalLock
(
dst
.
u
.
hGlobal
);
ok
(
!
memcmp
(
ptr1
,
ptr2
,
10
),
"got wrong data
\n
"
);
GlobalUnlock
(
ptr2
);
GlobalUnlock
(
ptr1
);
ok
(
GlobalFlags
(
dst
.
u
.
hGlobal
)
==
0
,
"got 0x%08x
\n
"
,
GlobalFlags
(
dst
.
u
.
hGlobal
));
GlobalFree
(
hg
);
ReleaseStgMedium
(
&
dst
);
memset
(
&
dst
,
0xe0
,
sizeof
(
dst
));
src
.
tymed
=
TYMED_HGLOBAL
;
src
.
u
.
hGlobal
=
NULL
;
hres
=
pCopyStgMedium
(
&
src
,
&
dst
);
ok
(
hres
==
S_OK
,
"CopyStgMedium failed: %08x
\n
"
,
hres
);
ok
(
dst
.
u
.
hGlobal
==
NULL
,
"got %p
\n
"
,
dst
.
u
.
hGlobal
);
hres
=
pCopyStgMedium
(
&
src
,
NULL
);
ok
(
hres
==
E_POINTER
,
"CopyStgMedium failed: %08x, expected E_POINTER
\n
"
,
hres
);
hres
=
pCopyStgMedium
(
NULL
,
&
dst
);
...
...
dlls/urlmon/urlmon_main.c
View file @
6c4bdf3b
...
...
@@ -544,6 +544,21 @@ HRESULT WINAPI CopyStgMedium(const STGMEDIUM *src, STGMEDIUM *dst)
if
(
dst
->
u
.
pstg
)
IStorage_AddRef
(
dst
->
u
.
pstg
);
break
;
case
TYMED_HGLOBAL
:
if
(
dst
->
u
.
hGlobal
)
{
SIZE_T
size
=
GlobalSize
(
src
->
u
.
hGlobal
);
char
*
src_ptr
,
*
dst_ptr
;
dst
->
u
.
hGlobal
=
GlobalAlloc
(
GMEM_FIXED
,
size
);
if
(
!
dst
->
u
.
hGlobal
)
return
E_OUTOFMEMORY
;
dst_ptr
=
GlobalLock
(
dst
->
u
.
hGlobal
);
src_ptr
=
GlobalLock
(
src
->
u
.
hGlobal
);
memcpy
(
dst_ptr
,
src_ptr
,
size
);
GlobalUnlock
(
src_ptr
);
GlobalUnlock
(
dst_ptr
);
}
break
;
default:
FIXME
(
"Unimplemented tymed %d
\n
"
,
src
->
tymed
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment