Jump to content











Photo
- - - - -

LockDismount v0.3.0.0 [Update]


  • Please log in to reply
36 replies to this topic

#1 TheK

TheK

    Frequent Member

  • Advanced user
  • 141 posts
  • Location:Germany (BW)
  •  
    Germany

Posted 02 September 2010 - 11:02 AM

Hello Community :cheers:

LockDismount is a small tool that does only one thing (or two to be exactly). It locks and dismounts every volume of a physical drive (HD or UFD for example). That's it!

So what is that good for?

Microsoft changed the way programs can directly write to physical drives in Windows Vista and later.
More technical background informations about this new 'feature' (or restriction) can be found here: http://msdn.microsof...y/ff551353.aspx

Unfortunately some older (but still good and useful) programs are not compatible with this new restriction and stopped working. You will usually see an "Access Denied" error message when they try to write to .PhysicalDriveX.

This is where LockDismount can help. By locking and dismounting all volumes it will allow some of these older programs to work again.

How to use it?

Posted Image

It's simple. Select the Drive you want to lock and press 'Lock it!'. Now open the 'older program' and let it perform the task that usually gave you the access denied error message. When done, unlock the drive again. That's all.
The only important thing is that every volumes gets successfully locked and that you keep them locked until the other program is done.

Please note that you can not lock your system drive or any drive that holds a pagefile!

The idea for this little tool was born here:
http://www.boot-land...?...st&p=108122 by Wonko ;)
So you know who you have to blame for it :ph34r:

How to use the Command Line Interface?
LockDismount will open in GUI mode if you start it without any command line parameters. If one or more parameters are given, it starts in CLI mode.

Posted Image

Batch script example (including Wonko's modifications):

@ECHO OFF

lockdismount -lock 4 someapp.exe -someaction .PhysicalDrive4



IF %ERRORLEVEL% EQU 0 ECHO Operation succeeded!&GOTO :EOF



IF ERRORLEVEL 999 GOTO :NODRV

IF ERRORLEVEL 998 GOTO :LOCKFAIL

IF ERRORLEVEL 997 GOTO :EXECFAIL

IF NOT ERRORLEVEL 0 GOTO :CMDFAIL

GOTO :EOF



:NODRV

echo Drive #4 doesn't exist!

GOTO :EOF



:LOCKFAIL

ECHO Failed to lock/dismount volumes!

GOTO :EOF



:EXECFAIL

ECHO Failed to execute external command!

GOTO :EOF



:CMDFAIL

ECHO External command was executed but ended with an error!

GOTO :EOF


Programs tested so far:

Windows 7:
- RoadKil's Disk Image v1.6
- dsfi (part of the dsfok package)
- Flashnul

Windows Server 2008 R2:
- VMware Workstation 7.11

Windows Vista:
- still looking for testers

Changes:

v0.3.0.0:
- added force dismount option
- added command line interface


Download: LockDismount v0.3.0.0
  • Nuno Brito likes this

#2 TheK

TheK

    Frequent Member

  • Advanced user
  • 141 posts
  • Location:Germany (BW)
  •  
    Germany

Posted 02 September 2010 - 11:11 AM

I have 2 Physical Drive inside my box
\\PhysicalDrive0 PATA (fixed) 2 partitions
\\PhysicalDrive1 SATA (fixed)
I have an option in the box BIOS (controller boot order) to select which one (SATA or PATA) to boot from.
Currently SATA is ticked as boot controller
I boot from \\PhysicalDrive1 SATA (fixed)
i launch Lockdismount
select to lock \\PhysicalDrive0 PATA (fixed)
2 partitions are locked and dismounted but 2 "LockDismount" windows error message


Thanks for reporting ;)
Erwan already mentioned a similar issue with floppy drives. This should be fixed in v0.2.0.0.

May I ask what you use LockDismount for and if it works?
It would be nice to have a list of apps that are tested and work with LockDismount.

#3 ksanderash

ksanderash

    Frequent Member

  • Advanced user
  • 162 posts
  • Interests:electronics, PCs, cinema, reading books, psychology, philosophy
  •  
    Moldova

Posted 02 September 2010 - 11:41 AM

a list of apps that are tested and work with LockDismount.

1. CloneDisk ;)

#4 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 10,092 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 03 September 2010 - 12:36 PM

1. CloneDisk :)

Didn't Roadkil's Disk Image also work? (actually BEFORE Clonedisk did...:D)
http://www.boot-land...?...8480&st=242

:)
Wonko

#5 erwan.l

erwan.l

    Silver Member

  • Developer
  • 851 posts
  • Location:Nantes - France
  •  
    France

