Patching

Just starting out? Need help? Post your questions and find answers here.
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Post by NoahPhense »

Patching is not important to me. My clients are much happier to receive a
full 'update' in the mail via CD.

But that will soon end. Once I have my server fully funcitonal, I will be
using an online updater. And for those that don't want to use the updater,
they can just login to the support forum anytime and download the latest
patch.

I find that clients don't mind downloading updates.. they rather look
forward to it, as we do with PB.. ;)

- np

I really couldn't patch my stuff anyhow, as it is encrypted.
deadmoap
User
User
Posts: 79
Joined: Sun Feb 22, 2004 11:45 pm
Location: Riverdale, Utah
Contact:

Post by deadmoap »

If you're a good programmer that not only knows how to program, but also how programs work and how they're put together, you can make it so that the users only have to download the changed parts of the executable.

I'm not going to explain how programs are put together. It's very complicated and you're probably only going to learn the same way I did, by disassembling very small programs and compairing the machine code to the assembly. I don't know that much about it myself, but I know enough to get by.

First, you need to know where stuff is in your program. Whenever you add/remove/change any code, you add a label in your program to the place where you're going modify, download the new code, and then "insert" the code into the right place of the executable.

But this idea may not be completely bug free. It might mess up parts of the program that hold certain addresses of the program and if you insert code in the middle, then everything behind it is pushed back so static addresses may be wrong.

I don't know exactly how to do this or if it would even work... it was just an idea. I could be giving you the old banana in the tail-pipe. :P
User avatar
griz
Enthusiast
Enthusiast
Posts: 167
Joined: Sun Jun 29, 2003 7:32 pm
Location: Canada

Post by griz »

You shouldn't need to worry about any of that, or even encryption. A byte level patcher doesn't care how you write your code, or if it is encrypted. It simply replaces the bytes in the file which have changed, and adds or removes bytes as required if the file sizes are different. You're essentially replacing one exe with another, byte by byte.

Although Pure Basic applications are small, I do like the idea of a tiny patcher for efficiency. If you had a 100KB patcher update versus a 500KB application update and there were a thousand downloads ... it would save you nearly 400 MB in bandwidth. As well, it can be written to update multiple files in a directory, including subdirectories. So you can distribute a single exe that brings everything up to date in a nice and tidy fashion.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> If you had a 100KB patcher update versus a 500KB application update and
> there were a thousand downloads ... it would save you nearly 400 MB in
> bandwidth.

A good point that I never considered.
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Post by NoahPhense »

PB wrote:> If you had a 100KB patcher update versus a 500KB application update and
> there were a thousand downloads ... it would save you nearly 400 MB in
> bandwidth.

A good point that I never considered.
Good thing I have unlimited bandwidth on an OC13c line (1000Mbits).

http://abetterhostingservice.com/network.htm
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post by LarsG »

NoahPhense wrote:
PB wrote:> If you had a 100KB patcher update versus a 500KB application update and
> there were a thousand downloads ... it would save you nearly 400 MB in
> bandwidth.

A good point that I never considered.
Good thing I have unlimited bandwidth on an OC13c line (1000Mbits).

http://abetterhostingservice.com/network.htm
My host has some kind of similar net... They've got several fibre lines directly to the norwegian portal handling most (if not all) of the traffic abroad... :)

I asked them if they had some sort of restrictions on the download rate, and I got an answer saying it normally wouldn't be any problem, but if I was worried I would get *alot* of traffic (I'm guessing several Gigs a week), then I should contact them, and they'd setup a dedicated server deal for me.. :p

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Post by NoahPhense »

Yeah this I know the sole owner of this setup.. so if anyone is interested.
Let me know, and I'll put you in touch with him.

Don't get me wrong this guy has restrictions too. But if.. when ;) I
have a requirement for over 1 billion bytes, I'm sure I will be able to
afford the next level.

- np
CherokeeStalker
User
User
Posts: 66
Joined: Fri Oct 17, 2003 2:42 am

Post by CherokeeStalker »

thefool wrote:@CherokeeStalker:

I have written a byte patcher for non-size changed files. I know its possible to make patchers that can work with changed filesizes, but how? Can you explain the concept? And btw, how lang are you converting it? :D
It's not one of my higher priorities at the moment BUT I can knock it up a notch or two in the list ! Look for me to post code here in 2 weeks or so. :D
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

thanks :D
Mohawk70
Enthusiast
Enthusiast
Posts: 404
Joined: Thu May 11, 2006 1:04 am
Location: Florida, USA

Re: Patching

Post by Mohawk70 »

I know this is an extremely old post but the method goes like this ...
1: old file is smaller
A: compare the exes up to the size of the old file and save the byte offset, old byte value, and new byte value off bytes thst are different ( hex encoded
$PPPPPPPPOONN --> P = offset O=Old N=New )
B: for offsets beyond the old file size
$PPPPPPPPXXNN X=non-existant
C: patch the differences from A
D: append the bytes from C
Note: keep track of number of bytes from A & B

You can validats files using filesize and sha3-512 filehashes


To speed up comparison compare smaller chunks and only look for different byte values if the chunks aren't identical.

Reverse for new file is smaller


This method would allow patch undo also
HP Z800 Workstation
CPU : Dual Xeon 5690 3.46GHz
RAM : 96GB RAM ( 8GB x 12 )
PSU : 1100W
GPU : NVIDIA RTX 3050 8GB
STORAGE : 9TB
(4) 2TB Seagate IronWolf Pro HDD
(1) 1TB Samsung 870 EVO SSD
Post Reply