BsDiff for Windows and .net   November 18th, 2007

This program is based on the excellent unix tool bsdiff from Colin Percival.

I made some adjustments, so that it would compile in C++ mode in Dev-C++ IDE (mingw compiler), using the libbzip2 package.

This version is based on bsdiff 4.1. The difference between 4.1 and 4.2 is only in the patch program, instead of using lseek and read he now uses pread, which I find this text about it:
Another thing to take note of is that Linux 2.2 introduces the pread() and pwrite() system calls. These allow a process to read and write from a specified position in a file. This is similar, but not identical, to using the lseek() system call followed by an ordinary read() or write() system call. In particular, concurrent access to a file (required for asynchronous I/O (AIO) support) requires the pread() and pwrite() system calls.

In the windows version, I had to adjust the code anyway, because I am not using pipes, but keep the file open for reading. I guess the bug of the official bsdiff had to do with the concurrent access of the several forks of the program to the file. That does not happen in the windows version at all, the file is opened only once.

For questions, write to Timotheus Pokorra.

Here are the sources (including the .dev files for Dev-C++):
Here are the 2 executables:
The code is licensed under the BSD Protection License (see the original LICENSE file in bsdiff-4.1.tar.gz).

See also Andreas John’s bsdiff for Visual C++.

May 2007: I have ported the program to, and with small modifications (make it a proper dll) you can use it even with C# programs. If anyone is interested in the code, I will be happy to share it. Drop me an email…
June 2007: Ok, someone has dropped me an email, and here is the version, with all required dlls. also read the readme.txt included in the archive, and the documentation in bsdiff.pas. If you have questions, ask!

Tags: , , , ,
This entry was posted on Sunday, November 18th, 2007 at 12:21 am and is filed under Software Development. You can follow any responses to this entry through the RSS 2.0 feed.Both comments and pings are currently closed.

2 Responses

April 13th, 2012 at 5:27 am
YB Says:

hi. my name is YB and I lived in Seoul. It is very usefull to me which you write about bsdiff.
So, please give me a dll source if it is not a harmfull to you.
my email address is and i don’t find your email so reply on this board. thank you and wait you. ^^

April 13th, 2012 at 3:28 pm
Timotheus Pokorra Says:

Hello YB, please find the link in the text.
The link still works.
All the best, Timotheus