[OLE32] Sync with Wine Staging 1.7.37. CORE-9246

svn path=/trunk/; revision=66628
This commit is contained in:
Amine Khaldi 2015-03-09 19:57:38 +00:00
parent a5ef97a5f5
commit ec27d5b880
9 changed files with 76 additions and 209 deletions

View file

@ -80,7 +80,7 @@ add_library(ole32 SHARED
set_module_type(ole32 win32dll)
target_link_libraries(ole32 wine uuid ${PSEH_LIB})
add_importlibs(ole32 advapi32 user32 gdi32 rpcrt4 msvcrt kernel32 ntdll)
add_importlibs(ole32 advapi32 user32 gdi32 rpcrt4 msvcrt kernel32 kernel32_vista ntdll)
add_delay_importlibs(ole32 oleaut32)
add_dependencies(ole32 ole32idl)
add_pch(ole32 precomp.h SOURCE)

View file

@ -174,8 +174,6 @@ static inline HRESULT get_ole_clipbrd(ole_clipbrd **clipbrd)
*/
static const WCHAR clipbrd_wndclass[] = {'C','L','I','P','B','R','D','W','N','D','C','L','A','S','S',0};
static const WCHAR wine_marshal_dataobject[] = {'W','i','n','e',' ','m','a','r','s','h','a','l',' ','d','a','t','a','o','b','j','e','c','t',0};
UINT ownerlink_clipboard_format = 0;
UINT filename_clipboard_format = 0;
UINT filenameW_clipboard_format = 0;
@ -190,13 +188,11 @@ UINT ole_private_data_clipboard_format = 0;
static UINT wine_marshal_clipboard_format;
static inline char *dump_fmtetc(FORMATETC *fmt)
static inline const char *dump_fmtetc(FORMATETC *fmt)
{
static char buf[100];
snprintf(buf, sizeof(buf), "cf %04x ptd %p aspect %x lindex %d tymed %x",
fmt->cfFormat, fmt->ptd, fmt->dwAspect, fmt->lindex, fmt->tymed);
return buf;
if (!fmt) return "(null)";
return wine_dbg_sprintf("cf %04x ptd %p aspect %x lindex %d tymed %x",
fmt->cfFormat, fmt->ptd, fmt->dwAspect, fmt->lindex, fmt->tymed);
}
/*---------------------------------------------------------------------*
@ -1113,6 +1109,8 @@ static DWORD get_tymed_from_nonole_cf(UINT cf)
return TYMED_ENHMF;
case CF_METAFILEPICT:
return TYMED_MFPICT;
case CF_BITMAP:
return TYMED_GDI;
default:
FIXME("returning TYMED_NULL for cf %04x\n", cf);
return TYMED_NULL;
@ -1290,6 +1288,27 @@ static HRESULT get_stgmed_for_emf(HENHMETAFILE hemf, STGMEDIUM *med)
return S_OK;
}
/************************************************************************
* get_stgmed_for_bitmap
*
* Returns a stg medium with a bitmap based on the handle
*/
static HRESULT get_stgmed_for_bitmap(HBITMAP hbmp, STGMEDIUM *med)
{
HRESULT hr;
med->pUnkForRelease = NULL;
med->tymed = TYMED_NULL;
hr = dup_bitmap(hbmp, &med->u.hBitmap);
if (FAILED(hr))
return hr;
med->tymed = TYMED_GDI;
return S_OK;
}
static inline BOOL string_off_equal(const DVTARGETDEVICE *t1, WORD off1, const DVTARGETDEVICE *t2, WORD off2)
{
const WCHAR *str1, *str2;
@ -1381,6 +1400,8 @@ static HRESULT WINAPI snapshot_GetData(IDataObject *iface, FORMATETC *fmt,
hr = get_stgmed_for_stream(h, med);
else if(mask & TYMED_ENHMF)
hr = get_stgmed_for_emf((HENHMETAFILE)h, med);
else if(mask & TYMED_GDI)
hr = get_stgmed_for_bitmap((HBITMAP)h, med);
else
{
FIXME("Unhandled tymed - mask %x req tymed %x\n", mask, fmt->tymed);

View file

@ -1628,7 +1628,6 @@ static HRESULT apartment_hostobject_in_hostapt(
return hr;
}
#ifndef __REACTOS__
static BOOL WINAPI register_class( INIT_ONCE *once, void *param, void **context )
{
WNDCLASSW wclass;
@ -1649,33 +1648,24 @@ static BOOL WINAPI register_class( INIT_ONCE *once, void *param, void **context
RegisterClassW(&wclass);
return TRUE;
}
#endif
/* create a window for the apartment or return the current one if one has
* already been created */
HRESULT apartment_createwindowifneeded(struct apartment *apt)
{
#ifndef __REACTOS__
static INIT_ONCE class_init_once = INIT_ONCE_STATIC_INIT;
#endif
if (apt->multi_threaded)
return S_OK;
if (!apt->win)
{
#ifndef __REACTOS__
HWND hwnd;
InitOnceExecuteOnce( &class_init_once, register_class, NULL, NULL );
hwnd = CreateWindowW(wszAptWinClass, NULL, 0, 0, 0, 0, 0,
HWND_MESSAGE, 0, hProxyDll, NULL);
#else
HWND hwnd = CreateWindowW(wszAptWinClass, NULL, 0,
0, 0, 0, 0,
HWND_MESSAGE, 0, hProxyDll, NULL);
#endif
if (!hwnd)
{
ERR("CreateWindow failed with error %d\n", GetLastError());
@ -1702,35 +1692,6 @@ void apartment_joinmta(void)
COM_CurrentInfo()->apt = MTA;
}
#ifdef __REACTOS__
static void COMPOBJ_InitProcess( void )
{
WNDCLASSW wclass;
/* Dispatching to the correct thread in an apartment is done through
* window messages rather than RPC transports. When an interface is
* marshalled into another apartment in the same process, a window of the
* following class is created. The *caller* of CoMarshalInterface (i.e., the
* application) is responsible for pumping the message loop in that thread.
* The WM_USER messages which point to the RPCs are then dispatched to
* apartment_wndproc by the user's code from the apartment in which the
* interface was unmarshalled.
*/
memset(&wclass, 0, sizeof(wclass));
wclass.lpfnWndProc = apartment_wndproc;
wclass.hInstance = hProxyDll;
wclass.lpszClassName = wszAptWinClass;
RegisterClassW(&wclass);
}
static void COMPOBJ_UninitProcess( void )
{
UnregisterClassW(wszAptWinClass, hProxyDll);
}
#endif
static void COM_TlsDestroy(void)
{
struct oletls *info = NtCurrentTeb()->ReservedForOle;
@ -1964,7 +1925,7 @@ HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
* SEE ALSO
* CoInitializeEx
*/
void WINAPI CoUninitialize(void)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
{
struct oletls * info = COM_CurrentInfo();
LONG lCOMRefCnt;
@ -4443,10 +4404,22 @@ HRESULT WINAPI CoWaitForMultipleHandles(DWORD dwFlags, DWORD dwTimeout,
DWORD start_time = GetTickCount();
APARTMENT *apt = COM_CurrentApt();
BOOL message_loop = apt && !apt->multi_threaded;
BOOL check_apc = (dwFlags & COWAIT_ALERTABLE) != 0;
TRACE("(0x%08x, 0x%08x, %d, %p, %p)\n", dwFlags, dwTimeout, cHandles,
pHandles, lpdwindex);
if (!lpdwindex)
return E_INVALIDARG;
*lpdwindex = 0;
if (!pHandles)
return E_INVALIDARG;
if (!cHandles)
return RPC_E_NO_SYNC;
while (TRUE)
{
DWORD now = GetTickCount();
@ -4465,9 +4438,19 @@ HRESULT WINAPI CoWaitForMultipleHandles(DWORD dwFlags, DWORD dwTimeout,
TRACE("waiting for rpc completion or window message\n");
res = MsgWaitForMultipleObjectsEx(cHandles, pHandles,
(dwTimeout == INFINITE) ? INFINITE : start_time + dwTimeout - now,
QS_SENDMESSAGE | QS_ALLPOSTMESSAGE | QS_PAINT, wait_flags);
res = WAIT_TIMEOUT;
if (check_apc)
{
res = WaitForMultipleObjectsEx(cHandles, pHandles,
(dwFlags & COWAIT_WAITALL) != 0, 0, TRUE);
check_apc = FALSE;
}
if (res == WAIT_TIMEOUT)
res = MsgWaitForMultipleObjectsEx(cHandles, pHandles,
(dwTimeout == INFINITE) ? INFINITE : start_time + dwTimeout - now,
QS_SENDMESSAGE | QS_ALLPOSTMESSAGE | QS_PAINT, wait_flags);
if (res == WAIT_OBJECT_0 + cHandles) /* messages available */
{
@ -5047,19 +5030,12 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID reserved)
switch(fdwReason) {
case DLL_PROCESS_ATTACH:
hProxyDll = hinstDLL;
#ifdef __REACTOS__
COMPOBJ_InitProcess();
#endif
break;
case DLL_PROCESS_DETACH:
if (reserved) break;
release_std_git();
#ifdef __REACTOS__
COMPOBJ_UninitProcess();
#else
UnregisterClassW( wszAptWinClass, hProxyDll );
#endif
RPC_UnregisterAllChannelHooks();
COMPOBJ_DllList_Free();
DeleteCriticalSection(&csRegisteredClassList);

View file

@ -205,7 +205,7 @@ HRESULT WINAPI OleInitialize(LPVOID reserved)
/******************************************************************************
* OleUninitialize [OLE32.@]
*/
void WINAPI OleUninitialize(void)
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
{
TRACE("()\n");
@ -2381,11 +2381,12 @@ static void OLEDD_TrackStateChange(TrackerWindowInfo* trackerInfo)
*/
case DRAGDROP_S_DROP:
if (*trackerInfo->pdwEffect != DROPEFFECT_NONE)
trackerInfo->returnValue = IDropTarget_Drop(trackerInfo->curDragTarget,
trackerInfo->dataObject,
trackerInfo->dwKeyState,
trackerInfo->curMousePos,
trackerInfo->pdwEffect);
{
hr = IDropTarget_Drop(trackerInfo->curDragTarget, trackerInfo->dataObject,
trackerInfo->dwKeyState, trackerInfo->curMousePos, trackerInfo->pdwEffect);
if (FAILED(hr))
trackerInfo->returnValue = hr;
}
else
IDropTarget_DragLeave(trackerInfo->curDragTarget);
break;

View file

@ -1,7 +1,7 @@
diff -prudN e:\Wine\dlls\ole32/compobj.c e:\reactos\dll\win32\ole32/compobj.c
--- e:\Wine\dlls\ole32/compobj.c 2014-04-04 14:12:42.091208400 +0100
+++ e:\reactos\dll\win32\ole32/compobj.c 2014-04-24 12:30:07.466625200 +0100
@@ -331,8 +303,12 @@ static NTSTATUS create_key( HKEY *retkey
diff -prudN e:\wine\dlls\ole32/compobj.c dll\win32\ole32/compobj.c
--- e:\wine\dlls\ole32/compobj.c 2015-02-21 17:13:09.561542200 +0100
+++ dll\win32\ole32/compobj.c 2015-02-28 13:26:29.259662000 +0100
@@ -331,8 +304,12 @@ static NTSTATUS create_key( HKEY *retkey
return status;
}
@ -14,135 +14,9 @@ diff -prudN e:\Wine\dlls\ole32/compobj.c e:\reactos\dll\win32\ole32/compobj.c
static HKEY classes_root_hkey;
@@ -1635,6 +1611,7 @@ static HRESULT apartment_hostobject_in_h
return hr;
}
+#ifndef __REACTOS__
static BOOL WINAPI register_class( INIT_ONCE *once, void *param, void **context )
{
WNDCLASSW wclass;
@@ -1655,24 +1632,20 @@ static BOOL WINAPI register_class( INIT_
RegisterClassW(&wclass);
return TRUE;
}
+#endif
/* create a window for the apartment or return the current one if one has
* already been created */
HRESULT apartment_createwindowifneeded(struct apartment *apt)
{
- static INIT_ONCE class_init_once = INIT_ONCE_STATIC_INIT;
-
if (apt->multi_threaded)
return S_OK;
if (!apt->win)
{
- HWND hwnd;
-
- InitOnceExecuteOnce( &class_init_once, register_class, NULL, NULL );
-
- hwnd = CreateWindowW(wszAptWinClass, NULL, 0, 0, 0, 0, 0,
- HWND_MESSAGE, 0, hProxyDll, NULL);
+ HWND hwnd = CreateWindowW(wszAptWinClass, NULL, 0,
+ 0, 0, 0, 0,
+ HWND_MESSAGE, 0, hProxyDll, NULL);
if (!hwnd)
{
ERR("CreateWindow failed with error %d\n", GetLastError());
@@ -1699,6 +1672,35 @@ void apartment_joinmta(void)
COM_CurrentInfo()->apt = MTA;
}
+#ifdef __REACTOS__
+
+static void COMPOBJ_InitProcess( void )
+{
+ WNDCLASSW wclass;
+
+ /* Dispatching to the correct thread in an apartment is done through
+ * window messages rather than RPC transports. When an interface is
+ * marshalled into another apartment in the same process, a window of the
+ * following class is created. The *caller* of CoMarshalInterface (i.e., the
+ * application) is responsible for pumping the message loop in that thread.
+ * The WM_USER messages which point to the RPCs are then dispatched to
+ * apartment_wndproc by the user's code from the apartment in which the
+ * interface was unmarshalled.
+ */
+ memset(&wclass, 0, sizeof(wclass));
+ wclass.lpfnWndProc = apartment_wndproc;
+ wclass.hInstance = hProxyDll;
+ wclass.lpszClassName = wszAptWinClass;
+ RegisterClassW(&wclass);
+}
+
+static void COMPOBJ_UninitProcess( void )
+{
+ UnregisterClassW(wszAptWinClass, hProxyDll);
+}
+
+#endif
+
static void COM_TlsDestroy(void)
{
struct oletls *info = NtCurrentTeb()->ReservedForOle;
@@ -4984,12 +4986,13 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,
switch(fdwReason) {
case DLL_PROCESS_ATTACH:
hProxyDll = hinstDLL;
+ COMPOBJ_InitProcess();
break;
case DLL_PROCESS_DETACH:
if (reserved) break;
release_std_git();
- UnregisterClassW( wszAptWinClass, hProxyDll );
+ COMPOBJ_UninitProcess();
RPC_UnregisterAllChannelHooks();
COMPOBJ_DllList_Free();
DeleteCriticalSection(&csRegisteredClassList);
diff -prudN e:\Wine\dlls\ole32/stg_prop.c e:\reactos\dll\win32\ole32/stg_prop.c
--- e:\Wine\dlls\ole32/stg_prop.c 2014-04-04 14:12:42.103216400 +0100
+++ e:\reactos\dll\win32\ole32/stg_prop.c 2014-04-08 19:21:32.097336500 +0100
@@ -36,32 +36,15 @@
* PropertyStorage_ReadFromStream
*/
-#include "config.h"
-#include "wine/port.h"
-
-#include <assert.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define COBJMACROS
-#define NONAMELESSUNION
-#define NONAMELESSSTRUCT
-
-#include "windef.h"
-#include "winbase.h"
-#include "winnls.h"
-#include "winuser.h"
-#include "wine/unicode.h"
-#include "wine/debug.h"
-#include "dictionary.h"
+#include "precomp.h"
#include "storage32.h"
-#include "enumx.h"
-#include "oleauto.h"
WINE_DEFAULT_DEBUG_CHANNEL(storage);
+#ifdef _MSC_VER
+#define __ASM_STDCALL_FUNC(name,args,code)
+#endif
+
static inline StorageImpl *impl_from_IPropertySetStorage( IPropertySetStorage *iface )
{
return CONTAINING_RECORD(iface, StorageImpl, base.IPropertySetStorage_iface);
diff -prudN e:\wine\dlls\ole32/stg_prop.c dll\win32\ole32/stg_prop.c
--- e:\wine\dlls\ole32/stg_prop.c 2015-02-21 17:13:09.569542200 +0100
+++ dll\win32\ole32/stg_prop.c 2014-04-08 19:21:32.097336500 +0100
@@ -1035,12 +1018,12 @@ static HRESULT PropertyStorage_ReadDicti
}
@ -184,4 +58,3 @@ diff -prudN e:\Wine\dlls\ole32/stg_prop.c e:\reactos\dll\win32\ole32/stg_prop.c
+ void* (__cdecl *fn)(void*,ULONG) = **(void***)this;
return fn(this, cbSize);
}

View file

@ -2950,7 +2950,7 @@ static HRESULT StorageImpl_GrabLocks(StorageImpl *This, DWORD openFlags)
hr = S_OK;
/* First check for any conflicting locks. */
if (SUCCEEDED(hr) && (openFlags & STGM_PRIORITY) == STGM_PRIORITY)
if ((openFlags & STGM_PRIORITY) == STGM_PRIORITY)
hr = StorageImpl_CheckLockRange(This, RANGELOCK_COMMIT, RANGELOCK_COMMIT, STG_E_LOCKVIOLATION);
if (SUCCEEDED(hr) && (STGM_ACCESS_MODE(openFlags) != STGM_WRITE))
@ -6976,10 +6976,8 @@ static ULONG BlockChainStream_GetHeadOfChain(BlockChainStream* This)
This->ownerDirEntry,
&chainEntry);
if (SUCCEEDED(hr))
{
if (SUCCEEDED(hr) && chainEntry.startingBlock < BLOCK_FIRST_SPECIAL)
return chainEntry.startingBlock;
}
}
return BLOCK_END_OF_CHAIN;
@ -7501,11 +7499,8 @@ static ULONG SmallBlockChainStream_GetHeadOfChain(
This->ownerDirEntry,
&chainEntry);
if (SUCCEEDED(hr))
{
if (SUCCEEDED(hr) && chainEntry.startingBlock < BLOCK_FIRST_SPECIAL)
return chainEntry.startingBlock;
}
}
return BLOCK_END_OF_CHAIN;

View file

@ -69,6 +69,7 @@ static const WORD MAX_BIG_BLOCK_SIZE_BITS = 0x000c;
static const WORD DEF_SMALL_BLOCK_SIZE_BITS = 0x0006;
static const WORD DEF_BIG_BLOCK_SIZE = 0x0200;
static const WORD DEF_SMALL_BLOCK_SIZE = 0x0040;
static const ULONG BLOCK_FIRST_SPECIAL = 0xFFFFFFFB;
static const ULONG BLOCK_EXTBBDEPOT = 0xFFFFFFFC;
static const ULONG BLOCK_SPECIAL = 0xFFFFFFFD;
static const ULONG BLOCK_END_OF_CHAIN = 0xFFFFFFFE;

View file

@ -1622,7 +1622,7 @@ unsigned char * WINAPI WdtpInterfacePointer_UserMarshal(ULONG *pFlags, ULONG Rea
if(CoMarshalInterface(stm, riid, punk, LOWORD(RealFlags), NULL, MSHLFLAGS_NORMAL) != S_OK)
{
IStream_Release(stm);
return NULL;
return pBuffer;
}
ALIGN_POINTER(pBuffer, 3);

View file

@ -151,7 +151,7 @@ reactos/dll/win32/ntprint # Synced to Wine-1.7.27
reactos/dll/win32/objsel # Synced to Wine-1.7.27
reactos/dll/win32/odbc32 # Synced to Wine-1.7.27. Depends on port of Linux ODBC.
reactos/dll/win32/odbccp32 # Synced to Wine-1.7.27
reactos/dll/win32/ole32 # Synced to Wine-1.7.27
reactos/dll/win32/ole32 # Synced to WineStaging-1.7.37
reactos/dll/win32/oleacc # Synced to Wine-1.7.27
reactos/dll/win32/oleaut32 # Synced to Wine-1.7.27
reactos/dll/win32/olecli32 # Synced to Wine-1.7.27