patching

Self Updating

What's the best way to terminate a program and then run additional code from the program that's being terminated? For example, what would be the best way for a program to self update itself? ...

Hooking syscalls from userspace on Windows

I'm patching connect() to redirect network traffic as part of a library (NetHooker) and this works well, but it depends on ws2_32.dll remaining the same and doesn't work if the syscall is used directly. So what I'm wondering is if there's a way to catch the syscall itself without a driver. Anyone know if this is possible? ...

Patching out CALLL by replacing with NOPs works in user space but not in kernel space

I have a device driver I want to patch. This device driver calls IOLog and I want to get rid of the logging. If I replace the CALLL to IOLog with (the corresponding number of) NOPs inside the device driver (kext), the kernel crashes with what looks like a smashed stack ("Backtrace terminated-invalid frame pointer 0"). The same techniqu...

Hooking sycalls from userspace on Linux

Is there any way to catch all syscalls on Linux? The only solution I know of is using LD_PRELOAD à la fakeroot, but that only works for dynamically linked applications. Furthermore, this approach requires enumerating all syscalls which is something I'd like to avoid. ...

How do you apply patches on a web project at production server?

We recently had a project where we released beta of a big web app on our client's server. Our client requested us to do bug fixes as they come, and we tried to do it same way. Normally while building an app on our prototype server is way easier, as I just have to issue simple 'svn up' command which takes a second. But on production env...

How to overwrite some bytes in the middle of a file with Python ?

I'd like to be able to overwrite some bytes at a given offset in a file using Python. My attempts have failed miserably and resulted : - either in overwriting the bytes at given offset but also truncating the file just after (file mode = "w" or "w+") - or in appending the bytes at the end of the file (file mode = "a" or "a+") Is it...

Django : Adding a property to the User class. Changing it at runtime and UserManager.create_user

For various complicated reasons[1] I need to add extra properties to the Django User class. I can't use either Profile nor the "inheritance" way of doing this. (As in http://stackoverflow.com/questions/44109/extending-the-user-model-with-custom-fields-in-django ) So what I've been doing is including the User class in my local_settings ...

Git working with patches

To follow up on my previous question Git work flow with an inexpirenced member. I choose to have him send patches to me. The problem is i haven't used patches before and i can't find tutorials giving explanation on the work flow. What i want is have him pull the latest code from the repo. create a branch work on it commit his changes wh...

Cross platform patching

I have a program that I intend to install on Linux and Windows machines. I have it cross-compiling fine (with autotools), but at some point I would like the program to be able to update its binaries. The only ways I can think of doing this are: Give users write access to "C:\Program Files\Foo Program" or "/usr/bin/foo_program". or ...

Anyone know of a good free patch creator?

Does anyone know of a good patching program that is free? You know, one that can take a directory with your old program in it and compare it to a directory with your new version, and spit out a patch that is only the difference between the two? Also, I am looking for something that can patch the entire directory, not just one exe. EDIT...

What language is to binary, as Perl is to text?

I am looking for a scripting (or higher level programming) language (or e.g. modules for Python or similar languages) for effortlessly analyzing and manipulating binary data in files (e.g. core dumps), much like Perl allows manipulating text files very smoothly. Things I want to do include presenting arbitrary chunks of the data in vari...

How to dynamically patch a running ASP.NET application?

Does anyone have a sample of how to patch a running asp.net app? The scenario I'm envisioning is that the app could look to a known central server for newer versions. Download the newer files to a temp location and then patch itself. The issues that I can see are that any file changes will get picked up by the file watcher and reload th...

Can you help with this assembly language code?

Hi, I've been looking through a piece of code of a pc game that I'm trying to "improve". (ok so maybe I suck at the game but I still want to play it). Could you please look into the following code: fld dword ptr[ebp+00007B1C] fsub dword ptr[esp+64] fst dword ptr[ebp+00007B1C] call 004A2E48 This code is called every second for the lev...

Modifying Patch Creation Properties (.pcp) file programmatically?

Is there a way to script the complete process of a hotfix build using msiexec.exe and msimsp.exe with a Patch Creation Properties file? I use msiexec.exe to create network installations of the before and after msi files, Orca to create a .pcp file, and msimsp.exe to create the patch file. I have been following the steps in these two ar...

I don't "get" how a program can update itself. How can I make my software update?

Say I make an .exe file and everything is peachy. Wonderful it works. Say I worked on a new feature on the software and I want it to be available for people who already have the older version, how can I make the software find my new version, patch it, and then go about it's business. I can't seem to wrap my head around the issue. Than...

To (monkey)patch or not to (monkey)patch, that is the question

I was talking to a colleague about one rather unexpected/undesired behavior of some package we use. Although there is an easy fix (or at least workaround) on our end without any apparent side effect, he strongly suggested extending the relevant code by hard patching it and posting the patch upstream, hopefully to be accepted at some poin...

Resolving patch conflicts manually

I've downloaded a patch from some site and trying to apply it (twisted, python web framework). Several hunks failed. How do I automate manual patching process using vim? Details: I'm trying to automate the process of applying failed hunks. Many tiny changes, each about adding/removing 1-2 chars. Difficult to see. I Have to create...

How to update application files using patching?

I am not interested in any auto update solution, such as ClickOnce or the MS Updater Block. For anyone feeling the urge to ask why not: I am already using these and there is nothing wrong with them, I would just like to learn about any efficient alternatives. I would like to publish patches = small differences that will modify existing ...

[WiX] Is there a way to create a patch that is identical to doing a full install of the newer version?

I'm trying to create patches using the method from this tutorial. An issue I'm running into is that I can't install a new patch on top of a previous patch. I can full install Version A,then patch to Version B. After that I can't patch to Version C. I can full install Version B, then patch to Version C. Currently we just do full insta...

Rails - how do I confirm the version of a plugin.

I noticed that a rails plug-in I am using has had several fixes made to it, and im a little worried about all the other rails apps i have written. Ideally I would like to have a script that can compare the checked out version of the plug-in against the repo version. Does anyone know if rails stores this info anywhere or if there is a p...