Hooking Ole32.dll Drag and Drop functionality in outlook
Is someone here familiar with the way Drag & Drop works on windows? I am trying to hook into the new outlook to somehow be able to have my program as a drag & drop target as the information the new outlook provides to other programs does not seem to suffice to read the actual dropped file - I am trying to use easyhook for this. I know it somehow has to be possible as drag & drop works for windows explorer. I have found multiple reports online of people reporting the same issue
1 Reply
CFSTR_PERFORMEDDROPEFFECT
This format identifier is used by the target to inform the data object through its IDataObject::SetData method of the outcome of a data transfer. The data is an STGMEDIUM structure that contains a global memory object. The structure's hGlobal member points to a DWORD set to the appropriate DROPEFFECT value, normally DROPEFFECT_MOVE or DROPEFFECT_COPY.
This format is normally used when the outcome of an operation can be either move or copy, such as in an optimized move or delete-on-paste operation. It provides a reliable way for the target to tell the data object what actually happened. It was introduced because the value of pdwEffect returned by DoDragDrop did not reliably indicate which operation had taken place. The CFSTR_PERFORMEDDROPEFFECT format is the reliable way to indicate that an unoptimized move has taken place.
I think that's what's going on in Chrome.
It is hard coded for Shell targets. What it does, I believe, is this sequence:
a) It creates an empty temporary file in that temporary directory.
b) It does DoDragDrop, with CF_HDROP, pointing to that file.
c) Explorer eventually conducts the Move of the empty temporary file.
d) Chrome can query the data object again to determine what the result of Explorer's operation was. That is, it can see that Explorer moved the temporary file to a certain path.
e) Chrome now knows the target path! It starts a file download, through it's normal download infrastructure, except the eventual target path is what Explorer told it.
So the actual write of the REAL file is done directly by Chrome.
Explorer is only moving an empty temporary file.
Because Chrome is a web browser, generally a drag/drop operation is going to be some background download. Through the Download Manager. So, it doesn't typically even have a file at that time to give to Explorer. Instead, the DoDragDrop is just using a fake file, so it can collect the target, and then start a real download in the background.
Outlook is written in HTML running in WebView2 which is Chrome. So, the only tools they had for DragAndDrop were those that were built into Chrome. So, they, in the background, simulate it by considering the .eml file a fake URL.