mirror of
https://github.com/reactos/reactos.git
synced 2024-12-31 19:42:51 +00:00
[OLE32]
sync to wine 1.2 RC2 svn path=/trunk/; revision=47405
This commit is contained in:
parent
1d5afb8039
commit
c48e118c70
14 changed files with 1258 additions and 652 deletions
|
@ -1266,10 +1266,10 @@ static HRESULT WINAPI snapshot_GetDataHere(IDataObject *iface, FORMATETC *fmt,
|
|||
ole_priv_data_entry *entry;
|
||||
TYMED supported;
|
||||
|
||||
TRACE("(%p, %p {%s}, %p (tymed %x)\n", iface, fmt, dump_fmtetc(fmt), med, med->tymed);
|
||||
|
||||
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(!This->data)
|
||||
|
|
|
@ -232,18 +232,20 @@ static HRESULT COMCAT_IsClassOfCategories(
|
|||
LPCWSTR string;
|
||||
|
||||
/* Check that every given category is implemented by class. */
|
||||
res = RegOpenKeyExW(key, impl_keyname, 0, KEY_READ, &subkey);
|
||||
if (res != ERROR_SUCCESS) return S_FALSE;
|
||||
for (string = categories->impl_strings; *string; string += 39) {
|
||||
HKEY catkey;
|
||||
res = RegOpenKeyExW(subkey, string, 0, 0, &catkey);
|
||||
if (res != ERROR_SUCCESS) {
|
||||
RegCloseKey(subkey);
|
||||
return S_FALSE;
|
||||
if (*categories->impl_strings) {
|
||||
res = RegOpenKeyExW(key, impl_keyname, 0, KEY_READ, &subkey);
|
||||
if (res != ERROR_SUCCESS) return S_FALSE;
|
||||
for (string = categories->impl_strings; *string; string += 39) {
|
||||
HKEY catkey;
|
||||
res = RegOpenKeyExW(subkey, string, 0, 0, &catkey);
|
||||
if (res != ERROR_SUCCESS) {
|
||||
RegCloseKey(subkey);
|
||||
return S_FALSE;
|
||||
}
|
||||
RegCloseKey(catkey);
|
||||
}
|
||||
RegCloseKey(catkey);
|
||||
RegCloseKey(subkey);
|
||||
}
|
||||
RegCloseKey(subkey);
|
||||
|
||||
/* Check that all categories required by class are given. */
|
||||
res = RegOpenKeyExW(key, req_keyname, 0, KEY_READ, &subkey);
|
||||
|
|
|
@ -4156,7 +4156,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
|||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
OLEDD_UnInitialize();
|
||||
COMPOBJ_UninitProcess();
|
||||
RPC_UnregisterAllChannelHooks();
|
||||
COMPOBJ_DllList_Free();
|
||||
|
|
|
@ -445,7 +445,6 @@ static HRESULT WINAPI
|
|||
CompositeMonikerImpl_Reduce(IMoniker* iface, IBindCtx* pbc, DWORD dwReduceHowFar,
|
||||
IMoniker** ppmkToLeft, IMoniker** ppmkReduced)
|
||||
{
|
||||
HRESULT res;
|
||||
IMoniker *tempMk,*antiMk,*mostRigthMk,*leftReducedComposedMk,*mostRigthReducedMk;
|
||||
IEnumMoniker *enumMoniker;
|
||||
|
||||
|
@ -462,8 +461,8 @@ CompositeMonikerImpl_Reduce(IMoniker* iface, IBindCtx* pbc, DWORD dwReduceHowFar
|
|||
IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL);
|
||||
IEnumMoniker_Release(enumMoniker);
|
||||
|
||||
res=CreateAntiMoniker(&antiMk);
|
||||
res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
|
||||
CreateAntiMoniker(&antiMk);
|
||||
IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
|
||||
IMoniker_Release(antiMk);
|
||||
|
||||
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_Release(enumMoniker);
|
||||
|
||||
res=CreateAntiMoniker(&antiMk);
|
||||
res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
|
||||
CreateAntiMoniker(&antiMk);
|
||||
IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
|
||||
IMoniker_Release(antiMk);
|
||||
|
||||
/* If any of the components reduces itself, the method returns S_OK and passes back a composite */
|
||||
|
|
|
@ -365,7 +365,7 @@ static HRESULT WINAPI DefaultHandler_SetClientSite(
|
|||
if (This->clientSite)
|
||||
IOleClientSite_AddRef(This->clientSite);
|
||||
|
||||
return S_OK;
|
||||
return hr;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
|
|
@ -371,12 +371,6 @@ static HRESULT WINAPI HGLOBALStreamImpl_Seek(
|
|||
TRACE("(%p, %x%08x, %d, %p)\n", iface, dlibMove.u.HighPart,
|
||||
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"
|
||||
* parameter.
|
||||
|
@ -405,10 +399,19 @@ static HRESULT WINAPI HGLOBALStreamImpl_Seek(
|
|||
newPosition.u.HighPart = 0;
|
||||
newPosition.u.LowPart += dlibMove.QuadPart;
|
||||
|
||||
end:
|
||||
if (plibNewPosition) *plibNewPosition = newPosition;
|
||||
if (dlibMove.u.LowPart >= 0x80000000 &&
|
||||
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;
|
||||
|
||||
end:
|
||||
if (plibNewPosition) *plibNewPosition = This->currentPosition;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
|
|
@ -501,7 +501,7 @@ HRESULT WINAPI CoRevokeMallocSpy(void)
|
|||
}
|
||||
LeaveCriticalSection(&IMalloc32_SpyCS);
|
||||
|
||||
return S_OK;
|
||||
return hres;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
@ -1214,16 +1214,13 @@ StdMarshalImpl_MarshalInterface(
|
|||
RPC_StartRemoting(apt);
|
||||
|
||||
hres = marshal_object(apt, &stdobjref, riid, pv, mshlflags);
|
||||
if (hres)
|
||||
if (hres != S_OK)
|
||||
{
|
||||
ERR("Failed to create ifstub, hres=0x%x\n", hres);
|
||||
return hres;
|
||||
}
|
||||
|
||||
hres = IStream_Write(pStm, &stdobjref, sizeof(stdobjref), &res);
|
||||
if (hres) return hres;
|
||||
|
||||
return S_OK;
|
||||
return IStream_Write(pStm, &stdobjref, sizeof(stdobjref), &res);
|
||||
}
|
||||
|
||||
/* 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 */
|
||||
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);
|
||||
if (hres) return hres;
|
||||
if (hres != S_OK) return hres;
|
||||
|
||||
/* check if we're marshalling back to ourselves */
|
||||
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 (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);
|
||||
|
||||
return hres;
|
||||
|
@ -1392,7 +1389,7 @@ StdMarshalImpl_ReleaseMarshalData(LPMARSHAL iface, IStream *pStm)
|
|||
TRACE("iface=%p, pStm=%p\n", iface, pStm);
|
||||
|
||||
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",
|
||||
wine_dbgstr_longlong(stdobjref.oxid),
|
||||
|
@ -1516,7 +1513,7 @@ static HRESULT get_marshaler(REFIID riid, IUnknown *pUnk, DWORD dwDestContext,
|
|||
if (!pUnk)
|
||||
return E_POINTER;
|
||||
hr = IUnknown_QueryInterface(pUnk, &IID_IMarshal, (LPVOID*)pMarshal);
|
||||
if (hr)
|
||||
if (hr != S_OK)
|
||||
hr = CoGetStandardMarshal(riid, pUnk, dwDestContext, pvDestContext,
|
||||
mshlFlags, pMarshal);
|
||||
return hr;
|
||||
|
@ -1537,7 +1534,7 @@ static HRESULT get_unmarshaler_from_stream(IStream *stream, IMarshal **marshal,
|
|||
|
||||
/* read common OBJREF header */
|
||||
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);
|
||||
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 */
|
||||
hr = IStream_Read(stream, &objref.u_objref.u_custom,
|
||||
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);
|
||||
return STG_E_READFAULT;
|
||||
|
@ -1583,7 +1580,7 @@ static HRESULT get_unmarshaler_from_stream(IStream *stream, IMarshal **marshal,
|
|||
return RPC_E_INVALID_OBJREF;
|
||||
}
|
||||
|
||||
if (hr)
|
||||
if (hr != S_OK)
|
||||
ERR("Failed to create marshal, 0x%08x\n", hr);
|
||||
|
||||
return hr;
|
||||
|
@ -1618,12 +1615,12 @@ HRESULT WINAPI CoGetMarshalSizeMax(ULONG *pulSize, REFIID riid, IUnknown *pUnk,
|
|||
CLSID marshaler_clsid;
|
||||
|
||||
hr = get_marshaler(riid, pUnk, dwDestContext, pvDestContext, mshlFlags, &pMarshal);
|
||||
if (hr)
|
||||
if (hr != S_OK)
|
||||
return hr;
|
||||
|
||||
hr = IMarshal_GetUnmarshalClass(pMarshal, riid, pUnk, dwDestContext,
|
||||
pvDestContext, mshlFlags, &marshaler_clsid);
|
||||
if (hr)
|
||||
if (hr != S_OK)
|
||||
{
|
||||
ERR("IMarshal::GetUnmarshalClass failed, 0x%08x\n", hr);
|
||||
IMarshal_Release(pMarshal);
|
||||
|
@ -1711,7 +1708,7 @@ HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk,
|
|||
|
||||
/* get the marshaler for the specified interface */
|
||||
hr = get_marshaler(riid, pUnk, dwDestContext, pvDestContext, mshlFlags, &pMarshal);
|
||||
if (hr)
|
||||
if (hr != S_OK)
|
||||
{
|
||||
ERR("Failed to get marshaller, 0x%08x\n", hr);
|
||||
return hr;
|
||||
|
@ -1719,7 +1716,7 @@ HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk,
|
|||
|
||||
hr = IMarshal_GetUnmarshalClass(pMarshal, riid, pUnk, dwDestContext,
|
||||
pvDestContext, mshlFlags, &marshaler_clsid);
|
||||
if (hr)
|
||||
if (hr != S_OK)
|
||||
{
|
||||
ERR("IMarshal::GetUnmarshalClass failed, 0x%08x\n", hr);
|
||||
goto cleanup;
|
||||
|
@ -1733,7 +1730,7 @@ HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk,
|
|||
|
||||
/* write the common OBJREF header to the stream */
|
||||
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);
|
||||
goto cleanup;
|
||||
|
@ -1749,7 +1746,7 @@ HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk,
|
|||
hr = IMarshal_GetMarshalSizeMax(pMarshal, riid, pUnk, dwDestContext,
|
||||
pvDestContext, mshlFlags,
|
||||
&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);
|
||||
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 */
|
||||
hr = IStream_Write(pStream, &objref,
|
||||
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);
|
||||
goto cleanup;
|
||||
|
@ -1769,7 +1766,7 @@ HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk,
|
|||
hr = IMarshal_MarshalInterface(pMarshal, pStream, riid, pUnk, dwDestContext,
|
||||
pvDestContext, mshlFlags);
|
||||
|
||||
if (hr)
|
||||
if (hr != S_OK)
|
||||
{
|
||||
ERR("Failed to marshal the interface %s, %x\n", debugstr_guid(riid), hr);
|
||||
goto cleanup;
|
||||
|
@ -1821,7 +1818,7 @@ HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
|
|||
|
||||
/* call the helper object to do the actual unmarshaling */
|
||||
hr = IMarshal_UnmarshalInterface(pMarshal, pStream, &iid, (LPVOID*)&object);
|
||||
if (hr)
|
||||
if (hr != S_OK)
|
||||
ERR("IMarshal::UnmarshalInterface failed, 0x%08x\n", hr);
|
||||
|
||||
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");
|
||||
hr = IUnknown_QueryInterface(object, riid, ppv);
|
||||
if (hr)
|
||||
if (hr != S_OK)
|
||||
ERR("Couldn't query for interface %s, hr = 0x%08x\n",
|
||||
debugstr_guid(riid), hr);
|
||||
IUnknown_Release(object);
|
||||
|
@ -1885,7 +1882,7 @@ HRESULT WINAPI CoReleaseMarshalData(IStream *pStream)
|
|||
|
||||
/* call the helper object to do the releasing of marshal data */
|
||||
hr = IMarshal_ReleaseMarshalData(pMarshal, pStream);
|
||||
if (hr)
|
||||
if (hr != S_OK)
|
||||
ERR("IMarshal::ReleaseMarshalData failed with error 0x%08x\n", hr);
|
||||
|
||||
IMarshal_Release(pMarshal);
|
||||
|
|
|
@ -1109,7 +1109,13 @@ HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szDisplayName,
|
|||
|
||||
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;
|
||||
|
||||
*pchEaten = 0;
|
||||
|
|
|
@ -57,13 +57,6 @@ WINE_DECLARE_DEBUG_CHANNEL(accel);
|
|||
* These are static/global variables and internal data structures that the
|
||||
* OLE module uses to maintain it's state.
|
||||
*/
|
||||
typedef struct tagDropTargetNode
|
||||
{
|
||||
HWND hwndTarget;
|
||||
IDropTarget* dropTarget;
|
||||
struct list entry;
|
||||
} DropTargetNode;
|
||||
|
||||
typedef struct tagTrackerWindowInfo
|
||||
{
|
||||
IDataObject* dataObject;
|
||||
|
@ -110,12 +103,25 @@ static LONG OLE_moduleLockCount = 0;
|
|||
/*
|
||||
* 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
|
||||
|
@ -144,22 +150,12 @@ extern void OLEClipbrd_Initialize(void);
|
|||
/******************************************************************************
|
||||
* These are the prototypes of the utility methods used for OLE Drag n Drop
|
||||
*/
|
||||
static void OLEDD_Initialize(void);
|
||||
static DropTargetNode* OLEDD_FindDropTarget(
|
||||
HWND hwndOfTarget);
|
||||
static void OLEDD_FreeDropTarget(DropTargetNode*, BOOL);
|
||||
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 void OLEDD_Initialize(void);
|
||||
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);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* OleBuildVersion [OLE32.@]
|
||||
*/
|
||||
|
@ -270,14 +266,22 @@ HRESULT WINAPI OleInitializeWOW(DWORD x, DWORD y) {
|
|||
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.@)
|
||||
*/
|
||||
HRESULT WINAPI RegisterDragDrop(
|
||||
HWND hwnd,
|
||||
LPDROPTARGET pDropTarget)
|
||||
HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
|
||||
{
|
||||
DropTargetNode* dropTargetInfo;
|
||||
DWORD pid = 0;
|
||||
|
||||
TRACE("(%p,%p)\n", hwnd, pDropTarget);
|
||||
|
||||
|
@ -296,32 +300,20 @@ HRESULT WINAPI RegisterDragDrop(
|
|||
return DRAGDROP_E_INVALIDHWND;
|
||||
}
|
||||
|
||||
/*
|
||||
* First, check if the window is already registered.
|
||||
*/
|
||||
dropTargetInfo = OLEDD_FindDropTarget(hwnd);
|
||||
/* block register for other processes windows */
|
||||
GetWindowThreadProcessId(hwnd, &pid);
|
||||
if (pid != GetCurrentProcessId())
|
||||
{
|
||||
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;
|
||||
|
||||
/*
|
||||
* 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);
|
||||
dropTargetInfo->dropTarget = pDropTarget;
|
||||
|
||||
list_add_tail(&targetListHead, &dropTargetInfo->entry);
|
||||
SetPropW(hwnd, prop_oledroptarget, pDropTarget);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -329,10 +321,9 @@ HRESULT WINAPI RegisterDragDrop(
|
|||
/***********************************************************************
|
||||
* RevokeDragDrop (OLE32.@)
|
||||
*/
|
||||
HRESULT WINAPI RevokeDragDrop(
|
||||
HWND hwnd)
|
||||
HRESULT WINAPI RevokeDragDrop(HWND hwnd)
|
||||
{
|
||||
DropTargetNode* dropTargetInfo;
|
||||
IDropTarget* droptarget;
|
||||
|
||||
TRACE("(%p)\n", hwnd);
|
||||
|
||||
|
@ -342,18 +333,12 @@ HRESULT WINAPI RevokeDragDrop(
|
|||
return DRAGDROP_E_INVALIDHWND;
|
||||
}
|
||||
|
||||
/*
|
||||
* First, check if the window is already registered.
|
||||
*/
|
||||
dropTargetInfo = OLEDD_FindDropTarget(hwnd);
|
||||
|
||||
/*
|
||||
* If it ain't in there, it's an error.
|
||||
*/
|
||||
if (dropTargetInfo==NULL)
|
||||
/* no registration data */
|
||||
if (!(droptarget = OLEDD_FindDropTarget(hwnd)))
|
||||
return DRAGDROP_E_NOTREGISTERED;
|
||||
|
||||
OLEDD_FreeDropTarget(dropTargetInfo, TRUE);
|
||||
IDropTarget_Release(droptarget);
|
||||
RemovePropW(hwnd, prop_oledroptarget);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -371,13 +356,12 @@ HRESULT WINAPI OleRegGetUserType(
|
|||
DWORD dwFormOfType,
|
||||
LPOLESTR* pszUserType)
|
||||
{
|
||||
char keyName[60];
|
||||
WCHAR keyName[60];
|
||||
DWORD dwKeyType;
|
||||
DWORD cbData;
|
||||
HKEY clsidKey;
|
||||
LONG hres;
|
||||
LPSTR buffer;
|
||||
HRESULT retVal;
|
||||
|
||||
/*
|
||||
* Initialize the out parameter.
|
||||
*/
|
||||
|
@ -386,17 +370,17 @@ HRESULT WINAPI OleRegGetUserType(
|
|||
/*
|
||||
* Build the key name we're looking for
|
||||
*/
|
||||
sprintf( keyName, "CLSID\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\\",
|
||||
clsid->Data1, clsid->Data2, clsid->Data3,
|
||||
clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3],
|
||||
clsid->Data4[4], clsid->Data4[5], clsid->Data4[6], clsid->Data4[7] );
|
||||
sprintfW( keyName, clsidfmtW,
|
||||
clsid->Data1, clsid->Data2, clsid->Data3,
|
||||
clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3],
|
||||
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
|
||||
*/
|
||||
hres = RegOpenKeyA(HKEY_CLASSES_ROOT,
|
||||
hres = RegOpenKeyW(HKEY_CLASSES_ROOT,
|
||||
keyName,
|
||||
&clsidKey);
|
||||
|
||||
|
@ -408,8 +392,8 @@ HRESULT WINAPI OleRegGetUserType(
|
|||
*/
|
||||
cbData = 0;
|
||||
|
||||
hres = RegQueryValueExA(clsidKey,
|
||||
"",
|
||||
hres = RegQueryValueExW(clsidKey,
|
||||
emptyW,
|
||||
NULL,
|
||||
&dwKeyType,
|
||||
NULL,
|
||||
|
@ -424,7 +408,7 @@ HRESULT WINAPI OleRegGetUserType(
|
|||
/*
|
||||
* Allocate a buffer for the registry value.
|
||||
*/
|
||||
*pszUserType = CoTaskMemAlloc(cbData*2);
|
||||
*pszUserType = CoTaskMemAlloc(cbData);
|
||||
|
||||
if (*pszUserType==NULL)
|
||||
{
|
||||
|
@ -432,41 +416,24 @@ HRESULT WINAPI OleRegGetUserType(
|
|||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
buffer = HeapAlloc(GetProcessHeap(), 0, cbData);
|
||||
|
||||
if (buffer == NULL)
|
||||
{
|
||||
RegCloseKey(clsidKey);
|
||||
CoTaskMemFree(*pszUserType);
|
||||
*pszUserType=NULL;
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
hres = RegQueryValueExA(clsidKey,
|
||||
"",
|
||||
hres = RegQueryValueExW(clsidKey,
|
||||
emptyW,
|
||||
NULL,
|
||||
&dwKeyType,
|
||||
(LPBYTE) buffer,
|
||||
(LPBYTE) *pszUserType,
|
||||
&cbData);
|
||||
|
||||
RegCloseKey(clsidKey);
|
||||
|
||||
|
||||
if (hres!=ERROR_SUCCESS)
|
||||
if (hres != ERROR_SUCCESS)
|
||||
{
|
||||
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 *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;
|
||||
HWND hwndTrackWindow;
|
||||
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.
|
||||
*/
|
||||
if (!IsValidInterface((LPUNKNOWN)pDropSource))
|
||||
return E_INVALIDARG;
|
||||
|
||||
trackerInfo.dataObject = pDataObject;
|
||||
trackerInfo.dropSource = pDropSource;
|
||||
|
@ -500,12 +469,12 @@ HRESULT WINAPI DoDragDrop (
|
|||
trackerInfo.curTargetHWND = 0;
|
||||
trackerInfo.curDragTarget = 0;
|
||||
|
||||
hwndTrackWindow = CreateWindowA(OLEDD_DRAGTRACKERCLASS, "TrackerWindow",
|
||||
hwndTrackWindow = CreateWindowW(OLEDD_DRAGTRACKERCLASS, trackerW,
|
||||
WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, 0,
|
||||
&trackerInfo);
|
||||
|
||||
if (hwndTrackWindow!=0)
|
||||
if (hwndTrackWindow)
|
||||
{
|
||||
/*
|
||||
* Capture the mouse input
|
||||
|
@ -517,7 +486,7 @@ HRESULT WINAPI DoDragDrop (
|
|||
/*
|
||||
* 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.y = msg.pt.y;
|
||||
|
@ -548,7 +517,7 @@ HRESULT WINAPI DoDragDrop (
|
|||
/*
|
||||
* 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* 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 miscStatusKey;
|
||||
HKEY aspectKey;
|
||||
|
@ -598,17 +569,17 @@ HRESULT WINAPI OleRegGetMiscStatus(
|
|||
/*
|
||||
* Build the key name we're looking for
|
||||
*/
|
||||
sprintf( keyName, "CLSID\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\\",
|
||||
clsid->Data1, clsid->Data2, clsid->Data3,
|
||||
clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3],
|
||||
clsid->Data4[4], clsid->Data4[5], clsid->Data4[6], clsid->Data4[7] );
|
||||
sprintfW( keyName, clsidfmtW,
|
||||
clsid->Data1, clsid->Data2, clsid->Data3,
|
||||
clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3],
|
||||
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
|
||||
*/
|
||||
result = RegOpenKeyA(HKEY_CLASSES_ROOT,
|
||||
result = RegOpenKeyW(HKEY_CLASSES_ROOT,
|
||||
keyName,
|
||||
&clsidKey);
|
||||
|
||||
|
@ -618,8 +589,8 @@ HRESULT WINAPI OleRegGetMiscStatus(
|
|||
/*
|
||||
* Get the MiscStatus
|
||||
*/
|
||||
result = RegOpenKeyA(clsidKey,
|
||||
"MiscStatus",
|
||||
result = RegOpenKeyW(clsidKey,
|
||||
miscstatusW,
|
||||
&miscStatusKey);
|
||||
|
||||
|
||||
|
@ -637,9 +608,9 @@ HRESULT WINAPI OleRegGetMiscStatus(
|
|||
/*
|
||||
* Open the key specific to the requested aspect.
|
||||
*/
|
||||
sprintf(keyName, "%d", dwAspect);
|
||||
sprintfW(keyName, dfmtW, dwAspect);
|
||||
|
||||
result = RegOpenKeyA(miscStatusKey,
|
||||
result = RegOpenKeyW(miscStatusKey,
|
||||
keyName,
|
||||
&aspectKey);
|
||||
|
||||
|
@ -1180,7 +1151,7 @@ static void OLEMenu_UnInitialize(void)
|
|||
*/
|
||||
static BOOL OLEMenu_InstallHooks( DWORD tid )
|
||||
{
|
||||
OleMenuHookItem *pHookItem = NULL;
|
||||
OleMenuHookItem *pHookItem;
|
||||
|
||||
/* Create an entry for the hook table */
|
||||
if ( !(pHookItem = HeapAlloc(GetProcessHeap(), 0,
|
||||
|
@ -1189,15 +1160,16 @@ static BOOL OLEMenu_InstallHooks( DWORD tid )
|
|||
|
||||
pHookItem->tid = tid;
|
||||
pHookItem->hHeap = GetProcessHeap();
|
||||
pHookItem->CallWndProc_hHook = NULL;
|
||||
|
||||
/* 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() );
|
||||
if ( !pHookItem->GetMsg_hHook )
|
||||
goto CLEANUP;
|
||||
|
||||
/* 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() );
|
||||
if ( !pHookItem->CallWndProc_hHook )
|
||||
goto CLEANUP;
|
||||
|
@ -1271,7 +1243,7 @@ CLEANUP:
|
|||
*/
|
||||
static OleMenuHookItem * OLEMenu_IsHookInstalled( DWORD tid )
|
||||
{
|
||||
OleMenuHookItem *pHookItem = NULL;
|
||||
OleMenuHookItem *pHookItem;
|
||||
|
||||
/* Do a simple linear search for an entry whose tid matches ours.
|
||||
* 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)
|
||||
{
|
||||
LPCWPSTRUCT pMsg = NULL;
|
||||
LPCWPSTRUCT pMsg;
|
||||
HOLEMENU hOleMenu = 0;
|
||||
OleMenuDescriptor *pOleMenuDescriptor = 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
|
||||
* the menu message to its active objects window instead. */
|
||||
|
||||
hOleMenu = GetPropA( pMsg->hwnd, "PROP_OLEMenuDescriptor" );
|
||||
hOleMenu = GetPropW( pMsg->hwnd, prop_olemenuW );
|
||||
if ( !hOleMenu )
|
||||
goto NEXTHOOK;
|
||||
|
||||
|
@ -1413,7 +1385,7 @@ static LRESULT CALLBACK OLEMenu_CallWndProc(INT code, WPARAM wParam, LPARAM lPar
|
|||
pOleMenuDescriptor->bIsServerItem = FALSE;
|
||||
|
||||
/* Send this message to the server as well */
|
||||
SendMessageA( pOleMenuDescriptor->hwndActiveObject,
|
||||
SendMessageW( pOleMenuDescriptor->hwndActiveObject,
|
||||
pMsg->message, pMsg->wParam, pMsg->lParam );
|
||||
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 ( pOleMenuDescriptor->bIsServerItem )
|
||||
{
|
||||
SendMessageA( pOleMenuDescriptor->hwndActiveObject,
|
||||
SendMessageW( pOleMenuDescriptor->hwndActiveObject,
|
||||
pMsg->message, pMsg->wParam, pMsg->lParam );
|
||||
}
|
||||
|
||||
|
@ -1481,7 +1453,7 @@ NEXTHOOK:
|
|||
*/
|
||||
static LRESULT CALLBACK OLEMenu_GetMsgProc(INT code, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LPMSG pMsg = NULL;
|
||||
LPMSG pMsg;
|
||||
HOLEMENU hOleMenu = 0;
|
||||
OleMenuDescriptor *pOleMenuDescriptor = 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
|
||||
* the menu message to its active objects window instead. */
|
||||
|
||||
hOleMenu = GetPropA( pMsg->hwnd, "PROP_OLEMenuDescriptor" );
|
||||
hOleMenu = GetPropW( pMsg->hwnd, prop_olemenuW );
|
||||
if ( !hOleMenu )
|
||||
goto NEXTHOOK;
|
||||
|
||||
|
@ -1671,7 +1643,7 @@ HRESULT WINAPI OleSetMenuDescriptor(
|
|||
pOleMenuDescriptor = NULL;
|
||||
|
||||
/* 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 */
|
||||
if ( !OLEMenu_InstallHooks( GetCurrentThreadId() ) )
|
||||
|
@ -1684,7 +1656,7 @@ HRESULT WINAPI OleSetMenuDescriptor(
|
|||
return E_FAIL;
|
||||
|
||||
/* Remove the menu descriptor property from the frame window */
|
||||
RemovePropA( hwndFrame, "PROP_OLEMenuDescriptor" );
|
||||
RemovePropW( hwndFrame, prop_olemenuW );
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
@ -1870,9 +1842,9 @@ void WINAPI ReleaseStgMedium(
|
|||
*/
|
||||
static void OLEDD_Initialize(void)
|
||||
{
|
||||
WNDCLASSA wndClass;
|
||||
WNDCLASSW wndClass;
|
||||
|
||||
ZeroMemory (&wndClass, sizeof(WNDCLASSA));
|
||||
ZeroMemory (&wndClass, sizeof(WNDCLASSW));
|
||||
wndClass.style = CS_GLOBALCLASS;
|
||||
wndClass.lpfnWndProc = OLEDD_DragTrackerWindowProc;
|
||||
wndClass.cbClsExtra = 0;
|
||||
|
@ -1881,58 +1853,7 @@ static void OLEDD_Initialize(void)
|
|||
wndClass.hbrBackground = 0;
|
||||
wndClass.lpszClassName = OLEDD_DRAGTRACKERCLASS;
|
||||
|
||||
RegisterClassA (&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;
|
||||
RegisterClassW (&wndClass);
|
||||
}
|
||||
|
||||
/***
|
||||
|
@ -1958,7 +1879,7 @@ static LRESULT WINAPI OLEDD_DragTrackerWindowProc(
|
|||
{
|
||||
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);
|
||||
|
||||
break;
|
||||
|
@ -1989,7 +1910,7 @@ static LRESULT WINAPI OLEDD_DragTrackerWindowProc(
|
|||
/*
|
||||
* 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
|
||||
{
|
||||
DropTargetNode* newDropTargetNode = 0;
|
||||
|
||||
/*
|
||||
* If we changed window, we have to notify our old target and check for
|
||||
* the new one.
|
||||
*/
|
||||
if (trackerInfo->curDragTarget!=0)
|
||||
{
|
||||
if (trackerInfo->curDragTarget)
|
||||
IDropTarget_DragLeave(trackerInfo->curDragTarget);
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure we're hovering over a window.
|
||||
*/
|
||||
if (hwndNewTarget!=0)
|
||||
if (hwndNewTarget)
|
||||
{
|
||||
/*
|
||||
* 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;
|
||||
|
||||
do {
|
||||
newDropTargetNode = OLEDD_FindDropTarget(nexttar);
|
||||
} while (!newDropTargetNode && (nexttar = GetParent(nexttar)) != 0);
|
||||
if(nexttar) hwndNewTarget = nexttar;
|
||||
new_target = OLEDD_FindDropTarget(next_target_wnd);
|
||||
} while (!new_target && (next_target_wnd = GetParent(next_target_wnd)));
|
||||
|
||||
trackerInfo->curDragTargetHWND = hwndNewTarget;
|
||||
trackerInfo->curDragTarget = newDropTargetNode ? newDropTargetNode->dropTarget : 0;
|
||||
if (next_target_wnd) hwndNewTarget = next_target_wnd;
|
||||
|
||||
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 (trackerInfo->curDragTarget!=0)
|
||||
if (trackerInfo->curDragTarget)
|
||||
{
|
||||
IDropTarget_DragEnter(trackerInfo->curDragTarget,
|
||||
trackerInfo->dataObject,
|
||||
trackerInfo->dwKeyState,
|
||||
trackerInfo->curMousePos,
|
||||
trackerInfo->pdwEffect);
|
||||
hr = IDropTarget_DragEnter(trackerInfo->curDragTarget,
|
||||
trackerInfo->dataObject,
|
||||
trackerInfo->dwKeyState,
|
||||
trackerInfo->curMousePos,
|
||||
trackerInfo->pdwEffect);
|
||||
|
||||
/* failed DragEnter() means invalid target */
|
||||
if (hr != S_OK)
|
||||
{
|
||||
trackerInfo->curDragTargetHWND = 0;
|
||||
trackerInfo->curTargetHWND = 0;
|
||||
trackerInfo->curDragTarget = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2110,24 +2050,28 @@ static void OLEDD_TrackMouseMove(TrackerWindowInfo* trackerInfo)
|
|||
* when that's the case, we must display the standard drag and drop
|
||||
* cursors.
|
||||
*/
|
||||
if (hr==DRAGDROP_S_USEDEFAULTCURSORS)
|
||||
if (hr == DRAGDROP_S_USEDEFAULTCURSORS)
|
||||
{
|
||||
HCURSOR hCur;
|
||||
|
||||
if (*trackerInfo->pdwEffect & DROPEFFECT_MOVE)
|
||||
{
|
||||
SetCursor(LoadCursorA(hProxyDll, MAKEINTRESOURCEA(1)));
|
||||
hCur = LoadCursorW(hProxyDll, MAKEINTRESOURCEW(1));
|
||||
}
|
||||
else if (*trackerInfo->pdwEffect & DROPEFFECT_COPY)
|
||||
{
|
||||
SetCursor(LoadCursorA(hProxyDll, MAKEINTRESOURCEA(2)));
|
||||
hCur = LoadCursorW(hProxyDll, MAKEINTRESOURCEW(2));
|
||||
}
|
||||
else if (*trackerInfo->pdwEffect & DROPEFFECT_LINK)
|
||||
{
|
||||
SetCursor(LoadCursorA(hProxyDll, MAKEINTRESOURCEA(3)));
|
||||
hCur = LoadCursorW(hProxyDll, MAKEINTRESOURCEW(3));
|
||||
}
|
||||
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
|
||||
* inform the target that the operation was cancelled.
|
||||
*/
|
||||
if (trackerInfo->curDragTarget!=0)
|
||||
if (trackerInfo->curDragTarget)
|
||||
{
|
||||
switch (trackerInfo->returnValue)
|
||||
{
|
||||
|
@ -2183,14 +2127,16 @@ static void OLEDD_TrackStateChange(TrackerWindowInfo* trackerInfo)
|
|||
* the drop target that we just dropped the object in it.
|
||||
*/
|
||||
case DRAGDROP_S_DROP:
|
||||
{
|
||||
IDropTarget_Drop(trackerInfo->curDragTarget,
|
||||
trackerInfo->dataObject,
|
||||
trackerInfo->dwKeyState,
|
||||
trackerInfo->curMousePos,
|
||||
trackerInfo->pdwEffect);
|
||||
break;
|
||||
}
|
||||
if (*trackerInfo->pdwEffect != DROPEFFECT_NONE)
|
||||
IDropTarget_Drop(trackerInfo->curDragTarget,
|
||||
trackerInfo->dataObject,
|
||||
trackerInfo->dwKeyState,
|
||||
trackerInfo->curMousePos,
|
||||
trackerInfo->pdwEffect);
|
||||
else
|
||||
IDropTarget_DragLeave(trackerInfo->curDragTarget);
|
||||
break;
|
||||
|
||||
/*
|
||||
* If the source told us that we should cancel, fool the drop
|
||||
* target by telling it that the mouse left it's window.
|
||||
|
@ -2256,13 +2202,13 @@ static void OLEUTL_ReadRegistryDWORDValue(
|
|||
HKEY regKey,
|
||||
DWORD* pdwValue)
|
||||
{
|
||||
char buffer[20];
|
||||
WCHAR buffer[20];
|
||||
DWORD cbData = sizeof(buffer);
|
||||
DWORD dwKeyType;
|
||||
DWORD cbData = 20;
|
||||
LONG lres;
|
||||
|
||||
lres = RegQueryValueExA(regKey,
|
||||
"",
|
||||
lres = RegQueryValueExW(regKey,
|
||||
emptyW,
|
||||
NULL,
|
||||
&dwKeyType,
|
||||
(LPBYTE)buffer,
|
||||
|
@ -2278,7 +2224,7 @@ static void OLEUTL_ReadRegistryDWORDValue(
|
|||
case REG_EXPAND_SZ:
|
||||
case REG_MULTI_SZ:
|
||||
case REG_SZ:
|
||||
*pdwValue = (DWORD)strtoul(buffer, NULL, 10);
|
||||
*pdwValue = (DWORD)strtoulW(buffer, NULL, 10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1314,6 +1314,13 @@ static HRESULT PropertyStorage_ReadFromStream(PropertyStorage_impl *This)
|
|||
hr = PropertyStorage_ReadFmtIdOffsetFromStream(This->stm, &fmtOffset);
|
||||
if (FAILED(hr))
|
||||
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)
|
||||
{
|
||||
WARN("invalid offset %d (stream length is %d)\n", fmtOffset.dwOffset,
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -263,6 +263,7 @@ struct StorageBaseImplVtbl {
|
|||
HRESULT (*StreamReadAt)(StorageBaseImpl*,DirRef,ULARGE_INTEGER,ULONG,void*,ULONG*);
|
||||
HRESULT (*StreamWriteAt)(StorageBaseImpl*,DirRef,ULARGE_INTEGER,ULONG,const void*,ULONG*);
|
||||
HRESULT (*StreamSetSize)(StorageBaseImpl*,DirRef,ULARGE_INTEGER);
|
||||
HRESULT (*StreamLink)(StorageBaseImpl*,DirRef,DirRef);
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/* 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
|
||||
*/
|
||||
|
@ -513,13 +524,22 @@ void StorageUtl_CopyDirEntryToSTATSTG(StorageBaseImpl *storage,STATSTG* destinat
|
|||
* The BlockChainStream class is a utility class that is used to create an
|
||||
* 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
|
||||
{
|
||||
StorageImpl* parentStorage;
|
||||
ULONG* headOfStreamPlaceHolder;
|
||||
DirRef ownerDirEntry;
|
||||
ULONG lastBlockNoInSequence;
|
||||
ULONG lastBlockNoInSequenceIndex;
|
||||
struct BlockChainRun* indexCache;
|
||||
ULONG indexCacheLen;
|
||||
ULONG indexCacheSize;
|
||||
ULONG tailIndex;
|
||||
ULONG numBlocks;
|
||||
};
|
||||
|
|
|
@ -2761,7 +2761,8 @@ void CALLBACK IAdviseSink_OnDataChange_Proxy(
|
|||
FORMATETC *pFormatetc,
|
||||
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(
|
||||
|
@ -2769,8 +2770,9 @@ HRESULT __RPC_STUB IAdviseSink_OnDataChange_Stub(
|
|||
FORMATETC *pFormatetc,
|
||||
ASYNC_STGMEDIUM *pStgmed)
|
||||
{
|
||||
FIXME(":stub\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p, %p)\n", This, pFormatetc, pStgmed);
|
||||
IAdviseSink_OnDataChange(This, pFormatetc, pStgmed);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CALLBACK IAdviseSink_OnViewChange_Proxy(
|
||||
|
@ -2778,7 +2780,8 @@ void CALLBACK IAdviseSink_OnViewChange_Proxy(
|
|||
DWORD dwAspect,
|
||||
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(
|
||||
|
@ -2786,64 +2789,73 @@ HRESULT __RPC_STUB IAdviseSink_OnViewChange_Stub(
|
|||
DWORD dwAspect,
|
||||
LONG lindex)
|
||||
{
|
||||
FIXME(":stub\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%d, %d)\n", This, dwAspect, lindex);
|
||||
IAdviseSink_OnViewChange(This, dwAspect, lindex);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CALLBACK IAdviseSink_OnRename_Proxy(
|
||||
IAdviseSink* This,
|
||||
IMoniker *pmk)
|
||||
{
|
||||
FIXME(":stub\n");
|
||||
TRACE("(%p)->(%p)\n", This, pmk);
|
||||
IAdviseSink_RemoteOnRename_Proxy(This, pmk);
|
||||
}
|
||||
|
||||
HRESULT __RPC_STUB IAdviseSink_OnRename_Stub(
|
||||
IAdviseSink* This,
|
||||
IMoniker *pmk)
|
||||
{
|
||||
FIXME(":stub\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", This, pmk);
|
||||
IAdviseSink_OnRename(This, pmk);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CALLBACK IAdviseSink_OnSave_Proxy(
|
||||
IAdviseSink* This)
|
||||
{
|
||||
FIXME(":stub\n");
|
||||
TRACE("(%p)\n", This);
|
||||
IAdviseSink_RemoteOnSave_Proxy(This);
|
||||
}
|
||||
|
||||
HRESULT __RPC_STUB IAdviseSink_OnSave_Stub(
|
||||
IAdviseSink* This)
|
||||
{
|
||||
FIXME(":stub\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)\n", This);
|
||||
IAdviseSink_OnSave(This);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CALLBACK IAdviseSink_OnClose_Proxy(
|
||||
IAdviseSink* This)
|
||||
{
|
||||
FIXME(":stub\n");
|
||||
TRACE("(%p)\n", This);
|
||||
IAdviseSink_RemoteOnClose_Proxy(This);
|
||||
}
|
||||
|
||||
HRESULT __RPC_STUB IAdviseSink_OnClose_Stub(
|
||||
IAdviseSink* This)
|
||||
{
|
||||
FIXME(":stub\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)\n", This);
|
||||
IAdviseSink_OnClose(This);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CALLBACK IAdviseSink2_OnLinkSrcChange_Proxy(
|
||||
IAdviseSink2* This,
|
||||
IMoniker *pmk)
|
||||
{
|
||||
FIXME(":stub\n");
|
||||
TRACE("(%p)->(%p)\n", This, pmk);
|
||||
IAdviseSink2_RemoteOnLinkSrcChange_Proxy(This, pmk);
|
||||
}
|
||||
|
||||
HRESULT __RPC_STUB IAdviseSink2_OnLinkSrcChange_Stub(
|
||||
IAdviseSink2* This,
|
||||
IMoniker *pmk)
|
||||
{
|
||||
FIXME(":stub\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p)->(%p)\n", This, pmk);
|
||||
IAdviseSink2_OnLinkSrcChange(This, pmk);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CALLBACK IDataObject_GetData_Proxy(
|
||||
|
|
Loading…
Reference in a new issue