FAQ Database Discussion Community


Why does using a function pointer to call a function bypass the hook?

c++,hook,detours
Using the Microsoft Detours library, I've written the following simple code: #include <Windows.h> #include <detours.h> #include <stdio.h> void RealFunc(int num) { printf("RealFunc %d\n", num); } void(*RealFuncPtr)(int) = &RealFunc; void HookedFunc(int num) { printf("HookedFunc %d\n", num + 100); // RealFunc(num); // This starts an infinite loop because it calls HookedFunc which...

Overwriting existing pointer in hooked function

c++,arrays,pointers,char,hook
I have a small problem I can't seem to figure out. I have hooked a function which has a char* parameter, for the record, the hook is working. Inside my own function I want to change the char pointer parameter to my own. int Foo(char *buffer, int length) { //.....

Mediawiki Call hook function from another file

php,function,hook,mediawiki
Hello I need to save some content to database in MediaWiki when a new page is created. So I added hook in my LocalSettings.php: $wgHooks['PageContentSaveComplete'][] ='assign_responsibility'; But I need to call the function assing_responsibility() from a extension php file Responsibility.php not LocalSettings. I am new at Mediawiki system and I...

Hooking local WndCallback using SetWindowLong: ACCESS DENIED

visual-c++,visual-studio-2013,x86,hook,win32gui
I'd like to locally hook my WindowProc function. First I was thinking of SetWindowsHookEx, but I wouldn't like to have an external DLL only for this hook. I'd like to make it internally and locally (I don't want a global hook). That's why I came across with SetWindowsLong. I'm trying...

ignore certain mercurial commands in mercurial hook

python,mercurial,hook
I have a mercurial hook like so: [hooks] pretxncommit.myhook = python:path/to/file:myhook with the code looking like this: def myhook(ui, repo, **kwargs): #do some stuff but this hook runs on commands that use the commit logic to do something else, in my case hg shelve. is there a way to get...

Is there any graceful way could revert the hooked method to original implementation on iOS?

