Later user TheK made the first good solution using the win api in his LockDismount tool; http://reboot.pro/12413/
LockVolume is more or less the same as his, except it is written AutoIt and source is attached. However, some differences are present;
1. My tool is per volume, whereas his is per disk.
2. Mine can optionally dismount if necessary, whereas his will dismount (not 100 % sure though)
Anyways, the only purpose was to provide some source for AutoIt coders to reuse. If there's bugs, the source is provided for you to fix..

Some explanation of the GUI:
Usually clicking on just "Lock It" and "Unlock It" should be enough. But sometimes you may want to dismount the volume as well. If so, then click on "Safe Dismount", after volume is locked. But if something is preventing the volume from being locked, then you must force dismount it by clicking on "Force Dismount" (no need to lock it afterwords then). Remounting the volume after a forcefully dismount, is done by clicking on "Force Remount". The activated buttons should be activated when it makes sense to use them, and if not show an error message. Either way, if anything goes wrong, just close the application, and all locks will be unocked. Just beware that a forced dismount may cause issues if something serious was going on on the file system for that volume.
Download; http://www.mediafire.../LockVolume.zip