Posted 03 September 2010 - 04:05 PM

Didn't Roadkil's Disk Image also work? (actually BEFORE Clonedisk did...:D)
http://www.boot-land...?...8480&st=242

:D
Wonko


Actually, to be exact, now clonedisk does not need lockdismount anymore as I "shamessly" re used Thek idea within clonedisk source code :)

/Erwan

#6 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 10,092 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 03 September 2010 - 04:11 PM

Actually, to be exact, now clonedisk does not need lockdismount anymore as I "shamessly" re used Thek idea within clonedisk source code :D


"sha-mess-ly" :D

Is that a mess, BUT sha encrypted? :D :D

;)

:)
Wonko

#7 ksanderash

ksanderash

    Frequent Member

  • Advanced user
  • 162 posts
  • Interests:electronics, PCs, cinema, reading books, psychology, philosophy
  •  
    Moldova

Posted 03 September 2010 - 06:05 PM

CloneDisk had much trouble :D But now it doesn't need external locking.

Roadkil's Disk Image still need support. I gave feedback to author, but no reaction yet.

Another great utility, Flashnul, can write flash under Windows 7 only after locking the flash with TheK tool. I'll report the author this issue tonight. Well, he just answered that the project is discontinued (( And also advised me to delete my Windows 7 ))

Posted Image

Dsfo and Dubaron DiskImage do work w/o lock.

Posted Image

#8 bilou_gateux

bilou_gateux

    Frequent Member

  • Expert
  • 208 posts
  •  
    France

Posted 04 September 2010 - 06:10 PM

May I ask what you use LockDismount for and if it works?


Not yet checked.
Lock and dismount the disk in my dual disk box not used for booting, launch VirtualBox, use this physical disk in VM guest and start Windows in virtual machine from real hard drive partition.
Make sure that host and guest never access the drive simultaneously.

#9 Nuno Brito

Nuno Brito

    Platinum Member

  • Team Reboot
  • 10,121 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 05 September 2010 - 11:58 PM

Can we get a good description of this project on the first topic, please? :D

I would like to announce it on the newsletter but it would help to see an introduction topic.. :D

#10 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 10,092 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 06 September 2010 - 02:55 PM

OT :D, but as always not that much :), anyone old enough to remember the Win 9x "LOCK" command? :)

http://www.computerh...com/lockhlp.htm

The good thing about the MS guys is that not only they do mess things up, but they tend to do this in the same way! :D

:D
Wonko

#11 TheK

TheK

    Frequent Member

  • Advanced user
  • 141 posts
  • Location:Germany (BW)
  •  
    Germany

Posted 06 September 2010 - 02:55 PM

Can we get a good description of this project on the first topic, please? :D

Done :D

Well, I don't know if it's good, but at least it's a description :D

#12 Nuno Brito

Nuno Brito

    Platinum Member

  • Team Reboot
  • 10,121 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 06 September 2010 - 04:50 PM

Email newsletter sent! :D

Hope you get valuable feedback, keep up the great work! :D

#13 costinel

costinel

    Newbie

  • Members
  • 12 posts

Posted 06 September 2010 - 08:24 PM

guys, is there a fundamental difference between this tool and chkdsk /f /v driveletter: ? (which asks you for forced dismount)

#14 steve6375

steve6375

    Platinum Member

  • Developer
  • 4,967 posts
  • Location:UK
  • Interests:computers (!), programming (masm,vb6,C,vbs), OSes, photography,TV,films,guitars
  •  
    United Kingdom

Posted 06 September 2010 - 09:21 PM

Hi
This looks like a useful tool - what is the command line syntax for it, as it would be even more useful if it could be used from the command line?

#15 TheK

TheK

    Frequent Member

  • Advanced user
  • 141 posts
  • Location:Germany (BW)
  •  
    Germany

Posted 07 September 2010 - 03:13 AM

Hope you get valuable feedback, keep up the great work! :D


Thanks Nuno :)

guys, is there a fundamental difference between this tool and chkdsk /f /v driveletter: ? (which asks you for forced dismount)

Yes and no. chkdsk dismounts the volume the same way as LockDismount does. However you don't want chkdsk (or any other program) to write to the drive at the same time you perform a backup or restore.

Hi
This looks like a useful tool - what is the command line syntax for it, as it would be even more useful if it could be used from the command line?

Hi Steve,

there is no command line support at the moment, but I'm thinking about it. It would be a bit tricky to use it from a batch file anyway.

lockdismount -lock \\.\PhysicalDrive2

