hook

C# - Hook into existing COM object

Say we have an existing process (or application) that calls a COM object from an ocx file such as "MyCOMLibrary.ocx". Is there a way to write a C# library to exactly replicate the ocx file? So that the original application can call your C# code rather than the original COM object? You would, of course, have to use identical CLSID and ...

Adding a hook to script/generate migration

I do my Rails dev from xterm and in vim. I'm getting sick of running script/generate migration do_whatever, then trawling through db/migrate trying to tab-complete to 20091015235018_do_whatever when there's 5 other migrations with similar timestamps. What's the best way to add a hook to open the generated migration in vim? I'd rather ...

Problems on injecting into printf using LD_PRELOAD method

Hi Experts, I was hacking printf() of glibc in one of my project and encountered some problem. Could you please give some clues? And one of my concern is why the same solution for malloc/free works perfect! As attached, “PrintfHank.c” contains my own solution of printf() which will be preloaded before standard library; and “main.c” jus...

Saving time in SVN post-commit hooks?

At my place of work we've started to introduce proper SVN hooks, "proper" meaning "doing a lot of policy checking". Currently, our policy consists of Perl::Critic with Perl::Tidy checking enabled. However, especially the latter one takes a lot of time on commits with several to many files touched and SVN wouldn't return until the post-co...

Alternatives to windows hooks in C#?

I would like to get notification of when any/all programs are being actively used. To do this via windows hooks I'd use an unmanaged C++ dll that talks to C#. There is an article that explains this process here. I was wondering though if there is any alternative to using system hooks though. ...

Hook into the Windows File Copy API from C#

Is there a way to hook into the Windows File Copy API from C#? I'm aware this would require unmanaged code, but a code sample or starter would be helpful. I've already seen the C++ code, but it's all greek. UPDATE: I apologize, I should have been more clear about my intentions. I wish to actually change the copy feature of Windows to...

How do I screen contributors in a Subversion pre-commit hook based on folder?

Here's the dilemma: I have a folder structure: product/branches/stable product/branches/someotherbranch product/tags product/trunk I have two users: John and Joe. I want to prevent Joe from committing to: product/branches/stable and product/tags What is the pre-commit hook syntax in Perl or Bash or whatever to get the job done? ...

Low-level keyboard hook issue : Keyboard state losed when application is not focused (Delphi)

Hello, I've been asked to develop a new application that will work along side the existing one. Both application will wait for a barcode reader input. I don't want our operator to scan a barcode twice: once for the existing application (16bit - clipper, no sources) and once for the new application. To solves this issue I've decided to u...

Can one create Apache hooks with PHP?

I have googled the topic for a while but haven't found what I'm looking for... Is there a mod for PHP that allows it to act much like mod_wsgi or mod_python so that one can create Apache hooks using PHP? For example an equivalent to WSGIAccesScript? Thank you ...

System Wide Shell Hook from .NET using Unmanaged DLL

Hello everyone, I have used the code supplied in the following CodeProject article in the past with success, but it only seems to partially work on Vista/7 (I'm guessing because of UAC). It works for the current thread, but it doesn't pick up system wide activity. I've tried adding requireAdministrator in the manifests and signing both ...

custom before/after hooks in rails for non standard actions?

I have a controller with some non standard actions, like admin, moderate, etc. I tried using the hook before_admin it that didn't work. Is it possible to use these hooks for my custom actions? Sorry for the lack of clarity. Say I have something that I want to happen before saving..it's easy to just do a before_save :do_whatever inside t...

NDIS Hooking for Blocking/Unblocking website on windows xp

Hello I am trying to block/unblock some of website on windows xp using NDIS Hooking.I am new for this NDIS Hooking on windows xp. so can you please tell whether is there any sample in msdn or do you have any sample application whick can Block/Unblock website. Thanks, Kamal. ...

Is there a way to hook or intercept CoGetClassObject and/or CoCreateInstance calls?

I'd like to intercept the COM CoCreateInstanceEx and/or CoGetClassObject functions to replace a class with a testing shim in a unit test. This will only be for a single CLSID; all others can go through unchanged. Is there a way to do this without horrible, evil hacks? ...

I Don't get the WM_GETMINMAXINFO message from other applications

Hello! In my C-Dll there is a Windows hook: hook = SetWindowsHookEx(WH_CALLWNDPROC, CallWndProc, hinstance, 0); With this Callback method: LRESULT CALLBACK CallWndProc(int nCode, WPARAM wParam, LPARAM lParam) { ... CWPSTRUCT* cw = reinterpret_cast<CWPSTRUCT*>(lParam); myfile << "CallWndProc allg. " << cw->message << "\n"; if (cw->...

Catching WM_GETMINMAXINFO from notepad.exe doesn't work

Hello! I want to catch all WM_GETMINMAXINFO messages which are sent to the "nodepad.exe" application. My base app is written in C#, the DLL with the windows hook is written in C. Let me show you the hook inside the C DLL: file: dll.h #ifndef _DLL_H_ #define _DLL_H_ #include <windows.h> #if BUILDING_DLL # define DLLIMPORT __declspec...

change a keystroke passing a hook(c/c++)

hello! is it possible to edit a keystroke using a winapi keyboard hook? well, not neccesary a keyboard hook but something like it.. i wanna do something like this: user presses key 'A' my function adds 1 to the virtual keycode (just an example) the 'A' becomes an 'B' and the 'B' is sent to the destination application thanks! ...

Mouse hook in a specific window

I need to set a hook on mouse clicks, using C++, Win API. So that when an icon on the desktop is being clicked I get the event. How will this happen? I think the only information I get in mouse hook event are the coordinates for the mouse, right? Now how do I make sure that the thing clicked is an icon on the desktop? ...

Winlogon: How to run app after explorer terminates during logoff?

Windows XP/VISTA/7 How might it be possible to run an application during the logoff procedure of a user, after explorer.exe terminates? The purpose is to block shutdown but with an application that runs after explorer has terminated. It is of course possible to temporararily block shutdown in vista with ShutdownBlockReasonCreate, or t...

Can I put LowLevelMouseProc and LowLevelKeyboardProc in the main EXE?

Global Windows hooks must be in a DLL because the hook is going to be called in the context of a different process, so the hook procedure's code must be injected into that process. However, there are limitations: SetWindowsHookEx can be used to inject a DLL into another process. A 32-bit DLL cannot be injected into a 64-bit pro...

Subversion: How to append text to every committed file?

I am looking for a way to do the following either on pre-commit or post-commit or any other way. Here is what I need to be working User commits the file Something runs (hook or something else) That something else from #2 should append static text to the file being committed Based on this http://subversion.open.collab.net/ds/vi...