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
7c1d8b29
Commit
7c1d8b29
authored
Jul 04, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32/tests: Use nameless unions/structs.
parent
61a06d4b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
212 additions
and
216 deletions
+212
-216
clipboard.c
dlls/ole32/tests/clipboard.c
+18
-19
marshal.c
dlls/ole32/tests/marshal.c
+2
-2
ole2.c
dlls/ole32/tests/ole2.c
+40
-40
propvariant.c
dlls/ole32/tests/propvariant.c
+45
-45
stg_prop.c
dlls/ole32/tests/stg_prop.c
+62
-62
storage32.c
dlls/ole32/tests/storage32.c
+28
-31
usrmarshal.c
dlls/ole32/tests/usrmarshal.c
+17
-17
No files found.
dlls/ole32/tests/clipboard.c
View file @
7c1d8b29
...
...
@@ -20,7 +20,6 @@
#define COBJMACROS
#define CONST_VTABLE
#define NONAMELESSUNION
#include <stdarg.h>
#include <stdio.h>
...
...
@@ -275,7 +274,7 @@ static HRESULT WINAPI DataObjectImpl_GetData(IDataObject* iface, FORMATETC *pfor
DataObjectImpl_GetData_calls
++
;
ok
(
pmedium
->
tymed
==
0
,
"pmedium->tymed = %lu
\n
"
,
pmedium
->
tymed
);
ok
(
U
(
*
pmedium
).
hGlobal
==
NULL
,
"pmedium->hGlobal = %p
\n
"
,
U
(
*
pmedium
).
hGlobal
);
ok
(
pmedium
->
hGlobal
==
NULL
,
"pmedium->hGlobal = %p
\n
"
,
pmedium
->
hGlobal
);
ok
(
pmedium
->
pUnkForRelease
==
NULL
,
"pmedium->pUnkForRelease = %p
\n
"
,
pmedium
->
pUnkForRelease
);
if
(
pformatetc
->
lindex
!=
-
1
)
...
...
@@ -293,24 +292,24 @@ static HRESULT WINAPI DataObjectImpl_GetData(IDataObject* iface, FORMATETC *pfor
if
(
pformatetc
->
cfFormat
==
CF_TEXT
||
pformatetc
->
cfFormat
==
cf_global
)
{
pmedium
->
tymed
=
TYMED_HGLOBAL
;
U
(
*
pmedium
).
hGlobal
=
This
->
text
;
pmedium
->
hGlobal
=
This
->
text
;
}
else
if
(
pformatetc
->
cfFormat
==
cf_stream
)
{
pmedium
->
tymed
=
TYMED_ISTREAM
;
IStream_AddRef
(
This
->
stm
);
U
(
*
pmedium
).
pstm
=
This
->
stm
;
pmedium
->
pstm
=
This
->
stm
;
}
else
if
(
pformatetc
->
cfFormat
==
cf_storage
||
pformatetc
->
cfFormat
==
cf_another
)
{
pmedium
->
tymed
=
TYMED_ISTORAGE
;
IStorage_AddRef
(
This
->
stg
);
U
(
*
pmedium
).
pstg
=
This
->
stg
;
pmedium
->
pstg
=
This
->
stg
;
}
else
if
(
pformatetc
->
cfFormat
==
CF_METAFILEPICT
)
{
pmedium
->
tymed
=
TYMED_MFPICT
;
U
(
*
pmedium
).
hMetaFilePict
=
This
->
hmfp
;
pmedium
->
hMetaFilePict
=
This
->
hmfp
;
}
return
S_OK
;
}
...
...
@@ -1412,7 +1411,7 @@ static void test_flushed_getdata(void)
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
ok
(
med
.
tymed
==
TYMED_ISTORAGE
,
"got %lx
\n
"
,
med
.
tymed
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IStorage_Stat
(
med
.
u
.
pstg
,
&
stat
,
STATFLAG_NONAME
);
hr
=
IStorage_Stat
(
med
.
pstg
,
&
stat
,
STATFLAG_NONAME
);
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
ok
(
stat
.
grfMode
==
(
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
),
"got %08lx
\n
"
,
stat
.
grfMode
);
ReleaseStgMedium
(
&
med
);
...
...
@@ -1704,7 +1703,7 @@ static void test_nonole_clipboard(void)
InitFormatEtc
(
fmt
,
CF_ENHMETAFILE
,
TYMED_ENHMF
);
hr
=
IDataObject_GetData
(
get
,
&
fmt
,
&
med
);
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
obj_type
=
GetObjectType
(
U
(
med
)
.
hEnhMetaFile
);
obj_type
=
GetObjectType
(
med
.
hEnhMetaFile
);
ok
(
obj_type
==
OBJ_ENHMETAFILE
,
"got %ld
\n
"
,
obj_type
);
if
(
SUCCEEDED
(
hr
))
ReleaseStgMedium
(
&
med
);
...
...
@@ -1753,7 +1752,7 @@ static void test_getdatahere(void)
med
.
pUnkForRelease
=
NULL
;
med
.
tymed
=
TYMED_HGLOBAL
;
U
(
med
)
.
hGlobal
=
GlobalAlloc
(
GMEM_MOVEABLE
,
100
);
med
.
hGlobal
=
GlobalAlloc
(
GMEM_MOVEABLE
,
100
);
hr
=
IDataObject_GetDataHere
(
get
,
&
fmt
,
&
med
);
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
ok
(
med
.
tymed
==
TYMED_HGLOBAL
,
"got %lx
\n
"
,
med
.
tymed
);
...
...
@@ -1765,7 +1764,7 @@ static void test_getdatahere(void)
med
.
pUnkForRelease
=
NULL
;
med
.
tymed
=
TYMED_HGLOBAL
;
U
(
med
)
.
hGlobal
=
GlobalAlloc
(
GMEM_MOVEABLE
,
100
);
med
.
hGlobal
=
GlobalAlloc
(
GMEM_MOVEABLE
,
100
);
hr
=
IDataObject_GetDataHere
(
get
,
&
fmt
,
&
med
);
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
ok
(
med
.
tymed
==
TYMED_HGLOBAL
,
"got %lx
\n
"
,
med
.
tymed
);
...
...
@@ -1775,7 +1774,7 @@ static void test_getdatahere(void)
med
.
pUnkForRelease
=
NULL
;
med
.
tymed
=
TYMED_HGLOBAL
;
U
(
med
)
.
hGlobal
=
GlobalAlloc
(
GMEM_MOVEABLE
,
1
);
med
.
hGlobal
=
GlobalAlloc
(
GMEM_MOVEABLE
,
1
);
hr
=
IDataObject_GetDataHere
(
get
,
&
fmt
,
&
med
);
ok
(
hr
==
E_FAIL
,
"got %08lx
\n
"
,
hr
);
ok
(
med
.
tymed
==
TYMED_HGLOBAL
,
"got %lx
\n
"
,
med
.
tymed
);
...
...
@@ -1785,7 +1784,7 @@ static void test_getdatahere(void)
med
.
pUnkForRelease
=
NULL
;
med
.
tymed
=
TYMED_ISTREAM
;
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
U
(
med
)
.
pstm
);
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
med
.
pstm
);
hr
=
IDataObject_GetDataHere
(
get
,
&
fmt
,
&
med
);
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
ok
(
med
.
tymed
==
TYMED_ISTREAM
,
"got %lx
\n
"
,
med
.
tymed
);
...
...
@@ -1795,7 +1794,7 @@ static void test_getdatahere(void)
med
.
pUnkForRelease
=
NULL
;
med
.
tymed
=
TYMED_ISTORAGE
;
StgCreateDocfile
(
NULL
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
|
STGM_DELETEONRELEASE
,
0
,
&
U
(
med
)
.
pstg
);
StgCreateDocfile
(
NULL
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
|
STGM_DELETEONRELEASE
,
0
,
&
med
.
pstg
);
hr
=
IDataObject_GetDataHere
(
get
,
&
fmt
,
&
med
);
ok
(
hr
==
E_FAIL
,
"got %08lx
\n
"
,
hr
);
ok
(
med
.
tymed
==
TYMED_ISTORAGE
,
"got %lx
\n
"
,
med
.
tymed
);
...
...
@@ -1807,7 +1806,7 @@ static void test_getdatahere(void)
med
.
pUnkForRelease
=
NULL
;
med
.
tymed
=
TYMED_HGLOBAL
;
U
(
med
)
.
hGlobal
=
GlobalAlloc
(
GMEM_MOVEABLE
,
100
);
med
.
hGlobal
=
GlobalAlloc
(
GMEM_MOVEABLE
,
100
);
hr
=
IDataObject_GetDataHere
(
get
,
&
fmt
,
&
med
);
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
ok
(
med
.
tymed
==
TYMED_HGLOBAL
,
"got %lx
\n
"
,
med
.
tymed
);
...
...
@@ -1817,7 +1816,7 @@ static void test_getdatahere(void)
med
.
pUnkForRelease
=
NULL
;
med
.
tymed
=
TYMED_ISTREAM
;
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
U
(
med
)
.
pstm
);
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
med
.
pstm
);
hr
=
IDataObject_GetDataHere
(
get
,
&
fmt
,
&
med
);
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
ok
(
med
.
tymed
==
TYMED_ISTREAM
,
"got %lx
\n
"
,
med
.
tymed
);
...
...
@@ -1827,7 +1826,7 @@ static void test_getdatahere(void)
med
.
pUnkForRelease
=
NULL
;
med
.
tymed
=
TYMED_ISTORAGE
;
StgCreateDocfile
(
NULL
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
|
STGM_DELETEONRELEASE
,
0
,
&
U
(
med
)
.
pstg
);
StgCreateDocfile
(
NULL
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
|
STGM_DELETEONRELEASE
,
0
,
&
med
.
pstg
);
hr
=
IDataObject_GetDataHere
(
get
,
&
fmt
,
&
med
);
ok
(
hr
==
E_FAIL
,
"got %08lx
\n
"
,
hr
);
ok
(
med
.
tymed
==
TYMED_ISTORAGE
,
"got %lx
\n
"
,
med
.
tymed
);
...
...
@@ -1839,7 +1838,7 @@ static void test_getdatahere(void)
med
.
pUnkForRelease
=
NULL
;
med
.
tymed
=
TYMED_HGLOBAL
;
U
(
med
)
.
hGlobal
=
GlobalAlloc
(
GMEM_MOVEABLE
,
3000
);
med
.
hGlobal
=
GlobalAlloc
(
GMEM_MOVEABLE
,
3000
);
hr
=
IDataObject_GetDataHere
(
get
,
&
fmt
,
&
med
);
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
ok
(
med
.
tymed
==
TYMED_HGLOBAL
,
"got %lx
\n
"
,
med
.
tymed
);
...
...
@@ -1849,7 +1848,7 @@ static void test_getdatahere(void)
med
.
pUnkForRelease
=
NULL
;
med
.
tymed
=
TYMED_ISTREAM
;
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
U
(
med
)
.
pstm
);
CreateStreamOnHGlobal
(
NULL
,
TRUE
,
&
med
.
pstm
);
hr
=
IDataObject_GetDataHere
(
get
,
&
fmt
,
&
med
);
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
ok
(
med
.
tymed
==
TYMED_ISTREAM
,
"got %lx
\n
"
,
med
.
tymed
);
...
...
@@ -1859,7 +1858,7 @@ static void test_getdatahere(void)
med
.
pUnkForRelease
=
NULL
;
med
.
tymed
=
TYMED_ISTORAGE
;
StgCreateDocfile
(
NULL
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
|
STGM_DELETEONRELEASE
,
0
,
&
U
(
med
)
.
pstg
);
StgCreateDocfile
(
NULL
,
STGM_READWRITE
|
STGM_SHARE_EXCLUSIVE
|
STGM_DELETEONRELEASE
,
0
,
&
med
.
pstg
);
hr
=
IDataObject_GetDataHere
(
get
,
&
fmt
,
&
med
);
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
ok
(
med
.
tymed
==
TYMED_ISTORAGE
,
"got %lx
\n
"
,
med
.
tymed
);
...
...
dlls/ole32/tests/marshal.c
View file @
7c1d8b29
...
...
@@ -1414,8 +1414,8 @@ static HRESULT WINAPI CustomMarshal_MarshalInterface(IMarshal *iface, IStream *s
hr
=
IStream_Stat
(
stream
,
&
stat
,
STATFLAG_DEFAULT
);
ok_ole_success
(
hr
,
IStream_Stat
);
ok
(
U
(
stat
.
cbSize
).
LowPart
==
0
,
"stream is not empty (%ld)
\n
"
,
U
(
stat
.
cbSize
)
.
LowPart
);
ok
(
U
(
stat
.
cbSize
).
HighPart
==
0
,
"stream is not empty (%ld)
\n
"
,
U
(
stat
.
cbSize
)
.
HighPart
);
ok
(
stat
.
cbSize
.
LowPart
==
0
,
"stream is not empty (%ld)
\n
"
,
stat
.
cbSize
.
LowPart
);
ok
(
stat
.
cbSize
.
HighPart
==
0
,
"stream is not empty (%ld)
\n
"
,
stat
.
cbSize
.
HighPart
);
hr
=
CoGetStandardMarshal
(
riid
,
(
IUnknown
*
)
iface
,
dwDestContext
,
NULL
,
mshlflags
,
&
std_marshal
);
...
...
dlls/ole32/tests/ole2.c
View file @
7c1d8b29
...
...
@@ -208,17 +208,17 @@ static void create_dib( STGMEDIUM *med )
void
*
ptr
;
med
->
tymed
=
TYMED_HGLOBAL
;
U
(
med
)
->
hGlobal
=
GlobalAlloc
(
GMEM_MOVEABLE
,
sizeof
(
dib_white
));
ptr
=
GlobalLock
(
U
(
med
)
->
hGlobal
);
med
->
hGlobal
=
GlobalAlloc
(
GMEM_MOVEABLE
,
sizeof
(
dib_white
));
ptr
=
GlobalLock
(
med
->
hGlobal
);
memcpy
(
ptr
,
dib_white
,
sizeof
(
dib_white
));
GlobalUnlock
(
U
(
med
)
->
hGlobal
);
GlobalUnlock
(
med
->
hGlobal
);
med
->
pUnkForRelease
=
NULL
;
}
static
void
create_bitmap
(
STGMEDIUM
*
med
)
{
med
->
tymed
=
TYMED_GDI
;
U
(
med
)
->
hBitmap
=
CreateBitmap
(
1
,
1
,
1
,
1
,
NULL
);
med
->
hBitmap
=
CreateBitmap
(
1
,
1
,
1
,
1
,
NULL
);
med
->
pUnkForRelease
=
NULL
;
}
...
...
@@ -228,7 +228,7 @@ static void create_emf(STGMEDIUM *med)
Rectangle
(
hdc
,
0
,
0
,
150
,
300
);
med
->
tymed
=
TYMED_ENHMF
;
U
(
med
)
->
hEnhMetaFile
=
CloseEnhMetaFile
(
hdc
);
med
->
hEnhMetaFile
=
CloseEnhMetaFile
(
hdc
);
med
->
pUnkForRelease
=
NULL
;
}
...
...
@@ -240,13 +240,13 @@ static void create_mfpict(STGMEDIUM *med)
Rectangle
(
hdc
,
0
,
0
,
100
,
200
);
med
->
tymed
=
TYMED_MFPICT
;
U
(
med
)
->
hMetaFilePict
=
GlobalAlloc
(
GMEM_MOVEABLE
,
sizeof
(
METAFILEPICT
));
mf
=
GlobalLock
(
U
(
med
)
->
hMetaFilePict
);
med
->
hMetaFilePict
=
GlobalAlloc
(
GMEM_MOVEABLE
,
sizeof
(
METAFILEPICT
));
mf
=
GlobalLock
(
med
->
hMetaFilePict
);
mf
->
mm
=
MM_ANISOTROPIC
;
mf
->
xExt
=
100
;
mf
->
yExt
=
200
;
mf
->
hMF
=
CloseMetaFile
(
hdc
);
GlobalUnlock
(
U
(
med
)
->
hMetaFilePict
);
GlobalUnlock
(
med
->
hMetaFilePict
);
med
->
pUnkForRelease
=
NULL
;
}
...
...
@@ -261,7 +261,7 @@ static void create_text(STGMEDIUM *med)
GlobalUnlock
(
handle
);
med
->
tymed
=
TYMED_HGLOBAL
;
U
(
med
)
->
hGlobal
=
handle
;
med
->
hGlobal
=
handle
;
med
->
pUnkForRelease
=
NULL
;
}
...
...
@@ -1372,9 +1372,9 @@ static HRESULT WINAPI DataObject_GetData(IDataObject *iface, FORMATETC *format,
case
CF_DIB
:
medium
->
tymed
=
TYMED_HGLOBAL
;
medium
->
pUnkForRelease
=
NULL
;
U
(
*
medium
).
hGlobal
=
GlobalAlloc
(
GMEM_MOVEABLE
,
sizeof
(
dib_white
));
memcpy
(
GlobalLock
(
U
(
*
medium
).
hGlobal
),
data_object_dib
,
sizeof
(
dib_white
));
GlobalUnlock
(
U
(
*
medium
).
hGlobal
);
medium
->
hGlobal
=
GlobalAlloc
(
GMEM_MOVEABLE
,
sizeof
(
dib_white
));
memcpy
(
GlobalLock
(
medium
->
hGlobal
),
data_object_dib
,
sizeof
(
dib_white
));
GlobalUnlock
(
medium
->
hGlobal
);
return
S_OK
;
case
CF_BITMAP
:
create_bitmap
(
medium
);
...
...
@@ -1454,7 +1454,7 @@ static HRESULT WINAPI DataObject_DAdvise(
{
ok
(
pformatetc
->
cfFormat
==
cf_test_2
,
"got %04x
\n
"
,
pformatetc
->
cfFormat
);
stgmedium
.
tymed
=
TYMED_HGLOBAL
;
U
(
stgmedium
)
.
hGlobal
=
GlobalAlloc
(
GMEM_MOVEABLE
|
GMEM_ZEROINIT
,
4
);
stgmedium
.
hGlobal
=
GlobalAlloc
(
GMEM_MOVEABLE
|
GMEM_ZEROINIT
,
4
);
stgmedium
.
pUnkForRelease
=
NULL
;
IAdviseSink_OnDataChange
(
pAdvSink
,
pformatetc
,
&
stgmedium
);
}
...
...
@@ -1752,7 +1752,7 @@ static void test_data_cache(void)
fmtetc
.
cfFormat
=
CF_METAFILEPICT
;
stgmedium
.
tymed
=
TYMED_MFPICT
;
U
(
stgmedium
)
.
hMetaFilePict
=
OleMetafilePictFromIconAndLabel
(
stgmedium
.
hMetaFilePict
=
OleMetafilePictFromIconAndLabel
(
LoadIconA
(
NULL
,
(
LPSTR
)
IDI_APPLICATION
),
wszPath
,
wszPath
,
0
);
stgmedium
.
pUnkForRelease
=
NULL
;
...
...
@@ -2032,9 +2032,9 @@ static void test_data_cache_dib_contents_stream(int num)
hr
=
IDataObject_GetData
(
data
,
&
fmt
,
&
med
);
ok
(
SUCCEEDED
(
hr
),
"got %08lx
\n
"
,
hr
);
ok
(
med
.
tymed
==
TYMED_HGLOBAL
,
"got %lx
\n
"
,
med
.
tymed
);
ok
(
GlobalSize
(
U
(
med
)
.
hGlobal
)
>=
sizeof
(
dib_white
)
-
sizeof
(
BITMAPFILEHEADER
),
"got %Iu
\n
"
,
GlobalSize
(
U
(
med
)
.
hGlobal
)
);
ptr
=
GlobalLock
(
U
(
med
)
.
hGlobal
);
ok
(
GlobalSize
(
med
.
hGlobal
)
>=
sizeof
(
dib_white
)
-
sizeof
(
BITMAPFILEHEADER
),
"got %Iu
\n
"
,
GlobalSize
(
med
.
hGlobal
)
);
ptr
=
GlobalLock
(
med
.
hGlobal
);
expect_info
=
*
(
BITMAPINFOHEADER
*
)(
file_dib
+
sizeof
(
BITMAPFILEHEADER
));
if
(
expect_info
.
biXPelsPerMeter
==
0
||
expect_info
.
biYPelsPerMeter
==
0
)
...
...
@@ -2047,7 +2047,7 @@ static void test_data_cache_dib_contents_stream(int num)
ok
(
!
memcmp
(
ptr
,
&
expect_info
,
sizeof
(
expect_info
)
),
"mismatch
\n
"
);
ok
(
!
memcmp
(
ptr
+
sizeof
(
expect_info
),
file_dib
+
sizeof
(
BITMAPFILEHEADER
)
+
sizeof
(
expect_info
),
sizeof
(
file_dib
)
-
sizeof
(
BITMAPFILEHEADER
)
-
sizeof
(
expect_info
)
),
"mismatch
\n
"
);
GlobalUnlock
(
U
(
med
)
.
hGlobal
);
GlobalUnlock
(
med
.
hGlobal
);
ReleaseStgMedium
(
&
med
);
check_enum_cache
(
cache
,
enum_expect
,
2
);
...
...
@@ -2202,7 +2202,7 @@ static void test_data_cache_cache(void)
hr
=
IDataObject_GetData
(
data
,
&
fmt
,
&
med
);
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
ok
(
med
.
tymed
==
TYMED_GDI
,
"got %ld
\n
"
,
med
.
tymed
);
check_bitmap_size
(
U
(
med
)
.
hBitmap
,
1
,
1
);
check_bitmap_size
(
med
.
hBitmap
,
1
,
1
);
ReleaseStgMedium
(
&
med
);
fmt
.
cfFormat
=
CF_DIB
;
...
...
@@ -2210,7 +2210,7 @@ static void test_data_cache_cache(void)
hr
=
IDataObject_GetData
(
data
,
&
fmt
,
&
med
);
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
ok
(
med
.
tymed
==
TYMED_HGLOBAL
,
"got %ld
\n
"
,
med
.
tymed
);
check_dib_size
(
U
(
med
)
.
hGlobal
,
1
,
1
);
check_dib_size
(
med
.
hGlobal
,
1
,
1
);
ReleaseStgMedium
(
&
med
);
/* Now set a 2x1 dib */
...
...
@@ -2226,7 +2226,7 @@ static void test_data_cache_cache(void)
hr
=
IDataObject_GetData
(
data
,
&
fmt
,
&
med
);
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
ok
(
med
.
tymed
==
TYMED_GDI
,
"got %ld
\n
"
,
med
.
tymed
);
check_bitmap_size
(
U
(
med
)
.
hBitmap
,
2
,
1
);
check_bitmap_size
(
med
.
hBitmap
,
2
,
1
);
ReleaseStgMedium
(
&
med
);
fmt
.
cfFormat
=
CF_DIB
;
...
...
@@ -2234,7 +2234,7 @@ static void test_data_cache_cache(void)
hr
=
IDataObject_GetData
(
data
,
&
fmt
,
&
med
);
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
ok
(
med
.
tymed
==
TYMED_HGLOBAL
,
"got %ld
\n
"
,
med
.
tymed
);
check_dib_size
(
U
(
med
)
.
hGlobal
,
2
,
1
);
check_dib_size
(
med
.
hGlobal
,
2
,
1
);
ReleaseStgMedium
(
&
med
);
/* uncache everything */
...
...
@@ -2563,7 +2563,7 @@ static void test_data_cache_updatecache( void )
hr
=
IDataObject_GetData
(
data
,
&
dib_fmt
,
&
medium
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
ok
(
medium
.
tymed
==
TYMED_HGLOBAL
,
"Got unexpected tymed %lu.
\n
"
,
medium
.
tymed
);
ok
(
compare_global
(
U
(
medium
)
.
hGlobal
,
dib_white
,
sizeof
(
dib_white
)),
"Media didn't match.
\n
"
);
ok
(
compare_global
(
medium
.
hGlobal
,
dib_white
,
sizeof
(
dib_white
)),
"Media didn't match.
\n
"
);
hr
=
IOleCache2_Cache
(
cache
,
&
emf_fmt
,
0
,
&
conn
[
1
]);
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
...
...
@@ -2575,7 +2575,7 @@ static void test_data_cache_updatecache( void )
hr
=
IDataObject_GetData
(
data
,
&
dib_fmt
,
&
medium
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
ok
(
medium
.
tymed
==
TYMED_HGLOBAL
,
"Got unexpected tymed %lu.
\n
"
,
medium
.
tymed
);
ok
(
compare_global
(
U
(
medium
)
.
hGlobal
,
dib_black
,
sizeof
(
dib_black
)),
"Media didn't match.
\n
"
);
ok
(
compare_global
(
medium
.
hGlobal
,
dib_black
,
sizeof
(
dib_black
)),
"Media didn't match.
\n
"
);
hr
=
IDataObject_GetData
(
data
,
&
emf_fmt
,
&
medium
);
ok
(
hr
==
OLE_E_BLANK
,
"Got hr %#lx.
\n
"
,
hr
);
...
...
@@ -2680,7 +2680,7 @@ static void test_data_cache_updatecache( void )
hr
=
IDataObject_GetData
(
data
,
&
dib_fmt
,
&
medium
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
ok
(
medium
.
tymed
==
TYMED_HGLOBAL
,
"Got unexpected tymed %lu.
\n
"
,
medium
.
tymed
);
ok
(
compare_global
(
U
(
medium
)
.
hGlobal
,
dib_white
,
sizeof
(
dib_white
)),
"Media didn't match.
\n
"
);
ok
(
compare_global
(
medium
.
hGlobal
,
dib_white
,
sizeof
(
dib_white
)),
"Media didn't match.
\n
"
);
hr
=
IDataObject_GetData
(
data
,
&
emf_fmt
,
&
medium
);
ok
(
hr
==
OLE_E_BLANK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDataObject_GetData
(
data
,
&
view_fmt
,
&
medium
);
...
...
@@ -2714,7 +2714,7 @@ static void test_data_cache_updatecache( void )
hr
=
IDataObject_GetData
(
data
,
&
dib_fmt
,
&
medium
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
ok
(
medium
.
tymed
==
TYMED_HGLOBAL
,
"Got unexpected tymed %lu.
\n
"
,
medium
.
tymed
);
ok
(
compare_global
(
U
(
medium
)
.
hGlobal
,
dib_white
,
sizeof
(
dib_white
)),
"Media didn't match.
\n
"
);
ok
(
compare_global
(
medium
.
hGlobal
,
dib_white
,
sizeof
(
dib_white
)),
"Media didn't match.
\n
"
);
hr
=
IDataObject_GetData
(
data
,
&
emf_fmt
,
&
medium
);
ok
(
hr
==
OLE_E_BLANK
,
"Got hr %#lx.
\n
"
,
hr
);
...
...
@@ -2725,7 +2725,7 @@ static void test_data_cache_updatecache( void )
hr
=
IDataObject_GetData
(
data
,
&
dib_fmt
,
&
medium
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
ok
(
medium
.
tymed
==
TYMED_HGLOBAL
,
"Got unexpected tymed %lu.
\n
"
,
medium
.
tymed
);
ok
(
compare_global
(
U
(
medium
)
.
hGlobal
,
dib_white
,
sizeof
(
dib_white
)),
"Media didn't match.
\n
"
);
ok
(
compare_global
(
medium
.
hGlobal
,
dib_white
,
sizeof
(
dib_white
)),
"Media didn't match.
\n
"
);
hr
=
IDataObject_GetData
(
data
,
&
emf_fmt
,
&
medium
);
ok
(
hr
==
OLE_E_BLANK
,
"Got hr %#lx.
\n
"
,
hr
);
...
...
@@ -2736,7 +2736,7 @@ static void test_data_cache_updatecache( void )
hr
=
IDataObject_GetData
(
data
,
&
dib_fmt
,
&
medium
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
ok
(
medium
.
tymed
==
TYMED_HGLOBAL
,
"Got unexpected tymed %lu.
\n
"
,
medium
.
tymed
);
ok
(
compare_global
(
U
(
medium
)
.
hGlobal
,
dib_white
,
sizeof
(
dib_white
)),
"Media didn't match.
\n
"
);
ok
(
compare_global
(
medium
.
hGlobal
,
dib_white
,
sizeof
(
dib_white
)),
"Media didn't match.
\n
"
);
hr
=
IDataObject_GetData
(
data
,
&
emf_fmt
,
&
medium
);
ok
(
hr
==
OLE_E_BLANK
,
"Got hr %#lx.
\n
"
,
hr
);
...
...
@@ -3968,8 +3968,8 @@ static HRESULT stgmedium_cmp(const STGMEDIUM *med1, STGMEDIUM *med2)
if
(
med1
->
tymed
==
TYMED_MFPICT
)
{
METAFILEPICT
*
mfpict1
=
GlobalLock
(
U
(
med1
)
->
hMetaFilePict
);
METAFILEPICT
*
mfpict2
=
GlobalLock
(
U
(
med2
)
->
hMetaFilePict
);
METAFILEPICT
*
mfpict1
=
GlobalLock
(
med1
->
hMetaFilePict
);
METAFILEPICT
*
mfpict2
=
GlobalLock
(
med2
->
hMetaFilePict
);
datasize1
=
GetMetaFileBitsEx
(
mfpict1
->
hMF
,
0
,
NULL
);
datasize2
=
GetMetaFileBitsEx
(
mfpict2
->
hMF
,
0
,
NULL
);
...
...
@@ -4016,15 +4016,15 @@ static HRESULT stgmedium_cmp(const STGMEDIUM *med1, STGMEDIUM *med2)
if
(
med1
->
tymed
==
TYMED_HGLOBAL
)
{
GlobalUnlock
(
U
(
med1
)
->
hGlobal
);
GlobalUnlock
(
U
(
med2
)
->
hGlobal
);
GlobalUnlock
(
med1
->
hGlobal
);
GlobalUnlock
(
med2
->
hGlobal
);
}
else
if
(
med1
->
tymed
==
TYMED_MFPICT
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data1
);
HeapFree
(
GetProcessHeap
(),
0
,
data2
);
GlobalUnlock
(
U
(
med1
)
->
hMetaFilePict
);
GlobalUnlock
(
U
(
med2
)
->
hMetaFilePict
);
GlobalUnlock
(
med1
->
hMetaFilePict
);
GlobalUnlock
(
med2
->
hMetaFilePict
);
}
else
{
...
...
@@ -4138,7 +4138,7 @@ static void get_stgdef(struct storage_def *stg_def, CLIPFORMAT cf, STGMEDIUM *st
stg_def
->
stream
[
stm_idx
].
data_size
=
data_size
;
break
;
case
CF_METAFILEPICT
:
mfpict
=
GlobalLock
(
U
(
stg_med
)
->
hMetaFilePict
);
mfpict
=
GlobalLock
(
stg_med
->
hMetaFilePict
);
data_size
=
GetMetaFileBitsEx
(
mfpict
->
hMF
,
0
,
NULL
);
if
(
!
strcmp
(
stg_def
->
stream
[
stm_idx
].
name
,
"CONTENTS"
))
{
...
...
@@ -4152,26 +4152,26 @@ static void get_stgdef(struct storage_def *stg_def, CLIPFORMAT cf, STGMEDIUM *st
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
data_size
);
GetMetaFileBitsEx
(
mfpict
->
hMF
,
data_size
,
data
);
}
GlobalUnlock
(
U
(
stg_med
)
->
hMetaFilePict
);
GlobalUnlock
(
stg_med
->
hMetaFilePict
);
stg_def
->
stream
[
stm_idx
].
data_size
=
data_size
;
stg_def
->
stream
[
stm_idx
].
data
=
data
;
break
;
case
CF_ENHMETAFILE
:
if
(
!
strcmp
(
stg_def
->
stream
[
stm_idx
].
name
,
"CONTENTS"
))
{
data_size
=
GetEnhMetaFileBits
(
U
(
stg_med
)
->
hEnhMetaFile
,
0
,
NULL
);
data_size
=
GetEnhMetaFileBits
(
stg_med
->
hEnhMetaFile
,
0
,
NULL
);
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
DWORD
)
+
sizeof
(
ENHMETAHEADER
)
+
data_size
);
*
((
DWORD
*
)
data
)
=
sizeof
(
ENHMETAHEADER
);
GetEnhMetaFileBits
(
U
(
stg_med
)
->
hEnhMetaFile
,
data_size
,
data
+
sizeof
(
DWORD
)
+
sizeof
(
ENHMETAHEADER
));
GetEnhMetaFileBits
(
stg_med
->
hEnhMetaFile
,
data_size
,
data
+
sizeof
(
DWORD
)
+
sizeof
(
ENHMETAHEADER
));
memcpy
(
data
+
sizeof
(
DWORD
),
data
+
sizeof
(
DWORD
)
+
sizeof
(
ENHMETAHEADER
),
sizeof
(
ENHMETAHEADER
));
data_size
+=
sizeof
(
DWORD
)
+
sizeof
(
ENHMETAHEADER
);
}
else
{
hdc
=
GetDC
(
NULL
);
data_size
=
GetWinMetaFileBits
(
U
(
stg_med
)
->
hEnhMetaFile
,
0
,
NULL
,
MM_ANISOTROPIC
,
hdc
);
data_size
=
GetWinMetaFileBits
(
stg_med
->
hEnhMetaFile
,
0
,
NULL
,
MM_ANISOTROPIC
,
hdc
);
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
data_size
);
GetWinMetaFileBits
(
U
(
stg_med
)
->
hEnhMetaFile
,
data_size
,
data
,
MM_ANISOTROPIC
,
hdc
);
GetWinMetaFileBits
(
stg_med
->
hEnhMetaFile
,
data_size
,
data
,
MM_ANISOTROPIC
,
hdc
);
ReleaseDC
(
NULL
,
hdc
);
}
stg_def
->
stream
[
stm_idx
].
data_size
=
data_size
;
...
...
dlls/ole32/tests/propvariant.c
View file @
7c1d8b29
...
...
@@ -188,8 +188,8 @@ static void test_validtypes(void)
hr
=
PropVariantClear
(
&
propvar
);
ok
(
hr
==
STG_E_INVALIDPARAMETER
,
"expected STG_E_INVALIDPARAMETER, got %08lx
\n
"
,
hr
);
ok
(
propvar
.
vt
==
0
,
"expected 0, got %d
\n
"
,
propvar
.
vt
);
ok
(
U
(
propvar
)
.
uhVal
.
QuadPart
==
0
,
"expected 0, got %#lx/%#lx
\n
"
,
U
(
propvar
).
uhVal
.
u
.
LowPart
,
U
(
propvar
)
.
uhVal
.
u
.
HighPart
);
ok
(
propvar
.
uhVal
.
QuadPart
==
0
,
"expected 0, got %#lx/%#lx
\n
"
,
propvar
.
uhVal
.
u
.
LowPart
,
propvar
.
uhVal
.
u
.
HighPart
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
valid_types
);
i
++
)
{
...
...
@@ -200,11 +200,11 @@ static void test_validtypes(void)
memset
(
&
propvar
,
0
,
sizeof
(
propvar
));
else
if
(
i
==
VT_BLOB
||
i
==
VT_BLOB_OBJECT
)
{
U
(
propvar
)
.
blob
.
cbSize
=
0
;
U
(
propvar
)
.
blob
.
pBlobData
=
NULL
;
propvar
.
blob
.
cbSize
=
0
;
propvar
.
blob
.
pBlobData
=
NULL
;
}
else
U
(
propvar
)
.
pszVal
=
NULL
;
propvar
.
pszVal
=
NULL
;
vt
=
propvar
.
vt
=
i
;
memset
(
&
copy
,
0x77
,
sizeof
(
copy
));
hr
=
PropVariantCopy
(
&
copy
,
&
propvar
);
...
...
@@ -212,9 +212,9 @@ static void test_validtypes(void)
if
(
hr
==
S_OK
)
{
ok
(
copy
.
vt
==
propvar
.
vt
,
"expected %d, got %d
\n
"
,
propvar
.
vt
,
copy
.
vt
);
ok
(
U
(
copy
).
uhVal
.
QuadPart
==
U
(
propvar
)
.
uhVal
.
QuadPart
,
"%u: expected %#lx/%#lx, got %#lx/%#lx
\n
"
,
i
,
U
(
propvar
).
uhVal
.
u
.
LowPart
,
U
(
propvar
)
.
uhVal
.
u
.
HighPart
,
U
(
copy
).
uhVal
.
u
.
LowPart
,
U
(
copy
)
.
uhVal
.
u
.
HighPart
);
ok
(
copy
.
uhVal
.
QuadPart
==
propvar
.
uhVal
.
QuadPart
,
"%u: expected %#lx/%#lx, got %#lx/%#lx
\n
"
,
i
,
propvar
.
uhVal
.
u
.
LowPart
,
propvar
.
uhVal
.
u
.
HighPart
,
copy
.
uhVal
.
u
.
LowPart
,
copy
.
uhVal
.
u
.
HighPart
);
}
else
{
...
...
@@ -224,11 +224,11 @@ static void test_validtypes(void)
hr
=
PropVariantClear
(
&
propvar
);
expect
(
hr
,
vt
,
FALSE
,
__LINE__
);
ok
(
propvar
.
vt
==
0
,
"expected 0, got %d
\n
"
,
propvar
.
vt
);
ok
(
U
(
propvar
)
.
uhVal
.
QuadPart
==
0
,
"%u: expected 0, got %#lx/%#lx
\n
"
,
i
,
U
(
propvar
).
uhVal
.
u
.
LowPart
,
U
(
propvar
)
.
uhVal
.
u
.
HighPart
);
ok
(
propvar
.
uhVal
.
QuadPart
==
0
,
"%u: expected 0, got %#lx/%#lx
\n
"
,
i
,
propvar
.
uhVal
.
u
.
LowPart
,
propvar
.
uhVal
.
u
.
HighPart
);
memset
(
&
propvar
,
0x55
,
sizeof
(
propvar
));
U
(
propvar
)
.
pszVal
=
NULL
;
propvar
.
pszVal
=
NULL
;
vt
=
propvar
.
vt
=
i
|
VT_ARRAY
;
memset
(
&
copy
,
0x77
,
sizeof
(
copy
));
hr
=
PropVariantCopy
(
&
copy
,
&
propvar
);
...
...
@@ -236,8 +236,8 @@ static void test_validtypes(void)
if
(
hr
==
S_OK
)
{
ok
(
copy
.
vt
==
propvar
.
vt
,
"expected %d, got %d
\n
"
,
propvar
.
vt
,
copy
.
vt
);
ok
(
U
(
copy
)
.
uhVal
.
QuadPart
==
0
,
"%u: expected 0, got %#lx/%#lx
\n
"
,
i
,
U
(
copy
).
uhVal
.
u
.
LowPart
,
U
(
copy
)
.
uhVal
.
u
.
HighPart
);
ok
(
copy
.
uhVal
.
QuadPart
==
0
,
"%u: expected 0, got %#lx/%#lx
\n
"
,
i
,
copy
.
uhVal
.
u
.
LowPart
,
copy
.
uhVal
.
u
.
HighPart
);
}
else
{
...
...
@@ -247,12 +247,12 @@ static void test_validtypes(void)
hr
=
PropVariantClear
(
&
propvar
);
expect
(
hr
,
vt
,
FALSE
,
__LINE__
);
ok
(
propvar
.
vt
==
0
,
"expected 0, got %d
\n
"
,
propvar
.
vt
);
ok
(
U
(
propvar
)
.
uhVal
.
QuadPart
==
0
,
"%u: expected 0, got %#lx/%#lx
\n
"
,
i
,
U
(
propvar
).
uhVal
.
u
.
LowPart
,
U
(
propvar
)
.
uhVal
.
u
.
HighPart
);
ok
(
propvar
.
uhVal
.
QuadPart
==
0
,
"%u: expected 0, got %#lx/%#lx
\n
"
,
i
,
propvar
.
uhVal
.
u
.
LowPart
,
propvar
.
uhVal
.
u
.
HighPart
);
memset
(
&
propvar
,
0x55
,
sizeof
(
propvar
));
U
(
propvar
)
.
caub
.
cElems
=
0
;
U
(
propvar
)
.
caub
.
pElems
=
NULL
;
propvar
.
caub
.
cElems
=
0
;
propvar
.
caub
.
pElems
=
NULL
;
vt
=
propvar
.
vt
=
i
|
VT_VECTOR
;
memset
(
&
copy
,
0x77
,
sizeof
(
copy
));
hr
=
PropVariantCopy
(
&
copy
,
&
propvar
);
...
...
@@ -260,8 +260,8 @@ static void test_validtypes(void)
if
(
hr
==
S_OK
)
{
ok
(
copy
.
vt
==
propvar
.
vt
,
"expected %d, got %d
\n
"
,
propvar
.
vt
,
copy
.
vt
);
ok
(
!
U
(
copy
).
caub
.
cElems
,
"%u: expected 0, got %ld
\n
"
,
i
,
U
(
copy
)
.
caub
.
cElems
);
ok
(
!
U
(
copy
).
caub
.
pElems
,
"%u: expected NULL, got %p
\n
"
,
i
,
U
(
copy
)
.
caub
.
pElems
);
ok
(
!
copy
.
caub
.
cElems
,
"%u: expected 0, got %ld
\n
"
,
i
,
copy
.
caub
.
cElems
);
ok
(
!
copy
.
caub
.
pElems
,
"%u: expected NULL, got %p
\n
"
,
i
,
copy
.
caub
.
pElems
);
}
else
{
...
...
@@ -271,11 +271,11 @@ static void test_validtypes(void)
hr
=
PropVariantClear
(
&
propvar
);
expect
(
hr
,
vt
,
FALSE
,
__LINE__
);
ok
(
propvar
.
vt
==
0
,
"expected 0, got %d
\n
"
,
propvar
.
vt
);
ok
(
U
(
propvar
)
.
uhVal
.
QuadPart
==
0
,
"%u: expected 0, got %#lx/%#lx
\n
"
,
i
,
U
(
propvar
).
uhVal
.
u
.
LowPart
,
U
(
propvar
)
.
uhVal
.
u
.
HighPart
);
ok
(
propvar
.
uhVal
.
QuadPart
==
0
,
"%u: expected 0, got %#lx/%#lx
\n
"
,
i
,
propvar
.
uhVal
.
u
.
LowPart
,
propvar
.
uhVal
.
u
.
HighPart
);
memset
(
&
propvar
,
0x55
,
sizeof
(
propvar
));
U
(
propvar
)
.
pszVal
=
NULL
;
propvar
.
pszVal
=
NULL
;
vt
=
propvar
.
vt
=
i
|
VT_BYREF
;
memset
(
&
copy
,
0x77
,
sizeof
(
copy
));
hr
=
PropVariantCopy
(
&
copy
,
&
propvar
);
...
...
@@ -283,9 +283,9 @@ static void test_validtypes(void)
if
(
hr
==
S_OK
)
{
ok
(
copy
.
vt
==
propvar
.
vt
,
"expected %d, got %d
\n
"
,
propvar
.
vt
,
copy
.
vt
);
ok
(
U
(
copy
).
uhVal
.
QuadPart
==
U
(
propvar
)
.
uhVal
.
QuadPart
,
"%u: expected %#lx/%#lx, got %#lx/%#lx
\n
"
,
i
,
U
(
propvar
).
uhVal
.
u
.
LowPart
,
U
(
propvar
)
.
uhVal
.
u
.
HighPart
,
U
(
copy
).
uhVal
.
u
.
LowPart
,
U
(
copy
)
.
uhVal
.
u
.
HighPart
);
ok
(
copy
.
uhVal
.
QuadPart
==
propvar
.
uhVal
.
QuadPart
,
"%u: expected %#lx/%#lx, got %#lx/%#lx
\n
"
,
i
,
propvar
.
uhVal
.
u
.
LowPart
,
propvar
.
uhVal
.
u
.
HighPart
,
copy
.
uhVal
.
u
.
LowPart
,
copy
.
uhVal
.
u
.
HighPart
);
}
else
{
...
...
@@ -295,8 +295,8 @@ static void test_validtypes(void)
hr
=
PropVariantClear
(
&
propvar
);
expect
(
hr
,
vt
,
FALSE
,
__LINE__
);
ok
(
propvar
.
vt
==
0
,
"expected 0, got %d
\n
"
,
propvar
.
vt
);
ok
(
U
(
propvar
)
.
uhVal
.
QuadPart
==
0
,
"%u: expected 0, got %#lx/%#lx
\n
"
,
i
,
U
(
propvar
).
uhVal
.
u
.
LowPart
,
U
(
propvar
)
.
uhVal
.
u
.
HighPart
);
ok
(
propvar
.
uhVal
.
QuadPart
==
0
,
"%u: expected 0, got %#lx/%#lx
\n
"
,
i
,
propvar
.
uhVal
.
u
.
LowPart
,
propvar
.
uhVal
.
u
.
HighPart
);
}
}
...
...
@@ -357,11 +357,11 @@ static void test_copy(void)
HRESULT
hr
;
propvarSrc
.
vt
=
VT_BSTR
;
U
(
propvarSrc
)
.
bstrVal
=
SysAllocString
(
wszTestString
);
propvarSrc
.
bstrVal
=
SysAllocString
(
wszTestString
);
hr
=
PropVariantCopy
(
&
propvarDst
,
&
propvarSrc
);
ok
(
hr
==
S_OK
,
"PropVariantCopy(...VT_BSTR...) failed
\n
"
);
ok
(
!
lstrcmpW
(
U
(
propvarSrc
).
bstrVal
,
U
(
propvarDst
)
.
bstrVal
),
"BSTR not copied properly
\n
"
);
ok
(
!
lstrcmpW
(
propvarSrc
.
bstrVal
,
propvarDst
.
bstrVal
),
"BSTR not copied properly
\n
"
);
hr
=
PropVariantClear
(
&
propvarSrc
);
ok
(
hr
==
S_OK
,
"PropVariantClear(...VT_BSTR...) failed
\n
"
);
hr
=
PropVariantClear
(
&
propvarDst
);
...
...
@@ -369,40 +369,40 @@ static void test_copy(void)
/* BSTR with embedded null */
propvarSrc
.
vt
=
VT_BSTR
;
U
(
propvarSrc
)
.
bstrVal
=
SysAllocStringLen
(
L"Test Str
\0
ing"
,
12
);
propvarSrc
.
bstrVal
=
SysAllocStringLen
(
L"Test Str
\0
ing"
,
12
);
hr
=
PropVariantCopy
(
&
propvarDst
,
&
propvarSrc
);
ok
(
hr
==
S_OK
,
"Failed to copy propvar, hr %#lx.
\n
"
,
hr
);
ok
(
SysStringLen
(
U
(
propvarDst
)
.
bstrVal
)
==
8
,
"Unexpected copy length.
\n
"
);
ok
(
SysStringLen
(
U
(
propvarSrc
)
.
bstrVal
)
==
12
,
"Unexpected source length.
\n
"
);
ok
(
!
lstrcmpW
(
U
(
propvarSrc
).
bstrVal
,
U
(
propvarDst
)
.
bstrVal
),
"BSTR not copied properly
\n
"
);
ok
(
SysStringLen
(
propvarDst
.
bstrVal
)
==
8
,
"Unexpected copy length.
\n
"
);
ok
(
SysStringLen
(
propvarSrc
.
bstrVal
)
==
12
,
"Unexpected source length.
\n
"
);
ok
(
!
lstrcmpW
(
propvarSrc
.
bstrVal
,
propvarDst
.
bstrVal
),
"BSTR not copied properly
\n
"
);
hr
=
PropVariantClear
(
&
propvarSrc
);
ok
(
hr
==
S_OK
,
"Failed to clear propvar, hr %#lx.
\n
"
,
hr
);
hr
=
PropVariantClear
(
&
propvarDst
);
ok
(
hr
==
S_OK
,
"Failed to clear propvar, hr %#lx.
\n
"
,
hr
);
propvarSrc
.
vt
=
VT_LPWSTR
;
U
(
propvarSrc
)
.
pwszVal
=
wszTestString
;
propvarSrc
.
pwszVal
=
wszTestString
;
hr
=
PropVariantCopy
(
&
propvarDst
,
&
propvarSrc
);
ok
(
hr
==
S_OK
,
"PropVariantCopy(...VT_LPWSTR...) failed
\n
"
);
ok
(
!
lstrcmpW
(
U
(
propvarSrc
).
pwszVal
,
U
(
propvarDst
)
.
pwszVal
),
"Wide string not copied properly
\n
"
);
ok
(
!
lstrcmpW
(
propvarSrc
.
pwszVal
,
propvarDst
.
pwszVal
),
"Wide string not copied properly
\n
"
);
hr
=
PropVariantClear
(
&
propvarDst
);
ok
(
hr
==
S_OK
,
"PropVariantClear(...VT_LPWSTR...) failed
\n
"
);
memset
(
&
propvarSrc
,
0
,
sizeof
(
propvarSrc
));
propvarSrc
.
vt
=
VT_LPSTR
;
U
(
propvarSrc
)
.
pszVal
=
szTestString
;
propvarSrc
.
pszVal
=
szTestString
;
hr
=
PropVariantCopy
(
&
propvarDst
,
&
propvarSrc
);
ok
(
hr
==
S_OK
,
"PropVariantCopy(...VT_LPSTR...) failed
\n
"
);
ok
(
!
strcmp
(
U
(
propvarSrc
).
pszVal
,
U
(
propvarDst
)
.
pszVal
),
"String not copied properly
\n
"
);
ok
(
!
strcmp
(
propvarSrc
.
pszVal
,
propvarDst
.
pszVal
),
"String not copied properly
\n
"
);
hr
=
PropVariantClear
(
&
propvarDst
);
ok
(
hr
==
S_OK
,
"PropVariantClear(...VT_LPSTR...) failed
\n
"
);
memset
(
&
propvarSrc
,
0
,
sizeof
(
propvarSrc
));
propvarSrc
.
vt
=
VT_UNKNOWN
;
U
(
propvarSrc
)
.
punkVal
=
&
unk_obj
.
IUnknown_iface
;
propvarSrc
.
punkVal
=
&
unk_obj
.
IUnknown_iface
;
hr
=
PropVariantCopy
(
&
propvarDst
,
&
propvarSrc
);
ok
(
hr
==
S_OK
,
"PropVariantCopy(...VT_UNKNOWN...) failed: 0x%08lx.
\n
"
,
hr
);
ok
(
U
(
propvarDst
)
.
punkVal
==
&
unk_obj
.
IUnknown_iface
,
"Got wrong IUnknown pointer
\n
"
);
ok
(
propvarDst
.
punkVal
==
&
unk_obj
.
IUnknown_iface
,
"Got wrong IUnknown pointer
\n
"
);
ok
(
unk_obj
.
ref
==
2
,
"got wrong refcount: %ld.
\n
"
,
unk_obj
.
ref
);
hr
=
PropVariantClear
(
&
propvarDst
);
ok
(
hr
==
S_OK
,
"PropVariantClear(...VT_UNKNOWN...) failed: 0x%08lx.
\n
"
,
hr
);
...
...
@@ -419,7 +419,7 @@ static void test_copy(void)
ok
(
unk_obj
.
ref
==
3
,
"got wrong refcount: %ld.
\n
"
,
unk_obj
.
ref
);
propvarSrc
.
vt
=
VT_ARRAY
|
VT_UNKNOWN
;
U
(
propvarSrc
)
.
parray
=
sa
;
propvarSrc
.
parray
=
sa
;
hr
=
PropVariantCopy
(
&
propvarDst
,
&
propvarSrc
);
ok
(
hr
==
S_OK
,
"PropVariantCopy(...VT_ARRAY|VT_UNKNOWN...) failed: 0x%08lx.
\n
"
,
hr
);
ok
(
unk_obj
.
ref
==
5
,
"got wrong refcount: %ld.
\n
"
,
unk_obj
.
ref
);
...
...
@@ -570,14 +570,14 @@ static void test_propertytovariant(void)
ok
(
ret
==
0
,
"StgConvertPropertyToVariant returned %i
\n
"
,
ret
);
ok
(
propvar
.
vt
==
VT_I4
,
"unexpected vt %x
\n
"
,
propvar
.
vt
);
ok
(
U
(
propvar
).
lVal
==
0xfeabcdef
,
"unexpected lVal %lx
\n
"
,
U
(
propvar
)
.
lVal
);
ok
(
propvar
.
lVal
==
0xfeabcdef
,
"unexpected lVal %lx
\n
"
,
propvar
.
lVal
);
ret
=
pStgConvertPropertyToVariant
((
SERIALIZEDPROPERTYVALUE
*
)
serialized_bstr_wc
,
CP_WINUNICODE
,
&
propvar
,
&
allocator
);
ok
(
ret
==
0
,
"StgConvertPropertyToVariant returned %i
\n
"
,
ret
);
ok
(
propvar
.
vt
==
VT_BSTR
,
"unexpected vt %x
\n
"
,
propvar
.
vt
);
ok
(
!
lstrcmpW
(
U
(
propvar
)
.
bstrVal
,
test_string
),
"unexpected string value
\n
"
);
ok
(
!
lstrcmpW
(
propvar
.
bstrVal
,
test_string
),
"unexpected string value
\n
"
);
PropVariantClear
(
&
propvar
);
ret
=
pStgConvertPropertyToVariant
((
SERIALIZEDPROPERTYVALUE
*
)
serialized_bstr_mb
,
...
...
@@ -585,7 +585,7 @@ static void test_propertytovariant(void)
ok
(
ret
==
0
,
"StgConvertPropertyToVariant returned %i
\n
"
,
ret
);
ok
(
propvar
.
vt
==
VT_BSTR
,
"unexpected vt %x
\n
"
,
propvar
.
vt
);
ok
(
!
lstrcmpW
(
U
(
propvar
)
.
bstrVal
,
test_string
),
"unexpected string value
\n
"
);
ok
(
!
lstrcmpW
(
propvar
.
bstrVal
,
test_string
),
"unexpected string value
\n
"
);
PropVariantClear
(
&
propvar
);
}
...
...
@@ -615,7 +615,7 @@ static void test_varianttoproperty(void)
PropVariantInit
(
&
propvar
);
propvar
.
vt
=
VT_I4
;
U
(
propvar
)
.
lVal
=
0xfeabcdef
;
propvar
.
lVal
=
0xfeabcdef
;
len
=
0xdeadbeef
;
propvalue
=
pStgConvertVariantToProperty
(
&
propvar
,
CP_WINUNICODE
,
NULL
,
&
len
,
...
...
@@ -661,7 +661,7 @@ static void test_varianttoproperty(void)
test_string_bstr
=
SysAllocString
(
test_string
);
propvar
.
vt
=
VT_BSTR
;
U
(
propvar
)
.
bstrVal
=
test_string_bstr
;
propvar
.
bstrVal
=
test_string_bstr
;
len
=
20
;
propvalue
=
pStgConvertVariantToProperty
(
&
propvar
,
CP_WINUNICODE
,
own_propvalue
,
&
len
,
0
,
FALSE
,
0
);
...
...
dlls/ole32/tests/stg_prop.c
View file @
7c1d8b29
...
...
@@ -90,16 +90,16 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
/* test setting one that I can't set */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PID_DICTIONARY
;
spec
.
propid
=
PID_DICTIONARY
;
var
.
vt
=
VT_I4
;
U
(
var
)
.
lVal
=
1
;
var
.
lVal
=
1
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
hr
==
STG_E_INVALIDPARAMETER
,
"Expected STG_E_INVALIDPARAMETER, got 0x%08lx
\n
"
,
hr
);
/* test setting one by name with an invalid propidNameFirst */
spec
.
ulKind
=
PRSPEC_LPWSTR
;
U
(
spec
)
.
lpwstr
=
propName
;
spec
.
lpwstr
=
propName
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
PID_DICTIONARY
);
ok
(
hr
==
STG_E_INVALIDPARAMETER
,
...
...
@@ -107,43 +107,43 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
/* test setting behavior (case-sensitive) */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PID_BEHAVIOR
;
U
(
var
)
.
lVal
=
1
;
spec
.
propid
=
PID_BEHAVIOR
;
var
.
lVal
=
1
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
hr
==
STG_E_INVALIDPARAMETER
,
"Expected STG_E_INVALIDPARAMETER, got 0x%08lx
\n
"
,
hr
);
/* set one by value.. */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PID_FIRST_USABLE
;
U
(
var
)
.
lVal
=
1
;
spec
.
propid
=
PID_FIRST_USABLE
;
var
.
lVal
=
1
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
hr
==
S_OK
,
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
/* set one by name */
spec
.
ulKind
=
PRSPEC_LPWSTR
;
U
(
spec
)
.
lpwstr
=
propName
;
U
(
var
)
.
lVal
=
2
;
spec
.
lpwstr
=
propName
;
var
.
lVal
=
2
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
PID_FIRST_USABLE
);
ok
(
hr
==
S_OK
,
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
/* set a string value */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PIDSI_AUTHOR
;
spec
.
propid
=
PIDSI_AUTHOR
;
var
.
vt
=
VT_LPSTR
;
U
(
var
)
.
pszVal
=
val
;
var
.
pszVal
=
val
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
hr
==
S_OK
,
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
/* set a clipboard value */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PIDSI_THUMBNAIL
;
spec
.
propid
=
PIDSI_THUMBNAIL
;
var
.
vt
=
VT_CF
;
clipdata
.
cbSize
=
sizeof
clipcontent
+
sizeof
(
ULONG
);
clipdata
.
ulClipFmt
=
CF_ENHMETAFILE
;
clipdata
.
pClipData
=
clipcontent
;
U
(
var
)
.
pclipdata
=
&
clipdata
;
var
.
pclipdata
=
&
clipdata
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
hr
==
S_OK
,
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
...
...
@@ -155,41 +155,41 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
ok
(
hr
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got 0x%08lx
\n
"
,
hr
);
/* read by propid */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PID_FIRST_USABLE
;
spec
.
propid
=
PID_FIRST_USABLE
;
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
hr
==
S_OK
,
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_I4
&&
U
(
var
)
.
lVal
==
1
,
ok
(
var
.
vt
==
VT_I4
&&
var
.
lVal
==
1
,
"Didn't get expected type or value for property (got type %d, value %ld)
\n
"
,
var
.
vt
,
U
(
var
)
.
lVal
);
var
.
vt
,
var
.
lVal
);
/* read by name */
spec
.
ulKind
=
PRSPEC_LPWSTR
;
U
(
spec
)
.
lpwstr
=
propName
;
spec
.
lpwstr
=
propName
;
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
hr
==
S_OK
,
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_I4
&&
U
(
var
)
.
lVal
==
2
,
ok
(
var
.
vt
==
VT_I4
&&
var
.
lVal
==
2
,
"Didn't get expected type or value for property (got type %d, value %ld)
\n
"
,
var
.
vt
,
U
(
var
)
.
lVal
);
var
.
vt
,
var
.
lVal
);
/* read string value */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PIDSI_AUTHOR
;
spec
.
propid
=
PIDSI_AUTHOR
;
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
hr
==
S_OK
,
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_LPSTR
&&
!
lstrcmpA
(
U
(
var
)
.
pszVal
,
val
),
ok
(
var
.
vt
==
VT_LPSTR
&&
!
lstrcmpA
(
var
.
pszVal
,
val
),
"Didn't get expected type or value for property (got type %d, value %s)
\n
"
,
var
.
vt
,
U
(
var
)
.
pszVal
);
var
.
vt
,
var
.
pszVal
);
PropVariantClear
(
&
var
);
/* read clipboard format */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PIDSI_THUMBNAIL
;
spec
.
propid
=
PIDSI_THUMBNAIL
;
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
hr
==
S_OK
,
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_CF
,
"variant type wrong
\n
"
);
ok
(
U
(
var
)
.
pclipdata
->
ulClipFmt
==
CF_ENHMETAFILE
,
ok
(
var
.
pclipdata
->
ulClipFmt
==
CF_ENHMETAFILE
,
"clipboard type wrong
\n
"
);
ok
(
U
(
var
)
.
pclipdata
->
cbSize
==
sizeof
clipcontent
+
sizeof
(
ULONG
),
ok
(
var
.
pclipdata
->
cbSize
==
sizeof
clipcontent
+
sizeof
(
ULONG
),
"clipboard size wrong
\n
"
);
ok
(
!
memcmp
(
U
(
var
)
.
pclipdata
->
pClipData
,
clipcontent
,
sizeof
clipcontent
),
ok
(
!
memcmp
(
var
.
pclipdata
->
pClipData
,
clipcontent
,
sizeof
clipcontent
),
"clipboard contents wrong
\n
"
);
ok
(
S_OK
==
PropVariantClear
(
&
var
),
"failed to clear variant
\n
"
);
...
...
@@ -200,12 +200,12 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
ok
(
hr
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got 0x%08lx
\n
"
,
hr
);
/* contrary to what the docs say, you can't delete the dictionary */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PID_DICTIONARY
;
spec
.
propid
=
PID_DICTIONARY
;
hr
=
IPropertyStorage_DeleteMultiple
(
propertyStorage
,
1
,
&
spec
);
ok
(
hr
==
STG_E_INVALIDPARAMETER
,
"Expected STG_E_INVALIDPARAMETER, got 0x%08lx
\n
"
,
hr
);
/* now delete the first value.. */
U
(
spec
)
.
propid
=
PID_FIRST_USABLE
;
spec
.
propid
=
PID_FIRST_USABLE
;
hr
=
IPropertyStorage_DeleteMultiple
(
propertyStorage
,
1
,
&
spec
);
ok
(
hr
==
S_OK
,
"DeleteMultiple failed: 0x%08lx
\n
"
,
hr
);
/* and check that it's no longer readable */
...
...
@@ -217,7 +217,7 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
/* check reverting */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PID_FIRST_USABLE
;
spec
.
propid
=
PID_FIRST_USABLE
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
hr
==
S_OK
,
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
hr
=
IPropertyStorage_Revert
(
propertyStorage
);
...
...
@@ -227,9 +227,9 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
ok
(
hr
==
S_FALSE
,
"Expected S_FALSE, got 0x%08lx
\n
"
,
hr
);
/* set an integer value again */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PID_FIRST_USABLE
;
spec
.
propid
=
PID_FIRST_USABLE
;
var
.
vt
=
VT_I4
;
U
(
var
)
.
lVal
=
1
;
var
.
lVal
=
1
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
hr
==
S_OK
,
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
/* commit it */
...
...
@@ -237,7 +237,7 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
ok
(
hr
==
S_OK
,
"Commit failed: 0x%08lx
\n
"
,
hr
);
/* set it to a string value */
var
.
vt
=
VT_LPSTR
;
U
(
var
)
.
pszVal
=
val
;
var
.
pszVal
=
val
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
hr
==
S_OK
,
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
/* revert it */
...
...
@@ -280,19 +280,19 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
/* check properties again */
spec
.
ulKind
=
PRSPEC_LPWSTR
;
U
(
spec
)
.
lpwstr
=
propName
;
spec
.
lpwstr
=
propName
;
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
hr
==
S_OK
,
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_I4
&&
U
(
var
)
.
lVal
==
2
,
ok
(
var
.
vt
==
VT_I4
&&
var
.
lVal
==
2
,
"Didn't get expected type or value for property (got type %d, value %ld)
\n
"
,
var
.
vt
,
U
(
var
)
.
lVal
);
var
.
vt
,
var
.
lVal
);
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PIDSI_AUTHOR
;
spec
.
propid
=
PIDSI_AUTHOR
;
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
hr
==
S_OK
,
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_LPSTR
&&
!
lstrcmpA
(
U
(
var
)
.
pszVal
,
val
),
ok
(
var
.
vt
==
VT_LPSTR
&&
!
lstrcmpA
(
var
.
pszVal
,
val
),
"Didn't get expected type or value for property (got type %d, value %s)
\n
"
,
var
.
vt
,
U
(
var
)
.
pszVal
);
var
.
vt
,
var
.
pszVal
);
PropVariantClear
(
&
var
);
IPropertyStorage_Release
(
propertyStorage
);
...
...
@@ -330,9 +330,9 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
}
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PID_FIRST_USABLE
;
spec
.
propid
=
PID_FIRST_USABLE
;
var
.
vt
=
VT_I4
;
U
(
var
)
.
lVal
=
1
;
var
.
lVal
=
1
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
hr
==
S_OK
,
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
...
...
@@ -370,13 +370,13 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
}
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PID_FIRST_USABLE
;
spec
.
propid
=
PID_FIRST_USABLE
;
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
hr
==
S_OK
,
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_I4
&&
U
(
var
)
.
lVal
==
1
,
ok
(
var
.
vt
==
VT_I4
&&
var
.
lVal
==
1
,
"Didn't get expected type or value for property (got type %d, value %ld)
\n
"
,
var
.
vt
,
U
(
var
)
.
lVal
);
var
.
vt
,
var
.
lVal
);
IPropertyStorage_Release
(
propertyStorage
);
if
(
propSetStorage
)
IPropertySetStorage_Release
(
*
propSetStorage
);
...
...
@@ -426,41 +426,41 @@ static void testCodepage(void)
PropVariantInit
(
&
var
);
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PID_CODEPAGE
;
spec
.
propid
=
PID_CODEPAGE
;
/* check code page before it's been explicitly set */
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
hr
==
S_OK
,
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_I2
&&
U
(
var
)
.
iVal
==
1200
,
ok
(
var
.
vt
==
VT_I2
&&
var
.
iVal
==
1200
,
"Didn't get expected type or value for property
\n
"
);
/* Set the code page to ascii */
var
.
vt
=
VT_I2
;
U
(
var
)
.
iVal
=
1252
;
var
.
iVal
=
1252
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
hr
==
S_OK
,
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
/* check code page */
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
hr
==
S_OK
,
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_I2
&&
U
(
var
)
.
iVal
==
1252
,
ok
(
var
.
vt
==
VT_I2
&&
var
.
iVal
==
1252
,
"Didn't get expected type or value for property
\n
"
);
/* Set code page to Unicode */
U
(
var
)
.
iVal
=
1200
;
var
.
iVal
=
1200
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
hr
==
S_OK
,
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
/* check code page */
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
hr
==
S_OK
,
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_I2
&&
U
(
var
)
.
iVal
==
1200
,
ok
(
var
.
vt
==
VT_I2
&&
var
.
iVal
==
1200
,
"Didn't get expected type or value for property
\n
"
);
/* Set a string value */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PID_FIRST_USABLE
;
spec
.
propid
=
PID_FIRST_USABLE
;
var
.
vt
=
VT_LPSTR
;
U
(
var
)
.
pszVal
=
aval
;
var
.
pszVal
=
aval
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
hr
==
S_OK
,
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
hr
==
S_OK
,
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_LPSTR
&&
!
strcmp
(
U
(
var
)
.
pszVal
,
"hi"
),
ok
(
var
.
vt
==
VT_LPSTR
&&
!
strcmp
(
var
.
pszVal
,
"hi"
),
"Didn't get expected type or value for property
\n
"
);
PropVariantClear
(
&
var
);
/* This seemingly non-sensical test is to show that the string is indeed
...
...
@@ -469,20 +469,20 @@ static void testCodepage(void)
* string would be maintained. As it is, only the first character is.)
*/
var
.
vt
=
VT_LPSTR
;
U
(
var
)
.
pszVal
=
(
LPSTR
)
wval
;
var
.
pszVal
=
(
LPSTR
)
wval
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
hr
==
S_OK
,
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
hr
==
S_OK
,
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_LPSTR
&&
!
strcmp
(
U
(
var
)
.
pszVal
,
"h"
),
ok
(
var
.
vt
==
VT_LPSTR
&&
!
strcmp
(
var
.
pszVal
,
"h"
),
"Didn't get expected type or value for property
\n
"
);
PropVariantClear
(
&
var
);
/* now that a property's been set, you can't change the code page */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PID_CODEPAGE
;
spec
.
propid
=
PID_CODEPAGE
;
var
.
vt
=
VT_I2
;
U
(
var
)
.
iVal
=
1200
;
var
.
iVal
=
1200
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
hr
==
STG_E_INVALIDPARAMETER
,
"Expected STG_E_INVALIDPARAMETER, got 0x%08lx
\n
"
,
hr
);
...
...
@@ -512,13 +512,13 @@ static void testCodepage(void)
ok
(
hr
==
S_OK
,
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_I2
,
"Didn't get expected type for property (%u)
\n
"
,
var
.
vt
);
/* Set code page to Unicode */
U
(
var
)
.
iVal
=
1200
;
var
.
iVal
=
1200
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
hr
==
S_OK
,
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
/* check code page */
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
hr
==
S_OK
,
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_I2
&&
U
(
var
)
.
iVal
==
1200
,
ok
(
var
.
vt
==
VT_I2
&&
var
.
iVal
==
1200
,
"Didn't get expected type or value for property
\n
"
);
/* This test is commented out for documentation. It fails under Wine,
* and I expect it would under Windows as well, yet it succeeds. There's
...
...
@@ -527,22 +527,22 @@ static void testCodepage(void)
if
(
0
)
{
static
unsigned
char
strVal
[]
=
{
0x81
,
0xff
,
0x04
,
0
};
/* Set code page to 950 (Traditional Chinese) */
U
(
var
)
.
iVal
=
950
;
var
.
iVal
=
950
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
hr
==
S_OK
,
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
/* Try writing an invalid string: lead byte 0x81 is unused in Traditional
* Chinese.
*/
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
)
.
propid
=
PID_FIRST_USABLE
;
spec
.
propid
=
PID_FIRST_USABLE
;
var
.
vt
=
VT_LPSTR
;
U
(
var
)
.
pszVal
=
(
LPSTR
)
strVal
;
var
.
pszVal
=
(
LPSTR
)
strVal
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
hr
==
S_OK
,
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
/* Check returned string */
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
hr
==
S_OK
,
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_LPSTR
&&
!
strcmp
(
U
(
var
)
.
pszVal
,
(
LPCSTR
)
strVal
),
ok
(
var
.
vt
==
VT_LPSTR
&&
!
strcmp
(
var
.
pszVal
,
(
LPCSTR
)
strVal
),
"Didn't get expected type or value for property
\n
"
);
}
...
...
dlls/ole32/tests/storage32.c
View file @
7c1d8b29
...
...
@@ -21,9 +21,6 @@
#include <stdio.h>
#define COBJMACROS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include <windows.h>
#include "wine/test.h"
...
...
@@ -1076,8 +1073,8 @@ static void test_storage_refcount(void)
r
=
IStorage_Stat
(
stg
,
&
statstg
,
STATFLAG_NONAME
);
ok
(
r
==
S_OK
,
"Stat should have succeeded instead of returning 0x%08lx
\n
"
,
r
);
ok
(
statstg
.
type
==
STGTY_STORAGE
,
"Statstg type should have been STGTY_STORAGE instead of %ld
\n
"
,
statstg
.
type
);
ok
(
U
(
statstg
.
cbSize
).
LowPart
==
0
,
"Statstg cbSize.LowPart should have been 0 instead of %ld
\n
"
,
U
(
statstg
.
cbSize
)
.
LowPart
);
ok
(
U
(
statstg
.
cbSize
).
HighPart
==
0
,
"Statstg cbSize.HighPart should have been 0 instead of %ld
\n
"
,
U
(
statstg
.
cbSize
)
.
HighPart
);
ok
(
statstg
.
cbSize
.
LowPart
==
0
,
"Statstg cbSize.LowPart should have been 0 instead of %ld
\n
"
,
statstg
.
cbSize
.
LowPart
);
ok
(
statstg
.
cbSize
.
HighPart
==
0
,
"Statstg cbSize.HighPart should have been 0 instead of %ld
\n
"
,
statstg
.
cbSize
.
HighPart
);
ok
(
statstg
.
grfMode
==
(
STGM_TRANSACTED
|
STGM_SHARE_DENY_WRITE
|
STGM_READWRITE
),
"Statstg grfMode should have been 0x10022 instead of 0x%lx
\n
"
,
statstg
.
grfMode
);
ok
(
statstg
.
grfLocksSupported
==
0
,
"Statstg grfLocksSupported should have been 0 instead of %ld
\n
"
,
statstg
.
grfLocksSupported
);
...
...
@@ -1093,8 +1090,8 @@ static void test_storage_refcount(void)
ok
(
!
memcmp
(
statstg
.
pwcsName
,
stgname
,
sizeof
(
stgname
)),
"Statstg pwcsName should have been the name the storage was created with
\n
"
);
ok
(
statstg
.
type
==
STGTY_STORAGE
,
"Statstg type should have been STGTY_STORAGE instead of %ld
\n
"
,
statstg
.
type
);
ok
(
U
(
statstg
.
cbSize
).
LowPart
==
0
,
"Statstg cbSize.LowPart should have been 0 instead of %ld
\n
"
,
U
(
statstg
.
cbSize
)
.
LowPart
);
ok
(
U
(
statstg
.
cbSize
).
HighPart
==
0
,
"Statstg cbSize.HighPart should have been 0 instead of %ld
\n
"
,
U
(
statstg
.
cbSize
)
.
HighPart
);
ok
(
statstg
.
cbSize
.
LowPart
==
0
,
"Statstg cbSize.LowPart should have been 0 instead of %ld
\n
"
,
statstg
.
cbSize
.
LowPart
);
ok
(
statstg
.
cbSize
.
HighPart
==
0
,
"Statstg cbSize.HighPart should have been 0 instead of %ld
\n
"
,
statstg
.
cbSize
.
HighPart
);
ok
(
statstg
.
grfMode
==
STGM_SHARE_EXCLUSIVE
,
"Statstg grfMode should have been STGM_SHARE_EXCLUSIVE instead of 0x%lx
\n
"
,
statstg
.
grfMode
);
ok
(
statstg
.
grfLocksSupported
==
0
,
"Statstg grfLocksSupported should have been 0 instead of %ld
\n
"
,
statstg
.
grfLocksSupported
);
...
...
@@ -1135,8 +1132,8 @@ static void test_storage_refcount(void)
r
=
IStorage_Stat
(
stg
,
&
statstg
,
STATFLAG_NONAME
);
ok
(
r
==
S_OK
,
"Stat should have succeeded instead of returning 0x%08lx
\n
"
,
r
);
ok
(
statstg
.
type
==
STGTY_STORAGE
,
"Statstg type should have been STGTY_STORAGE instead of %ld
\n
"
,
statstg
.
type
);
ok
(
U
(
statstg
.
cbSize
).
LowPart
==
0
,
"Statstg cbSize.LowPart should have been 0 instead of %ld
\n
"
,
U
(
statstg
.
cbSize
)
.
LowPart
);
ok
(
U
(
statstg
.
cbSize
).
HighPart
==
0
,
"Statstg cbSize.HighPart should have been 0 instead of %ld
\n
"
,
U
(
statstg
.
cbSize
)
.
HighPart
);
ok
(
statstg
.
cbSize
.
LowPart
==
0
,
"Statstg cbSize.LowPart should have been 0 instead of %ld
\n
"
,
statstg
.
cbSize
.
LowPart
);
ok
(
statstg
.
cbSize
.
HighPart
==
0
,
"Statstg cbSize.HighPart should have been 0 instead of %ld
\n
"
,
statstg
.
cbSize
.
HighPart
);
ok
(
statstg
.
grfMode
==
(
STGM_TRANSACTED
|
STGM_SHARE_DENY_WRITE
|
STGM_READWRITE
),
"Statstg grfMode should have been 0x10022 instead of 0x%lx
\n
"
,
statstg
.
grfMode
);
ok
(
statstg
.
grfLocksSupported
==
0
,
"Statstg grfLocksSupported should have been 0 instead of %ld
\n
"
,
statstg
.
grfLocksSupported
);
...
...
@@ -2336,26 +2333,26 @@ static void test_simple(void)
pos
.
QuadPart
=
0
;
r
=
IStream_Seek
(
stm
,
pos
,
STREAM_SEEK_CUR
,
&
upos
);
ok
(
r
==
S_OK
,
"got %08lx
\n
"
,
r
);
ok
(
upos
.
QuadPart
==
3
,
"got %ld
\n
"
,
upos
.
u
.
LowPart
);
ok
(
upos
.
QuadPart
==
3
,
"got %ld
\n
"
,
upos
.
LowPart
);
r
=
IStream_Stat
(
stm
,
&
stat
,
STATFLAG_NONAME
);
ok
(
r
==
S_OK
||
broken
(
r
==
STG_E_INVALIDFUNCTION
),
/* NT4 and below */
"got %08lx
\n
"
,
r
);
if
(
r
==
S_OK
)
ok
(
stat
.
cbSize
.
QuadPart
==
3
,
"got %ld
\n
"
,
stat
.
cbSize
.
u
.
LowPart
);
ok
(
stat
.
cbSize
.
QuadPart
==
3
,
"got %ld
\n
"
,
stat
.
cbSize
.
LowPart
);
pos
.
QuadPart
=
1
;
r
=
IStream_Seek
(
stm
,
pos
,
STREAM_SEEK_SET
,
&
upos
);
ok
(
r
==
S_OK
,
"got %08lx
\n
"
,
r
);
ok
(
upos
.
QuadPart
==
1
,
"got %ld
\n
"
,
upos
.
u
.
LowPart
);
ok
(
upos
.
QuadPart
==
1
,
"got %ld
\n
"
,
upos
.
LowPart
);
r
=
IStream_Stat
(
stm
,
&
stat
,
STATFLAG_NONAME
);
ok
(
r
==
S_OK
||
broken
(
r
==
STG_E_INVALIDFUNCTION
),
/* NT4 and below */
"got %08lx
\n
"
,
r
);
if
(
r
==
S_OK
)
ok
(
stat
.
cbSize
.
QuadPart
==
1
,
"got %ld
\n
"
,
stat
.
cbSize
.
u
.
LowPart
);
ok
(
stat
.
cbSize
.
QuadPart
==
1
,
"got %ld
\n
"
,
stat
.
cbSize
.
LowPart
);
IStream_Release
(
stm
);
...
...
@@ -2393,7 +2390,7 @@ static void test_simple(void)
r
=
IStream_Stat
(
stm
,
&
stat
,
STATFLAG_NONAME
);
ok
(
r
==
S_OK
,
"got %08lx
\n
"
,
r
);
ok
(
stat
.
cbSize
.
QuadPart
==
6000
,
"got %ld
\n
"
,
stat
.
cbSize
.
u
.
LowPart
);
ok
(
stat
.
cbSize
.
QuadPart
==
6000
,
"got %ld
\n
"
,
stat
.
cbSize
.
LowPart
);
IStream_Release
(
stm
);
...
...
@@ -2402,7 +2399,7 @@ static void test_simple(void)
r
=
IStream_Stat
(
stm
,
&
stat
,
STATFLAG_NONAME
);
ok
(
r
==
S_OK
,
"got %08lx
\n
"
,
r
);
ok
(
stat
.
cbSize
.
QuadPart
==
4096
,
"got %ld
\n
"
,
stat
.
cbSize
.
u
.
LowPart
);
ok
(
stat
.
cbSize
.
QuadPart
==
4096
,
"got %ld
\n
"
,
stat
.
cbSize
.
LowPart
);
IStream_Release
(
stm
);
...
...
@@ -3269,7 +3266,7 @@ static void test_hglobal_storage_creation(void)
r
=
ILockBytes_Stat
(
ilb
,
&
stat
,
STATFLAG_NONAME
);
ok
(
r
==
S_OK
,
"ILockBytes_Stat failed, hr=%lx
\n
"
,
r
);
ok
(
stat
.
cbSize
.
u
.
LowPart
<
2512
,
"expected truncated size, got %ld
\n
"
,
stat
.
cbSize
.
u
.
LowPart
);
ok
(
stat
.
cbSize
.
LowPart
<
2512
,
"expected truncated size, got %ld
\n
"
,
stat
.
cbSize
.
LowPart
);
ILockBytes_Release
(
ilb
);
}
...
...
@@ -3524,10 +3521,10 @@ static void test_locking(void)
hfile
=
CreateFileW
(
filename
,
open_mode
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
|
FILE_SHARE_DELETE
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
hfile
!=
INVALID_HANDLE_VALUE
,
"couldn't open file with mode %lx
\n
"
,
current
->
stg_mode
);
ol
.
u
.
s
.
OffsetHigh
=
0
;
ol
.
OffsetHigh
=
0
;
ol
.
hEvent
=
NULL
;
for
(
ol
.
u
.
s
.
Offset
=
0x7ffffe00
;
ol
.
u
.
s
.
Offset
!=
0x80000000
;
ol
.
u
.
s
.
Offset
++
)
for
(
ol
.
Offset
=
0x7ffffe00
;
ol
.
Offset
!=
0x80000000
;
ol
.
Offset
++
)
{
if
(
LockFileEx
(
hfile
,
LOCKFILE_EXCLUSIVE_LOCK
|
LOCKFILE_FAIL_IMMEDIATELY
,
0
,
1
,
0
,
&
ol
))
locked
=
FALSE
;
...
...
@@ -3539,7 +3536,7 @@ static void test_locking(void)
UnlockFileEx
(
hfile
,
0
,
1
,
0
,
&
ol
);
if
((
ol
.
u
.
s
.
Offset
&
0x1ff
)
==
*
next_lock
)
if
((
ol
.
Offset
&
0x1ff
)
==
*
next_lock
)
{
expect_locked
=
TRUE
;
next_lock
++
;
...
...
@@ -3549,12 +3546,12 @@ static void test_locking(void)
if
(
!
current
->
todo
||
locked
==
expect_locked
)
ok
(
locked
==
expect_locked
,
"byte %lx of file with mode %lx is %slocked but should %sbe
\n
"
,
ol
.
u
.
s
.
Offset
,
current
->
stg_mode
,
locked
?
""
:
"not "
,
expect_locked
?
""
:
"not "
);
ol
.
Offset
,
current
->
stg_mode
,
locked
?
""
:
"not "
,
expect_locked
?
""
:
"not "
);
else
{
any_failure
=
TRUE
;
todo_wine
ok
(
locked
==
expect_locked
,
"byte %lx of file with mode %lx is %slocked but should %sbe
\n
"
,
ol
.
u
.
s
.
Offset
,
current
->
stg_mode
,
locked
?
""
:
"not "
,
expect_locked
?
""
:
"not "
);
ol
.
Offset
,
current
->
stg_mode
,
locked
?
""
:
"not "
,
expect_locked
?
""
:
"not "
);
}
}
...
...
@@ -3573,17 +3570,17 @@ static void test_locking(void)
hfile
=
CreateFileW
(
filename
,
open_mode
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
|
FILE_SHARE_DELETE
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
ok
(
hfile
!=
INVALID_HANDLE_VALUE
,
"couldn't open file with mode %lx
\n
"
,
current
->
stg_mode
);
ol
.
u
.
s
.
OffsetHigh
=
0
;
ol
.
OffsetHigh
=
0
;
ol
.
hEvent
=
NULL
;
for
(
ol
.
u
.
s
.
Offset
=
0x7ffffe00
;
ol
.
u
.
s
.
Offset
!=
0x80000000
;
ol
.
u
.
s
.
Offset
++
)
for
(
ol
.
Offset
=
0x7ffffe00
;
ol
.
Offset
!=
0x80000000
;
ol
.
Offset
++
)
{
if
(
ol
.
u
.
s
.
Offset
==
0x7fffff92
||
(
ol
.
u
.
s
.
Offset
==
0x7fffff80
&&
current
->
stg_mode
==
(
STGM_TRANSACTED
|
STGM_READWRITE
))
||
(
ol
.
u
.
s
.
Offset
==
0x7fffff80
&&
current
->
stg_mode
==
(
STGM_TRANSACTED
|
STGM_READ
)))
if
(
ol
.
Offset
==
0x7fffff92
||
(
ol
.
Offset
==
0x7fffff80
&&
current
->
stg_mode
==
(
STGM_TRANSACTED
|
STGM_READWRITE
))
||
(
ol
.
Offset
==
0x7fffff80
&&
current
->
stg_mode
==
(
STGM_TRANSACTED
|
STGM_READ
)))
continue
;
/* This makes opens hang */
if
(
ol
.
u
.
s
.
Offset
<
0x7fffff00
)
if
(
ol
.
Offset
<
0x7fffff00
)
LockFileEx
(
hfile
,
0
,
0
,
1
,
0
,
&
ol
);
else
LockFileEx
(
hfile
,
LOCKFILE_EXCLUSIVE_LOCK
,
0
,
1
,
0
,
&
ol
);
...
...
@@ -3596,11 +3593,11 @@ static void test_locking(void)
failed
=
FAILED
(
hr
);
if
(
!
expect_failed
&&
(
ol
.
u
.
s
.
Offset
&
0x1ff
)
==
next_range
[
0
])
if
(
!
expect_failed
&&
(
ol
.
Offset
&
0x1ff
)
==
next_range
[
0
])
{
expect_failed
=
TRUE
;
}
else
if
(
expect_failed
&&
(
ol
.
u
.
s
.
Offset
&
0x1ff
)
==
next_range
[
1
])
else
if
(
expect_failed
&&
(
ol
.
Offset
&
0x1ff
)
==
next_range
[
1
])
{
expect_failed
=
FALSE
;
next_range
+=
2
;
...
...
@@ -3608,12 +3605,12 @@ static void test_locking(void)
if
(
!
current
->
todo
||
failed
==
expect_failed
)
ok
(
failed
==
expect_failed
,
"open with byte %lx locked, mode %lx %s but should %s
\n
"
,
ol
.
u
.
s
.
Offset
,
current
->
stg_mode
,
failed
?
"failed"
:
"succeeded"
,
expect_failed
?
"fail"
:
"succeed"
);
ol
.
Offset
,
current
->
stg_mode
,
failed
?
"failed"
:
"succeeded"
,
expect_failed
?
"fail"
:
"succeed"
);
else
{
any_failure
=
TRUE
;
todo_wine
ok
(
failed
==
expect_failed
,
"open with byte %lx locked, mode %lx %s but should %s
\n
"
,
ol
.
u
.
s
.
Offset
,
current
->
stg_mode
,
failed
?
"failed"
:
"succeeded"
,
expect_failed
?
"fail"
:
"succeed"
);
ol
.
Offset
,
current
->
stg_mode
,
failed
?
"failed"
:
"succeeded"
,
expect_failed
?
"fail"
:
"succeed"
);
}
}
...
...
dlls/ole32/tests/usrmarshal.c
View file @
7c1d8b29
...
...
@@ -815,7 +815,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
expect_buffer_end
=
WdtpInterfacePointer_UserMarshal
(
&
umcb
.
Flags
,
umcb
.
Flags
,
expect_buffer
+
2
*
sizeof
(
DWORD
),
unk
,
&
IID_IUnknown
);
med
.
tymed
=
TYMED_NULL
;
U
(
med
)
.
pstg
=
NULL
;
med
.
pstg
=
NULL
;
med
.
pUnkForRelease
=
unk
;
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
NULL
,
0
,
MSHCTX_DIFFERENTMACHINE
);
...
...
@@ -837,7 +837,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
Test_Unknown2
.
refs
=
1
;
med2
.
tymed
=
TYMED_NULL
;
U
(
med2
)
.
pstm
=
NULL
;
med2
.
pstm
=
NULL
;
med2
.
pUnkForRelease
=
&
Test_Unknown2
.
IUnknown_iface
;
STGMEDIUM_UserUnmarshal
(
&
umcb
.
Flags
,
buffer
,
&
med2
);
...
...
@@ -852,7 +852,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
expect_buffer
,
expect_size
,
MSHCTX_DIFFERENTMACHINE
);
med2
.
tymed
=
TYMED_NULL
;
U
(
med2
)
.
pstm
=
NULL
;
med2
.
pstm
=
NULL
;
med2
.
pUnkForRelease
=
NULL
;
STGMEDIUM_UserUnmarshal
(
&
umcb
.
Flags
,
expect_buffer
,
&
med2
);
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
NULL
,
0
,
MSHCTX_DIFFERENTMACHINE
);
...
...
@@ -882,7 +882,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
expect_buffer_end
=
WdtpInterfacePointer_UserMarshal
(
&
umcb
.
Flags
,
umcb
.
Flags
,
expect_buffer_end
,
unk
,
&
IID_IUnknown
);
med
.
tymed
=
TYMED_ISTREAM
;
U
(
med
)
.
pstm
=
stm
;
med
.
pstm
=
stm
;
med
.
pUnkForRelease
=
unk
;
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
NULL
,
0
,
MSHCTX_DIFFERENTMACHINE
);
...
...
@@ -907,13 +907,13 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
Test_Stream2
.
refs
=
1
;
Test_Unknown2
.
refs
=
1
;
med2
.
tymed
=
TYMED_ISTREAM
;
U
(
med2
)
.
pstm
=
&
Test_Stream2
.
IStream_iface
;
med2
.
pstm
=
&
Test_Stream2
.
IStream_iface
;
med2
.
pUnkForRelease
=
&
Test_Unknown2
.
IUnknown_iface
;
STGMEDIUM_UserUnmarshal
(
&
umcb
.
Flags
,
buffer
,
&
med2
);
ok
(
med2
.
tymed
==
TYMED_ISTREAM
,
"got tymed %lx
\n
"
,
med2
.
tymed
);
ok
(
U
(
med2
)
.
pstm
!=
NULL
,
"Incorrectly unmarshalled
\n
"
);
ok
(
med2
.
pstm
!=
NULL
,
"Incorrectly unmarshalled
\n
"
);
ok
(
med2
.
pUnkForRelease
!=
NULL
,
"Incorrectly unmarshalled
\n
"
);
ok
(
Test_Stream2
.
refs
==
0
,
"got %ld
\n
"
,
Test_Stream2
.
refs
);
ok
(
Test_Unknown2
.
refs
==
0
,
"got %ld
\n
"
,
Test_Unknown2
.
refs
);
...
...
@@ -924,7 +924,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
expect_buffer
,
expect_size
,
MSHCTX_DIFFERENTMACHINE
);
med2
.
tymed
=
TYMED_NULL
;
U
(
med2
)
.
pstm
=
NULL
;
med2
.
pstm
=
NULL
;
med2
.
pUnkForRelease
=
NULL
;
STGMEDIUM_UserUnmarshal
(
&
umcb
.
Flags
,
expect_buffer
,
&
med2
);
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
NULL
,
0
,
MSHCTX_DIFFERENTMACHINE
);
...
...
@@ -941,7 +941,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
expect_size
=
3
*
sizeof
(
DWORD
);
med
.
tymed
=
TYMED_ISTREAM
;
U
(
med
)
.
pstm
=
NULL
;
med
.
pstm
=
NULL
;
med
.
pUnkForRelease
=
NULL
;
init_user_marshal_cb
(
&
umcb
,
&
stub_msg
,
&
rpc_msg
,
NULL
,
0
,
MSHCTX_DIFFERENTMACHINE
);
...
...
@@ -965,13 +965,13 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
Test_Stream2
.
refs
=
1
;
Test_Unknown2
.
refs
=
1
;
med2
.
tymed
=
TYMED_ISTREAM
;
U
(
med2
)
.
pstm
=
&
Test_Stream2
.
IStream_iface
;
med2
.
pstm
=
&
Test_Stream2
.
IStream_iface
;
med2
.
pUnkForRelease
=
&
Test_Unknown2
.
IUnknown_iface
;
STGMEDIUM_UserUnmarshal
(
&
umcb
.
Flags
,
buffer
,
&
med2
);
ok
(
med2
.
tymed
==
TYMED_ISTREAM
,
"got tymed %lx
\n
"
,
med2
.
tymed
);
ok
(
U
(
med2
)
.
pstm
==
NULL
,
"Incorrectly unmarshalled
\n
"
);
ok
(
med2
.
pstm
==
NULL
,
"Incorrectly unmarshalled
\n
"
);
ok
(
med2
.
pUnkForRelease
==
&
Test_Unknown2
.
IUnknown_iface
,
"Incorrectly unmarshalled
\n
"
);
ok
(
Test_Stream2
.
refs
==
0
,
"got %ld
\n
"
,
Test_Stream2
.
refs
);
ok
(
Test_Unknown2
.
refs
==
1
,
"got %ld
\n
"
,
Test_Unknown2
.
refs
);
...
...
@@ -1307,8 +1307,8 @@ static HRESULT WINAPI obj_DO_GetDataHere(IDataObject *iface, FORMATETC *fmt,
if
(
fmt
->
cfFormat
==
2
)
{
IStream_Release
(
U
(
med
)
->
pstm
);
U
(
med
)
->
pstm
=
&
Test_Stream2
.
IStream_iface
;
IStream_Release
(
med
->
pstm
);
med
->
pstm
=
&
Test_Stream2
.
IStream_iface
;
}
return
S_OK
;
...
...
@@ -1363,7 +1363,7 @@ static void test_GetDataHere_Proxy(void)
fmt
.
ptd
=
NULL
;
fmt
.
dwAspect
=
DVASPECT_CONTENT
;
fmt
.
lindex
=
-
1
;
U
(
med
)
.
pstm
=
NULL
;
med
.
pstm
=
NULL
;
med
.
pUnkForRelease
=
&
Test_Unknown
.
IUnknown_iface
;
fmt
.
tymed
=
med
.
tymed
=
TYMED_NULL
;
...
...
@@ -1384,13 +1384,13 @@ static void test_GetDataHere_Proxy(void)
ok
(
hr
==
DV_E_TYMED
,
"got %08lx
\n
"
,
hr
);
fmt
.
tymed
=
med
.
tymed
=
TYMED_ISTREAM
;
U
(
med
)
.
pstm
=
&
Test_Stream
.
IStream_iface
;
med
.
pstm
=
&
Test_Stream
.
IStream_iface
;
med
.
pUnkForRelease
=
&
Test_Unknown
.
IUnknown_iface
;
hr
=
IDataObject_GetDataHere
(
data
,
&
fmt
,
&
med
);
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
ok
(
U
(
med
)
.
pstm
==
&
Test_Stream
.
IStream_iface
,
"stm changed
\n
"
);
ok
(
med
.
pstm
==
&
Test_Stream
.
IStream_iface
,
"stm changed
\n
"
);
ok
(
med
.
pUnkForRelease
==
&
Test_Unknown
.
IUnknown_iface
,
"punk changed
\n
"
);
ok
(
Test_Stream
.
refs
==
1
,
"got %ld
\n
"
,
Test_Stream
.
refs
);
...
...
@@ -1398,13 +1398,13 @@ static void test_GetDataHere_Proxy(void)
fmt
.
cfFormat
=
2
;
fmt
.
tymed
=
med
.
tymed
=
TYMED_ISTREAM
;
U
(
med
)
.
pstm
=
&
Test_Stream
.
IStream_iface
;
med
.
pstm
=
&
Test_Stream
.
IStream_iface
;
med
.
pUnkForRelease
=
&
Test_Unknown
.
IUnknown_iface
;
hr
=
IDataObject_GetDataHere
(
data
,
&
fmt
,
&
med
);
ok
(
hr
==
S_OK
,
"got %08lx
\n
"
,
hr
);
ok
(
U
(
med
)
.
pstm
==
&
Test_Stream
.
IStream_iface
,
"stm changed
\n
"
);
ok
(
med
.
pstm
==
&
Test_Stream
.
IStream_iface
,
"stm changed
\n
"
);
ok
(
med
.
pUnkForRelease
==
&
Test_Unknown
.
IUnknown_iface
,
"punk changed
\n
"
);
ok
(
Test_Stream
.
refs
==
1
,
"got %ld
\n
"
,
Test_Stream
.
refs
);
...
...
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