ios,objective-c,hook,jailbreak,cydia-substrate
With CydiaSubstrate we could easily hook the methods as below, but I want to know how can I uninstall the hooking and revert the implementation to original one? Thank you! static IMP original_UIView_setFrame_; void replaced_UIView_setFrame_(UIView* self, SEL _cmd, CGRect frame) { // Note the implicit self and _cmd parameters are...

Is there an onSave hook for Parse local datastore (on iOS)?

parse.com,hook,nsnotifications,local-datastore
While Parse Cloud Code provides an on-save hook that lets you perform custom actions on the backend when objects are saved, their iOS SDK doesn't have any similar hook for when objects are saved into the local datastore with -save(Eventually)* methods. I would like changes in data to drive my...

My MouseHook is blocking the hook notifications of other applications

.net,vb.net,winapi,mouseevent,hook
I've implemented an LL mouse hook that captures when the mouse receives movement if the mouse is moving on an specified area. The problem is that when my mouse hook is active, it blocks the hooks of other applications, other applications that tries to catch mouse events. Like for example...

Account onLogin hook Meteor loop

javascript,login,meteor,hook,account
I am building an application using Meteor. I want to create a new Cart ID (to act as a cart where I can store items) each time a user logs into my application. However, every time I open a new page in the application, a new Cart ID is created....

Implementing “and” for Python class?

python,class,hook,logical-operators
I have code similar to this: import operator class Comparator: def __init__(self,fieldName,compareToValue,my_operator): self.op = my_operator self.field = fieldName self.comparedTo = compareToValue def __call__(self,row): my_row_val = getattr(row,self.field) return self.op(my_row_val,self.comparedTo) class Row: class RowItem: def __init__(self,name): self.name = name def __eq__(self,other): return Comparator(self.name,other,operator.eq) val1 = RowItem("val1") val2 = RowItem("val2") val3 = RowItem("val3")...

Plugin system with events or hooks?

php,events,architecture,hook
I've created a plugin system for a software in php. In order for a plugin to alter the behaviour of the programm I wrote this (simplified) code: class PluginController { /* ... */ public function addHook($name, $function, $priority = 10) { /* store the function callback $function associated with $name...

Wordpress: Prevent attachment from being deleted from Medialibrary

wordpress,delete,hook,attachment
In Wordpress admin media library page (upload.php) I'd like to do some checking on delete_attachment action. I want my custom function to fire before attachment's being deleted. In this function I want to check for it's relations with another objects in database. And delete it only if there are no...

What is the point of VirtualProtect when any process, including malware, can use it?

c++,c,memory,hook,detours
I understand that the VirtualProtect function changes the permissions on a page in memory without question. Surely this ends up with no immediate purpose when any running process is able to use it? For example, someone could easily write a piece of malware which uses the VirtualProtectEx function in order...

Android trims the rest of the deep link URI after ampersand

android,android-intent,android-manifest,hook,deep-linking
I'm trying to add yet another deep link to my android application, I want my URI to look like this : my_app://photos?id=147619727001201&edit=true. The problem is that the system doesn't recognize this URI, so I just get trimmed version of it (my_app://photos?id=147619727001201). I'm just curious how android system treats deep links,...

how to backup buddypress messages and recipient details to another table

wordpress,hook,buddypress
How can i backup all the messages when user send messages to table "bp_messages_backup".I have tried by using some hooks but not working for me. bp_after_message_thread_list this hook gives all the details required but insert the same message to table after refresh.

Getting StackOverflow exception while reading stringlist in newly hooked LoadResString method

delphi,winapi,hook,resourcestring
For reference - following is my code, where I am getting StackOverflow exception in NewLoadResString function. The case is like I have creted two stringlist i.e. RecStrNameIdMap and NewStringValueList. Here RecStrNameIdMap is hash string list to store name and string Identifier mapping. So that I can refer Resource string name...

How to properly set global mouse hook on background thread?

c++,windows,multithreading,hook
I write a code that hook Low Level Mouse in background thread. How I properly set HOOKPROC m_Callback so it is called in same that thread? Thank! std::mutex m; std::condition_variable cv; bool tk_worker_kill = false; LRESULT CALLBACK m_Callback(int nCode, WPARAM wparam, LPARAM lparam) { // do something return CallNextHookEx(_m_hook, nCode,...

Is it possible to locate functions from executable at runtime on Windows?

c++,windows,winapi,hook
I'm injecting code into a function in windows in order to create hooks. I have this thread within the process, which successfully creates hooks to functions exported by DLLs. I'm planning to extend this functionality to include some functions or methods within the executable itself. All I need now is...

Change database in Liferay with losing any data

liferay,hook,liferay-6,portlet,liferay-theme
As of today, I am developing the liferay portal enhancements with default hsql database. I have implemented many features and created multiple sites and site templates with different roles and user. 1) Now I want to change the database from hsql database to PostgreSQL. Now how can I change the...

Apache Subversion pre-commit to restrict files

apache,svn,hook,pre-commit
I'm new to Apache SVN and I need some help to use a pre-commit script to filter which files are being upload to my repository. I was searching a lot and found this script on another question, but it didn't work for me. #!/bin/bash REPOS=$1 TXN=$2 AWK=/usr/bin/awk SVNLOOK="/usr/bin/svnlook"; #Put all...

Engineyard Deployment: How to detect in deployhooks that its the first attempt to execute 'rake db:seed'

ruby-on-rails,deployment,hook,engineyard
I am having trouble to detect that this is the first attempt of deployment after a server instance is booted. I need to run the command rake db:seed only the first time to set the default users and other details in database. I have no idea if this is possible....

Update a post without update post title

wordpress,wordpress-plugin,hook,posts
I want to update post data without update post title even if user change the post title. For this functionality I have write the following codes. But it's not working. My code is as follows : function update_post_without_update_title($post_id,$data) { $post = get_post($post_id); if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )...

Liferay 6.2 Hook deployment strange behaviour

liferay,hook,liferay-6
I have deployed a document library hook which includes many jsp files under custom_jsps. Recently, I wanted to change folder_action.jsp, so I changed it and deployed it normally in document library portlet. As it was expected, a folder_action.portal.jsp was created containing the original file. However, I've noticed something strange. After...

Cannot get my post-commit script to run (git)

git,hook
I want my remote git-repo to create a zip file from one folder in the master branch every time someone pushes. I renamed the post-commit.sample file and added the following: #!/bin/bash echo "creating zip" /usr/local/bin/git archive --format=zip --output=~/the-folder.zip master:the-folder echo "creating zip done" When I commit from my client I...

How do I setup a systemwide hook to listen for WM_DEVICECHANGE?

c++,windows,winapi,hook
I want to setup a System wide hook to listen for WM_DEVICECHANGE in C++. I know that hooks are setup using SetWindowsHookEx(). I have done this before for Keyboard messages (WM_KEYUP, WM_KEYDOWN) but I want to do it for WM_DEVICECHANGE. I am currently using: #include <windows.h> #include <tchar.h> #include <iostream>...

Prestashop - module - Load on each pageload

smarty,hook,prestashop,prestashop-1.6
I'm developing a prestashop module The goal of this module is that when a page on the front office is loaded a mysql query runs. The query starts to sync the quantity's of all products. So they match the quantity's of a external stock management system. The code is already...

pyinstaller hooks never called

python,hook,pyinstaller
I am trying to create an EXE of a python program. The program is quite complex and cannot be listed here. I have some user defined modules, halfwave, halfwave.utils and halfwave.db. I need to create a hook for these modules, so I have made files hook-halfwave.py, hook-halfwave.db.py and halfwave.utils.py and...

OpenGL reading back buffer quickly

c++,opengl,hook
I'm trying to read the contents of the back-buffer into a buffer of my own. glReadPixels by itself is way too slow and drops my FPS from 50 to 30. So I decided to try the "asynchronous" read with a PBuffer but it crashes. My code is as follows: If...

Is there a way to listen to an event in the phantom context from page context?

javascript,events,phantomjs,hook,webpage
For example: I open a page with PhantomJS, evaluate an asynchronous script (e.g. ajax). When it succeeds, I want to let the phantom context (outside of page.evaluate()) know that the asynchronous process is finished. I don't want to use setTimeout and setInteval to wait and check continously in the phantom...

How can I sort woocommerce grouped products by post date instead of menu order?

php,wordpress,filter,woocommerce,hook
What code/filter can I add to my wordpress functions.php file to modify the order of grouped products by post date instead of menu_order? class-wc-product-grouped.php $args = apply_filters( 'woocommerce_grouped_children_args', array( 'post_parent' => $this->id, 'post_type' => 'product', 'orderby' => 'menu_order', 'order' => 'ASC', 'fields' => 'ids', 'post_status' => 'publish', 'numberposts' => -1,...

Xposed - Can't hook static method

android,hook,xposed-framework
I try to hook Settings.System.putInt method which is static. One of the calls for this method is done in setAirplaneModeOn method of com.android.settings.AirplaneModeEnabler class. It is placed in Settings app of android. Also, putInt method is used in com.android.systemui. However, following code doesn't hook putInt method. It doesn't give any...

Universal Post Commit Git Hook

git,hook
I was wondering fi there was a simple way to set up a post commit git hook so that it would run regardless of the repo that it is run with (It is my understanding that the applied hook comes from a hook/ folder in the git directory). Thank you!...

Adding content after add to cart button on woocommerce single page

php,wordpress,woocommerce,hook
I have successfully added a content after short description on single product page with if (!function_exists('my_content')) { function my_content( $content ) { $content .= '<div class="custom_content">Custom content!</div>'; return $content; } } add_filter('woocommerce_short_description', 'my_content', 10, 2); I saw that in short-description.php there was apply_filters( 'woocommerce_short_description', $post->post_excerpt ) so I hooked to...

How to get class object of a function in hooked function?

c++,qt,hook,interceptor
I recently started to work on application interception using madhookc hooking library.I am hooking the methods called in the application to do manipulation of text. At one point i got stuck and need your help. I have a paragraph of text in which in which some text is Bold and...

AJAX Call not working in liferay 6.2.2?

ajax,liferay,hook,liferay-6
I am trying to perform a AJAX Call. But what i get is ResourceURL as undefined when i see the error in chrome. Below is my code. Declaration: <liferay-portlet:resourceURL copyCurrentRenderParameters="<%= false %>" var="mainURL" /> Implementation: xhr2.open("POST", resourceURL , false); But at implmentation i get resourceURL as undefined. In 6.1 it...

C# LVM_DELETEITEM from listview

c#,winapi,hook
So, I'm programming in C#, and I am trying to get a item id from the SysListView32, then send a LVM_DELETEITEM message to remove the item from the list view. My code: using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Diagnostics; using Microsoft.Win32.SafeHandles; using System.Runtime.InteropServices; using System.Text; using System.ComponentModel;...

How to get or store heap size in RtlAllocateHeap for later use in RtlFreeHeap?

c++,windows,heap,hook
The core problem: An old Windows XP game freezes on newer Windows versions unless it is run with Windows XP compatibility mode. Even through it is not essential to provide a code fix for this, I still like to make a fix for this freeze, because noobie users run in...

Hook method to various boxes whenever one of the text box changes text, is there a simple way?

c#,winforms,hook
I wanna keep my program information updated, so I've been using the same method over and over again in each of these text changed method private void textBox5_TextChanged(object sender, EventArgs e) { //specific code for textBox5 updatedatamethod(); } private void textBox6_TextChanged(object sender, EventArgs e) { //specific code for textBox6 updatedatamethod();...

Function pointer - purpose of argument for DInput8.dll hook code

c++,keyboard,hook,directinput
I have been trying to figure out the purpose of one argument in a DirectInput8 hooking project. I am producing some portion the opensource code here. For the sake of brevity, I am only posting a few functions. ULONG oldCreateDevice; HRESULT WINAPI xCreateDevice(DWORD d1, DWORD d2, DWORD d3, DWORD d4)...

Integrate ElFinder with existing permission system

php,hook,bind,elfinder
Is there a way to integrate elfinder with my current user permissions system? I would need some kind of hook which would be triggered before e.g. a file gets deleted. There I should be able to abort the delete command and return some kind of response if the logged in...

using hook on OPENFILEW dialog disables resize control

winapi,dialog,windows-xp,hook
Using this code the resulting dialog box is drawn without ability to be able to be resized by mouse: #include <windows.h> static UINT_PTR CALLBACK OFNHookProc (HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) { return 0; } int main() { OPENFILENAMEW ofn; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(OPENFILENAMEW); ofn.nMaxFile = MAX_PATH;...