Monday, June 29, 2009

Want a Signed Driver?

Yeah, you know you want it... A signed driver... So you don't need to jump through any of the hoops necessary to get unsigned drivers (like what PeerBlock - and PeerGuardian 2 before it - require to run) to load under recent versions of Windows.

What does it take to get an official signed driver? One thing, really:


Looks like there are only two places on the planet from which you can buy code-signing certificates that will instruct Windows that it's okay to load a driver. One of them costs $500/year, the other is $230/year. (Possibly plus taxes/VAT, I'm not yet sure.) To get to that point, we're going to need to all pitch in together!

After looking further into the matter, they will not sell code-signing certificates to individuals, only "registered organizations". This appears to mean that I'll need to setup an LLC or something before being "allowed" to purchase the code-signing certificate for us . . . at an additional cost of about $200 here in the state of New York in which I live. So our target goal is not the $230 I'd originally assumed, but more like $430. We're still over halfway to that larger value now, so will get there, it's just going to take a bit more time.

So to start things off, I've signed up at to accept donations. All money we initially collect will be pooled up until we have enough for one of these driver-signing certificates; anything over and above that will be used for better hosting for the project, and/or some additional PeerBlock-related ideas I have. Depending on how the cash flow ends up looking, money will also be set aside for future years' code-signing certificates; the $230+ payment only allows you to sign that driver for one year from the date of purchase, although anything we sign within that time will remain signed even after the certificate expires.

So click that little "Donate" image above, and let's see what we can do to get that signed driver! Donate as much as you feel comfortable with: the cost of a beer, the cost of a pizza, the cost of a CD, or a movie, or a videogame . . . even a single dollar will help to aid The Cause.

Status: As of 9/23/09, we've raised enough money to purchase our code-signing certificate (and all the company-registration stuff required to get to that point), and have in fact released a version that includes a signed-driver: PeerBlock r162 Interim Release! While we've talked this all over the rest of our site(s), I just noticed that I hadn't updated this post with our current status for awhile - figured I should do that. We are still collecting donations in the hopes that we will be able to afford to rent a VPS server which would hopefully support a "real" online-updating system, and in less than 12 months we'll need to purchase another $230 code-signing certificate, so rest assured that your donation will still be used for a good cause.

Thanks for your support!

        ---  Mark  ---

Edited to try a new direct-to-PayPal Donate button, so as to not require you to have a account to be able to donate. Here's the one in case you'd rather do it that way:

Support This Project
Edited 7/24/09 to reflect the fact that it turns out we'll need to register as a company before being allowed to purchase a code-signing certificate.
Edited 8/5/09 to include a "Status" line, showing how much we have in our driver-signing fund.

Sunday, June 28, 2009

PeerBlock r52 Interim Release

Here is the latest "test version" of PeerBlock - based on the code at SVN rev 52 at Google Code. Please give it a shot on your respective systems, and let me know one way or the other how it works for you.

What's Changed

Here's what's different since the last official public "ghetto release" of r33.

First off, and most importantly I think, the pg2loader.exe tool should no longer be necessary to start up PeerBlock. We should no longer be seeing the "hang while updating/adding-to lists" problem either.

Next up is the mini-dump functionality. In theory, any unhandled exceptions should be triggering creation of a peerblock.dmp file. In practice, however, I have been having some issues getting that to work reliably . . . particularly with the "app-crash on exit" problem I've been seeing every so often when exiting the "Release (Vista) x64" version of the program. If you end up generating any problems that result in the creation of a peerblock.dmp file, please send it to me along with your peerblock.log. Hopefully I'll have things setup to be able to analyze them this time.

PeerBlock now has new filenames, peerblock.exe and pbfilter.sys. This means that it can be installed in the same directory as your currently-installed PG2 install, without overwriting files. It also is now using peerblock.conf as its configuration file; if this file doesn't exist, it will first read-in pb2.conf and use that as its initial settings, and will then save to peerblock.conf (i.e. NOT overwriting pb2.conf) when you exit it.

Other than that, the program version now shows up in both the main UI window as well as in the "About" screen (right-click on icon, select "About"). Also the OS version you're running should be logged into the peerblock.log file.

Known Problems

