Exemplo n.º 1
0
 public HookBinding(IBindingMethod bindingMethod, HookType hookType, BindingScope bindingScope, int hookOrder)
     : base(bindingMethod)
 {
     HookOrder = hookOrder;
     HookType = hookType;
     BindingScope = bindingScope;
 }
    public static void SetHook(
        HookType hookType,
        AssemblyDefinition targetAssembly, string targetName,
        AssemblyDefinition calleeAssembly, string calleeName)
    {
        int i0 = targetName.LastIndexOf('.');
        if (i0 < 0)
        {
            throw new Exception(string.Format("SetHook - Error : Bad Name ({0})", targetName));
        }
        string targetTypeName = targetName.Substring(0, i0);
        string targetMethodName = targetName.Substring(i0 + 1);

        int i1 = calleeName.LastIndexOf('.');
        if (i1 < 0)
        {
            throw new Exception(string.Format("SetHook - Error : Bad Name ({0})", calleeName));
        }
        string calleeTypeName = calleeName.Substring(0, i1);
        string calleeMethodName = calleeName.Substring(i1 + 1);

        SetHook(hookType,
                targetAssembly, targetTypeName, targetMethodName,
                calleeAssembly, calleeTypeName, calleeMethodName);
    }
Exemplo n.º 3
0
 public static void AddMethod(Function func, HookType type)
 {
     switch (type)
     {
         case HookType.Update:
             UpdateLoop += func;
             break;
         case HookType.Render:
             RenderLoop += func;
             break;
         case HookType.GUI:
             GUILoop += func;
             break;
         case HookType.FixedUpdate:
             FixedUpdateLoop += func;
             break;
         case HookType.LateUpdate:
             LateUpdateLoop += func;
             break;
         case HookType.PreRender:
             PreRenderLoop += func;
             break;
         case HookType.PostRender:
             PostRenderLoop += func;
             break;
         case HookType.Dispose:
             DisposeFunc += func;
             break;
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookEntityMetadata" /> class.
 /// </summary>
 /// <param name="hookType"></param>
 /// <param name="entry"></param>
 /// <param name="state">The state.</param>
 /// <param name="context">The optional existing context (I believe this is usable for migrations).</param>
 public HookEntityMetadata(HookType hookType, HookedEntityEntry entry, EntityState state, System.Data.Entity.DbContext context = null)
 {
     HookType = hookType;
     Entry = entry;
     _state = state;
     CurrentContext = context;
 }
		public ArrayList GetHooks (HookType hookType, HookDir dir, HookAction action, Type type, string member)
		{
			if (dir == HookDir.Read)
				return FindHook (ReaderHooks, hookType, action, type, member);
			else
				return FindHook (WriterHooks, hookType, action, type, member);
		}
    public static void SetHook(
        HookType hookType,
        AssemblyDefinition targetAssembly, string targetTypeName, string targetMethodName,
        AssemblyDefinition calleeAssembly, string calleeTypeName, string calleeMethodName)
    {
#if DEBUG
        Console.WriteLine("SetHook - {0}/{1}|{2} -> {3}/{4}|{5}", targetAssembly.Name.Name, targetTypeName, targetMethodName, calleeAssembly.Name.Name, calleeTypeName, calleeMethodName);
#endif
        TypeDefinition calleeTypeDefinition = calleeAssembly.MainModule.GetType(calleeTypeName);
        if (calleeTypeDefinition == null)
        {
            throw new Exception(string.Format("Error ({0}) : {1} is not found", calleeAssembly.Name, calleeTypeName));
        }

        MethodDefinition calleeMethod = GetMethod(calleeTypeDefinition, calleeMethodName);
        if (calleeMethod == null)
        {
            throw new Exception(string.Format("Error ({0}) : {1}.{2} is not found", calleeAssembly.Name, calleeTypeName, calleeMethodName));
        }

        TypeDefinition targetTypeDefinition = targetAssembly.MainModule.GetType(targetTypeName);
        if (targetTypeDefinition == null)
        {
            throw new Exception(string.Format("Error ({0}) : {1} is not found", targetAssembly.Name, targetTypeName));
        }

        MethodDefinition targetMethod = GetMethod(targetTypeDefinition, targetMethodName);
        if (targetMethod == null)
        {
            throw new Exception(string.Format("Error ({0}) : {1}.{2} is not found", targetAssembly.Name, targetTypeName, targetMethodName));
        }
        HookMethod(hookType, targetAssembly.MainModule, targetMethod, calleeMethod);
    }
Exemplo n.º 7
0
 /// <summary>
 /// Creates a new hook.
 /// </summary>
 public Hook(HookType type, bool wrapCallback, bool global)
     : this()
 {
     this.type = type;
     this.wrapCallback = wrapCallback;
     this.global = global;
 }
Exemplo n.º 8
0
 private double GetConfinementModifier(HookType hookType, bool enclosingRebarIsPerpendicular, double enclosingRebarSpacing)
 {
     double confinementModifier=1.0;
     if (hookType== HookType.Degree90 && db<=11/8)
     {
         //      (b) For 90-degree hooks of No. 11 and smaller bars
         //      that are either enclosed within ties or stirrups
         //      perpendicular to the bar being developed, spaced
         //      not greater than 3db along ldh; or enclosed within
         //      ties or stirrups parallel to the bar being developed,
         //      spaced not greater than 3db along the length of the
         //      tail extension of the hook plus bend.................... 0.8
         if (enclosingRebarIsPerpendicular == true && enclosingRebarSpacing <= 3.0 * db)
         {
             confinementModifier = SetConfinementModifier();
         } 
         if (enclosingRebarIsPerpendicular ==true && enclosingRebarSpacing<3.0*db)
         {
             confinementModifier = SetConfinementModifier();
         }
     }
     if (hookType== HookType.Degree180 && db<=11/8)
     {
         if (enclosingRebarIsPerpendicular==true && enclosingRebarSpacing<=3*db)
         {
             confinementModifier = SetConfinementModifier();
         }
     }
     return confinementModifier;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseHook"/> class.
 /// </summary>
 /// <param name="hookType">Type of the hook.</param>
 /// <param name="install">if set to <c>true</c> [install].</param>
 internal BaseHook(HookType hookType, bool install)
     : this(hookType)
 {
     if (install)
     {
         this.Install();
     }
 }
Exemplo n.º 10
0
 public WM_TouchHook(IntPtr hWnd, HookType hookType) : base(hWnd, hookType)
 {
     this.scalingFactorX = 1f;
     this.scalingFactorY = 1f;
     DisableNativePressAndHoldGesture = true;
     this.mdTouchInputSize = Marshal.SizeOf(new TOUCHINPUT());
     this.gestureDelegate = new Win32.WndProcDelegate(this.GestureWndProc);
 }
Exemplo n.º 11
0
 internal HookBase(HookType type)
 {
     _hType = type;
     _hProc = new HookProc(HookProcBase);
     using (Process p = Process.GetCurrentProcess())
     using (ProcessModule pm = p.MainModule)
         _hHook = SetWindowsHookEx((int)_hType, _hProc, GetModuleHandle(pm.ModuleName), 0);
 }
Exemplo n.º 12
0
 public WindowsHook(IntPtr hWnd, HookType hook, HookDelegate proc)
 {
     this.hHook = IntPtr.Zero;
     this.hWnd = IntPtr.Zero;
     this.hWnd = hWnd;
     this.hookType = hook;
     this.hookDelegate = proc;
 }
Exemplo n.º 13
0
 public WindowsHook(IntPtr hWnd, HookType hook)
 {
     this.hHook = IntPtr.Zero;
     this.hWnd = IntPtr.Zero;
     this.hWnd = hWnd;
     this.hookType = hook;
     this.hookDelegate = new HookDelegate(this.CoreHookProc);
 }
Exemplo n.º 14
0
        private IEnumerable<IHookBinding> GetHookList(HookType bindingEvent)
        {
            List<IHookBinding> list;
            if (hooks.TryGetValue(bindingEvent, out list))
                return list;

            return Enumerable.Empty<IHookBinding>();
        }
Exemplo n.º 15
0
 internal HookHandle(HookType hookType, HookProc hookProc) : base(IntPtr.Zero, false)
 {
     GCHandle.Alloc(hookProc);
     handle = User32.SetWindowsHookEx(hookType, hookProc, IntPtr.Zero, IntPtr.Zero);
     if (handle == IntPtr.Zero)
     {
         IsInvalid = true;
     }
 }
        protected override bool ValidateHook(BindingSourceMethod bindingSourceMethod, BindingSourceAttribute hookAttribute, HookType hookType)
        {
            //TODO: this call will be refactored when binding error detecttion will be improved in v2 - currently implemented here for backwards compatibility
            if (!IsScenarioSpecificHook(hookType) &&
                !bindingSourceMethod.IsStatic)
                throw errorProvider.GetNonStaticEventError(bindingSourceMethod.BindingMethod);

            return base.ValidateHook(bindingSourceMethod, hookAttribute, hookType);
        }
Exemplo n.º 17
0
        public static void Install()
        {
            _hookDelegate = Hook;

                        IntPtr addr = Kernel32.GetProcAddress(Kernel32.GetModuleHandle("ws2_32.dll"), "WSAAsyncGetHostByName");

                        _originalDelegate = (HookType) Marshal.GetDelegateForFunctionPointer(addr, typeof (HookType));

                        HookHelper.Jump(_hookAddress, Marshal.GetFunctionPointerForDelegate(_hookDelegate));
        }
Exemplo n.º 18
0
 protected bool IsScenarioSpecificHook(HookType hookType)
 {
     return
         hookType == HookType.BeforeScenario ||
         hookType == HookType.AfterScenario ||
         hookType == HookType.BeforeScenarioBlock ||
         hookType == HookType.AfterScenarioBlock ||
         hookType == HookType.BeforeStep ||
         hookType == HookType.AfterStep;
 }
Exemplo n.º 19
0
        private List<IHookBinding> GetHookList(HookType bindingEvent)
        {
            List<IHookBinding> list;
            if (!hooks.TryGetValue(bindingEvent, out list))
            {
                list = new List<IHookBinding>();
                hooks.Add(bindingEvent, list);
            }

            return list;
        }
Exemplo n.º 20
0
 public static int GetHookType(HookType type)
 {
     switch (type)
     {
         case HookType.Lava:
             return 1150888;
         case HookType.Dredging:
             return 1150890;
         case HookType.JunkProof:
             return 1150883;
     }
     return 0;
 }
 public SvnChangeInfoEventArgsWrapper(HookType hookType, SvnChangeInfoEventArgs svnChangeInfoEventArgs)
 {
     this.HookType = hookType;
       this.BaseRevision = svnChangeInfoEventArgs.BaseRevision;
       this.Author = svnChangeInfoEventArgs.Author;
       this.LogMessage = svnChangeInfoEventArgs.LogMessage;
       this.Revision = svnChangeInfoEventArgs.Revision;
       this.Time = svnChangeInfoEventArgs.Time;
       this.AffectedItems = new List<IRepoAffectedItem>();
       foreach (SvnChangeItem item in svnChangeInfoEventArgs.ChangedPaths)
       {
     this.AffectedItems.Add(new SvnChangeItemWrapper(item));
       }
 }
Exemplo n.º 22
0
 public static IEnumerable<Hook> CollectHooks(HookType hookType, Type type) {
   if (type.BaseType != null)
     foreach (var hook in CollectHooks(hookType, type.BaseType))
       yield return hook;
   if (HasStorableClassAttribute(type)) {
     foreach (MethodInfo methodInfo in type.GetMethods(DECLARED_INSTANCE_MEMBERS)) {
       if (methodInfo.ReturnType == typeof(void) && methodInfo.GetParameters().Length == 0) {
         foreach (StorableHookAttribute hook in methodInfo.GetCustomAttributes(typeof(StorableHookAttribute), false)) {
           if (hook != null && hook.HookType == hookType) {
             yield return CreateHook(methodInfo);
           }
         }
       }
     }
   }
 }
Exemplo n.º 23
0
    public static void SetHook(
        HookType hookType,
        AssemblyDefinition targetAssembly, string targetName,
        AssemblyDefinition calleeAssembly, string calleeName)
    {
        string targetTypeName;
        string targetMethodName;
        SplitName(targetName, out targetTypeName, out targetMethodName);

        string calleeTypeName;
        string calleeMethodName;
        SplitName(calleeName, out calleeTypeName, out calleeMethodName);

        SetHook(hookType,
                targetAssembly, targetTypeName, targetMethodName,
                calleeAssembly, calleeTypeName, calleeMethodName);
    }
Exemplo n.º 24
0
        public static bool SetHookValue(HookType type, int index, Composite value, bool insert = false)
        {
            if (!TreeHooks.Instance.Hooks.ContainsKey(type.ToString())) return false;

            if (!insert)
            {
                TreeHooks.Instance.Hooks[type.ToString()][index] = value;
                Logger.DBLog.DebugFormat("Replaced Hook [{0}]", type.ToString());
                return true;
            }
            else
            {
                TreeHooks.Instance.Hooks[type.ToString()].Insert(index, value);
                Logger.DBLog.DebugFormat("Inserted composite for Hook [{0}] at index {1}", type.ToString(), index);
                return true;
            }
        }
Exemplo n.º 25
0
        internal static void Install(HookType hook)
        {
            var hookLocation1 = new IntPtr(0x005D53B1);
                        var hookLocation = new IntPtr(0x005D5590);

                        IntPtr codeCave2 = Marshal.AllocHGlobal(4);

                        IntPtr codeCave1 = Marshal.AllocHGlobal(128);

                        byte[] code1 = FasmNet.Assemble(new[]
                                {
                                        "use32",
                                        "org " + codeCave1,
                                        "push esi",
                                        "push edi",
                                        "mov esi, dword[ebx+0x10]",
                                        "mov dword[" + codeCave2 + "],esi",
                                        "lea esi, dword[ebx+0x78]",
                                        "jmp " + (hookLocation1 + 5)
                                });
                        Marshal.Copy(code1, 0, codeCave1, code1.Length);

                        HookHelper.Jump(hookLocation1, codeCave1);

                        IntPtr codeCave = Marshal.AllocHGlobal(128);

                        byte[] code = FasmNet.Assemble(new[]
                                {
                                        "use32",
                                        "org " + codeCave,
                                        "push dword [ebp+0x8]",
                                        "push dword [" + codeCave2 + "]",
                                        "call " + Marshal.GetFunctionPointerForDelegate(hook),
                                        "pop edi",
                                        "pop esi",
                                        "pop ebx",
                                        "leave",
                                        "retn 8"
                                });
                        Marshal.Copy(code, 0, codeCave, code.Length);

                        HookHelper.Jump(hookLocation, codeCave);
        }
Exemplo n.º 26
0
        internal static void Install(HookType hook)
        {
            var hookLocation = new IntPtr(0x0A2B2E8);

                        IntPtr codeCave = Marshal.AllocHGlobal(128);

                        byte[] code = FasmNet.Assemble(new[]
                                {
                                        "use32",
                                        "org " + codeCave,
                                        "pushad",
                                        "call " + Marshal.GetFunctionPointerForDelegate(hook),
                                        "popad",
                                        "retn"
                                });
                        Marshal.Copy(code, 0, codeCave, code.Length);

                        Marshal.WriteIntPtr(hookLocation, codeCave);
        }
        public double GetDevelopmentLength(HookType hookType, double sideCover, double barExtensionCover, bool enclosingRebarIsPerpendicular, double enclosingRebarSpacing)
        {
            double ldh = this.GetBasicDevelopmentLength();
            //ldh modifiers per 12.5.3 
            // (a)
            double SideCoverModifier = GetSideCoverModifier(hookType, sideCover, barExtensionCover); 
            // (b) & (c)
            double ConfinementModifier = GetConfinementModifier(hookType, enclosingRebarIsPerpendicular, enclosingRebarSpacing);
            // (d) -- see below
           
                if (SideCoverModifier==0.0 || ConfinementModifier==0.0)
                {
                    throw new Exception("Hook development modifiers cannot be 0");
                }
            ldh = ldh * SideCoverModifier * ConfinementModifier;
            ldh = this.CheckDevelopmentLengthForExcessAndMinimum(ldh);

            return ldh;
          }
Exemplo n.º 28
0
        internal static void Install(HookType hook)
        {
            var hookLocation = new IntPtr(0x007B25F6);

                        IntPtr codeCave = Marshal.AllocHGlobal(128);

                        byte[] code = FasmNet.Assemble(new[]
                                {
                                        "use32",
                                        "org " + codeCave,
                                        "mov dword[esi+0x88],ecx",
                                        "pushad",
                                        "push dword[esi+0x2C]",
                                        "call " + Marshal.GetFunctionPointerForDelegate(hook),
                                        "popad",
                                        "jmp " + (hookLocation + 6)
                                });
                        Marshal.Copy(code, 0, codeCave, code.Length);

                        HookHelper.Jump(hookLocation, codeCave);
        }
Exemplo n.º 29
0
        public SharpHook(HookType hookType)
        {
            using (Process process = Process.GetCurrentProcess())
            using (ProcessModule module = process.MainModule)
            {
                IntPtr hModule = Win32API.GetModuleHandle(module.ModuleName);

                if ((hookType & HookType.Keyboard) > 0)
                {
                    keyboardHookProc = new Win32API.HookProc(KeyboardHookProc);
                    keyboardHook = Win32API.SetWindowsHookEx(Win32API.HookType.WH_KEYBOARD_LL, keyboardHookProc, hModule, 0);
                }

                if ((hookType & HookType.Mouse) > 0)
                {
                    Debug.WriteLine("DoubleClickTime: " + Win32API.GetDoubleClickTime());

                    mouseHookProc = new Win32API.HookProc(MouseHookProc);
                    mouseHook = Win32API.SetWindowsHookEx(Win32API.HookType.WH_MOUSE_LL, mouseHookProc, hModule, 0);
                }
            }
        }
Exemplo n.º 30
0
    public static void HookMethod(
        HookType hookType,
        ModuleDefinition targetModule, MethodDefinition targetMethod,
        MethodDefinition calleeMethod)
    {
        ILProcessor l = targetMethod.Body.GetILProcessor();
        Instruction instInsertPoint = targetMethod.Body.Instructions.First();

        if (hookType == HookType.PostCall)
        {
            instInsertPoint = targetMethod.Body.Instructions.Last();
        }

        InsertInstDelegate o = newInst =>
        {
            l.InsertBefore(instInsertPoint, newInst);
        };

        int n = targetMethod.Parameters.Count + (targetMethod.IsStatic ? 0 : 1);
        for (int i = 0; i < n; i++)
        {
            if (i == 0)
            {
                o(l.Create(OpCodes.Ldarg_0));
            }
            else
            {
                // ref 参照にしたい場合は OpCodes.Ldarga にすること
                o(l.Create(OpCodes.Ldarg, i));
            }
        }
        o(l.Create(OpCodes.Call, targetModule.Import(calleeMethod)));

        // PreJumpの場合は元の処理を行わないように、そのままRetする
        if (hookType == HookType.PreJump)
        {
            o(l.Create(OpCodes.Ret));
        }
    }
Exemplo n.º 31
0
 public static extern IntPtr SetWindowsHookEx(HookType code,
                                              HookProc func,
                                              IntPtr hInstance,
                                              int threadID);
Exemplo n.º 32
0
 public static extern IntPtr SetWindowsHookEx(HookType hookType, HookProc callback, IntPtr hMod, uint dwThreadId);
Exemplo n.º 33
0
 public static extern int SetWindowsHookEx(
     HookType idHook,
     HookProc lpfn,
     IntPtr hInstance,
     int threadId
     );
Exemplo n.º 34
0
 public LocalWindowsHook(HookType hook)
 {
     m_hookType   = hook;
     m_filterFunc = new HookProc(this.CoreHookProc);
 }
Exemplo n.º 35
0
 public Task ExecuteAsync(HookType type, IDomainEntityContext <T> context, CancellationToken cancellationToken)
 {
     _logger.LogInformation($"{type}: {typeof(T).Name}");
     return(Task.CompletedTask);
 }
Exemplo n.º 36
0
 private void FireScenarioEvents(HookType bindingEvent)
 {
     FireEvents(bindingEvent);
 }
Exemplo n.º 37
0
 public LocalWindowsHook(HookType hook, HookProc func)
 {
     m_hookType   = hook;
     m_filterFunc = func;
 }
Exemplo n.º 38
0
 protected WindowsHook(HookType hookType, UserCallback userCallback)
 {
     this.hookType       = hookType;
     this.userCallback   = userCallback;
     this.systemCallback = Callback;
 }
Exemplo n.º 39
0
 protected static extern IntPtr SetWindowsHookEx(HookType code,
                                                 HookProc func,
                                                 IntPtr hInstance,
                                                 int threadId);
Exemplo n.º 40
0
 private static extern IntPtr SetWindowsHookEx(HookType idHook, HookProc lpfn, IntPtr hMod, int dwThreadId);
Exemplo n.º 41
0
 private IOrderedEnumerable <IHookBinding> GetOrderedHooks(HookType bindingEvent)
 {
     return(bindingRegistry.GetHooks(bindingEvent).OrderBy(x => x.HookOrder));
 }
Exemplo n.º 42
0
 protected void Install(HookType type)
 {
     base.m_hookType = type;
     base.Install();
 }
Exemplo n.º 43
0
 public static extern int CallNextHookEx(HookType idHook, int nCode, IntPtr wParam, IntPtr lParam);
Exemplo n.º 44
0
 public static extern IntPtr SetWindowsHookEx(HookType hook, WndProcDelegate callback,
                                              IntPtr hMod, uint dwThreadId);
Exemplo n.º 45
0
 // passed-in routine used for call-back
 public WindowsHook(HookType hookType, WindowHookProc pfnClientHookProc)
 {
     this.hookType          = hookType;
     this.pfnClientHookProc = pfnClientHookProc;
     SetWindowsHook();
 }
Exemplo n.º 46
0
        protected void InstallHook(HookType hookType, bool global)
        {
            lock (HookLock)
            {
                // If hook is installed already then return.
                _hookType = hookType;
                if (hook1handleRef.Handle != IntPtr.Zero)
                {
                    return;
                }
                string lpModuleName = System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName;
                var    hMod         = NativeMethods.GetModuleHandle(lpModuleName);
                // Assign Virtual function.
                _Hook1Procedure = new HookProcDelegate(Hook1Procedure);
                IntPtr hook1Handle;
                if (hookType == HookType.WH_MOUSE)
                {
                    uint threadId = NativeMethods.GetCurrentThreadId();
                    // Listen for events.
                    hook1Handle = NativeMethods.SetWindowsHookEx(
                        (uint)hookType,
                        _Hook1Procedure,
                        hMod,
                        // Associate hook procedure with current application/thread only.
                        threadId
                        );
                    if (hook1Handle == IntPtr.Zero)
                    {
                        var ex = new Win32Exception();
                        throw new Exception(ex.Message);
                    }
                    _Hook2Procedure = new WinEventProcDelegate(Hook2Procedure);
                    // Listen for name change changes across all processes/threads on current desktop...
                    var hook2Handle = NativeMethods.SetWinEventHook(
                        EVENT_OBJECT_NAMECHANGE,
                        EVENT_OBJECT_NAMECHANGE,
                        IntPtr.Zero,
                        _Hook2Procedure,
                        0,
                        // Associate hook procedure with current application/thread only.
                        global ? 0 : threadId,
                        WINEVENT_OUTOFCONTEXT
                        );
                    if (hook2Handle == IntPtr.Zero)
                    {
                        var ex = new Win32Exception();
                        throw new Exception(ex.Message);
                    }
                    hook2handleRef = new HandleRef(null, hook2Handle);

                    // Listen for name change changes across all processes/threads on current desktop...
                    var hook3Handle = NativeMethods.SetWinEventHook(
                        EVENT_OBJECT_SHOW,
                        EVENT_OBJECT_SHOW,
                        IntPtr.Zero,
                        _Hook2Procedure,
                        0,
                        // Associate hook procedure with current application/thread only.
                        global ? 0 : threadId,
                        WINEVENT_OUTOFCONTEXT
                        );
                    if (hook3Handle == IntPtr.Zero)
                    {
                        var ex = new Win32Exception();
                        throw new Exception(ex.Message);
                    }
                    hook3handleRef = new HandleRef(null, hook3Handle);
                }
                else
                {
                    // Listen for events.
                    hook1Handle = NativeMethods.SetWindowsHookEx((uint)hookType, _Hook1Procedure, hMod, 0);
                    if (hook1Handle == IntPtr.Zero)
                    {
                        var ex = new Win32Exception();
                        throw new Exception(ex.Message);
                    }
                }
                hook1handleRef = new HandleRef(null, hook1Handle);
            }
        }
 private static extern IntPtr SetWindowsHookEx(HookType code, HookProc func, IntPtr instance, int threadID);
Exemplo n.º 48
0
 /// <summary>
 /// Use your own HookProc ?
 /// </summary>
 public CoreWindowsHook(HookType hookType, Win32Api.HookProc callBackFunction)
 {
     InternalHookType = hookType;
     CallBackFunction = callBackFunction;
 }
Exemplo n.º 49
0
 /// <summary>
 /// Register to the HookInvoked event
 /// </summary>
 public CoreWindowsHook(HookType hookType)
 {
     InternalHookType = hookType;
     CallBackFunction = CoreHookProc;
 }
Exemplo n.º 50
0
 public IEnumerable <IHookBinding> GetHooks(HookType bindingEvent)
 {
     return(Enumerable.Empty <IHookBinding>()); //not used in VS
 }
Exemplo n.º 51
0
 protected WindowsHook(HookType hookType)
 {
     this.hookType = hookType;
     SetWindowsHook();
 }
Exemplo n.º 52
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 4:
                m_PlayerConstructed = reader.ReadBool();
                m_LowerStatReq      = reader.ReadInt();
                goto case 3;

            case 3:
                m_UsesRemaining     = reader.ReadInt();
                m_ShowUsesRemaining = reader.ReadBool();
                goto case 2;

            case 2:
                m_OriginalHue = reader.ReadInt();
                int idx = reader.ReadInt();
                m_BaitType     = FishInfo.GetTypeFromIndex(idx);
                m_HookType     = (HookType)reader.ReadInt();
                m_HookUses     = reader.ReadInt();
                m_BaitUses     = reader.ReadInt();
                m_EnhancedBait = reader.ReadBool();

                SaveFlag flags = (SaveFlag)reader.ReadInt();

                if (GetSaveFlag(flags, SaveFlag.xAttributes))
                {
                    m_AosAttributes = new AosAttributes(this, reader);
                }
                else
                {
                    m_AosAttributes = new AosAttributes(this);
                }

                if (GetSaveFlag(flags, SaveFlag.SkillBonuses))
                {
                    m_AosSkillBonuses = new AosSkillBonuses(this, reader);
                }
                else
                {
                    m_AosSkillBonuses = new AosSkillBonuses(this);
                }
                break;

            case 1:
                m_AosAttributes   = new AosAttributes(this);
                m_AosSkillBonuses = new AosSkillBonuses(this);
                break;
            }

            if (Parent is Mobile)
            {
                m_AosSkillBonuses.AddTo((Mobile)Parent);
            }

            int strBonus = m_AosAttributes.BonusStr;
            int dexBonus = m_AosAttributes.BonusDex;
            int intBonus = m_AosAttributes.BonusInt;

            if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
            {
                Mobile m = (Mobile)Parent;

                string modName = Serial.ToString();

                if (strBonus != 0)
                {
                    m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
                }

                if (dexBonus != 0)
                {
                    m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
                }

                if (intBonus != 0)
                {
                    m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
                }
            }

            if (Parent is Mobile)
            {
                ((Mobile)Parent).CheckStatTimers();
            }

            if (m_BaitType != null && m_BaitUses <= 0)
            {
                BaitType = null;
            }

            if (m_HookType != HookType.None && m_HookUses <= 0)
            {
                HookType = HookType.None;
            }

            if (version < 3 && m_Crafter != null)
            {
                m_PlayerConstructed = true;

                if (m_Resource == CraftResource.None)
                {
                    Resource = CraftResource.RegularWood;
                }
                else
                {
                    DistributeMaterialBonus();
                }
            }
        }
Exemplo n.º 53
0
 /// <summary>
 /// Call this method to monitor for certain types of events
 /// </summary>
 protected void Install(HookType type)
 {
     InternalHookType = type;
     base.Install();
 }
Exemplo n.º 54
0
 public static extern IntPtr SetWindowsHookEx(HookType idHook, HookCallbackDelegate lpfn, IntPtr hMod, uint dwThreadId);
Exemplo n.º 55
0
        // ************************************************************************

        // ************************************************************************
        // Event delegate

        // ************************************************************************

        // ************************************************************************
        // Class constructor(s)
        public LocalWindowsHook(HookType hook)
        {
            MHookType   = hook;
            MFilterFunc = CoreHookProc;
        }
Exemplo n.º 56
0
 private static extern int SetWindowsHookEx(HookType idHook, CallbackDelegate lpfn, int hInstance, int threadId);
Exemplo n.º 57
0
 public LocalWindowsHook(HookType hook, HookProc func)
 {
     MHookType   = hook;
     MFilterFunc = func;
 }
Exemplo n.º 58
0
 public static extern IntPtr SetWindowsHookEx(HookType hookType, HookProcDelegate lpfn, IntPtr hModule, uint dwThreadId);
Exemplo n.º 59
0
 static extern IntPtr SetWindowsHookEx(HookType hookType, HookProc lpfn, IntPtr hMod, uint dwThreadId);
Exemplo n.º 60
0
 public static extern IntPtr SetWindowsHookEx(HookType hookType, UIntPtr lpfn, IntPtr hMod, uint dwThreadId);