I did, because for the first time over 8 years I faced a problem I couldn't solve on my XP installation, and I didn't regret moving to Windows 7. Yet!
-- Wessam Fathi
I did, because for the first time over 8 years I faced a problem I couldn't solve on my XP installation, and I didn't regret moving to Windows 7. Yet!
-- Wessam Fathi
Thanks for your reply, actually I didn't know that it won't work except for applications with a message bump, and that it probably won't for console applications. That's a valuable piece of information I didn't actually know :) Regarding the library licensing, I only used it for the college project - not a commercial application - so I didn't need to buy it. -- Wessam Fathi
Well I've used Detours extensively myself, when developing my graduation project back at college - it was an antivirus and a firewall package. I used detours in the antivirus part, to intercept all calls to CreateProcess function, when the user tries to run any program it was blocked until user Allows / Denies. It did work, I can send you videos for the application running if you want :) Here is the code I used, that's only a bit demonstrating the technique not the whole code, so it definetely won't compile: 1. Detours management code encapsulated in a dll: ------------------------------------------------- BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: hInst = (HINSTANCE)hModule; //intercept the API functions of the host program Intercept(); hook = NULL; //request a unique message number form the sytem for inter processes messaging WM_HOOKMESSAGE = RegisterWindowMessage("{398E8909-327E-4ce8-B523-012AA80808A0}"); return TRUE; case DLL_PROCESS_DETACH: //if we had a successful interception, de-intercept the detour function if(CreateProcessW_T && CreateProcessA_T) DeIntercept(); //if we had a successful windows hook, un install that hook if(hWndServer != NULL) ClearHook(hWndServer); return TRUE; } return TRUE; } //hook install function CREATEHOOK_API bool SetHook(HWND hWnd) { if(hWndServer != NULL) return FALSE; // already hooked! hook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)MyProc, hInst, 0); if(hook != NULL) { /* success */ hWndServer = hWnd; return TRUE; } /* success */ return FALSE; // failed to set hook } //hook un-install functions CREATEHOOK_API bool ClearHook(HWND hWnd) { if(hWnd != hWndServer || hWnd == NULL) return FALSE; BOOL unhooked = UnhookWindowsHookEx(hook); if(unhooked) hWndServer = NULL; return unhooked; } //this is a dummy hook proc, since the main use of the hook is to //load our library to all processes in the system static LRESULT CALLBACK MyProc(int nCode, WPARAM wParam, LPARAM lParam) { return CallNextHookEx(hook, nCode, wParam, lParam); } //API interception installation function CREATEHOOK_API int Intercept() { //intercept the CreateProcessW function CreateProcessW_T =(BOOL(WINAPI *)(LPCWSTR, LPWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPCWSTR, LPSTARTUPINFOW, LPPROCESS_INFORMATION))De
Did you check out the detours library, Detours intercepts Win32 functions by re-writing target function images. I used it when developing a simple firewall, to re-route all calls to winsock functions (connect, listen, send, recv). It is a system wide hook where all calls to the patched functions from all processes are redirected to my detour function. -- Wessam Fathi
This is probably because the VC++ compiler is trying to optimize memory allocations, by automatically choosing the ordering and layout of variables in memory in order to minimize memory usage. -- Wessam Fathi
Perhaps you can hook the TerminateProcess function in the kernel dll, then whenever it is called, check to see if the process to end is your process then return immediatly and don't call the hooked function. Hooking can be a tricky thing to accomplish actually, I've had some experience with it using Microsoft's Detours library, it took sometime but proved to be useful at last, maybe you can try and see what turns out for yourself :) -- Wessam Fathi
I'm trying to develop an add-in for Outlook Express, the add-in is supposed to intercept sending mails and (optionally) add attachments to the mail being sent. I have already done that on Microsoft Outlook using Visual Studio Tools for Office, but I couldn't find any way to do it on Outlook Express. Help would be greatly appreciated, just point me on the way. Thanks in advance, Wessam Fathi Wessam Fathi
I'm trying to develop an add-in for Outlook Express, the add-in is supposed to intercept sending mails and (optionally) add attachments to the mail being sent. I have already done that on Microsoft Outlook using Visual Studio Tools for Office, but I couldn't find any way to do it on Outlook Express. Help would be greatly appreciated, just point me on the way. Thanks in advance, Wessam Fathi Wessam Fathi
I'm trying to develop an add-in for Outlook Express, the add-in is supposed to intercept sending mails and (optionally) add attachments to the mail being sent. I have already done that on Microsoft Outlook using Visual Studio Tools for Office, but I couldn't find any way to do it on Outlook Express. Help would be greatly appreciated, just point me on the way. Thanks in advance, Wessam Fathi Wessam Fathi
I'm trying to develop an add-in for Outlook Express, the add-in is supposed to intercept sending mails and (optionally) add attachments to the mail being sent. I have already done that on Microsoft Outlook using Visual Studio Tools for Office, but I couldn't find any way to do it on Outlook Express. Help would be greatly appreciated, just point me on the way. Thanks in advance, Wessam Fathi