hook

Linux module to hook process functions

你离开我真会死。 提交于 2019-12-08 00:44:57
问题 I have a problem, maybe you have some information about this. I want to hook socket receive function (recv) in running process and modify incoming data. How i know, i can do this using kernel module, but i cant find information about how to do such hook. I tried to go another ways like Netfilter, iptables, but these ways to slow. 回答1: Be aware that there are several different syscalls which could be used - not just recv(). Assuming the application in question does its kernel interaction via

PInvoke errors calling external SetWindowsHookEx and GetModuleHandle

爱⌒轻易说出口 提交于 2019-12-07 23:08:13
问题 I am trying to set windows hooks in my program to an external EXE. This will be used to monitor resizing/minimizing of the window, so I can resize my program similarly, docking to the window. How do I get around error codes 1428 and 126 below? When calling SetWindowsHookEx with a null hMod, I was getting this error 1428 . I get the same error if passing the current module (instead of IntPtr.Zero), which it seems to get correctly, as so: IntPtr module = PInvoke.GetModuleHandle(null); [...]

Hook for pthread_create

只愿长相守 提交于 2019-12-07 22:42:51
问题 Is there (in glibc-2.5 and newer) a way to define a hook for pthread_create? There is a lot of binary applications and I want to write a dynamic lib to be loaded via LD_PRELOAD I can add hook on entry to main (''attributte constructor''), but how can I force my code to be executed in every thread just before the thread's function will run. 回答1: This answer shows how to interpose pthread_create. (Beware: it will work correctly in 64-bit, but not 32-bit programs.) Once you interpose pthread

Windows: How to query state of modifier keys within low level keyboard hook?

佐手、 提交于 2019-12-07 21:29:30
问题 For a usb keyboard configuration tool I need to intercept all keyboard input and detect which modifier keys and normal keys are pressed simultaneously. Therefore I use a windows low level hook (WH_KEYBOARD_LL) which works fine except that I´m not able to determine if WIN-Key (VK_LWIN / VK_RWIN) is pressed (control / shift and alt is working). I made a little commandline tool to show the problem: #include <Windows.h> #include <iostream> using namespace std; HHOOK hKeyboardHook; LRESULT

Run startup code in the parent with Django and Gunicorn

本小妞迷上赌 提交于 2019-12-07 17:35:39
问题 I need my code run at Django application startup, before Django starts listening for incoming connections. Running my code upon the first HTTP request is not good enough. When I use Gunicorn, my code must run in the parent process, before it forks. https://stackoverflow.com/a/2781488/97248 doesn't seem to work in Django 1.4.2: it doesn't run the Middleware's __init__ method until the first request is received. Ditto for adding code to urls.py . A quick Google search didn't reveal anything

How to run a hook action when header load in wordpress blog?

丶灬走出姿态 提交于 2019-12-07 16:48:30
问题 Am woking on an error plugin. I want to generate some error or success msgs when header loads in WordPress blog site. like as: if(is header load) { //run a action hook here //print success or error msgs through hook function } suggest a hook action to display msgs when header load. 回答1: Below code might help. You can put this code in the functions.php in your theme folder. function load_me_on_header() { // do something here ... like show error message. } add_action('wp_head','load_me_on

HOOK C# method in DLL

冷暖自知 提交于 2019-12-07 16:12:21
问题 I have C# application which calls SUM() function from a DLL. I want to hook that SUM() function in the DLL and manipulate the instructions by injecting my DLL into the process of C# application. Please reply. 回答1: Please see this http://www.codeproject.com/Articles/463508/Net-CLR-Injection-Modify-IL-Codes-on-Run-time You can do that by modifying the IL code on runtime 来源: https://stackoverflow.com/questions/11101223/hook-c-sharp-method-in-dll

Hooking into Hibernate's query generation

喜夏-厌秋 提交于 2019-12-07 14:48:13
问题 I would like to implement virtual views with a preprocessor. A simple example: HQL before: FROM PublishedArticle a Effective HQL after: FROM Article a WHERE a.published = true Essentially I need a way to process queries before they get executed (instead of creating views on-the-fly which would have a high cost). 回答1: You can use a StatementInspector to completely rewrite the SQL to suit your needs. For further reading: How I can configure StatementInspector in Hibernate? 回答2: Couldn't you do

How to hook all operating system calls of my own process?

半城伤御伤魂 提交于 2019-12-07 13:13:22
问题 I need to hijack all operating system calls of my own process. I cannot rewrite code as it is partly not my code (plug-ins). I need to be able to decide within my implementation of a specific system call, if I want to call the original implementation or not. Operating systems will be at first windows xp and higher versions. Later os x 10.5 and higher will follow. Starting on windows with 32 bit versions, later for all operating systems also 64 bit versions. I found a lot of documentation and

mysqldump schema only, schema update without drop

流过昼夜 提交于 2019-12-07 11:41:01
问题 I'm looking at using the git pre-commit hook to export a MySQL db schema prior to commiting changes so that other developers can update their own databases with a SQL script from the git repo. By default a mysqldump (I'm using --no-data) will drop existing tables before rebuilding them which isn't what I'm after. I'm wondering if anyone knows of a way to do a mysqldump or similar to describe the db schemas with SQL to update tables if they exists instead of a drop and rebuild. I realize this