sync to wine 1.2 RC2

svn path=/trunk/; revision=47405
This commit is contained in:
Christoph von Wittich 2010-05-29 11:34:57 +00:00
parent 1d5afb8039
commit c48e118c70
14 changed files with 1258 additions and 652 deletions

View file

@ -1266,10 +1266,10 @@ static HRESULT WINAPI snapshot_GetDataHere(IDataObject *iface, FORMATETC *fmt,
ole_priv_data_entry *entry; ole_priv_data_entry *entry;
TYMED supported; TYMED supported;
TRACE("(%p, %p {%s}, %p (tymed %x)\n", iface, fmt, dump_fmtetc(fmt), med, med->tymed);
if ( !fmt || !med ) return E_INVALIDARG; if ( !fmt || !med ) return E_INVALIDARG;
TRACE("(%p, %p {%s}, %p (tymed %x)\n", iface, fmt, dump_fmtetc(fmt), med, med->tymed);
if ( !OpenClipboard(NULL)) return CLIPBRD_E_CANT_OPEN; if ( !OpenClipboard(NULL)) return CLIPBRD_E_CANT_OPEN;
if(!This->data) if(!This->data)

View file

@ -232,18 +232,20 @@ static HRESULT COMCAT_IsClassOfCategories(
LPCWSTR string; LPCWSTR string;
/* Check that every given category is implemented by class. */ /* Check that every given category is implemented by class. */
res = RegOpenKeyExW(key, impl_keyname, 0, KEY_READ, &subkey); if (*categories->impl_strings) {
if (res != ERROR_SUCCESS) return S_FALSE; res = RegOpenKeyExW(key, impl_keyname, 0, KEY_READ, &subkey);
for (string = categories->impl_strings; *string; string += 39) { if (res != ERROR_SUCCESS) return S_FALSE;
HKEY catkey; for (string = categories->impl_strings; *string; string += 39) {
res = RegOpenKeyExW(subkey, string, 0, 0, &catkey); HKEY catkey;
if (res != ERROR_SUCCESS) { res = RegOpenKeyExW(subkey, string, 0, 0, &catkey);
RegCloseKey(subkey); if (res != ERROR_SUCCESS) {
return S_FALSE; RegCloseKey(subkey);
return S_FALSE;
}
RegCloseKey(catkey);
} }
RegCloseKey(catkey); RegCloseKey(subkey);
} }
RegCloseKey(subkey);
/* Check that all categories required by class are given. */ /* Check that all categories required by class are given. */
res = RegOpenKeyExW(key, req_keyname, 0, KEY_READ, &subkey); res = RegOpenKeyExW(key, req_keyname, 0, KEY_READ, &subkey);

View file

@ -4156,7 +4156,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
OLEDD_UnInitialize();
COMPOBJ_UninitProcess(); COMPOBJ_UninitProcess();
RPC_UnregisterAllChannelHooks(); RPC_UnregisterAllChannelHooks();
COMPOBJ_DllList_Free(); COMPOBJ_DllList_Free();

View file

@ -445,7 +445,6 @@ static HRESULT WINAPI
CompositeMonikerImpl_Reduce(IMoniker* iface, IBindCtx* pbc, DWORD dwReduceHowFar, CompositeMonikerImpl_Reduce(IMoniker* iface, IBindCtx* pbc, DWORD dwReduceHowFar,
IMoniker** ppmkToLeft, IMoniker** ppmkReduced) IMoniker** ppmkToLeft, IMoniker** ppmkReduced)
{ {
HRESULT res;
IMoniker *tempMk,*antiMk,*mostRigthMk,*leftReducedComposedMk,*mostRigthReducedMk; IMoniker *tempMk,*antiMk,*mostRigthMk,*leftReducedComposedMk,*mostRigthReducedMk;
IEnumMoniker *enumMoniker; IEnumMoniker *enumMoniker;
@ -462,8 +461,8 @@ CompositeMonikerImpl_Reduce(IMoniker* iface, IBindCtx* pbc, DWORD dwReduceHowFar
IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL);
IEnumMoniker_Release(enumMoniker); IEnumMoniker_Release(enumMoniker);
res=CreateAntiMoniker(&antiMk); CreateAntiMoniker(&antiMk);
res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
IMoniker_Release(antiMk); IMoniker_Release(antiMk);
return IMoniker_Reduce(mostRigthMk,pbc,dwReduceHowFar,&tempMk, ppmkReduced); return IMoniker_Reduce(mostRigthMk,pbc,dwReduceHowFar,&tempMk, ppmkReduced);
@ -479,8 +478,8 @@ CompositeMonikerImpl_Reduce(IMoniker* iface, IBindCtx* pbc, DWORD dwReduceHowFar
IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL);
IEnumMoniker_Release(enumMoniker); IEnumMoniker_Release(enumMoniker);
res=CreateAntiMoniker(&antiMk); CreateAntiMoniker(&antiMk);
res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
IMoniker_Release(antiMk); IMoniker_Release(antiMk);
/* If any of the components reduces itself, the method returns S_OK and passes back a composite */ /* If any of the components reduces itself, the method returns S_OK and passes back a composite */

View file

@ -365,7 +365,7 @@ static HRESULT WINAPI DefaultHandler_SetClientSite(
if (This->clientSite) if (This->clientSite)
IOleClientSite_AddRef(This->clientSite); IOleClientSite_AddRef(This->clientSite);
return S_OK; return hr;
} }
/************************************************************************ /************************************************************************

View file

@ -371,12 +371,6 @@ static HRESULT WINAPI HGLOBALStreamImpl_Seek(
TRACE("(%p, %x%08x, %d, %p)\n", iface, dlibMove.u.HighPart, TRACE("(%p, %x%08x, %d, %p)\n", iface, dlibMove.u.HighPart,
dlibMove.u.LowPart, dwOrigin, plibNewPosition); dlibMove.u.LowPart, dwOrigin, plibNewPosition);
if (dlibMove.u.LowPart >= 0x80000000)
{
hr = STG_E_SEEKERROR;
goto end;
}
/* /*
* The file pointer is moved depending on the given "function" * The file pointer is moved depending on the given "function"
* parameter. * parameter.
@ -405,10 +399,19 @@ static HRESULT WINAPI HGLOBALStreamImpl_Seek(
newPosition.u.HighPart = 0; newPosition.u.HighPart = 0;
newPosition.u.LowPart += dlibMove.QuadPart; newPosition.u.LowPart += dlibMove.QuadPart;
end: if (dlibMove.u.LowPart >= 0x80000000 &&
if (plibNewPosition) *plibNewPosition = newPosition; newPosition.u.LowPart >= dlibMove.u.LowPart)
{
/* We tried to seek backwards and went past the start. */
hr = STG_E_SEEKERROR;
goto end;
}
This->currentPosition = newPosition; This->currentPosition = newPosition;
end:
if (plibNewPosition) *plibNewPosition = This->currentPosition;
return hr; return hr;
} }

View file

