Page 1 of 1

copy files on desktop

Posted: Wed Oct 11, 2017 7:30 am
by NobMiwa
Hello,

I want to hook "copy" files on desktop by user mouse operation.
I hooked CreateFileW and CopyFileW and copy file on desktop.
But I could not get information.

Could you tell me what API is Explorer using ?

Regards,
Nobuo Miwa

Re: copy files on desktop

Posted: Wed Oct 11, 2017 3:57 pm
by iconic
Newer shells no longer use shell APIs such as SHFileOperation()-> FO_COPY but instead use the IFileOperation interface based on COM when performing Desktop file actions. You can hook OLE32.dll!CoCreateInstance() and setup interface method hooks on CopyItem and CopyItems. The last parameter of CoCreateInstance() is a returned interface pointer which you can then index into in order to access the method table. CopyItem and CopyItems have the index of 16 and 17 in the method table of function pointers, respectively. MCH can be used for such purposes however it's not as simple as hooking a named export with the likes of HookApi() but still relatively a simple task ;)

--Iconic

Re: copy files on desktop

Posted: Mon Oct 16, 2017 8:46 am
by madshi
Iconic is right, of course, as always.

Here's some more information on how to hook COM object methods:

viewtopic.php?f=7&t=27248