Patching?!

This is a discussion on Patching?! within the Tech Board forums, part of the Community Boards category; can someone please explain me how software patches work? let say i have a software and the vendor releases a ...

  1. #1
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768

    Patching?!

    can someone please explain me how software patches work?
    let say i have a software and the vendor releases a patch, i install the patch and the software is fixed, how does it work?



    thanks.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  2. #2
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Well most of these applications use external files and/or libraries.

    So patches usually replace either these files or the actual executable.
    What is C++?

  3. #3
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    by libraries you mean dll files?
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  4. #4
    C(++)(#)
    Join Date
    Jul 2004
    Posts
    309
    DLLs, MPQs, and the like. Basicly any library file type can be used to allow for easier patching, by overriding them. This way you don't always need to change the whole program itself.
    To code is divine

  5. #5
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    never heard of mpq before, are they like the dll?
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  6. #6
    C(++)(#)
    Join Date
    Jul 2004
    Posts
    309
    It's only really used (accutely I think it's ONLY used) by Blizzard Entertainment in their games. It's more like a .zip than a DLL. It basicly holds a bunch of files, like models and important .txt files, that can easily be called from in the main file. Its almost like a folder file. Search for WinMPQ for more information on it, althought I don't think anyone really knows how to use it except for Blizzard.

    But basicly they just place any patch change information in it, so in small patches they can just replace the patch.mpq file and easily change stuff.
    To code is divine

  7. #7
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    so if i'm not part of the Blizard crew the only way to patch my software without changing the entire program is to use dlls!?
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  8. #8
    C(++)(#)
    Join Date
    Jul 2004
    Posts
    309
    Or develop your own type of library. Also, if the file isn't very large, you could just redistirbute a new .exe that overwrites the old one wih the new, patched, one.
    To code is divine

  9. #9
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    got it, thanks.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  10. #10
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    The fastest patch I've ever seen run was one put out by lucas arts for their jedi knight series. All it did was patch a few bytes in the .exe and it was done (ie: changed some bytes around, I'm sure it only had to do with the graphics engine). So there are several ways it can be done. The most foolproof has already been covered here, but the quickest and coolest is to actually patch files by changing the byte-code...very cool stuff.
    PHP and XML
    Let's talk about SAX

  11. #11
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,786
    Quote Originally Posted by Waldo2k2
    The fastest patch I've ever seen run was one put out by lucas arts for their jedi knight series. All it did was patch a few bytes in the .exe and it was done (ie: changed some bytes around, I'm sure it only had to do with the graphics engine). So there are several ways it can be done. The most foolproof has already been covered here, but the quickest and coolest is to actually patch files by changing the byte-code...very cool stuff.
    Also pretty difficult for anything more than swapping a few bites (i've managed to add a new section, hijack the thread before running the startup code, open a messagebox and then return to the original code - always seems a little shakey though and doesnt always work too well)

    Also, antivirus programs hate this method and can sometimes see this as a virus (thereby stopping the patched program from running).

    Youre better off swapping dlls

  12. #12
    Registered User
    Join Date
    Sep 2004
    Posts
    123
    I was going to say much the same thing as Fordy, so instead I'll just add that some malware will do exactly that - modify or even delete legitimate system files.

    I'd guess that if you could open a valid Windows file for writing and squirt some extra code in there, you could be capable of writing a pretty nasty piece of malware. If the manufacturer, date, and version details are left intact, it would not be easy to spot that something is seriously wrong.

    The best (only?) way you'd be able to detect it would be to compare it (or its MD5 hash) against the correct versions of the file, and give alert based on the differences.

    I've even seen cases where Notepad has been replaced with a malware installer!

    Edit: Where I work, we use PowerBuilder. The software, as delivered, comes as executables (.exe) and PowerBuilder Dynamic libraries (.pbd) (in addition to others irrelevant to this). When a customer requires a patch, I make a change in the source library (pbl) and recompile the required pbd file(s), then deliver it to the customer.

    Problem: Supposing somsone raises a patch that involves a.pbd and b.pbd, then I come along at a later date and raise another patch to b.pbd, I can't just deliver b.pbd as this could leave a system with half another patch. All patches must be delivered to prevent this from occurring.
    Last edited by Driver; 11-05-2004 at 06:12 AM. Reason: Add info

  13. #13
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    >>All patches must be delivered to prevent this from occurring.

    this is why nearly all games that can be played online now force updating of the software before connecting to servers. And I've seen several programs btw that patch windows files...many of them are used for...well lets just say some people prefer not to pay for software. I've always wanted to be able to do this type of thing, I just don't have the patience to step through a program under softice for hours on end to get everything mapped out. That's mainly why I was so impressed with lucas arts. They did exactly what I've always wanted to do and it worked perfectly (and afaik my antivirus didn't complain at all).
    PHP and XML
    Let's talk about SAX

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Patching an exe to block 3rd party extractors
    By jmprox in forum Windows Programming
    Replies: 9
    Last Post: 09-24-2008, 11:54 AM
  2. Patching System
    By Puppet Master in forum Game Programming
    Replies: 7
    Last Post: 05-18-2006, 10:12 PM
  3. patching memory in another process
    By 44ffcc in forum Windows Programming
    Replies: 2
    Last Post: 02-06-2006, 08:32 AM
  4. Patching a file
    By bEaST in forum C++ Programming
    Replies: 10
    Last Post: 09-21-2003, 01:33 AM
  5. Patching
    By CodeMonkey in forum C++ Programming
    Replies: 5
    Last Post: 07-25-2002, 08:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21