hook

Prestashop - Change order status when payment is validated

醉酒当歌 提交于 2019-12-04 09:48:33
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 == Configuration::get('PS_OS_PAYMENT')) { $oOrder->setCurrentState(Configuration::get('XXXXXX_STATUS

How to find a functions address to hook/detour in an EXE file?

元气小坏坏 提交于 2019-12-04 09:27:05
I drove against a wall again and need your help with some low-level stuff. I already succeeded in hooking exported DLL-Functions ( with this code btw. ) by injecting them into my target process (e.g. I can easily detour MessageBoxW from user32.dll ). Unfortunately I aim for a different scenario: I have to detour a function defined inside the executable I'm injecting my code into. The application is Open-Source so I know everything about the function I'd need for hooking it, but the binary is signed with a certificate so I can not compile my own version. Is it possible to fetch the functions'

Is Swift resistant against hooking?

橙三吉。 提交于 2019-12-04 09:11:00
Cycript is a console based application that is a blend of Objective-C and JavaScript. Cycript is very useful for dynamic analysis of iOS applications. If you write any methods or the complete ipa with Swift is it still possible to hook the application on a jailbroken device? Or is Swift safe like "native C" Code on iOS ? I'm not really familiar with Cycript but I have a little understanding of the Swift compiler. Swift code will be more resistant to hooking but it should not be completely impossible. NSObject subclasses and Swift classes that are declared @objc should be as accessible as

Windows keyboardhook reporting everything twice

[亡魂溺海] 提交于 2019-12-04 08:24:43
I am using Delphi and trying to read from a bar code scanner over USB, so that it is just another Human Interface Device. I get the digits correctly, but get each twice. I imagine that this is key down and key up. I could; kludge it with a flag and ignore very second read, but would rather do it propery. My code is adapted slightly from this link . Can I specify that I only want key_up events when assigning the hook? KBHook := SetWindowsHookEx(WH_KEYBOARD, @KeyboardHookProc, HInstance, GetCurrentThreadId()) ; or somehow check a flag within the hook function itself? Update: I tried to code for

Object-based default value in SQLAlchemy declarative

喜你入骨 提交于 2019-12-04 08:24:09
With SQLAlchemy, it is possible to add a default value to every function. As I understand it, this may also be a callable (either without any arguments or with an optional ExecutionContext argument). Now in a declarative scenario, I wonder if it is somehow possible to have a default function which is called with the object that is being stored. I.e. possibly like so: Base = sqlalchemy.ext.declarative.declarative_base() class BaseEntity(Base): value = Column('value', String(40), default=BaseEntity.gen_default) def gen_default(self): # do something with self, for example # generate a default

Not able to detect branch from Git post-receive hook

与世无争的帅哥 提交于 2019-12-04 07:48:51
问题 I've got a post receive hook setup on the remote repo that tries to determine the branch name of the incoming push as follows: $branch = `git rev-parse --abbrev-ref HEAD` What i'm finding, though, is that no matter what branch I push from my $branch variable gets set with 'master'. Any ideas? 回答1: The post-receive hook gets the same data as the pre-receive and not as arguments, but from stdin. The following is sent for all refs: oldRev (space) newRev (space) refName (Line feed) You could

C++ SetWindowsHookEx WH_KEYBOARD_LL Correct Setup

时光怂恿深爱的人放手 提交于 2019-12-04 07:30:18
I'm creating a console application in which I'd like to record key presses (like the UP ARROW). I've created a Low Level Keyboard Hook that is supposed to capture all Key Presses in any thread and invoke my callback function, but it isn't working. The program stalls for a bit when I hit a key, but never invokes the callback. I've checked the documentation but haven't found anything. I don't know whether I'm using SetWindowsHookEx() incorrectly (to my knowledge it successfully creates the hook) or my callback function is incorrect! I'm not sure whats wrong! Thanks in advance for the help.

Git Hook - Make server pull after I push to github

假装没事ソ 提交于 2019-12-04 06:11:28
I have a local repository, and I have set up another repository on my live server: www.site.com/projects/ProjectA What I want to achieve is very simple: After I PUSH to GitHub, I want the repository at www.site.com/projects/ProjectA to PULL - hence update the live version of the project, that my client can see. I've been reading tons about hooks and I cannot find a very simple example for what I need. All tutorials are made for advanced functionality. What I have done I have the SSH access settings done. I have a remote repository at www.site.com/projects/ProjectA that I created while logged

PHP function or file to run before and after every request

本小妞迷上赌 提交于 2019-12-04 05:51:51
I am wondering if there is a way to specify a php function or file to be called every time a user visits and exits a page on my site. So if a user visits say example.com/ex.php can I have a function called before ex.php is run and after ex.php is finished? I want to be able to record the time it takes to execute php files on my site and store that so I can run queries later to analyze the info. I would prefer not to have to add code to the beginning and end of every file I want to track. Thanks in advance. Try auto Append/prepend file ini directive. http://php.net/manual/en/ini.core.php Apache

How to know if the keyboard is active on a text input

你说的曾经没有我的故事 提交于 2019-12-04 05:29:15
问题 I have an application that acts like an on screen keyboard, I need it to know if there is a keyboard cursor (caret) active any where, so the keyboard will set to active. I have searched for keyboard hooks and winapi, but I couldn't find the proper method to use. To simplify my problem, I need my application to be active if the user can press on the real keyboard and print text on the computer. 回答1: It is easy by searching for the caret position, since it should be larger than 0 GUITHREADINFO