Unable to hook DoDragDrop method of Ole32.dll

Mar 22 at 3:17 AM
Hi,
I am developing an Outlook Plugin using VSTO where I want to hook to DoDragDrop method defined in Ole32.dll,but somehow that call is not getting intercepted.

This is what I have tried till now reading on the various websites.I have used EasyHook to achieve the same..I have been able to hook to CreateFile APIs though.
public partial class DragDrop
    {

        private LocalHook DragDropHook;
        Stack<String> Queue = new Stack<string>();

        internal class HookCallbackHelper
        {
            public HookCallbackHelper(bool isUnicode) { IsUnicode = isUnicode; }
            public bool IsUnicode;
        }
        private void DragDrop_Load(object sender, RibbonUIEventArgs e)
        {

        }

        private void btnHook_Click(object sender, RibbonControlEventArgs e)
        {
            try
            {

                DragDropHook = LocalHook.Create(LocalHook.GetProcAddress("Ole32.dll", "DoDragDrop"),
                    new DDoDragDrop(DoDragDrop_Hooked),new HookCallbackHelper(true));

                DragDropHook.ThreadACL.SetExclusiveACL(new Int32[] { 0 });


            }
            catch (Exception ExtInfo)
            {
                System.Windows.Forms.MessageBox.Show(ExtInfo.Message);
                //Interface.ReportException(ExtInfo);

                return;
            }
        }

        private int DoDragDrop_Hooked(IDataObject pDataObj, IDropSource pDropSource, uint dwOKEffects, uint[] pdwEffect)
        {
            

            System.Windows.Forms.MessageBox.Show("Hooked");

            try
            {

                HookCallbackHelper hch = HookRuntimeInfo.Callback as HookCallbackHelper;
                lock (Queue)
                {
                    Queue.Push("[" + RemoteHooking.GetCurrentProcessId() + ":" +
                        RemoteHooking.GetCurrentThreadId() + "]");
                }
            }
            catch
            {
            }

            // call original API...
            return DoDragDrop(pDataObj, pDropSource, dwOKEffects, pdwEffect);
        }

        [UnmanagedFunctionPointer(CallingConvention.StdCall,
            CharSet = CharSet.Ansi,
            SetLastError = true)]
        public delegate int DDoDragDrop(
            IDataObject pDataObj,
            IDropSource pDropSource,
            UInt32 dwOKEffects,
            UInt32[] pdwEffect
        );

        [DllImport("Ole32.dll",
            CharSet = CharSet.Unicode,
            SetLastError = true,
            CallingConvention = CallingConvention.StdCall)]
        public static extern int DoDragDrop(IDataObject pDataObj, IDropSource pDropSource,
           UInt32 dwOKEffects, UInt32[] pdwEffect);
    }

    [ComImport, Guid("00000121-0000-0000-C000-000000000046"),
        InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IDropSource
    {
        [PreserveSig]
        UInt32 QueryContinueDrag(
        [MarshalAs(UnmanagedType.Bool)] bool fEscapePressed,
        UInt32 grfKeyState);

        [PreserveSig]
        UInt32 GiveFeedback(
        UInt32 dwEffect);
    }
Please help me if missing anything or any error in defining the signature of the function.