Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
61a06d4b
Commit
61a06d4b
authored
Jul 04, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Use nameless unions/structs.
parent
34ab144f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
102 additions
and
128 deletions
+102
-128
antimoniker.c
dlls/ole32/antimoniker.c
+0
-2
clipboard.c
dlls/ole32/clipboard.c
+28
-30
compobj.c
dlls/ole32/compobj.c
+0
-2
datacache.c
dlls/ole32/datacache.c
+0
-0
filelockbytes.c
dlls/ole32/filelockbytes.c
+12
-15
filemoniker.c
dlls/ole32/filemoniker.c
+0
-2
itemmoniker.c
dlls/ole32/itemmoniker.c
+0
-2
memlockbytes.c
dlls/ole32/memlockbytes.c
+17
-20
ole2.c
dlls/ole32/ole2.c
+19
-21
oleobj.c
dlls/ole32/oleobj.c
+1
-3
pointermoniker.c
dlls/ole32/pointermoniker.c
+0
-2
stg_prop.c
dlls/ole32/stg_prop.c
+17
-19
stg_stream.c
dlls/ole32/stg_stream.c
+8
-10
storage32.c
dlls/ole32/storage32.c
+0
-0
usrmarshal.c
dlls/ole32/usrmarshal.c
+0
-0
No files found.
dlls/ole32/antimoniker.c
View file @
61a06d4b
...
...
@@ -22,8 +22,6 @@
#include <string.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
...
...
dlls/ole32/clipboard.c
View file @
61a06d4b
...
...
@@ -64,8 +64,6 @@
#include <stdio.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
...
...
@@ -646,7 +644,7 @@ static HRESULT render_embed_source_hack(IDataObject *data, LPFORMATETC fmt)
return
hr
;
}
hr
=
StgCreateDocfileOnILockBytes
(
ptrILockBytes
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
0
,
&
std
.
u
.
pstg
);
hr
=
StgCreateDocfileOnILockBytes
(
ptrILockBytes
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
0
,
&
std
.
pstg
);
ILockBytes_Release
(
ptrILockBytes
);
if
(
FAILED
(
hr
=
IDataObject_GetDataHere
(
theOleClipboard
->
src_data
,
fmt
,
&
std
)))
...
...
@@ -675,7 +673,7 @@ static HRESULT render_embed_source_hack(IDataObject *data, LPFORMATETC fmt)
if
(
SUCCEEDED
(
hr
=
IDataObject_GetData
(
theOleClipboard
->
src_data
,
&
fmt2
,
&
std2
)))
{
mfp
=
GlobalLock
(
std2
.
u
.
hGlobal
);
mfp
=
GlobalLock
(
std2
.
hGlobal
);
}
if
(
mfp
)
...
...
@@ -704,7 +702,7 @@ static HRESULT render_embed_source_hack(IDataObject *data, LPFORMATETC fmt)
pdh
.
dwObjectExtentY
=
mfp
->
yExt
;
pdh
.
dwSize
=
nSize
;
hr
=
IStorage_CreateStream
(
std
.
u
.
pstg
,
L"
\2
OlePres000"
,
hr
=
IStorage_CreateStream
(
std
.
pstg
,
L"
\2
OlePres000"
,
STGM_CREATE
|
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
0
,
0
,
&
pStream
);
hr
=
IStream_Write
(
pStream
,
&
pdh
,
sizeof
(
PresentationDataHeader
),
NULL
);
...
...
@@ -718,15 +716,15 @@ static HRESULT render_embed_source_hack(IDataObject *data, LPFORMATETC fmt)
HeapFree
(
GetProcessHeap
(),
0
,
mfBits
);
GlobalUnlock
(
std2
.
u
.
hGlobal
);
GlobalUnlock
(
std2
.
hGlobal
);
ReleaseStgMedium
(
&
std2
);
ReadClassStg
(
std
.
u
.
pstg
,
&
clsID
);
ReadClassStg
(
std
.
pstg
,
&
clsID
);
ProgIDFromCLSID
(
&
clsID
,
&
strProgID
);
WideCharToMultiByte
(
CP_ACP
,
0
,
strProgID
,
-
1
,
strOleTypeName
,
sizeof
(
strOleTypeName
),
NULL
,
NULL
);
STORAGE_CreateOleStream
(
std
.
u
.
pstg
,
0
);
OLECONVERT_CreateCompObjStream
(
std
.
u
.
pstg
,
strOleTypeName
);
STORAGE_CreateOleStream
(
std
.
pstg
,
0
);
OLECONVERT_CreateCompObjStream
(
std
.
pstg
,
strOleTypeName
);
CoTaskMemFree
(
strProgID
);
}
}
...
...
@@ -790,7 +788,7 @@ static HRESULT get_data_from_storage(IDataObject *data, FORMATETC *fmt, HGLOBAL
stg_fmt
=
*
fmt
;
med
.
tymed
=
stg_fmt
.
tymed
=
TYMED_ISTORAGE
;
med
.
u
.
pstg
=
stg
;
med
.
pstg
=
stg
;
med
.
pUnkForRelease
=
NULL
;
hr
=
IDataObject_GetDataHere
(
data
,
&
stg_fmt
,
&
med
);
...
...
@@ -800,7 +798,7 @@ static HRESULT get_data_from_storage(IDataObject *data, FORMATETC *fmt, HGLOBAL
hr
=
IDataObject_GetData
(
data
,
&
stg_fmt
,
&
med
);
if
(
FAILED
(
hr
))
goto
end
;
hr
=
IStorage_CopyTo
(
med
.
u
.
pstg
,
0
,
NULL
,
NULL
,
stg
);
hr
=
IStorage_CopyTo
(
med
.
pstg
,
0
,
NULL
,
NULL
,
stg
);
ReleaseStgMedium
(
&
med
);
if
(
FAILED
(
hr
))
goto
end
;
}
...
...
@@ -835,7 +833,7 @@ static HRESULT get_data_from_stream(IDataObject *data, FORMATETC *fmt, HGLOBAL *
stm_fmt
=
*
fmt
;
med
.
tymed
=
stm_fmt
.
tymed
=
TYMED_ISTREAM
;
med
.
u
.
pstm
=
stm
;
med
.
pstm
=
stm
;
med
.
pUnkForRelease
=
NULL
;
hr
=
IDataObject_GetDataHere
(
data
,
&
stm_fmt
,
&
med
);
...
...
@@ -849,9 +847,9 @@ static HRESULT get_data_from_stream(IDataObject *data, FORMATETC *fmt, HGLOBAL *
if
(
FAILED
(
hr
))
goto
error
;
offs
.
QuadPart
=
0
;
IStream_Seek
(
med
.
u
.
pstm
,
offs
,
STREAM_SEEK_END
,
&
pos
);
IStream_Seek
(
med
.
u
.
pstm
,
offs
,
STREAM_SEEK_SET
,
NULL
);
hr
=
IStream_CopyTo
(
med
.
u
.
pstm
,
stm
,
pos
,
NULL
,
NULL
);
IStream_Seek
(
med
.
pstm
,
offs
,
STREAM_SEEK_END
,
&
pos
);
IStream_Seek
(
med
.
pstm
,
offs
,
STREAM_SEEK_SET
,
NULL
);
hr
=
IStream_CopyTo
(
med
.
pstm
,
stm
,
pos
,
NULL
,
NULL
);
ReleaseStgMedium
(
&
med
);
if
(
FAILED
(
hr
))
goto
error
;
}
...
...
@@ -886,7 +884,7 @@ static HRESULT get_data_from_global(IDataObject *data, FORMATETC *fmt, HGLOBAL *
hr
=
IDataObject_GetData
(
data
,
&
mem_fmt
,
&
med
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
dup_global_mem
(
med
.
u
.
hGlobal
,
GMEM_DDESHARE
|
GMEM_MOVEABLE
,
&
h
);
hr
=
dup_global_mem
(
med
.
hGlobal
,
GMEM_DDESHARE
|
GMEM_MOVEABLE
,
&
h
);
if
(
SUCCEEDED
(
hr
))
*
mem
=
h
;
...
...
@@ -914,7 +912,7 @@ static HRESULT get_data_from_enhmetafile(IDataObject *data, FORMATETC *fmt, HGLO
hr
=
IDataObject_GetData
(
data
,
&
mem_fmt
,
&
med
);
if
(
FAILED
(
hr
))
return
hr
;
copy
=
CopyEnhMetaFileW
(
med
.
u
.
hEnhMetaFile
,
NULL
);
copy
=
CopyEnhMetaFileW
(
med
.
hEnhMetaFile
,
NULL
);
if
(
copy
)
*
mem
=
(
HGLOBAL
)
copy
;
else
hr
=
E_FAIL
;
...
...
@@ -942,7 +940,7 @@ static HRESULT get_data_from_metafilepict(IDataObject *data, FORMATETC *fmt, HGL
hr
=
IDataObject_GetData
(
data
,
&
mem_fmt
,
&
med
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
dup_metafilepict
(
med
.
u
.
hMetaFilePict
,
&
copy
);
hr
=
dup_metafilepict
(
med
.
hMetaFilePict
,
&
copy
);
if
(
SUCCEEDED
(
hr
))
*
mem
=
copy
;
...
...
@@ -972,7 +970,7 @@ static HRESULT get_data_from_bitmap(IDataObject *data, FORMATETC *fmt, HBITMAP *
hr
=
IDataObject_GetData
(
data
,
&
mem_fmt
,
&
med
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
dup_bitmap
(
med
.
u
.
hBitmap
,
&
copy
);
hr
=
dup_bitmap
(
med
.
hBitmap
,
&
copy
);
if
(
SUCCEEDED
(
hr
))
*
hbm
=
copy
;
...
...
@@ -1299,7 +1297,7 @@ static HRESULT get_stgmed_for_global(HGLOBAL h, STGMEDIUM *med)
med
->
pUnkForRelease
=
NULL
;
med
->
tymed
=
TYMED_NULL
;
hr
=
dup_global_mem
(
h
,
GMEM_MOVEABLE
,
&
med
->
u
.
hGlobal
);
hr
=
dup_global_mem
(
h
,
GMEM_MOVEABLE
,
&
med
->
hGlobal
);
if
(
SUCCEEDED
(
hr
))
med
->
tymed
=
TYMED_HGLOBAL
;
...
...
@@ -1322,7 +1320,7 @@ static HRESULT get_stgmed_for_stream(HGLOBAL h, STGMEDIUM *med)
hr
=
dup_global_mem
(
h
,
GMEM_MOVEABLE
,
&
dst
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
CreateStreamOnHGlobal
(
dst
,
TRUE
,
&
med
->
u
.
pstm
);
hr
=
CreateStreamOnHGlobal
(
dst
,
TRUE
,
&
med
->
pstm
);
if
(
FAILED
(
hr
))
{
GlobalFree
(
dst
);
...
...
@@ -1365,7 +1363,7 @@ static HRESULT get_stgmed_for_storage(HGLOBAL h, STGMEDIUM *med)
return
SUCCEEDED
(
hr
)
?
E_FAIL
:
hr
;
}
hr
=
StgOpenStorageOnILockBytes
(
lbs
,
NULL
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
NULL
,
0
,
&
med
->
u
.
pstg
);
hr
=
StgOpenStorageOnILockBytes
(
lbs
,
NULL
,
STGM_SHARE_EXCLUSIVE
|
STGM_READWRITE
,
NULL
,
0
,
&
med
->
pstg
);
ILockBytes_Release
(
lbs
);
if
(
FAILED
(
hr
))
{
...
...
@@ -1387,8 +1385,8 @@ static HRESULT get_stgmed_for_emf(HENHMETAFILE hemf, STGMEDIUM *med)
med
->
pUnkForRelease
=
NULL
;
med
->
tymed
=
TYMED_NULL
;
med
->
u
.
hEnhMetaFile
=
CopyEnhMetaFileW
(
hemf
,
NULL
);
if
(
!
med
->
u
.
hEnhMetaFile
)
return
E_OUTOFMEMORY
;
med
->
hEnhMetaFile
=
CopyEnhMetaFileW
(
hemf
,
NULL
);
if
(
!
med
->
hEnhMetaFile
)
return
E_OUTOFMEMORY
;
med
->
tymed
=
TYMED_ENHMF
;
return
S_OK
;
}
...
...
@@ -1405,7 +1403,7 @@ static HRESULT get_stgmed_for_bitmap(HBITMAP hbmp, STGMEDIUM *med)
med
->
pUnkForRelease
=
NULL
;
med
->
tymed
=
TYMED_NULL
;
hr
=
dup_bitmap
(
hbmp
,
&
med
->
u
.
hBitmap
);
hr
=
dup_bitmap
(
hbmp
,
&
med
->
hBitmap
);
if
(
FAILED
(
hr
))
return
hr
;
...
...
@@ -1603,15 +1601,15 @@ static HRESULT WINAPI snapshot_GetDataHere(IDataObject *iface, FORMATETC *fmt,
case
TYMED_HGLOBAL
:
{
DWORD
src_size
=
GlobalSize
(
h
);
DWORD
dst_size
=
GlobalSize
(
med
->
u
.
hGlobal
);
DWORD
dst_size
=
GlobalSize
(
med
->
hGlobal
);
hr
=
E_FAIL
;
if
(
dst_size
>=
src_size
)
{
void
*
src
=
GlobalLock
(
h
);
void
*
dst
=
GlobalLock
(
med
->
u
.
hGlobal
);
void
*
dst
=
GlobalLock
(
med
->
hGlobal
);
memcpy
(
dst
,
src
,
src_size
);
GlobalUnlock
(
med
->
u
.
hGlobal
);
GlobalUnlock
(
med
->
hGlobal
);
GlobalUnlock
(
h
);
hr
=
S_OK
;
}
...
...
@@ -1621,7 +1619,7 @@ static HRESULT WINAPI snapshot_GetDataHere(IDataObject *iface, FORMATETC *fmt,
{
DWORD
src_size
=
GlobalSize
(
h
);
void
*
src
=
GlobalLock
(
h
);
hr
=
IStream_Write
(
med
->
u
.
pstm
,
src
,
src_size
,
NULL
);
hr
=
IStream_Write
(
med
->
pstm
,
src
,
src_size
,
NULL
);
GlobalUnlock
(
h
);
break
;
}
...
...
@@ -1636,7 +1634,7 @@ static HRESULT WINAPI snapshot_GetDataHere(IDataObject *iface, FORMATETC *fmt,
hr
=
get_stgmed_for_storage
(
h
,
&
copy
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IStorage_CopyTo
(
copy
.
u
.
pstg
,
0
,
NULL
,
NULL
,
med
->
u
.
pstg
);
hr
=
IStorage_CopyTo
(
copy
.
pstg
,
0
,
NULL
,
NULL
,
med
->
pstg
);
ReleaseStgMedium
(
&
copy
);
}
break
;
...
...
dlls/ole32/compobj.c
View file @
61a06d4b
...
...
@@ -40,8 +40,6 @@
#include <assert.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
...
...
dlls/ole32/datacache.c
View file @
61a06d4b
This diff is collapsed.
Click to expand it.
dlls/ole32/filelockbytes.c
View file @
61a06d4b
...
...
@@ -28,9 +28,6 @@
#include <limits.h>
#define COBJMACROS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
...
...
@@ -189,7 +186,7 @@ static HRESULT WINAPI FileLockBytesImpl_ReadAt(
LARGE_INTEGER
offset
;
ULONG
cbRead
;
TRACE
(
"%p, %ld, %p, %lu, %p.
\n
"
,
iface
,
ulOffset
.
u
.
LowPart
,
pv
,
cb
,
pcbRead
);
TRACE
(
"%p, %ld, %p, %lu, %p.
\n
"
,
iface
,
ulOffset
.
LowPart
,
pv
,
cb
,
pcbRead
);
/* verify a sane environment */
if
(
!
This
)
return
E_FAIL
;
...
...
@@ -244,7 +241,7 @@ static HRESULT WINAPI FileLockBytesImpl_WriteAt(
LARGE_INTEGER
offset
;
ULONG
cbWritten
;
TRACE
(
"%p, %ld, %p, %lu, %p.
\n
"
,
iface
,
ulOffset
.
u
.
LowPart
,
pv
,
cb
,
pcbWritten
);
TRACE
(
"%p, %ld, %p, %lu, %p.
\n
"
,
iface
,
ulOffset
.
LowPart
,
pv
,
cb
,
pcbWritten
);
/* verify a sane environment */
if
(
!
This
)
return
E_FAIL
;
...
...
@@ -297,7 +294,7 @@ static HRESULT WINAPI FileLockBytesImpl_SetSize(ILockBytes* iface, ULARGE_INTEGE
HRESULT
hr
=
S_OK
;
LARGE_INTEGER
newpos
;
TRACE
(
"new size %lu
\n
"
,
newSize
.
u
.
LowPart
);
TRACE
(
"new size %lu
\n
"
,
newSize
.
LowPart
);
newpos
.
QuadPart
=
newSize
.
QuadPart
;
if
(
SetFilePointerEx
(
This
->
hfile
,
newpos
,
NULL
,
FILE_BEGIN
))
...
...
@@ -328,7 +325,7 @@ static HRESULT WINAPI FileLockBytesImpl_LockRegion(ILockBytes* iface,
OVERLAPPED
ol
;
DWORD
lock_flags
=
LOCKFILE_FAIL_IMMEDIATELY
;
TRACE
(
"ofs %lu count %lu flags %lx
\n
"
,
libOffset
.
u
.
LowPart
,
cb
.
u
.
LowPart
,
dwLockType
);
TRACE
(
"ofs %lu count %lu flags %lx
\n
"
,
libOffset
.
LowPart
,
cb
.
LowPart
,
dwLockType
);
if
(
dwLockType
&
LOCK_WRITE
)
return
STG_E_INVALIDFUNCTION
;
...
...
@@ -337,10 +334,10 @@ static HRESULT WINAPI FileLockBytesImpl_LockRegion(ILockBytes* iface,
lock_flags
|=
LOCKFILE_EXCLUSIVE_LOCK
;
ol
.
hEvent
=
0
;
ol
.
u
.
s
.
Offset
=
libOffset
.
u
.
LowPart
;
ol
.
u
.
s
.
OffsetHigh
=
libOffset
.
u
.
HighPart
;
ol
.
Offset
=
libOffset
.
LowPart
;
ol
.
OffsetHigh
=
libOffset
.
HighPart
;
if
(
LockFileEx
(
This
->
hfile
,
lock_flags
,
0
,
cb
.
u
.
LowPart
,
cb
.
u
.
HighPart
,
&
ol
))
if
(
LockFileEx
(
This
->
hfile
,
lock_flags
,
0
,
cb
.
LowPart
,
cb
.
HighPart
,
&
ol
))
return
S_OK
;
return
get_lock_error
();
}
...
...
@@ -351,16 +348,16 @@ static HRESULT WINAPI FileLockBytesImpl_UnlockRegion(ILockBytes* iface,
FileLockBytesImpl
*
This
=
impl_from_ILockBytes
(
iface
);
OVERLAPPED
ol
;
TRACE
(
"ofs %lu count %lu flags %lx
\n
"
,
libOffset
.
u
.
LowPart
,
cb
.
u
.
LowPart
,
dwLockType
);
TRACE
(
"ofs %lu count %lu flags %lx
\n
"
,
libOffset
.
LowPart
,
cb
.
LowPart
,
dwLockType
);
if
(
dwLockType
&
LOCK_WRITE
)
return
STG_E_INVALIDFUNCTION
;
ol
.
hEvent
=
0
;
ol
.
u
.
s
.
Offset
=
libOffset
.
u
.
LowPart
;
ol
.
u
.
s
.
OffsetHigh
=
libOffset
.
u
.
HighPart
;
ol
.
Offset
=
libOffset
.
LowPart
;
ol
.
OffsetHigh
=
libOffset
.
HighPart
;
if
(
UnlockFileEx
(
This
->
hfile
,
0
,
cb
.
u
.
LowPart
,
cb
.
u
.
HighPart
,
&
ol
))
if
(
UnlockFileEx
(
This
->
hfile
,
0
,
cb
.
LowPart
,
cb
.
HighPart
,
&
ol
))
return
S_OK
;
return
get_lock_error
();
}
...
...
@@ -382,7 +379,7 @@ static HRESULT WINAPI FileLockBytesImpl_Stat(ILockBytes* iface,
pstatstg
->
type
=
STGTY_LOCKBYTES
;
pstatstg
->
cbSize
.
u
.
LowPart
=
GetFileSize
(
This
->
hfile
,
&
pstatstg
->
cbSize
.
u
.
HighPart
);
pstatstg
->
cbSize
.
LowPart
=
GetFileSize
(
This
->
hfile
,
&
pstatstg
->
cbSize
.
HighPart
);
/* FIXME: If the implementation is exported, we'll need to set other fields. */
pstatstg
->
grfLocksSupported
=
LOCK_EXCLUSIVE
|
LOCK_ONLYONCE
|
WINE_LOCK_READ
;
...
...
dlls/ole32/filemoniker.c
View file @
61a06d4b
...
...
@@ -24,8 +24,6 @@
#include <string.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
...
...
dlls/ole32/itemmoniker.c
View file @
61a06d4b
...
...
@@ -23,8 +23,6 @@
#include <string.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "winerror.h"
#include "windef.h"
#include "winbase.h"
...
...
dlls/ole32/memlockbytes.c
View file @
61a06d4b
...
...
@@ -24,8 +24,6 @@
#include <string.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
...
...
@@ -120,8 +118,8 @@ HRESULT WINAPI CreateILockBytesOnHGlobal(HGLOBAL global, BOOL delete_on_release,
/*
* Initialize the size of the array to the size of the handle.
*/
lockbytes
->
byteArraySize
.
u
.
HighPart
=
0
;
lockbytes
->
byteArraySize
.
u
.
LowPart
=
GlobalSize
(
lockbytes
->
supportHandle
);
lockbytes
->
byteArraySize
.
HighPart
=
0
;
lockbytes
->
byteArraySize
.
LowPart
=
GlobalSize
(
lockbytes
->
supportHandle
);
*
ret
=
&
lockbytes
->
ILockBytes_iface
;
...
...
@@ -164,18 +162,18 @@ HRESULT WINAPI GetHGlobalFromILockBytes(ILockBytes* iface, HGLOBAL* phglobal)
return
hres
;
}
TRACE
(
"cbSize is %s
\n
"
,
wine_dbgstr_longlong
(
stbuf
.
cbSize
.
QuadPart
));
*
phglobal
=
GlobalAlloc
(
GMEM_MOVEABLE
|
GMEM_SHARE
,
stbuf
.
cbSize
.
u
.
LowPart
);
*
phglobal
=
GlobalAlloc
(
GMEM_MOVEABLE
|
GMEM_SHARE
,
stbuf
.
cbSize
.
LowPart
);
if
(
!*
phglobal
)
return
E_INVALIDARG
;
memset
(
&
start
,
0
,
sizeof
(
start
));
hres
=
ILockBytes_ReadAt
(
iface
,
start
,
GlobalLock
(
*
phglobal
),
stbuf
.
cbSize
.
u
.
LowPart
,
&
xread
);
hres
=
ILockBytes_ReadAt
(
iface
,
start
,
GlobalLock
(
*
phglobal
),
stbuf
.
cbSize
.
LowPart
,
&
xread
);
GlobalUnlock
(
*
phglobal
);
if
(
hres
!=
S_OK
)
{
FIXME
(
"%p->ReadAt failed with %lx
\n
"
,
iface
,
hres
);
return
hres
;
}
if
(
stbuf
.
cbSize
.
u
.
LowPart
!=
xread
)
{
FIXME
(
"Read size is not requested size %ld vs %ld?
\n
"
,
stbuf
.
cbSize
.
u
.
LowPart
,
xread
);
if
(
stbuf
.
cbSize
.
LowPart
!=
xread
)
{
FIXME
(
"Read size is not requested size %ld vs %ld?
\n
"
,
stbuf
.
cbSize
.
LowPart
,
xread
);
}
return
S_OK
;
}
...
...
@@ -279,15 +277,14 @@ static HRESULT WINAPI HGLOBALLockBytesImpl_ReadAt(
/*
* Make sure the offset is valid.
*/
if
(
ulOffset
.
u
.
LowPart
>
This
->
byteArraySize
.
u
.
LowPart
)
if
(
ulOffset
.
LowPart
>
This
->
byteArraySize
.
LowPart
)
return
E_FAIL
;
/*
* Using the known size of the array, calculate the number of bytes
* to read.
*/
bytesToReadFromBuffer
=
min
(
This
->
byteArraySize
.
u
.
LowPart
-
ulOffset
.
u
.
LowPart
,
cb
);
bytesToReadFromBuffer
=
min
(
This
->
byteArraySize
.
LowPart
-
ulOffset
.
LowPart
,
cb
);
/*
* Lock the buffer in position and copy the data.
...
...
@@ -295,7 +292,7 @@ static HRESULT WINAPI HGLOBALLockBytesImpl_ReadAt(
supportBuffer
=
GlobalLock
(
This
->
supportHandle
);
memcpy
(
pv
,
(
char
*
)
supportBuffer
+
ulOffset
.
u
.
LowPart
,
(
char
*
)
supportBuffer
+
ulOffset
.
LowPart
,
bytesToReadFromBuffer
);
/*
...
...
@@ -354,14 +351,14 @@ static HRESULT WINAPI HGLOBALLockBytesImpl_WriteAt(
}
else
{
newSize
.
u
.
HighPart
=
0
;
newSize
.
u
.
LowPart
=
ulOffset
.
u
.
LowPart
+
cb
;
newSize
.
HighPart
=
0
;
newSize
.
LowPart
=
ulOffset
.
LowPart
+
cb
;
}
/*
* Verify if we need to grow the stream
*/
if
(
newSize
.
u
.
LowPart
>
This
->
byteArraySize
.
u
.
LowPart
)
if
(
newSize
.
LowPart
>
This
->
byteArraySize
.
LowPart
)
{
/* grow stream */
if
(
ILockBytes_SetSize
(
iface
,
newSize
)
==
STG_E_MEDIUMFULL
)
...
...
@@ -373,7 +370,7 @@ static HRESULT WINAPI HGLOBALLockBytesImpl_WriteAt(
*/
supportBuffer
=
GlobalLock
(
This
->
supportHandle
);
memcpy
((
char
*
)
supportBuffer
+
ulOffset
.
u
.
LowPart
,
pv
,
cb
);
memcpy
((
char
*
)
supportBuffer
+
ulOffset
.
LowPart
,
pv
,
cb
);
/*
* Return the number of bytes written.
...
...
@@ -415,22 +412,22 @@ static HRESULT WINAPI HGLOBALLockBytesImpl_SetSize(
/*
* As documented.
*/
if
(
libNewSize
.
u
.
HighPart
!=
0
)
if
(
libNewSize
.
HighPart
!=
0
)
return
STG_E_INVALIDFUNCTION
;
if
(
This
->
byteArraySize
.
u
.
LowPart
==
libNewSize
.
u
.
LowPart
)
if
(
This
->
byteArraySize
.
LowPart
==
libNewSize
.
LowPart
)
return
S_OK
;
/*
* Re allocate the HGlobal to fit the new size of the stream.
*/
supportHandle
=
GlobalReAlloc
(
This
->
supportHandle
,
libNewSize
.
u
.
LowPart
,
GMEM_MOVEABLE
);
supportHandle
=
GlobalReAlloc
(
This
->
supportHandle
,
libNewSize
.
LowPart
,
GMEM_MOVEABLE
);
if
(
supportHandle
==
0
)
return
STG_E_MEDIUMFULL
;
This
->
supportHandle
=
supportHandle
;
This
->
byteArraySize
.
u
.
LowPart
=
libNewSize
.
u
.
LowPart
;
This
->
byteArraySize
.
LowPart
=
libNewSize
.
LowPart
;
return
S_OK
;
}
...
...
dlls/ole32/ole2.c
View file @
61a06d4b
...
...
@@ -31,8 +31,6 @@
#include <string.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
...
...
@@ -2010,64 +2008,64 @@ void WINAPI ReleaseStgMedium(
case
TYMED_HGLOBAL
:
{
if
(
(
pmedium
->
pUnkForRelease
==
0
)
&&
(
pmedium
->
u
.
hGlobal
!=
0
)
)
GlobalFree
(
pmedium
->
u
.
hGlobal
);
(
pmedium
->
hGlobal
!=
0
)
)
GlobalFree
(
pmedium
->
hGlobal
);
break
;
}
case
TYMED_FILE
:
{
if
(
pmedium
->
u
.
lpszFileName
!=
0
)
if
(
pmedium
->
lpszFileName
!=
0
)
{
if
(
pmedium
->
pUnkForRelease
==
0
)
{
DeleteFileW
(
pmedium
->
u
.
lpszFileName
);
DeleteFileW
(
pmedium
->
lpszFileName
);
}
CoTaskMemFree
(
pmedium
->
u
.
lpszFileName
);
CoTaskMemFree
(
pmedium
->
lpszFileName
);
}
break
;
}
case
TYMED_ISTREAM
:
{
if
(
pmedium
->
u
.
pstm
!=
0
)
if
(
pmedium
->
pstm
!=
0
)
{
IStream_Release
(
pmedium
->
u
.
pstm
);
IStream_Release
(
pmedium
->
pstm
);
}
break
;
}
case
TYMED_ISTORAGE
:
{
if
(
pmedium
->
u
.
pstg
!=
0
)
if
(
pmedium
->
pstg
!=
0
)
{
IStorage_Release
(
pmedium
->
u
.
pstg
);
IStorage_Release
(
pmedium
->
pstg
);
}
break
;
}
case
TYMED_GDI
:
{
if
(
(
pmedium
->
pUnkForRelease
==
0
)
&&
(
pmedium
->
u
.
hBitmap
!=
0
)
)
DeleteObject
(
pmedium
->
u
.
hBitmap
);
(
pmedium
->
hBitmap
!=
0
)
)
DeleteObject
(
pmedium
->
hBitmap
);
break
;
}
case
TYMED_MFPICT
:
{
if
(
(
pmedium
->
pUnkForRelease
==
0
)
&&
(
pmedium
->
u
.
hMetaFilePict
!=
0
)
)
(
pmedium
->
hMetaFilePict
!=
0
)
)
{
LPMETAFILEPICT
pMP
=
GlobalLock
(
pmedium
->
u
.
hMetaFilePict
);
LPMETAFILEPICT
pMP
=
GlobalLock
(
pmedium
->
hMetaFilePict
);
DeleteMetaFile
(
pMP
->
hMF
);
GlobalUnlock
(
pmedium
->
u
.
hMetaFilePict
);
GlobalFree
(
pmedium
->
u
.
hMetaFilePict
);
GlobalUnlock
(
pmedium
->
hMetaFilePict
);
GlobalFree
(
pmedium
->
hMetaFilePict
);
}
break
;
}
case
TYMED_ENHMF
:
{
if
(
(
pmedium
->
pUnkForRelease
==
0
)
&&
(
pmedium
->
u
.
hEnhMetaFile
!=
0
)
)
(
pmedium
->
hEnhMetaFile
!=
0
)
)
{
DeleteEnhMetaFile
(
pmedium
->
u
.
hEnhMetaFile
);
DeleteEnhMetaFile
(
pmedium
->
hEnhMetaFile
);
}
break
;
}
...
...
@@ -2782,7 +2780,7 @@ static HRESULT get_storage(IDataObject *data, IStorage *stg, UINT *src_cf, BOOL
/* CF_EMBEDEDOBJECT */
init_fmtetc
(
&
fmt
,
embedded_object_clipboard_format
,
TYMED_ISTORAGE
);
med
.
tymed
=
TYMED_ISTORAGE
;
med
.
u
.
pstg
=
stg
;
med
.
pstg
=
stg
;
med
.
pUnkForRelease
=
NULL
;
hr
=
IDataObject_GetDataHere
(
data
,
&
fmt
,
&
med
);
if
(
SUCCEEDED
(
hr
))
...
...
@@ -2794,7 +2792,7 @@ static HRESULT get_storage(IDataObject *data, IStorage *stg, UINT *src_cf, BOOL
/* CF_EMBEDSOURCE */
init_fmtetc
(
&
fmt
,
embed_source_clipboard_format
,
TYMED_ISTORAGE
);
med
.
tymed
=
TYMED_ISTORAGE
;
med
.
u
.
pstg
=
stg
;
med
.
pstg
=
stg
;
med
.
pUnkForRelease
=
NULL
;
hr
=
IDataObject_GetDataHere
(
data
,
&
fmt
,
&
med
);
if
(
SUCCEEDED
(
hr
))
...
...
dlls/ole32/oleobj.c
View file @
61a06d4b
...
...
@@ -24,8 +24,6 @@
#include <string.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
...
...
@@ -767,7 +765,7 @@ static HRESULT WINAPI DataAdviseHolder_SendOnDataChange(IDataAdviseHolder *iface
{
STGMEDIUM
stg
;
stg
.
tymed
=
TYMED_NULL
;
stg
.
u
.
pstg
=
NULL
;
stg
.
pstg
=
NULL
;
stg
.
pUnkForRelease
=
NULL
;
if
(
!
(
statdata
.
advf
&
ADVF_NODATA
))
...
...
dlls/ole32/pointermoniker.c
View file @
61a06d4b
...
...
@@ -23,8 +23,6 @@
#include <string.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
...
...
dlls/ole32/stg_prop.c
View file @
61a06d4b
...
...
@@ -44,8 +44,6 @@
#include <string.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
...
...
@@ -499,7 +497,7 @@ static HRESULT WINAPI IPropertyStorage_fnReadMultiple(
if
(
rgpspec
[
i
].
ulKind
==
PRSPEC_LPWSTR
)
{
PROPVARIANT
*
prop
=
PropertyStorage_FindPropertyByName
(
This
,
rgpspec
[
i
].
u
.
lpwstr
);
rgpspec
[
i
].
lpwstr
);
if
(
prop
)
PropertyStorage_PropVariantCopy
(
&
rgpropvar
[
i
],
prop
,
GetACP
(),
...
...
@@ -507,7 +505,7 @@ static HRESULT WINAPI IPropertyStorage_fnReadMultiple(
}
else
{
switch
(
rgpspec
[
i
].
u
.
propid
)
switch
(
rgpspec
[
i
].
propid
)
{
case
PID_CODEPAGE
:
rgpropvar
[
i
].
vt
=
VT_I2
;
...
...
@@ -520,7 +518,7 @@ static HRESULT WINAPI IPropertyStorage_fnReadMultiple(
default:
{
PROPVARIANT
*
prop
=
PropertyStorage_FindProperty
(
This
,
rgpspec
[
i
].
u
.
propid
);
rgpspec
[
i
].
propid
);
if
(
prop
)
PropertyStorage_PropVariantCopy
(
&
rgpropvar
[
i
],
prop
,
...
...
@@ -765,7 +763,7 @@ static HRESULT WINAPI IPropertyStorage_fnWriteMultiple(
if
(
rgpspec
[
i
].
ulKind
==
PRSPEC_LPWSTR
)
{
PROPVARIANT
*
prop
=
PropertyStorage_FindPropertyByName
(
This
,
rgpspec
[
i
].
u
.
lpwstr
);
rgpspec
[
i
].
lpwstr
);
if
(
prop
)
PropVariantCopy
(
prop
,
&
rgpropvar
[
i
]);
...
...
@@ -782,7 +780,7 @@ static HRESULT WINAPI IPropertyStorage_fnWriteMultiple(
PROPID
nextId
=
max
(
propidNameFirst
,
This
->
highestProp
+
1
);
hr
=
PropertyStorage_StoreNameWithId
(
This
,
(
LPCSTR
)
rgpspec
[
i
].
u
.
lpwstr
,
CP_UNICODE
,
nextId
);
(
LPCSTR
)
rgpspec
[
i
].
lpwstr
,
CP_UNICODE
,
nextId
);
if
(
SUCCEEDED
(
hr
))
hr
=
PropertyStorage_StorePropWithId
(
This
,
nextId
,
&
rgpropvar
[
i
],
GetACP
());
...
...
@@ -791,7 +789,7 @@ static HRESULT WINAPI IPropertyStorage_fnWriteMultiple(
}
else
{
switch
(
rgpspec
[
i
].
u
.
propid
)
switch
(
rgpspec
[
i
].
propid
)
{
case
PID_DICTIONARY
:
/* Can't set the dictionary */
...
...
@@ -823,11 +821,11 @@ static HRESULT WINAPI IPropertyStorage_fnWriteMultiple(
/* silently ignore like MSDN says */
break
;
default:
if
(
rgpspec
[
i
].
u
.
propid
>=
PID_MIN_READONLY
)
if
(
rgpspec
[
i
].
propid
>=
PID_MIN_READONLY
)
hr
=
STG_E_INVALIDPARAMETER
;
else
hr
=
PropertyStorage_StorePropWithId
(
This
,
rgpspec
[
i
].
u
.
propid
,
&
rgpropvar
[
i
],
GetACP
());
rgpspec
[
i
].
propid
,
&
rgpropvar
[
i
],
GetACP
());
}
}
}
...
...
@@ -864,14 +862,14 @@ static HRESULT WINAPI IPropertyStorage_fnDeleteMultiple(
{
void
*
propid
;
if
(
dictionary_find
(
This
->
name_to_propid
,
rgpspec
[
i
].
u
.
lpwstr
,
&
propid
))
if
(
dictionary_find
(
This
->
name_to_propid
,
rgpspec
[
i
].
lpwstr
,
&
propid
))
dictionary_remove
(
This
->
propid_to_prop
,
propid
);
}
else
{
if
(
rgpspec
[
i
].
u
.
propid
>=
PID_FIRST_USABLE
&&
rgpspec
[
i
].
u
.
propid
<
PID_MIN_READONLY
)
dictionary_remove
(
This
->
propid_to_prop
,
UlongToPtr
(
rgpspec
[
i
].
u
.
propid
));
if
(
rgpspec
[
i
].
propid
>=
PID_FIRST_USABLE
&&
rgpspec
[
i
].
propid
<
PID_MIN_READONLY
)
dictionary_remove
(
This
->
propid_to_prop
,
UlongToPtr
(
rgpspec
[
i
].
propid
));
else
hr
=
STG_E_INVALIDPARAMETER
;
}
...
...
@@ -1746,20 +1744,20 @@ static HRESULT PropertyStorage_ReadFromStream(PropertyStorage_impl *This)
hr
=
IStream_Stat
(
This
->
stm
,
&
stat
,
STATFLAG_NONAME
);
if
(
FAILED
(
hr
))
goto
end
;
if
(
stat
.
cbSize
.
u
.
HighPart
)
if
(
stat
.
cbSize
.
HighPart
)
{
WARN
(
"stream too big
\n
"
);
/* maximum size varies, but it can't be this big */
hr
=
STG_E_INVALIDHEADER
;
goto
end
;
}
if
(
stat
.
cbSize
.
u
.
LowPart
==
0
)
if
(
stat
.
cbSize
.
LowPart
==
0
)
{
/* empty stream is okay */
hr
=
S_OK
;
goto
end
;
}
else
if
(
stat
.
cbSize
.
u
.
LowPart
<
sizeof
(
PROPERTYSETHEADER
)
+
else
if
(
stat
.
cbSize
.
LowPart
<
sizeof
(
PROPERTYSETHEADER
)
+
sizeof
(
FORMATIDOFFSET
))
{
WARN
(
"stream too small
\n
"
);
...
...
@@ -1794,9 +1792,9 @@ static HRESULT PropertyStorage_ReadFromStream(PropertyStorage_impl *This)
hr
=
PropertyStorage_ReadFmtIdOffsetFromStream
(
This
->
stm
,
&
fmtOffset
);
if
(
FAILED
(
hr
))
goto
end
;
if
(
fmtOffset
.
dwOffset
>
stat
.
cbSize
.
u
.
LowPart
)
if
(
fmtOffset
.
dwOffset
>
stat
.
cbSize
.
LowPart
)
{
WARN
(
"invalid offset %ld (stream length is %ld)
\n
"
,
fmtOffset
.
dwOffset
,
stat
.
cbSize
.
u
.
LowPart
);
WARN
(
"invalid offset %ld (stream length is %ld)
\n
"
,
fmtOffset
.
dwOffset
,
stat
.
cbSize
.
LowPart
);
hr
=
STG_E_INVALIDHEADER
;
goto
end
;
}
...
...
dlls/ole32/stg_stream.c
View file @
61a06d4b
...
...
@@ -29,8 +29,6 @@
#include <string.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
...
...
@@ -272,7 +270,7 @@ static HRESULT WINAPI StgStreamImpl_Seek(
DirEntry
currentEntry
;
HRESULT
hr
;
TRACE
(
"%p, %ld, %ld, %p.
\n
"
,
iface
,
dlibMove
.
u
.
LowPart
,
dwOrigin
,
plibNewPosition
);
TRACE
(
"%p, %ld, %ld, %p.
\n
"
,
iface
,
dlibMove
.
LowPart
,
dwOrigin
,
plibNewPosition
);
/*
* fail if the stream has no parent (as does windows)
...
...
@@ -342,7 +340,7 @@ static HRESULT WINAPI StgStreamImpl_SetSize(
HRESULT
hr
;
TRACE
(
"%p, %ld.
\n
"
,
iface
,
libNewSize
.
u
.
LowPart
);
TRACE
(
"%p, %ld.
\n
"
,
iface
,
libNewSize
.
LowPart
);
if
(
!
This
->
parentStorage
)
{
...
...
@@ -353,9 +351,9 @@ static HRESULT WINAPI StgStreamImpl_SetSize(
/*
* As documented.
*/
if
(
libNewSize
.
u
.
HighPart
!=
0
)
if
(
libNewSize
.
HighPart
!=
0
)
{
WARN
(
"invalid value for libNewSize.
u.HighPart %ld
\n
"
,
libNewSize
.
u
.
HighPart
);
WARN
(
"invalid value for libNewSize.
HighPart %ld
\n
"
,
libNewSize
.
HighPart
);
return
STG_E_INVALIDFUNCTION
;
}
...
...
@@ -397,7 +395,7 @@ static HRESULT WINAPI StgStreamImpl_CopyTo(
ULARGE_INTEGER
totalBytesRead
;
ULARGE_INTEGER
totalBytesWritten
;
TRACE
(
"%p, %p, %ld, %p, %p.
\n
"
,
iface
,
pstm
,
cb
.
u
.
LowPart
,
pcbRead
,
pcbWritten
);
TRACE
(
"%p, %p, %ld, %p, %p.
\n
"
,
iface
,
pstm
,
cb
.
LowPart
,
pcbRead
,
pcbWritten
);
/*
* Sanity check
...
...
@@ -420,7 +418,7 @@ static HRESULT WINAPI StgStreamImpl_CopyTo(
if
(
cb
.
QuadPart
>=
sizeof
(
tmpBuffer
)
)
copySize
=
sizeof
(
tmpBuffer
);
else
copySize
=
cb
.
u
.
LowPart
;
copySize
=
cb
.
LowPart
;
IStream_Read
(
iface
,
tmpBuffer
,
copySize
,
&
bytesRead
);
...
...
@@ -696,8 +694,8 @@ StgStreamImpl* StgStreamImpl_Construct(
/*
* Start the stream at the beginning.
*/
newStream
->
currentPosition
.
u
.
HighPart
=
0
;
newStream
->
currentPosition
.
u
.
LowPart
=
0
;
newStream
->
currentPosition
.
HighPart
=
0
;
newStream
->
currentPosition
.
LowPart
=
0
;
/* add us to the storage's list of active streams */
StorageBaseImpl_AddStream
(
parentStorage
,
newStream
);
...
...
dlls/ole32/storage32.c
View file @
61a06d4b
This diff is collapsed.
Click to expand it.
dlls/ole32/usrmarshal.c
View file @
61a06d4b
This diff is collapsed.
Click to expand it.
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