sometool -backup \\.\PhysicalDrive2 c:\backup.img

lockdismount -unlock \\.\PhysicalDriv2

something like this isn't possible at the moment because calling LockDismount would block the batch as it can't be closed before the backup task ends (that would automatically unlock the volumes). It would require multiple instances and IPC to work, wich is possible, but a lot more work.

#16 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 10,092 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 07 September 2010 - 07:53 AM

lockdismount -lock .PhysicalDrive2

sometool -backup .PhysicalDrive2 c:backup.img

lockdismount -unlock .PhysicalDriv2

something like this isn't possible at the moment because calling LockDismount would block the batch as it can't be closed before the backup task ends (that would automatically unlock the volumes). It would require multiple instances and IPC to work, wich is possible, but a lot more work.


I don't really see the problem. :)

Something like:
lockdismount -lock .PhysicalDrive2

START /WAIT "A title" sometool -backup .PhysicalDrive2 c:backup.img

lockdismount -unlock .PhysicalDrive2


Or am I missing something?

:D
Wonko

#17 steve6375

steve6375

    Platinum Member

  • Developer
  • 4,967 posts
  • Location:UK
  • Interests:computers (!), programming (masm,vb6,C,vbs), OSes, photography,TV,films,guitars
  •  
    United Kingdom

Posted 07 September 2010 - 07:53 AM

Hi Steve,
there is no command line support at the moment, but I'm thinking about it. It would be a bit tricky to use it from a batch file anyway.

lockdismount -lock \\.\PhysicalDrive2

sometool -backup \\.\PhysicalDrive2 c:\backup.img

lockdismount -unlock \\.\PhysicalDriv2
something like this isn't possible at the moment because calling LockDismount would block the batch as it can't be closed before the backup task ends (that would automatically unlock the volumes). It would require multiple instances and IPC to work, wich is possible, but a lot more work.



How about

start lockdismount -lock \\.\PhysicalDrive2

sometool -backup \\.\PhysicalDrive2 c:\backup.img

taskkill /IM lockdismount.exe


#18 paraglider

paraglider

    Gold Member

  • .script developer
  • 1,614 posts
  • Location:NC,USA
  •  
    United States

Posted 07 September 2010 - 11:45 AM

That gives potential timing problems. You need the lock program to run and lock the drive before the backup program runs and attempts to access the physical drive.

Thinks what needed is for lockdismount to have an option to run a configurable command line after its locked the drive.

#19 steve6375

steve6375

    Platinum Member

  • Developer
  • 4,967 posts
  • Location:UK
  • Interests:computers (!), programming (masm,vb6,C,vbs), OSes, photography,TV,films,guitars
  •  
    United Kingdom

Posted 07 September 2010 - 12:17 PM

That gives potential timing problems. You need the lock program to run and lock the drive before the backup program runs and attempts to access the physical drive.

Thinks what needed is for lockdismount to have an option to run a configurable command line after its locked the drive.



How about passing the command for your program to execute?

start /wait lockdismount \\.\PhysicalDrive2 domybackup.cmd


so your app locks the drive volumes, calls the cmd file (or exe with params?) then unlocks and exits?

#20 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 10,092 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 07 September 2010 - 01:12 PM

That gives potential timing problems. You need the lock program to run and lock the drive before the backup program runs and attempts to access the physical drive.

Thinks what needed is for lockdismount to have an option to run a configurable command line after its locked the drive.


Which amount of time do you expect?
I mean, millisecond, seconds, minutes or hours :)?

I guess that if the verified time to actually lock a physicaldrive is, say a bunch of tenths of a second, we can put a fixed timeout of say, 5 seconds, and noone will complain.... :)


something like:
lockdismount -lock .PhysicalDrive2

::Wait a bit

::like using a PING or any of the WAIT third party programs available

START /WAIT "A title" sometool -backup .PhysicalDrive2 c:backup.img

lockdismount -unlock .PhysicalDrive2


OR wouldn't a good ol' ERRORLEVEL check be enough, possibly with a -islocked feature? :D

lockdismount -lock .PhysicalDrive2

:Lock_Loop

::Wait a bit

::like using a PING or any of the WAIT third party programs available

::Check somehow that the drive is locked/unlocked, like:

lockdismount -islocked .PhysicalDrive2

IF "%ERRORLEVEL%"="......." (START /WAIT "A title" sometool -backup .PhysicalDrive2 c:backup.img) ELSE (GOTO :Lock_Loop)

lockdismount -unlock .PhysicalDrive2


:D
Wonko

#21 TheK

