I'm assuming, of course, that you're using some version of XP. Download the patch first, before you format. Throw it on a CDR or something, format, install your OS, and before you plug in your network cable, install the appropriate patches.
Here's the Sasser patch patch.
Here's the XP...