Jump to content











Photo
- - - - -

LockDismount v0.3.0.0 [Update]


  • Please log in to reply
36 replies to this topic

#26 TheK

TheK

    Frequent Member

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

Posted 09 September 2010 - 03:02 AM

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?

It's a bit more complicated than that. I think MSDN explains it best:
FSCTL_LOCK_VOLUME
FSCTL_DISMOUNT_VOLUME

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

:D
Wonko

Thanks for helping out :D
Looks like Mediafire was down for at least a day :)


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

Thanks for your feedback Ulli :)

Now there's only Vista left for testing...

#27 TheK

TheK

    Frequent Member

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

Posted 12 September 2010 - 11:16 AM

updated to v0.3.0.0.

See first post for more details :hyper:

#28 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 12 September 2010 - 11:50 AM

updated to v0.3.0.0.

See first post for more details ;)


Command line and ERRORLEVEL added! :hyper:

If I may :w00t::
@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 #%2 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


(If command succeeds you have three IF's less and 2K/XP and later have built-in label ":EOF" so you won't need ":end")

:)
Wonko

#29 TheK

TheK

    Frequent Member

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

Posted 12 September 2010 - 12:14 PM

(If command succeeds you have three IF's less and 2K/XP and later have built-in label ":EOF" so you won't need ":end")


Wonko, you're the batch script guru :hyper: ;)

...but
echo Drive #%2 doesn't exist!
should be
echo Drive #4 doesn't exist!
as the drive number is hardcoded in the rest of the script, right? :)

#30 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 12 September 2010 - 12:30 PM

as the drive number is hardcoded in the rest of the script, right? ;)


Yep. :hyper:

It was a snippet from my own modified version, that uses command line parameters to the batch.

Command line:
lockdismount -lock 4 someapp.exe -someaction .PhysicalDrive4

is simply replaced by:
::%1 is the lockdismount parameter -lock

::%2 is target PhysicalDrive #

::%3 is the target application

::%4 up to %9 are it's command line parameters

::Example ld.cmd -lock 4 someapp.exe -someaction .PhysicalDrive4

lockdismount %*


Sorry for the mix-up.

:)
Wonko

#31 TheK

TheK

    Frequent Member

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

Posted 12 September 2010 - 01:25 PM

Updated the script example with your modifications. Hope you don't mind :hyper:

#32 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 12 September 2010 - 01:29 PM

Updated the script example with your modifications. Hope you don't mind :hyper:

As long as everyone complies with my careware license :), no prob whatsoever :) .
http://jaclaz.alterv...s/careware.html

;)
Wonko

#33 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 23 September 2010 - 09:28 PM

So, to use the tool with a virtual machine, one should:
"Lock and dismount the disk not used for booting in your dual disk PC box, launch VirtualBox, use this physical disk in VM guest and even start Windows in virtual machine from its real drive partition. Thus make sure that host and guest never access the drive simultaneously. "

Is it required to lock physical drive inside the VM before one exits from it, and then unlock the drive in a host machine?
In what situation Force Dismount option should be used? Why a partition can't be dismounted without it, and is it good practice to "force" such dismount?

It doesn't seem practical though to lock a drive in a host such a way, since it will remain locked until one exits from VM. On the contrary, if VM does it itself at each write operation, it will lock the drive only for brief moments when writing to it, and unlock right after, making available in a host system. This way the host boot drive can be used in the VM as well.

#34 sambul61

sambul61

    Gold Member

  • Advanced user
  • 1568 posts
  •  
    American Samoa

Posted 24 September 2010 - 07:53 PM

Hey guys! Is it safe to use this program? My HD clicks pretty loud when I try to lock it. What actually happen with the physical drive that results in such click sound?

Besides, it doesn't lock even a non-bootable drive - can't find any app or open files that prevent it from being locked. It locks 2 partitions and fails to lock 3-d one with "operation failed". So, what then happen with already locked partitions on the same drive - are they unlocked at fail event?

Edited by sambul61, 24 September 2010 - 07:54 PM.


#35 Nuno Brito

Nuno Brito

    Platinum Member

  • Team Reboot
  • 10424 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 03 April 2012 - 01:27 PM

Hello, would it be possible to clean up the first topic?

The text is garbled after the forum upgrade and needs to be corrected.

Thanks!

#36 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 03 April 2012 - 06:25 PM

Hello, would it be possible to clean up the first topic?

The text is garbled after the forum upgrade and needs to be corrected.

Thanks!

Well, guess why I provided the "reboot.pro botched code converter"? :dubbio:
http://reboot.pro/15275/
http://pastehtml.com.../b4t99xk89.html

I am using it to "clean" my CODEs.

The CODE in first post is:
@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




:cheers:
Wonko

#37 Nuno Brito

Nuno Brito

    Platinum Member

  • Team Reboot
  • 10424 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 April 2012 - 01:23 PM

Thank you. I have updated the first topic.

However, I have no access to your "botched" converter since it is blocked by the internet proxy at my workplace.

Would you please make it available on our downloads portal? If not, don't worry about it. Albeit it would make the converter easier to find by readers.

:)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users