@ -501,7 +501,7 @@ HRESULT WINAPI CoRevokeMallocSpy(void)
} }
LeaveCriticalSection(&IMalloc32_SpyCS); LeaveCriticalSection(&IMalloc32_SpyCS);
return S_OK; return hres;
} }
/****************************************************************************** /******************************************************************************

View file

@ -1214,16 +1214,13 @@ StdMarshalImpl_MarshalInterface(
RPC_StartRemoting(apt); RPC_StartRemoting(apt);
hres = marshal_object(apt, &stdobjref, riid, pv, mshlflags); hres = marshal_object(apt, &stdobjref, riid, pv, mshlflags);
if (hres) if (hres != S_OK)
{ {
ERR("Failed to create ifstub, hres=0x%x\n", hres); ERR("Failed to create ifstub, hres=0x%x\n", hres);
return hres; return hres;
} }
hres = IStream_Write(pStm, &stdobjref, sizeof(stdobjref), &res); return IStream_Write(pStm, &stdobjref, sizeof(stdobjref), &res);
if (hres) return hres;
return S_OK;
} }
/* helper for StdMarshalImpl_UnmarshalInterface - does the unmarshaling with /* helper for StdMarshalImpl_UnmarshalInterface - does the unmarshaling with
@ -1321,10 +1318,10 @@ StdMarshalImpl_UnmarshalInterface(LPMARSHAL iface, IStream *pStm, REFIID riid, v
/* read STDOBJREF from wire */ /* read STDOBJREF from wire */
hres = IStream_Read(pStm, &stdobjref, sizeof(stdobjref), &res); hres = IStream_Read(pStm, &stdobjref, sizeof(stdobjref), &res);
if (hres) return STG_E_READFAULT; if (hres != S_OK) return STG_E_READFAULT;
hres = apartment_getoxid(apt, &oxid); hres = apartment_getoxid(apt, &oxid);
if (hres) return hres; if (hres != S_OK) return hres;
/* check if we're marshalling back to ourselves */ /* check if we're marshalling back to ourselves */
if ((oxid == stdobjref.oxid) && (stubmgr = get_stub_manager(apt, stdobjref.oid))) if ((oxid == stdobjref.oxid) && (stubmgr = get_stub_manager(apt, stdobjref.oid)))
@ -1374,7 +1371,7 @@ StdMarshalImpl_UnmarshalInterface(LPMARSHAL iface, IStream *pStm, REFIID riid, v
if (stubmgr) stub_manager_int_release(stubmgr); if (stubmgr) stub_manager_int_release(stubmgr);
if (stub_apt) apartment_release(stub_apt); if (stub_apt) apartment_release(stub_apt);
if (hres) WARN("Failed with error 0x%08x\n", hres); if (hres != S_OK) WARN("Failed with error 0x%08x\n", hres);
else TRACE("Successfully created proxy %p\n", *ppv); else TRACE("Successfully created proxy %p\n", *ppv);
return hres; return hres;
@ -1392,7 +1389,7 @@ StdMarshalImpl_ReleaseMarshalData(LPMARSHAL iface, IStream *pStm)
TRACE("iface=%p, pStm=%p\n", iface, pStm); TRACE("iface=%p, pStm=%p\n", iface, pStm);
hres = IStream_Read(pStm, &stdobjref, sizeof(stdobjref), &res); hres = IStream_Read(pStm, &stdobjref, sizeof(stdobjref), &res);
if (hres) return STG_E_READFAULT; if (hres != S_OK) return STG_E_READFAULT;
TRACE("oxid = %s, oid = %s, ipid = %s\n", TRACE("oxid = %s, oid = %s, ipid = %s\n",
wine_dbgstr_longlong(stdobjref.oxid), wine_dbgstr_longlong(stdobjref.oxid),
@ -1516,7 +1513,7 @@ static HRESULT get_marshaler(REFIID riid, IUnknown *pUnk, DWORD dwDestContext,
if (!pUnk) if (!pUnk)
return E_POINTER; return E_POINTER;
hr = IUnknown_QueryInterface(pUnk, &IID_IMarshal, (LPVOID*)pMarshal); hr = IUnknown_QueryInterface(pUnk, &IID_IMarshal, (LPVOID*)pMarshal);
if (hr) if (hr != S_OK)
hr = CoGetStandardMarshal(riid, pUnk, dwDestContext, pvDestContext, hr = CoGetStandardMarshal(riid, pUnk, dwDestContext, pvDestContext,
mshlFlags, pMarshal); mshlFlags, pMarshal);
return hr; return hr;
@ -1537,7 +1534,7 @@ static HRESULT get_unmarshaler_from_stream(IStream *stream, IMarshal **marshal,
/* read common OBJREF header */ /* read common OBJREF header */
hr = IStream_Read(stream, &objref, FIELD_OFFSET(OBJREF, u_objref), &res); hr = IStream_Read(stream, &objref, FIELD_OFFSET(OBJREF, u_objref), &res);
if (hr || (res != FIELD_OFFSET(OBJREF, u_objref))) if (hr != S_OK || (res != FIELD_OFFSET(OBJREF, u_objref)))
{ {
ERR("Failed to read common OBJREF header, 0x%08x\n", hr); ERR("Failed to read common OBJREF header, 0x%08x\n", hr);
return STG_E_READFAULT; return STG_E_READFAULT;
@ -1566,7 +1563,7 @@ static HRESULT get_unmarshaler_from_stream(IStream *stream, IMarshal **marshal,
/* read constant sized OR_CUSTOM data from stream */ /* read constant sized OR_CUSTOM data from stream */
hr = IStream_Read(stream, &objref.u_objref.u_custom, hr = IStream_Read(stream, &objref.u_objref.u_custom,
custom_header_size, &res); custom_header_size, &res);
if (hr || (res != custom_header_size)) if (hr != S_OK || (res != custom_header_size))
{ {
ERR("Failed to read OR_CUSTOM header, 0x%08x\n", hr); ERR("Failed to read OR_CUSTOM header, 0x%08x\n", hr);
return STG_E_READFAULT; return STG_E_READFAULT;
@ -1583,7 +1580,7 @@ static HRESULT get_unmarshaler_from_stream(IStream *stream, IMarshal **marshal,
return RPC_E_INVALID_OBJREF; return RPC_E_INVALID_OBJREF;
} }
if (hr) if (hr != S_OK)
ERR("Failed to create marshal, 0x%08x\n", hr); ERR("Failed to create marshal, 0x%08x\n", hr);
return hr; return hr;
@ -1618,12 +1615,12 @@ HRESULT WINAPI CoGetMarshalSizeMax(ULONG *pulSize, REFIID riid, IUnknown *pUnk,
CLSID marshaler_clsid; CLSID marshaler_clsid;
hr = get_marshaler(riid, pUnk, dwDestContext, pvDestContext, mshlFlags, &pMarshal); hr = get_marshaler(riid, pUnk, dwDestContext, pvDestContext, mshlFlags, &pMarshal);
if (hr) if (hr != S_OK)
return hr; return hr;
hr = IMarshal_GetUnmarshalClass(pMarshal, riid, pUnk, dwDestContext, hr = IMarshal_GetUnmarshalClass(pMarshal, riid, pUnk, dwDestContext,
pvDestContext, mshlFlags, &marshaler_clsid); pvDestContext, mshlFlags, &marshaler_clsid);
if (hr) if (hr != S_OK)
{ {
ERR("IMarshal::GetUnmarshalClass failed, 0x%08x\n", hr); ERR("IMarshal::GetUnmarshalClass failed, 0x%08x\n", hr);
IMarshal_Release(pMarshal); IMarshal_Release(pMarshal);
@ -1711,7 +1708,7 @@ HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk,
/* get the marshaler for the specified interface */ /* get the marshaler for the specified interface */
hr = get_marshaler(riid, pUnk, dwDestContext, pvDestContext, mshlFlags, &pMarshal); hr = get_marshaler(riid, pUnk, dwDestContext, pvDestContext, mshlFlags, &pMarshal);
if (hr) if (hr != S_OK)
{ {
ERR("Failed to get marshaller, 0x%08x\n", hr); ERR("Failed to get marshaller, 0x%08x\n", hr);
return hr; return hr;
@ -1719,7 +1716,7 @@ HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk,
hr = IMarshal_GetUnmarshalClass(pMarshal, riid, pUnk, dwDestContext, hr = IMarshal_GetUnmarshalClass(pMarshal, riid, pUnk, dwDestContext,
pvDestContext, mshlFlags, &marshaler_clsid); pvDestContext, mshlFlags, &marshaler_clsid);
if (hr) if (hr != S_OK)
{ {
ERR("IMarshal::GetUnmarshalClass failed, 0x%08x\n", hr); ERR("IMarshal::GetUnmarshalClass failed, 0x%08x\n", hr);
goto cleanup; goto cleanup;
@ -1733,7 +1730,7 @@ HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk,
/* write the common OBJREF header to the stream */ /* write the common OBJREF header to the stream */
hr = IStream_Write(pStream, &objref, FIELD_OFFSET(OBJREF, u_objref), NULL); hr = IStream_Write(pStream, &objref, FIELD_OFFSET(OBJREF, u_objref), NULL);
if (hr) if (hr != S_OK)
{ {
ERR("Failed to write OBJREF header to stream, 0x%08x\n", hr); ERR("Failed to write OBJREF header to stream, 0x%08x\n", hr);
goto cleanup; goto cleanup;
@ -1749,7 +1746,7 @@ HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk,
hr = IMarshal_GetMarshalSizeMax(pMarshal, riid, pUnk, dwDestContext, hr = IMarshal_GetMarshalSizeMax(pMarshal, riid, pUnk, dwDestContext,
pvDestContext, mshlFlags, pvDestContext, mshlFlags,
&objref.u_objref.u_custom.size); &objref.u_objref.u_custom.size);
if (hr) if (hr != S_OK)
{ {
ERR("Failed to get max size of marshal data, error 0x%08x\n", hr); ERR("Failed to get max size of marshal data, error 0x%08x\n", hr);
goto cleanup; goto cleanup;
@ -1757,7 +1754,7 @@ HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk,
/* write constant sized common header and OR_CUSTOM data into stream */ /* write constant sized common header and OR_CUSTOM data into stream */
hr = IStream_Write(pStream, &objref, hr = IStream_Write(pStream, &objref,
FIELD_OFFSET(OBJREF, u_objref.u_custom.pData), NULL); FIELD_OFFSET(OBJREF, u_objref.u_custom.pData), NULL);
if (hr) if (hr != S_OK)
{ {
ERR("Failed to write OR_CUSTOM header to stream with 0x%08x\n", hr); ERR("Failed to write OR_CUSTOM header to stream with 0x%08x\n", hr);
goto cleanup; goto cleanup;
@ -1769,7 +1766,7 @@ HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk,
hr = IMarshal_MarshalInterface(pMarshal, pStream, riid, pUnk, dwDestContext, hr = IMarshal_MarshalInterface(pMarshal, pStream, riid, pUnk, dwDestContext,
pvDestContext, mshlFlags); pvDestContext, mshlFlags);
if (hr) if (hr != S_OK)
{ {
ERR("Failed to marshal the interface %s, %x\n", debugstr_guid(riid), hr); ERR("Failed to marshal the interface %s, %x\n", debugstr_guid(riid), hr);
goto cleanup; goto cleanup;
@ -1821,7 +1818,7 @@ HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
/* call the helper object to do the actual unmarshaling */ /* call the helper object to do the actual unmarshaling */
hr = IMarshal_UnmarshalInterface(pMarshal, pStream, &iid, (LPVOID*)&object); hr = IMarshal_UnmarshalInterface(pMarshal, pStream, &iid, (LPVOID*)&object);
if (hr) if (hr != S_OK)
ERR("IMarshal::UnmarshalInterface failed, 0x%08x\n", hr); ERR("IMarshal::UnmarshalInterface failed, 0x%08x\n", hr);
if (hr == S_OK) if (hr == S_OK)
@ -1831,7 +1828,7 @@ HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
{ {
TRACE("requested interface != marshalled interface, additional QI needed\n"); TRACE("requested interface != marshalled interface, additional QI needed\n");
hr = IUnknown_QueryInterface(object, riid, ppv); hr = IUnknown_QueryInterface(object, riid, ppv);
if (hr) if (hr != S_OK)
ERR("Couldn't query for interface %s, hr = 0x%08x\n", ERR("Couldn't query for interface %s, hr = 0x%08x\n",
debugstr_guid(riid), hr); debugstr_guid(riid), hr);
IUnknown_Release(object); IUnknown_Release(object);
@ -1885,7 +1882,7 @@ HRESULT WINAPI CoReleaseMarshalData(IStream *pStream)
/* call the helper object to do the releasing of marshal data */ /* call the helper object to do the releasing of marshal data */
hr = IMarshal_ReleaseMarshalData(pMarshal, pStream); hr = IMarshal_ReleaseMarshalData(pMarshal, pStream);
if (hr) if (hr != S_OK)
ERR("IMarshal::ReleaseMarshalData failed with error 0x%08x\n", hr); ERR("IMarshal::ReleaseMarshalData failed with error 0x%08x\n", hr);
IMarshal_Release(pMarshal); IMarshal_Release(pMarshal);

View file

@ -1109,7 +1109,13 @@ HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szDisplayName,
TRACE("(%p, %s, %p, %p)\n", pbc, debugstr_w(szDisplayName), pchEaten, ppmk); TRACE("(%p, %s, %p, %p)\n", pbc, debugstr_w(szDisplayName), pchEaten, ppmk);
if (!(IsValidInterface((LPUNKNOWN) pbc))) if (!pbc || !IsValidInterface((LPUNKNOWN) pbc))
return E_INVALIDARG;
if (!szDisplayName || !*szDisplayName)
return E_INVALIDARG;
if (!pchEaten || !ppmk)
return E_INVALIDARG; return E_INVALIDARG;
*pchEaten = 0; *pchEaten = 0;

View file

@ -57,13 +57,6 @@ WINE_DECLARE_DEBUG_CHANNEL(accel);
* These are static/global variables and internal data structures that the * These are static/global variables and internal data structures that the
* OLE module uses to maintain it's state. * OLE module uses to maintain it's state.
*/ */
typedef struct tagDropTargetNode
{
HWND hwndTarget;
IDropTarget* dropTarget;
struct list entry;
} DropTargetNode;
typedef struct tagTrackerWindowInfo typedef struct tagTrackerWindowInfo
{ {
IDataObject* dataObject; IDataObject* dataObject;
@ -110,12 +103,25 @@ static LONG OLE_moduleLockCount = 0;
/* /*
* Name of our registered window class. * Name of our registered window class.
*/ */
static const char OLEDD_DRAGTRACKERCLASS[] = "WineDragDropTracker32"; static const WCHAR OLEDD_DRAGTRACKERCLASS[] =
{'W','i','n','e','D','r','a','g','D','r','o','p','T','r','a','c','k','e','r','3','2',0};
/* /*
* This is the head of the Drop target container. * Name of menu descriptor property.
*/ */
static struct list targetListHead = LIST_INIT(targetListHead); static const WCHAR prop_olemenuW[] =
{'P','R','O','P','_','O','L','E','M','e','n','u','D','e','s','c','r','i','p','t','o','r',0};
/* property to store IDropTarget pointer */
static const WCHAR prop_oledroptarget[] =
{'O','l','e','D','r','o','p','T','a','r','g','e','t','I','n','t','e','r','f','a','c','e',0};
static const WCHAR clsidfmtW[] =
{'C','L','S','I','D','\\','{','%','0','8','x','-','%','0','4','x','-','%','0','4','x','-',
'%','0','2','x','%','0','2','x','-','%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x',
'%','0','2','x','%','0','2','x','}','\\',0};
static const WCHAR emptyW[] = { 0 };
/****************************************************************************** /******************************************************************************
* These are the prototypes of miscellaneous utility methods * These are the prototypes of miscellaneous utility methods
@ -144,22 +150,12 @@ extern void OLEClipbrd_Initialize(void);
/****************************************************************************** /******************************************************************************
* These are the prototypes of the utility methods used for OLE Drag n Drop * These are the prototypes of the utility methods used for OLE Drag n Drop
*/ */
static void OLEDD_Initialize(void); static void OLEDD_Initialize(void);
static DropTargetNode* OLEDD_FindDropTarget( static LRESULT WINAPI OLEDD_DragTrackerWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
HWND hwndOfTarget); static void OLEDD_TrackMouseMove(TrackerWindowInfo* trackerInfo);
static void OLEDD_FreeDropTarget(DropTargetNode*, BOOL); static void OLEDD_TrackStateChange(TrackerWindowInfo* trackerInfo);
static LRESULT WINAPI OLEDD_DragTrackerWindowProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam);
static void OLEDD_TrackMouseMove(
TrackerWindowInfo* trackerInfo);
static void OLEDD_TrackStateChange(
TrackerWindowInfo* trackerInfo);
static DWORD OLEDD_GetButtonState(void); static DWORD OLEDD_GetButtonState(void);
/****************************************************************************** /******************************************************************************
* OleBuildVersion [OLE32.@] * OleBuildVersion [OLE32.@]
*/ */
@ -270,14 +266,22 @@ HRESULT WINAPI OleInitializeWOW(DWORD x, DWORD y) {
return 0; return 0;
} }
/***
* OLEDD_FindDropTarget()
*
* Returns IDropTarget pointer registered for this window.
*/
static inline IDropTarget* OLEDD_FindDropTarget(HWND hwnd)
{
return GetPropW(hwnd, prop_oledroptarget);
}
/*********************************************************************** /***********************************************************************
* RegisterDragDrop (OLE32.@) * RegisterDragDrop (OLE32.@)
*/ */
HRESULT WINAPI RegisterDragDrop( HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
HWND hwnd,
LPDROPTARGET pDropTarget)
{ {
DropTargetNode* dropTargetInfo; DWORD pid = 0;
TRACE("(%p,%p)\n", hwnd, pDropTarget); TRACE("(%p,%p)\n", hwnd, pDropTarget);
@ -296,32 +300,20 @@ HRESULT WINAPI RegisterDragDrop(
return DRAGDROP_E_INVALIDHWND; return DRAGDROP_E_INVALIDHWND;
} }
/* /* block register for other processes windows */
* First, check if the window is already registered. GetWindowThreadProcessId(hwnd, &pid);
*/ if (pid != GetCurrentProcessId())
dropTargetInfo = OLEDD_FindDropTarget(hwnd); {
FIXME("register for another process windows is disabled\n");
return DRAGDROP_E_INVALIDHWND;
}
if (dropTargetInfo!=NULL) /* check if the window is already registered */
if (OLEDD_FindDropTarget(hwnd))
return DRAGDROP_E_ALREADYREGISTERED; return DRAGDROP_E_ALREADYREGISTERED;
/*
* If it's not there, we can add it. We first create a node for it.
*/
dropTargetInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(DropTargetNode));
if (dropTargetInfo==NULL)
return E_OUTOFMEMORY;
dropTargetInfo->hwndTarget = hwnd;
/*
* Don't forget that this is an interface pointer, need to nail it down since
* we keep a copy of it.
*/
IDropTarget_AddRef(pDropTarget); IDropTarget_AddRef(pDropTarget);
dropTargetInfo->dropTarget = pDropTarget; SetPropW(hwnd, prop_oledroptarget, pDropTarget);
list_add_tail(&targetListHead, &dropTargetInfo->entry);
return S_OK; return S_OK;
} }
@ -329,10 +321,9 @@ HRESULT WINAPI RegisterDragDrop(
/*********************************************************************** /***********************************************************************
* RevokeDragDrop (OLE32.@) * RevokeDragDrop (OLE32.@)
*/ */
HRESULT WINAPI RevokeDragDrop( HRESULT WINAPI RevokeDragDrop(HWND hwnd)
HWND hwnd)
{ {
DropTargetNode* dropTargetInfo; IDropTarget* droptarget;
TRACE("(%p)\n", hwnd); TRACE("(%p)\n", hwnd);
@ -342,18 +333,12 @@ HRESULT WINAPI RevokeDragDrop(
return DRAGDROP_E_INVALIDHWND; return DRAGDROP_E_INVALIDHWND;
} }
/* /* no registration data */
* First, check if the window is already registered. if (!(droptarget = OLEDD_FindDropTarget(hwnd)))
*/
dropTargetInfo = OLEDD_FindDropTarget(hwnd);
/*
* If it ain't in there, it's an error.
*/
if (dropTargetInfo==NULL)
return DRAGDROP_E_NOTREGISTERED; return DRAGDROP_E_NOTREGISTERED;
OLEDD_FreeDropTarget(dropTargetInfo, TRUE); IDropTarget_Release(droptarget);
RemovePropW(hwnd, prop_oledroptarget);
return S_OK; return S_OK;
} }
@ -371,13 +356,12 @@ HRESULT WINAPI OleRegGetUserType(
DWORD dwFormOfType, DWORD dwFormOfType,
LPOLESTR* pszUserType) LPOLESTR* pszUserType)
{ {
char keyName[60]; WCHAR keyName[60];
DWORD dwKeyType; DWORD dwKeyType;
DWORD cbData; DWORD cbData;
HKEY clsidKey; HKEY clsidKey;
LONG hres; LONG hres;
LPSTR buffer;
HRESULT retVal;
/* /*
* Initialize the out parameter. * Initialize the out parameter.
*/ */
@ -386,17 +370,17 @@ HRESULT WINAPI OleRegGetUserType(
/* /*
* Build the key name we're looking for * Build the key name we're looking for
*/ */
sprintf( keyName, "CLSID\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\\", sprintfW( keyName, clsidfmtW,
clsid->Data1, clsid->Data2, clsid->Data3, clsid->Data1, clsid->Data2, clsid->Data3,
clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3], clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3],
clsid->Data4[4], clsid->Data4[5], clsid->Data4[6], clsid->Data4[7] ); clsid->Data4[4], clsid->Data4[5], clsid->Data4[6], clsid->Data4[7] );
TRACE("(%s, %d, %p)\n", keyName, dwFormOfType, pszUserType); TRACE("(%s, %d, %p)\n", debugstr_w(keyName), dwFormOfType, pszUserType);
/* /*
* Open the class id Key * Open the class id Key
*/ */
hres = RegOpenKeyA(HKEY_CLASSES_ROOT, hres = RegOpenKeyW(HKEY_CLASSES_ROOT,
keyName, keyName,
&clsidKey); &clsidKey);
@ -408,8 +392,8 @@ HRESULT WINAPI OleRegGetUserType(
*/ */
cbData = 0; cbData = 0;
hres = RegQueryValueExA(clsidKey, hres = RegQueryValueExW(clsidKey,
"", emptyW,
NULL, NULL,
&dwKeyType, &dwKeyType,
NULL, NULL,
@ -424,7 +408,7 @@ HRESULT WINAPI OleRegGetUserType(
/* /*
* Allocate a buffer for the registry value. * Allocate a buffer for the registry value.
*/ */
*pszUserType = CoTaskMemAlloc(cbData*2); *pszUserType = CoTaskMemAlloc(cbData);
if (*pszUserType==NULL) if (*pszUserType==NULL)
{ {
@ -432,41 +416,24 @@ HRESULT WINAPI OleRegGetUserType(
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
buffer = HeapAlloc(GetProcessHeap(), 0, cbData); hres = RegQueryValueExW(clsidKey,
emptyW,
if (buffer == NULL)
{
RegCloseKey(clsidKey);
CoTaskMemFree(*pszUserType);
*pszUserType=NULL;
return E_OUTOFMEMORY;
}
hres = RegQueryValueExA(clsidKey,
"",
NULL, NULL,
&dwKeyType, &dwKeyType,
(LPBYTE) buffer, (LPBYTE) *pszUserType,
&cbData); &cbData);
RegCloseKey(clsidKey); RegCloseKey(clsidKey);
if (hres != ERROR_SUCCESS)
if (hres!=ERROR_SUCCESS)
{ {
CoTaskMemFree(*pszUserType); CoTaskMemFree(*pszUserType);
*pszUserType=NULL; *pszUserType = NULL;
retVal = REGDB_E_READREGDB; return REGDB_E_READREGDB;
} }
else
{
MultiByteToWideChar( CP_ACP, 0, buffer, -1, *pszUserType, cbData /*FIXME*/ );
retVal = S_OK;
}
HeapFree(GetProcessHeap(), 0, buffer);
return retVal; return S_OK;
} }
/*********************************************************************** /***********************************************************************
@ -478,17 +445,19 @@ HRESULT WINAPI DoDragDrop (
DWORD dwOKEffect, /* [in] effects allowed by the source */ DWORD dwOKEffect, /* [in] effects allowed by the source */
DWORD *pdwEffect) /* [out] ptr to effects of the source */ DWORD *pdwEffect) /* [out] ptr to effects of the source */
{ {
static const WCHAR trackerW[] = {'T','r','a','c','k','e','r','W','i','n','d','o','w',0};
TrackerWindowInfo trackerInfo; TrackerWindowInfo trackerInfo;
HWND hwndTrackWindow; HWND hwndTrackWindow;
MSG msg; MSG msg;
TRACE("(DataObject %p, DropSource %p)\n", pDataObject, pDropSource); TRACE("(%p, %p, %d, %p)\n", pDataObject, pDropSource, dwOKEffect, pdwEffect);
if (!pDataObject || !pDropSource || !pdwEffect)
return E_INVALIDARG;
/* /*
* Setup the drag n drop tracking window. * Setup the drag n drop tracking window.
*/ */
if (!IsValidInterface((LPUNKNOWN)pDropSource))
return E_INVALIDARG;
trackerInfo.dataObject = pDataObject; trackerInfo.dataObject = pDataObject;
trackerInfo.dropSource = pDropSource; trackerInfo.dropSource = pDropSource;
@ -500,12 +469,12 @@ HRESULT WINAPI DoDragDrop (
trackerInfo.curTargetHWND = 0; trackerInfo.curTargetHWND = 0;
trackerInfo.curDragTarget = 0; trackerInfo.curDragTarget = 0;
hwndTrackWindow = CreateWindowA(OLEDD_DRAGTRACKERCLASS, "TrackerWindow", hwndTrackWindow = CreateWindowW(OLEDD_DRAGTRACKERCLASS, trackerW,
WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT, WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, 0,
&trackerInfo); &trackerInfo);
if (hwndTrackWindow!=0) if (hwndTrackWindow)
{ {
/* /*
* Capture the mouse input * Capture the mouse input
@ -517,7 +486,7 @@ HRESULT WINAPI DoDragDrop (
/* /*
* Pump messages. All mouse input should go to the capture window. * Pump messages. All mouse input should go to the capture window.
*/ */
while (!trackerInfo.trackingDone && GetMessageA(&msg, 0, 0, 0) ) while (!trackerInfo.trackingDone && GetMessageW(&msg, 0, 0, 0) )
{ {
trackerInfo.curMousePos.x = msg.pt.x; trackerInfo.curMousePos.x = msg.pt.x;
trackerInfo.curMousePos.y = msg.pt.y; trackerInfo.curMousePos.y = msg.pt.y;
@ -548,7 +517,7 @@ HRESULT WINAPI DoDragDrop (
/* /*
* Dispatch the messages only when it's not a keyboard message. * Dispatch the messages only when it's not a keyboard message.
*/ */
DispatchMessageA(&msg); DispatchMessageW(&msg);
} }
} }
@ -584,7 +553,9 @@ HRESULT WINAPI OleRegGetMiscStatus(
DWORD dwAspect, DWORD dwAspect,
DWORD* pdwStatus) DWORD* pdwStatus)
{ {
char keyName[60]; static const WCHAR miscstatusW[] = {'M','i','s','c','S','t','a','t','u','s',0};
static const WCHAR dfmtW[] = {'%','d',0};
WCHAR keyName[60];
HKEY clsidKey; HKEY clsidKey;
HKEY miscStatusKey; HKEY miscStatusKey;
HKEY aspectKey; HKEY aspectKey;
@ -598,17 +569,17 @@ HRESULT WINAPI OleRegGetMiscStatus(
/* /*
* Build the key name we're looking for * Build the key name we're looking for
*/ */
sprintf( keyName, "CLSID\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\\", sprintfW( keyName, clsidfmtW,
clsid->Data1, clsid->Data2, clsid->Data3, clsid->Data1, clsid->Data2, clsid->Data3,
clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3], clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3],
clsid->Data4[4], clsid->Data4[5], clsid->Data4[6], clsid->Data4[7] ); clsid->Data4[4], clsid->Data4[5], clsid->Data4[6], clsid->Data4[7] );
TRACE("(%s, %d, %p)\n", keyName, dwAspect, pdwStatus); TRACE("(%s, %d, %p)\n", debugstr_w(keyName), dwAspect, pdwStatus);
/* /*
* Open the class id Key * Open the class id Key
*/ */
result = RegOpenKeyA(HKEY_CLASSES_ROOT, result = RegOpenKeyW(HKEY_CLASSES_ROOT,
keyName, keyName,
&clsidKey); &clsidKey);
@ -618,8 +589,8 @@ HRESULT WINAPI OleRegGetMiscStatus(
/* /*
* Get the MiscStatus * Get the MiscStatus
*/ */
result = RegOpenKeyA(clsidKey, result = RegOpenKeyW(clsidKey,
"MiscStatus", miscstatusW,
&miscStatusKey); &miscStatusKey);
@ -637,9 +608,9 @@ HRESULT WINAPI OleRegGetMiscStatus(
/* /*
* Open the key specific to the requested aspect. * Open the key specific to the requested aspect.
*/ */
sprintf(keyName, "%d", dwAspect); sprintfW(keyName, dfmtW, dwAspect);
result = RegOpenKeyA(miscStatusKey, result = RegOpenKeyW(miscStatusKey,
keyName, keyName,
&aspectKey); &aspectKey);
@ -1180,7 +1151,7 @@ static void OLEMenu_UnInitialize(void)
*/ */
static BOOL OLEMenu_InstallHooks( DWORD tid ) static BOOL OLEMenu_InstallHooks( DWORD tid )
{ {
OleMenuHookItem *pHookItem = NULL; OleMenuHookItem *pHookItem;
/* Create an entry for the hook table */ /* Create an entry for the hook table */
if ( !(pHookItem = HeapAlloc(GetProcessHeap(), 0, if ( !(pHookItem = HeapAlloc(GetProcessHeap(), 0,
@ -1189,15 +1160,16 @@ static BOOL OLEMenu_InstallHooks( DWORD tid )
pHookItem->tid = tid; pHookItem->tid = tid;
pHookItem->hHeap = GetProcessHeap(); pHookItem->hHeap = GetProcessHeap();
pHookItem->CallWndProc_hHook = NULL;
/* Install a thread scope message hook for WH_GETMESSAGE */ /* Install a thread scope message hook for WH_GETMESSAGE */
pHookItem->GetMsg_hHook = SetWindowsHookExA( WH_GETMESSAGE, OLEMenu_GetMsgProc, pHookItem->GetMsg_hHook = SetWindowsHookExW( WH_GETMESSAGE, OLEMenu_GetMsgProc,
0, GetCurrentThreadId() ); 0, GetCurrentThreadId() );
if ( !pHookItem->GetMsg_hHook ) if ( !pHookItem->GetMsg_hHook )
goto CLEANUP; goto CLEANUP;
/* Install a thread scope message hook for WH_CALLWNDPROC */ /* Install a thread scope message hook for WH_CALLWNDPROC */
pHookItem->CallWndProc_hHook = SetWindowsHookExA( WH_CALLWNDPROC, OLEMenu_CallWndProc, pHookItem->CallWndProc_hHook = SetWindowsHookExW( WH_CALLWNDPROC, OLEMenu_CallWndProc,
0, GetCurrentThreadId() ); 0, GetCurrentThreadId() );
if ( !pHookItem->CallWndProc_hHook ) if ( !pHookItem->CallWndProc_hHook )
goto CLEANUP; goto CLEANUP;
@ -1271,7 +1243,7 @@ CLEANUP:
*/ */
static OleMenuHookItem * OLEMenu_IsHookInstalled( DWORD tid ) static OleMenuHookItem * OLEMenu_IsHookInstalled( DWORD tid )
{ {
OleMenuHookItem *pHookItem = NULL; OleMenuHookItem *pHookItem;
/* Do a simple linear search for an entry whose tid matches ours. /* Do a simple linear search for an entry whose tid matches ours.
* We really need a map but efficiency is not a concern here. */ * We really need a map but efficiency is not a concern here. */
@ -1376,7 +1348,7 @@ static BOOL OLEMenu_SetIsServerMenu( HMENU hmenu, OleMenuDescriptor *pOleMenuDes
*/ */
static LRESULT CALLBACK OLEMenu_CallWndProc(INT code, WPARAM wParam, LPARAM lParam) static LRESULT CALLBACK OLEMenu_CallWndProc(INT code, WPARAM wParam, LPARAM lParam)
{ {
LPCWPSTRUCT pMsg = NULL; LPCWPSTRUCT pMsg;
HOLEMENU hOleMenu = 0; HOLEMENU hOleMenu = 0;
OleMenuDescriptor *pOleMenuDescriptor = NULL; OleMenuDescriptor *pOleMenuDescriptor = NULL;
OleMenuHookItem *pHookItem = NULL; OleMenuHookItem *pHookItem = NULL;
@ -1395,7 +1367,7 @@ static LRESULT CALLBACK OLEMenu_CallWndProc(INT code, WPARAM wParam, LPARAM lPar
* If the window has an OLEMenu property we may need to dispatch * If the window has an OLEMenu property we may need to dispatch
* the menu message to its active objects window instead. */ * the menu message to its active objects window instead. */
hOleMenu = GetPropA( pMsg->hwnd, "PROP_OLEMenuDescriptor" ); hOleMenu = GetPropW( pMsg->hwnd, prop_olemenuW );
if ( !hOleMenu ) if ( !hOleMenu )
goto NEXTHOOK; goto NEXTHOOK;
@ -1413,7 +1385,7 @@ static LRESULT CALLBACK OLEMenu_CallWndProc(INT code, WPARAM wParam, LPARAM lPar
pOleMenuDescriptor->bIsServerItem = FALSE; pOleMenuDescriptor->bIsServerItem = FALSE;
/* Send this message to the server as well */ /* Send this message to the server as well */
SendMessageA( pOleMenuDescriptor->hwndActiveObject, SendMessageW( pOleMenuDescriptor->hwndActiveObject,
pMsg->message, pMsg->wParam, pMsg->lParam ); pMsg->message, pMsg->wParam, pMsg->lParam );
goto NEXTHOOK; goto NEXTHOOK;
} }
@ -1454,7 +1426,7 @@ static LRESULT CALLBACK OLEMenu_CallWndProc(INT code, WPARAM wParam, LPARAM lPar
/* If the message was for the server dispatch it accordingly */ /* If the message was for the server dispatch it accordingly */
if ( pOleMenuDescriptor->bIsServerItem ) if ( pOleMenuDescriptor->bIsServerItem )
{ {
SendMessageA( pOleMenuDescriptor->hwndActiveObject, SendMessageW( pOleMenuDescriptor->hwndActiveObject,
pMsg->message, pMsg->wParam, pMsg->lParam ); pMsg->message, pMsg->wParam, pMsg->lParam );
} }
@ -1481,7 +1453,7 @@ NEXTHOOK:
*/ */
static LRESULT CALLBACK OLEMenu_GetMsgProc(INT code, WPARAM wParam, LPARAM lParam) static LRESULT CALLBACK OLEMenu_GetMsgProc(INT code, WPARAM wParam, LPARAM lParam)
{ {
LPMSG pMsg = NULL; LPMSG pMsg;
HOLEMENU hOleMenu = 0; HOLEMENU hOleMenu = 0;
OleMenuDescriptor *pOleMenuDescriptor = NULL; OleMenuDescriptor *pOleMenuDescriptor = NULL;
OleMenuHookItem *pHookItem = NULL; OleMenuHookItem *pHookItem = NULL;
@ -1500,7 +1472,7 @@ static LRESULT CALLBACK OLEMenu_GetMsgProc(INT code, WPARAM wParam, LPARAM lPara
* If the window has an OLEMenu property we may need to dispatch * If the window has an OLEMenu property we may need to dispatch
* the menu message to its active objects window instead. */ * the menu message to its active objects window instead. */
hOleMenu = GetPropA( pMsg->hwnd, "PROP_OLEMenuDescriptor" ); hOleMenu = GetPropW( pMsg->hwnd, prop_olemenuW );
if ( !hOleMenu ) if ( !hOleMenu )
goto NEXTHOOK; goto NEXTHOOK;
@ -1671,7 +1643,7 @@ HRESULT WINAPI OleSetMenuDescriptor(
pOleMenuDescriptor = NULL; pOleMenuDescriptor = NULL;
/* Add a menu descriptor windows property to the frame window */ /* Add a menu descriptor windows property to the frame window */
SetPropA( hwndFrame, "PROP_OLEMenuDescriptor", hOleMenu ); SetPropW( hwndFrame, prop_olemenuW, hOleMenu );
/* Install thread scope message hooks for WH_GETMESSAGE and WH_CALLWNDPROC */ /* Install thread scope message hooks for WH_GETMESSAGE and WH_CALLWNDPROC */
if ( !OLEMenu_InstallHooks( GetCurrentThreadId() ) ) if ( !OLEMenu_InstallHooks( GetCurrentThreadId() ) )
@ -1684,7 +1656,7 @@ HRESULT WINAPI OleSetMenuDescriptor(
return E_FAIL; return E_FAIL;
/* Remove the menu descriptor property from the frame window */ /* Remove the menu descriptor property from the frame window */
RemovePropA( hwndFrame, "PROP_OLEMenuDescriptor" ); RemovePropW( hwndFrame, prop_olemenuW );
} }
return S_OK; return S_OK;
@ -1870,9 +1842,9 @@ void WINAPI ReleaseStgMedium(
*/ */
static void OLEDD_Initialize(void) static void OLEDD_Initialize(void)
{ {
WNDCLASSA wndClass; WNDCLASSW wndClass;
ZeroMemory (&wndClass, sizeof(WNDCLASSA)); ZeroMemory (&wndClass, sizeof(WNDCLASSW));
wndClass.style = CS_GLOBALCLASS; wndClass.style = CS_GLOBALCLASS;
wndClass.lpfnWndProc = OLEDD_DragTrackerWindowProc; wndClass.lpfnWndProc = OLEDD_DragTrackerWindowProc;
wndClass.cbClsExtra = 0; wndClass.cbClsExtra = 0;
@ -1881,58 +1853,7 @@ static void OLEDD_Initialize(void)
wndClass.hbrBackground = 0; wndClass.hbrBackground = 0;
wndClass.lpszClassName = OLEDD_DRAGTRACKERCLASS; wndClass.lpszClassName = OLEDD_DRAGTRACKERCLASS;
RegisterClassA (&wndClass); RegisterClassW (&wndClass);
}
/***
* OLEDD_FreeDropTarget()
*
* Frees the drag and drop data structure
*/
static void OLEDD_FreeDropTarget(DropTargetNode *dropTargetInfo, BOOL release_drop_target)
{
list_remove(&dropTargetInfo->entry);
if (release_drop_target) IDropTarget_Release(dropTargetInfo->dropTarget);
HeapFree(GetProcessHeap(), 0, dropTargetInfo);
}
/***
* OLEDD_UnInitialize()
*
* Releases the OLE drag and drop data structures.
*/
void OLEDD_UnInitialize(void)
{
/*
* Simply empty the list.
*/
while (!list_empty(&targetListHead))
{
DropTargetNode* curNode = LIST_ENTRY(list_head(&targetListHead), DropTargetNode, entry);
OLEDD_FreeDropTarget(curNode, FALSE);
}
}
/***
* OLEDD_FindDropTarget()
*
* Finds information about the drop target.
*/
static DropTargetNode* OLEDD_FindDropTarget(HWND hwndOfTarget)
{
DropTargetNode* curNode;
/*
* Iterate the list to find the HWND value.
*/
LIST_FOR_EACH_ENTRY(curNode, &targetListHead, DropTargetNode, entry)
if (hwndOfTarget==curNode->hwndTarget)
return curNode;
/*
* If we get here, the item is not in the list
*/
return NULL;
} }
/*** /***
@ -1958,7 +1879,7 @@ static LRESULT WINAPI OLEDD_DragTrackerWindowProc(
{ {
LPCREATESTRUCTA createStruct = (LPCREATESTRUCTA)lParam; LPCREATESTRUCTA createStruct = (LPCREATESTRUCTA)lParam;
SetWindowLongPtrA(hwnd, 0, (LONG_PTR)createStruct->lpCreateParams); SetWindowLongPtrW(hwnd, 0, (LONG_PTR)createStruct->lpCreateParams);
SetTimer(hwnd, DRAG_TIMER_ID, 50, NULL); SetTimer(hwnd, DRAG_TIMER_ID, 50, NULL);
break; break;
@ -1989,7 +1910,7 @@ static LRESULT WINAPI OLEDD_DragTrackerWindowProc(
/* /*
* This is a window proc after all. Let's call the default. * This is a window proc after all. Let's call the default.
*/ */
return DefWindowProcA (hwnd, uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam);
} }
/*** /***
@ -2038,46 +1959,65 @@ static void OLEDD_TrackMouseMove(TrackerWindowInfo* trackerInfo)
} }
else else
{ {
DropTargetNode* newDropTargetNode = 0;
/* /*
* If we changed window, we have to notify our old target and check for * If we changed window, we have to notify our old target and check for
* the new one. * the new one.
*/ */
if (trackerInfo->curDragTarget!=0) if (trackerInfo->curDragTarget)
{
IDropTarget_DragLeave(trackerInfo->curDragTarget); IDropTarget_DragLeave(trackerInfo->curDragTarget);
}
/* /*
* Make sure we're hovering over a window. * Make sure we're hovering over a window.
*/ */
if (hwndNewTarget!=0) if (hwndNewTarget)
{ {
/* /*
* Find-out if there is a drag target under the mouse * Find-out if there is a drag target under the mouse
*/ */
HWND nexttar = hwndNewTarget; HWND next_target_wnd = hwndNewTarget;
IDropTarget *new_target;
DWORD pid;
trackerInfo->curTargetHWND = hwndNewTarget; trackerInfo->curTargetHWND = hwndNewTarget;
do { do {
newDropTargetNode = OLEDD_FindDropTarget(nexttar); new_target = OLEDD_FindDropTarget(next_target_wnd);
} while (!newDropTargetNode && (nexttar = GetParent(nexttar)) != 0); } while (!new_target && (next_target_wnd = GetParent(next_target_wnd)));
if(nexttar) hwndNewTarget = nexttar;
trackerInfo->curDragTargetHWND = hwndNewTarget; if (next_target_wnd) hwndNewTarget = next_target_wnd;
trackerInfo->curDragTarget = newDropTargetNode ? newDropTargetNode->dropTarget : 0;
GetWindowThreadProcessId(hwndNewTarget, &pid);
if (pid != GetCurrentProcessId())
{
FIXME("drop to another process window is unsupported\n");
trackerInfo->curDragTargetHWND = 0;
trackerInfo->curTargetHWND = 0;
trackerInfo->curDragTarget = 0;
}
else
{
trackerInfo->curDragTargetHWND = hwndNewTarget;
trackerInfo->curDragTarget = new_target;
}
/* /*
* If there is, notify it that we just dragged-in * If there is, notify it that we just dragged-in
*/ */
if (trackerInfo->curDragTarget!=0) if (trackerInfo->curDragTarget)
{ {
IDropTarget_DragEnter(trackerInfo->curDragTarget, hr = IDropTarget_DragEnter(trackerInfo->curDragTarget,
trackerInfo->dataObject, trackerInfo->dataObject,
trackerInfo->dwKeyState, trackerInfo->dwKeyState,
trackerInfo->curMousePos, trackerInfo->curMousePos,
trackerInfo->pdwEffect); trackerInfo->pdwEffect);
/* failed DragEnter() means invalid target */
if (hr != S_OK)
{
trackerInfo->curDragTargetHWND = 0;
trackerInfo->curTargetHWND = 0;
trackerInfo->curDragTarget = 0;
}
} }
} }
else else
@ -2110,24 +2050,28 @@ static void OLEDD_TrackMouseMove(TrackerWindowInfo* trackerInfo)
* when that's the case, we must display the standard drag and drop * when that's the case, we must display the standard drag and drop
* cursors. * cursors.
*/ */
if (hr==DRAGDROP_S_USEDEFAULTCURSORS) if (hr == DRAGDROP_S_USEDEFAULTCURSORS)
{ {
HCURSOR hCur;
if (*trackerInfo->pdwEffect & DROPEFFECT_MOVE) if (*trackerInfo->pdwEffect & DROPEFFECT_MOVE)
{ {
SetCursor(LoadCursorA(hProxyDll, MAKEINTRESOURCEA(1))); hCur = LoadCursorW(hProxyDll, MAKEINTRESOURCEW(1));
} }
else if (*trackerInfo->pdwEffect & DROPEFFECT_COPY) else if (*trackerInfo->pdwEffect & DROPEFFECT_COPY)
{ {
SetCursor(LoadCursorA(hProxyDll, MAKEINTRESOURCEA(2))); hCur = LoadCursorW(hProxyDll, MAKEINTRESOURCEW(2));
} }
else if (*trackerInfo->pdwEffect & DROPEFFECT_LINK) else if (*trackerInfo->pdwEffect & DROPEFFECT_LINK)
{ {
SetCursor(LoadCursorA(hProxyDll, MAKEINTRESOURCEA(3))); hCur = LoadCursorW(hProxyDll, MAKEINTRESOURCEW(3));
} }
else else
{ {
SetCursor(LoadCursorA(hProxyDll, MAKEINTRESOURCEA(0))); hCur = LoadCursorW(hProxyDll, MAKEINTRESOURCEW(0));
} }
SetCursor(hCur);
} }
} }
@ -2174,7 +2118,7 @@ static void OLEDD_TrackStateChange(TrackerWindowInfo* trackerInfo)
* If we end-up over a target, drop the object in the target or * If we end-up over a target, drop the object in the target or
* inform the target that the operation was cancelled. * inform the target that the operation was cancelled.
*/ */
if (trackerInfo->curDragTarget!=0) if (trackerInfo->curDragTarget)
{ {
switch (trackerInfo->returnValue) switch (trackerInfo->returnValue)
{ {
@ -2183,14 +2127,16 @@ static void OLEDD_TrackStateChange(TrackerWindowInfo* trackerInfo)
* the drop target that we just dropped the object in it. * the drop target that we just dropped the object in it.
*/ */
case DRAGDROP_S_DROP: case DRAGDROP_S_DROP:
{ if (*trackerInfo->pdwEffect != DROPEFFECT_NONE)
IDropTarget_Drop(trackerInfo->curDragTarget, IDropTarget_Drop(trackerInfo->curDragTarget,
trackerInfo->dataObject, trackerInfo->dataObject,
trackerInfo->dwKeyState, trackerInfo->dwKeyState,
trackerInfo->curMousePos, trackerInfo->curMousePos,
trackerInfo->pdwEffect); trackerInfo->pdwEffect);
break; else
} IDropTarget_DragLeave(trackerInfo->curDragTarget);
break;
/* /*
* If the source told us that we should cancel, fool the drop * If the source told us that we should cancel, fool the drop
* target by telling it that the mouse left it's window. * target by telling it that the mouse left it's window.
@ -2256,13 +2202,13 @@ static void OLEUTL_ReadRegistryDWORDValue(
HKEY regKey, HKEY regKey,
DWORD* pdwValue) DWORD* pdwValue)
{ {
char buffer[20]; WCHAR buffer[20];
DWORD cbData = sizeof(buffer);
DWORD dwKeyType; DWORD dwKeyType;
DWORD cbData = 20;
LONG lres; LONG lres;
lres = RegQueryValueExA(regKey, lres = RegQueryValueExW(regKey,
"", emptyW,
NULL, NULL,
&dwKeyType, &dwKeyType,
(LPBYTE)buffer, (LPBYTE)buffer,
@ -2278,7 +2224,7 @@ static void OLEUTL_ReadRegistryDWORDValue(
case REG_EXPAND_SZ: case REG_EXPAND_SZ:
case REG_MULTI_SZ: case REG_MULTI_SZ:
case REG_SZ: case REG_SZ:
*pdwValue = (DWORD)strtoul(buffer, NULL, 10); *pdwValue = (DWORD)strtoulW(buffer, NULL, 10);
break; break;
} }
} }

View file

@ -1314,6 +1314,13 @@ static HRESULT PropertyStorage_ReadFromStream(PropertyStorage_impl *This)
hr = PropertyStorage_ReadFmtIdOffsetFromStream(This->stm, &fmtOffset); hr = PropertyStorage_ReadFmtIdOffsetFromStream(This->stm, &fmtOffset);
if (FAILED(hr)) if (FAILED(hr))
goto end; goto end;
if (!IsEqualGUID(&fmtOffset.fmtid, &FMTID_DocSummaryInformation) &&
!IsEqualGUID(&fmtOffset.fmtid, &FMTID_SummaryInformation))
{
WARN("not reading unknown fmtid %s\n", debugstr_guid(&fmtOffset.fmtid));
hr = S_FALSE;
goto end;
}
if (fmtOffset.dwOffset > stat.cbSize.u.LowPart) if (fmtOffset.dwOffset > stat.cbSize.u.LowPart)
{ {
WARN("invalid offset %d (stream length is %d)\n", fmtOffset.dwOffset, WARN("invalid offset %d (stream length is %d)\n", fmtOffset.dwOffset,

File diff suppressed because it is too large Load diff

View file

@ -263,6 +263,7 @@ struct StorageBaseImplVtbl {
HRESULT (*StreamReadAt)(StorageBaseImpl*,DirRef,ULARGE_INTEGER,ULONG,void*,ULONG*); HRESULT (*StreamReadAt)(StorageBaseImpl*,DirRef,ULARGE_INTEGER,ULONG,void*,ULONG*);
HRESULT (*StreamWriteAt)(StorageBaseImpl*,DirRef,ULARGE_INTEGER,ULONG,const void*,ULONG*); HRESULT (*StreamWriteAt)(StorageBaseImpl*,DirRef,ULARGE_INTEGER,ULONG,const void*,ULONG*);
HRESULT (*StreamSetSize)(StorageBaseImpl*,DirRef,ULARGE_INTEGER); HRESULT (*StreamSetSize)(StorageBaseImpl*,DirRef,ULARGE_INTEGER);
HRESULT (*StreamLink)(StorageBaseImpl*,DirRef,DirRef);
}; };
static inline void StorageBaseImpl_Destroy(StorageBaseImpl *This) static inline void StorageBaseImpl_Destroy(StorageBaseImpl *This)
@ -320,6 +321,16 @@ static inline HRESULT StorageBaseImpl_StreamSetSize(StorageBaseImpl *This,
return This->baseVtbl->StreamSetSize(This, index, newsize); return This->baseVtbl->StreamSetSize(This, index, newsize);
} }
/* Make dst point to the same stream that src points to. Other stream operations
* will not work properly for entries that point to the same stream, so this
* must be a very temporary state, and only one entry pointing to a given stream
* may be reachable at any given time. */
static inline HRESULT StorageBaseImpl_StreamLink(StorageBaseImpl *This,
DirRef dst, DirRef src)
{
return This->baseVtbl->StreamLink(This, dst, src);
}
/**************************************************************************** /****************************************************************************
* StorageBaseImpl stream list handlers * StorageBaseImpl stream list handlers
*/ */
@ -513,13 +524,22 @@ void StorageUtl_CopyDirEntryToSTATSTG(StorageBaseImpl *storage,STATSTG* destinat
* The BlockChainStream class is a utility class that is used to create an * The BlockChainStream class is a utility class that is used to create an
* abstraction of the big block chains in the storage file. * abstraction of the big block chains in the storage file.
*/ */
struct BlockChainRun
{
/* This represents a range of blocks that happen reside in consecutive sectors. */
ULONG firstSector;
ULONG firstOffset;
ULONG lastOffset;
};
struct BlockChainStream struct BlockChainStream
{ {
StorageImpl* parentStorage; StorageImpl* parentStorage;
ULONG* headOfStreamPlaceHolder; ULONG* headOfStreamPlaceHolder;
DirRef ownerDirEntry; DirRef ownerDirEntry;
ULONG lastBlockNoInSequence; struct BlockChainRun* indexCache;
ULONG lastBlockNoInSequenceIndex; ULONG indexCacheLen;
ULONG indexCacheSize;
ULONG tailIndex; ULONG tailIndex;
ULONG numBlocks; ULONG numBlocks;
}; };

View file

@ -2761,7 +2761,8 @@ void CALLBACK IAdviseSink_OnDataChange_Proxy(
FORMATETC *pFormatetc, FORMATETC *pFormatetc,
STGMEDIUM *pStgmed) STGMEDIUM *pStgmed)
{ {
FIXME(":stub\n"); TRACE("(%p)->(%p, %p)\n", This, pFormatetc, pStgmed);
IAdviseSink_RemoteOnDataChange_Proxy(This, pFormatetc, pStgmed);
} }
HRESULT __RPC_STUB IAdviseSink_OnDataChange_Stub( HRESULT __RPC_STUB IAdviseSink_OnDataChange_Stub(
@ -2769,8 +2770,9 @@ HRESULT __RPC_STUB IAdviseSink_OnDataChange_Stub(
FORMATETC *pFormatetc, FORMATETC *pFormatetc,
ASYNC_STGMEDIUM *pStgmed) ASYNC_STGMEDIUM *pStgmed)
{ {
FIXME(":stub\n"); TRACE("(%p)->(%p, %p)\n", This, pFormatetc, pStgmed);
return E_NOTIMPL; IAdviseSink_OnDataChange(This, pFormatetc, pStgmed);
return S_OK;
} }
void CALLBACK IAdviseSink_OnViewChange_Proxy( void CALLBACK IAdviseSink_OnViewChange_Proxy(
@ -2778,7 +2780,8 @@ void CALLBACK IAdviseSink_OnViewChange_Proxy(
DWORD dwAspect, DWORD dwAspect,
LONG lindex) LONG lindex)
{ {
FIXME(":stub\n"); TRACE("(%p)->(%d, %d)\n", This, dwAspect, lindex);
IAdviseSink_RemoteOnViewChange_Proxy(This, dwAspect, lindex);
} }
HRESULT __RPC_STUB IAdviseSink_OnViewChange_Stub( HRESULT __RPC_STUB IAdviseSink_OnViewChange_Stub(
@ -2786,64 +2789,73 @@ HRESULT __RPC_STUB IAdviseSink_OnViewChange_Stub(
DWORD dwAspect, DWORD dwAspect,
LONG lindex) LONG lindex)
{ {
FIXME(":stub\n"); TRACE("(%p)->(%d, %d)\n", This, dwAspect, lindex);
return E_NOTIMPL; IAdviseSink_OnViewChange(This, dwAspect, lindex);
return S_OK;
} }
void CALLBACK IAdviseSink_OnRename_Proxy( void CALLBACK IAdviseSink_OnRename_Proxy(
IAdviseSink* This, IAdviseSink* This,
IMoniker *pmk) IMoniker *pmk)
{ {
FIXME(":stub\n"); TRACE("(%p)->(%p)\n", This, pmk);
IAdviseSink_RemoteOnRename_Proxy(This, pmk);
} }
HRESULT __RPC_STUB IAdviseSink_OnRename_Stub( HRESULT __RPC_STUB IAdviseSink_OnRename_Stub(
IAdviseSink* This, IAdviseSink* This,
IMoniker *pmk) IMoniker *pmk)
{ {
FIXME(":stub\n"); TRACE("(%p)->(%p)\n", This, pmk);
return E_NOTIMPL; IAdviseSink_OnRename(This, pmk);
return S_OK;
} }
void CALLBACK IAdviseSink_OnSave_Proxy( void CALLBACK IAdviseSink_OnSave_Proxy(
IAdviseSink* This) IAdviseSink* This)
{ {
FIXME(":stub\n"); TRACE("(%p)\n", This);
IAdviseSink_RemoteOnSave_Proxy(This);
} }
HRESULT __RPC_STUB IAdviseSink_OnSave_Stub( HRESULT __RPC_STUB IAdviseSink_OnSave_Stub(
IAdviseSink* This) IAdviseSink* This)
{ {
FIXME(":stub\n"); TRACE("(%p)\n", This);
return E_NOTIMPL; IAdviseSink_OnSave(This);
return S_OK;
} }
void CALLBACK IAdviseSink_OnClose_Proxy( void CALLBACK IAdviseSink_OnClose_Proxy(
IAdviseSink* This) IAdviseSink* This)
{ {
FIXME(":stub\n"); TRACE("(%p)\n", This);
IAdviseSink_RemoteOnClose_Proxy(This);
} }
HRESULT __RPC_STUB IAdviseSink_OnClose_Stub( HRESULT __RPC_STUB IAdviseSink_OnClose_Stub(
IAdviseSink* This) IAdviseSink* This)
{ {
FIXME(":stub\n"); TRACE("(%p)\n", This);
return E_NOTIMPL; IAdviseSink_OnClose(This);
return S_OK;
} }
void CALLBACK IAdviseSink2_OnLinkSrcChange_Proxy( void CALLBACK IAdviseSink2_OnLinkSrcChange_Proxy(
IAdviseSink2* This, IAdviseSink2* This,
IMoniker *pmk) IMoniker *pmk)
{ {
FIXME(":stub\n"); TRACE("(%p)->(%p)\n", This, pmk);
IAdviseSink2_RemoteOnLinkSrcChange_Proxy(This, pmk);
} }
HRESULT __RPC_STUB IAdviseSink2_OnLinkSrcChange_Stub( HRESULT __RPC_STUB IAdviseSink2_OnLinkSrcChange_Stub(
IAdviseSink2* This, IAdviseSink2* This,
IMoniker *pmk) IMoniker *pmk)
{ {
FIXME(":stub\n"); TRACE("(%p)->(%p)\n", This, pmk);
return E_NOTIMPL; IAdviseSink2_OnLinkSrcChange(This, pmk);
return S_OK;
} }
HRESULT CALLBACK IDataObject_GetData_Proxy( HRESULT CALLBACK IDataObject_GetData_Proxy(