These are some problems I've currently seen with the tool on my machine.
  1. Crash When Exiting - After right-clicking on the taskbar icon and selecting "Exit", sometimes the program crashes. Almost never happens while I'm running in the debugger, and the minidump-creation code doesn't seem to be kicking-in.
  2. Crash Before Updating - Very rarely, I've seen the program crash while it's preparing to setup network connections to check for updates. The one time I saw this in the debugger, it appeared to be while it was setting up the preconnect callback (which are PG2's modifications to the original libcurl library), so this is likely either a problem with those original routines, my port of them to the new libcurl codebase, or some combination thereof. Have not seen this happen since I got the minidump stuff built-in.
  3. Long Startup - It seems to take awhile after you first run the tool before it starts checking for updates and the taskbar icon appears. I only started seeing this recently, so it may be a side-effect of the minidump-creation stuff I put in there.
  4. Delayed UI - Even after the taskbar icon appears, if you double-click on it (or even right-click) it takes awhile for the UI to respond. The right-click menu takes awhile to appear, the main UI window takes awhile to show up and then after it shows up takes a second or so to become responsive as it scrolls through all the recent activity. This may be due to the fact that I've recently been stopping/restarting it while heavy network traffic (utorrent-based bittorrent) is underway so it's getting swamped - which may have been what led to the original PG2 warnings of "make sure utorrent is NOT running before you start PG2".
...and I think that's just about it. The last two of these issues have just recently started showing up, so may be due to recent updates I've made. The first two have actually been around for awhile now, but few other people have reported seeing them - so there may be some particular machine-configuration that brings them out.

If you can confirm/deny seeing any of these problems on your setup, please make sure to let me know!!

Things to Test

Here are some tests we should all try to run through on our respective machines:
  1. Side-by-Side Installation - Unzip the peerblock.exe and pbfilter.sys files into the same directory in which you currently have PG2 installed. Make sure that no peerblock.conf file is currently in that dir; delete the pre-existing peerblock.conf if it's there. Try running PeerBlock and make sure that its settings look the same as PG2's. Exit the program and make sure that a peerblock.conf is created. Start PG2 again and update some of the settings; then exit and restart it to make sure those new settings are successfully loaded.
  2. Base Install - Try unzipping peerblock.exe and pbfilter.sys into their own directory somewhere and running it. It should run through the "Startup Wizard", and afterwards should run normally (peerblock.conf and all). Verify this, and that there is no pg2.conf file in that directory afterwards.
  3. Version Display - Make sure that the title of the main UI window says "PeerBlock r52". Right-click on the taskbar icon and select "About"; verify that it says "PeerBlock r52" in there as well.
  4. OS Rev Logging - Open up peerblock.log and look up near the beginning of the file, verify that the "Running on OS:" line correctly states the version of Windows you're running.
  5. Update at Startup - Set PeerBlock's configuration to Update At Startup. Verify that the program starts, doesn't crash, and does in fact appear to be working correctly.
  6. Exit - Try exitting/restarting the program many times, to see if you can hit Problem #1 above.
  7. Update Lists - Check the update functionality, make sure no crashes occur. (i.e. test for Problem #2 mentioned above.)
  8. Startup Delays - Check for Problems #3 and #4 above.

Get it Here

Make sure you pick the right file for your OS rev!

Thanks for Contributing!

Thanks guys, I'm very appreciative that y'all are willing to help out with this pre-release testing. Hopefully we'll be able to smooth things out enough that we can agree it's ready for another public release sometime soon. Oh, and I'd like to extend thanks to you guys in the Official PeerBlock Credits (e.g., displayed in the About window) for your help. Let me know how you'd like to be credited (or if you'd rather not be, for some reason); full name like everything else in there now, some alias, both (e.g. Mark "MarkSide" Bulas), or what.

Again, if you encounter any problems whatsoever, please either drop me an email or comment to this blog-post describing the error, what OS rev you're running, etc. And make sure to save aside the peerblock.log and peerblock.dmp files for me from any problem-runs, before you restart PeerBlock.

Happy Testing!

        --- Mark ---

Friday, June 26, 2009

Mini-Dumps (r46/r47)

PeerBlock can now generate mini-dumps!

This means that when the program crashes, it should automagically create a peerblock.dmp file containing the state of the program as it was when the exception was hit. Hopefully this should help me get enough information that I'll be able to quickly track down crash-causing bugs such as the occasional crashes during list-updating, or while exiting the program.

From r46 on in, if you experience such a crash with PeerBlock, please make sure to send me peerblock.log as well as peerblock.dmp (if it exists).

Technical Details

I'm making use of the SetUnhandledExceptionFilter() routine, as documented in the CodeProject article Post-Mortem Debugging Your Application with Minidumps and Visual Studio .NET. Note that in order to get it to build under Win32, the "TopLevelFilter()" routine (PeerblockExceptionFilter(), for our project) needs to be declared as returning a LONG WINAPI, not just a LONG as per the article.

Currently I'm simply setting this exception-filter up during program start, and it's simply writing-out to a peerblock.dmp file in whatever directory PeerBlock is running from. Future work in this area should include writing this out to a PeerBlock App-Data directory, saving some number of dumps instead of overwriting them each time, including support for large dump-files (i.e., including heap), and ensuring that we can get a mini-dump even if we're internally catching the exception (e.g., by adding a "take dump" button to the message-box that appears, or at least by explicitly calling our PeerblockExceptionFilter() routine).

Thursday, June 25, 2009

Now Using peerblock.conf (r44)

In SVN r44 (at Google Code), I just implemented use of a peerblock.conf file for PeerBlock configuration. This should work well with the recent renaming of the program files to peerblock.exe and pbfilter.sys, as you can now install PeerBlock into the same directory as PG2 - without overwriting any files - and it will be able to work without affecting PG2's operation. If peerblock.conf doesn't exist, it will instead load pg2.conf (assuming it exists) and then save the settings to a new peerblock.conf file when you exit the program.

Technical Details

If all you're interested in is the user-visible side of things, you can stop reading now. This "Technical Details" section is where I plan on putting the more code-specific stuff; for my own future reference, or for anyone following along with the code at home.

The configuration-file loading routines live in configuration.cpp/.h. I added a parameterized LoadFile() routine that accepts the name of the file you'd like to load, and returns true if it successfully loaded or false if not. Load() now calls into this routine to first attempt to load peerblock.conf from the directory the program is located in, and if it cannot it then tries to load pg2.conf as a backup.

When the program exits, it will save its settings out to peerblock.conf. Note that this appears to be the only time the code saves the settings, and I didn't feel like changing it. Might be worth changing it to save whenever you update settings though, just in case the program crashes after you've updated settings but before you've exited safely . . . then again maybe this is by design, in case one of your new settings is what caused the crash?

Added tracelog statements at Info level. Since Release mode builds will log at Info level we'll see these messages whenever the program is run, but this should be okay since we really shouldn't be calling into the routines all that often.

What IS PeerBlock??!?

If you've wandered over here randomly, and have no idea what this here "PeerBlock" thing is, this post is for you.

PeerBlock is a new version (aka a "fork") of the popular Peer Guardian 2 software. It blocks "known bad" computers from accessing yours, for example governments and corporations. The problem with PG2 is that it hasn't been updated for around 2 years now, and has a number of bugs that are particularly obnoxious on Windows Vista and Windows 7 (especially 64-bit). So PeerBlock was started to try and bang the source into shape, fix those bugs, and generate a PeerGuardian 2 variant that actually works without all the workarounds on top of hacks required by PG2.

I hope to eventually merge my changes back into the mainline PG2/PG3 source tree, but for now am simply aiming to have something that works well on my new 64-bit Windows 7 (RC) based machine.

If you're interested in helping out - either by hacking away at the code with me or even just by testing out new private builds of the app - send me an email and let me know!

Thanks for reading,

        --- MarkSide ---

Welcome to the PeerBlock Dev Blog!

This blog will track the ongoing development of PeerBlock, a fork of the original PeerGuardian 2 code.

My intent is to post to this blog as I work on PeerBlock. These posts will include discussion of new features; tips/tricks I've learned while banging away at the code; analysis of the code as I perform "code archaeology" to figure out what it all means; third-party libraries I'm including; and more. Ideally, I'd love to be able to discuss each and every meaningful SVN commit, for sake of future "archaeologists" if nothing else - the base code is rather obtuse (and almost completely uncommented) so it's taken awhile for me to fully understand what is going on, and I'd love to be able to save the next person who comes along to resurrect the project some grief.

If you're interested in what's coming down the pike for PeerBlock, this is where you want to be to find out!

Thanks for reading,

        --- MarkSide ---