c# - How to get DropSource from DoDragDrop API Hooking -
i hooked dodragdrop
api explorer , getting dragged files path idataobject working dropsource
path. can dropsource
path dodragdrop
, possibilities hooking or follow other way.
below code dragged files idataobject.
public class main : easyhook.ientrypoint { dragdrop_console.remotemon interface; public localhook dragdrophook; public main(remotehooking.icontext incontext, string inchannelname) { try { interface = remotehooking.ipcconnectclient<dragdrop_console.remotemon>(inchannelname); } catch (argumentexception ex) { interface.errorhandle(ex); } } public void run(remotehooking.icontext incontext, string inchannelname) { try { dragdrophook = localhook.create(localhook.getprocaddress("ole32.dll", "dodragdrop"), new dragdropdelegate(dodragdrophook), this); dragdrophook.threadacl.setexclusiveacl(new int32[] { 0 }); } catch (exception ex) { interface.errorhandle(ex); return; } interface.isinstalled(remotehooking.getcurrentprocessid()); remotehooking.wakeupprocess(); while (true) { thread.sleep(1000); } } [dllimport("ole32.dll", charset = charset.unicode, setlasterror = true, callingconvention = callingconvention.stdcall)] static extern int dodragdrop(idataobject pdataobj, idropsource pdropsource, uint dwokeffects, uint[] pdweffect); [unmanagedfunctionpointer(callingconvention.stdcall, charset = charset.ansi, setlasterror = true)] delegate int dragdropdelegate(idataobject pdataobj, idropsource pdropsource, uint dwokeffects, uint[] pdweffect); [comimport, guid("00000121-0000-0000-c000-000000000046"), interfacetype(cominterfacetype.interfaceisiunknown)] public interface idropsource { [preservesig] uint querycontinuedrag([marshalas(unmanagedtype.bool)] bool fescapepressed, uint grfkeystate); [preservesig] uint givefeedback(uint dweffect); } int dodragdrophook(idataobject pdataobj, idropsource pdropsource, uint dwokeffects, uint[] pdweffect) { // enumerate pdataobj structure } } }
Comments
Post a Comment