TheK

    Frequent Member

  • Advanced user
  • 141 posts
  • Location:Germany (BW)
  •  
    Germany

Posted 07 September 2010 - 02:58 PM

Thinks what needed is for lockdismount to have an option to run a configurable command line after its locked the drive.

How about passing the command for your program to execute?

start /wait lockdismount \\.\PhysicalDrive2 domybackup.cmd


so your app locks the drive volumes, calls the cmd file (or exe with params?) then unlocks and exits?


hmm...that should do the trick. I'll give it a try :D

OR wouldn't a good ol' ERRORLEVEL check be enough, possibly with a -islocked feature? :D

lockdismount -lock \\.\PhysicalDrive2

:Lock_Loop

::Wait a bit

::like using a PING or any of the WAIT third party programs available

::Check somehow that the drive is locked/unlocked, like:

lockdismount -islocked \\.\PhysicalDrive2

IF "%ERRORLEVEL%"="......." (START /WAIT "A title" sometool -backup \\.\PhysicalDrive2 c:\backup.img) ELSE (GOTO :Lock_Loop)

lockdismount -unlock \\.\PhysicalDrive2


lockdismount -unlock \\.\PhysicalDrive2

This requires multiple instances and IPC (inter process communication) as you can't pass a command line parameter to a program that is already running.

With IPC it would work like that:

lockdismount -lock \\.\PhysicalDrive2
- first instance of lockdismout starts.
- first instance starts a second intance and passes the required parameters to the second instance.
- second instance locks, dismounts and passes the result back to the first instance (and keeps locking and running).
- first instance exits and passes the exit code to the batch file (wich can by queried with ERRORLEVEL).

- now the backup (or whatever) program can be startet
sometool -backup \\.\PhysicalDrive2 c:\backup.img
- when it exits another instance of lockdismount needs to be startet
lockdismount -unlock \\.\PhysicalDrive2
- this will tell the second instance which is still running to unlock and exit.

Sounds complicated, but would be easy to use.

Maybe I can find some time at the weekend to try this aswell.

#22 Holmes.Sherlock

Holmes.Sherlock

    Gold Member

  • Team Reboot
  • 1,349 posts
  • Location:India
  •  
    India

Posted 07 September 2010 - 03:57 PM

Am I correct in saying:

Locking means - enabling direct disk access
&
Dismounting means - to invalidate all open handles to the drive?

Is there any other subtle difference?

#23 Bladrunner

Bladrunner
  • Members
  • 3 posts

Posted 07 September 2010 - 07:07 PM

Just to let you know that the download link dosnt work - times out and says to try later - have tried downloading form different PCs




Hello Community :)

LockDismount is a small tool that does only one thing (or two to be exactly). It locks and dismounts every volume of a physical drive (HD or UFD for example). That's it!

So what is that good for?

Microsoft changed the way programs can directly write to physical drives in Windows Vista and later.
More technical background informations about this new 'feature' (or restriction) can be found here: http://msdn.microsof...y/ff551353.aspx

Unfortunately some older (but still good and useful) programs are not compatible with this new restriction and stopped working. You will usually see an "Access Denied" error message when they try to write to \\.\PhysicalDriveX.

This is where LockDismount can help. By locking and dismounting all volumes it will allow some of these older programs to work again.

How to use it?

It's simple. Select the Drive you want to lock and press 'Lock it!'. Now open the 'older program' and let it perform the task that usually gave you the access denied error message. When done, unlock the drive again. That's all.
The only important thing is that every volumes gets successfully locked and that you keep them locked until the other program is done.

Please note that you can not lock your system drive or any drive that holds a pagefile!

The idea for this little tool was born here:
http://www.boot-land...?...st&p=108122 by Wonko :D
So you know who you have to blame for it :D

Programs tested so far:

Windows 7:
- RoadKil's Disk Image v1.6
- dsfi (part of the dsfok package)
- Flashnul

Windows Vista:
- still looking for testers

Download: LockDismount v0.2.0.0



#24 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 10,092 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 08 September 2010 - 09:51 PM

Just to let you know that the download link dosnt work - times out and says to try later - have tried downloading form different PCs


It's working now, however, and just in case, I am attaching it.

:D
Wonko

Attached Files



#25 sanbarrow

sanbarrow

    Silver Member

  • Developer
  • 788 posts
  • Location:Germany - Sauerland

Posted 08 September 2010 - 11:31 PM

nice tool - thanks for posting it

I use it with VMware Workstation 7.11 on a 2008 R2 host to run VMs that use physical disks.
Way easier to use this tool then having to use the other known workarounds.

Ulli




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users