hook

Windows: How to intercept Win32 disk I/O API

纵然是瞬间 提交于 2019-12-10 10:24:36
问题 On Windows, all disk I/O ultimately happens via Win32 API calls like CreateFile , SetFilePointer , etc. Now, is it possible to intercept these disk I/O Win32 calls and hook in your own code, at run time, for all dynamically-linked Windows applications? That is, applications that get their CreateFile functionality via a Windows DLL instead of a static, C library. Some constraints that I have are: No source code: I won't have the source code for the processes I'd like to intercept. Thread

How can I set up a CBT hook on a Win32 console window?

吃可爱长大的小学妹 提交于 2019-12-10 10:18:27
问题 I've been trying to set up a CBT hook for my C++ Console application with the following code: ...includes... typedef struct _HOOKDATA { int type; HOOKPROC hookproc; HHOOK hhook; }_HOOKDATA; _HOOKDATA hookdata; //CBT LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam) { //do not proccess message if(code < 0) { cout<<"code less than 0"<<endl; return CallNextHookEx(hookdata.hhook,code,wParam,lParam); } switch(code) { case HCBT_ACTIVATE: break; case HCBT_CREATEWND: cout<<"CREATEWND"<

Why would Windows hooks not receive certain messages?

最后都变了- 提交于 2019-12-10 04:17:08
问题 Microsoft does not recommend DirectInput for keyboard and mouse input. As such, I've written an input manager class that uses SetWindowsHookEx to hook into WndProc and GetMsg. I believe the hooks are set appropriately, though they look to be the cause of various issues. Neither my WndProc nor GetMsg hooks receive any of the messages that the actual WndProc is receiving. My input manager never receives the WM_INPUT, WM_ BUTTON , WM_MOUSEWHEEL, and WM_KEY* messages that it needs. What gives?

get_current_user_id() Not Working with wp_login Hook - WordPress

牧云@^-^@ 提交于 2019-12-09 23:53:23
问题 I wrote a function and it works great with most hooks, such as wp_head. The problem is, I can't seem to get the user ID for a user, as they log in with wp_login as my hook. get_current_user_id() returns nothing, and I can't seem to get any other user object either. Does the actual login happen AFTER wp_login? Because that doesn't make sense to me. 回答1: I never got get_current_user_id() to work, but I did find a solution. First, I had to give my function very low priority. In the action hook,

Preventing a DLL file from loading into my process via MS Detours

给你一囗甜甜゛ 提交于 2019-12-09 23:06:03
问题 I'd like to prevent a specific third-party DLL file from loading into my application's process at runtime. My initial attempt at this was using the MS Detours product. I have a 32-bit MFC application running on Windows 10 64-bit. I tested with the free MS Detours 3.0 version as a feasibility check. In my MFC application class constructor, I call Detours to intercept the "load library" APIs (LoadLibraryW, LoadLibraryExW, LoadLibraryA, and LoadLibraryExA). This lets me intercept library loading

Override Avada Catalog sorting hook back to default in Woocommerce

我们两清 提交于 2019-12-09 22:19:37
问题 I am trying to modify Woocommerce sorting option to get a customized one by adding the following code to Avada child function.php file: // add custom sorting option add_filter( 'woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args' ); function custom_woocommerce_get_catalog_ordering_args( $args ) { $orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce

Prestashop - Change order status when payment is validated

天涯浪子 提交于 2019-12-09 18:33:35
问题 When a payment is validated, the order status becomes "Payment validated" ("Paiement accepté" in french). I want to set another status when payment is validated, so the history would show the following : Current status : My personnal status History : My personnal status Payment validated To do so, I use the hook actionOrderStatusPostUpdate. This is my code : public function hookActionOrderStatusPostUpdate($aParams) { $oOrder = new Order($aParams['id_order']); if($aParams['newOrderStatus']->id

How to enforce Coding Standard for the repository located in GIthub

懵懂的女人 提交于 2019-12-09 16:18:00
问题 We have an account in Github and hosts all of our projects in Github (private repositories). We want to enforce coding-standard and probably other hooks that we use for internal purpose. We have had these hooks work pretty well for subversion since the repository located in a single place, administering these hooks was excellent. With Github, looks like I lose an ability to add my hooks in the main repository(?), hence I am struck: How do I enforce coding-standard to every member when they

Hooking an existing method in Java

我怕爱的太早我们不能终老 提交于 2019-12-09 14:40:26
问题 I want to hook the method System.out.print in Java and have the ability to read/change the variables used in the method before the part of the method is called that actually adds the string to whatever the output stream is. In C++ I would just detour the function, or set an int3 instruction so I could access the registers but in java I have no idea how to accomplish something similar. 回答1: You can rewrite the byte code of the methods, and in the process capture/change the local variables. It

SetWindowsHookEx creates a local hook. How to make it global?

你说的曾经没有我的故事 提交于 2019-12-09 09:53:32
问题 In a Delphi XE application I am trying to set up a global hook to monitor focus changes. The hook is created in a dll: focusHook := SetWindowsHookEx( WH_CBT, @FocusHookProc, HInstance, 0 ); // dwThreadId (the last argument) set to 0 should create a global hook In the same dll I have the hook procedure that posts a message to the host app window: function FocusHookProc( code : integer; wParam: WPARAM; lParam: LPARAM ) : LResult; stdcall; begin if ( code < 0 ) then begin result :=