Re: Unlock the drive



On Sep 27, 2:08 am, Sony Kalkan <sonykal...@xxxxxxxxx> wrote:
Hi,
I want to unlock the drive programmatically ? is there an api
function
related to it. For instance, when i run chkdsk with /F parameter, i
get "drive in use" error . I want to unlock drive programmatically
and
execute chkdsk


Well, if you just want to run chkdsk, run it with the /x parameter,
and it will dismount the drive if possible.

Programmatically, you need to open a handle to the volume (CreateFile
with "\\.\D:"), and then send it the FSCTL_DISMOUNT_VOLUME IOCTL with
DeviceIoControl. You must be appropriately authorized to do that, and
you will probably not be able to do it on the boot volume since
Windows will always keep that open.

.



Relevant Pages

  • Scan disk
    ... not run b/c it can not unlock the drive I'm trying to check. ... Any pointers on how to unlock the c drive so I can run the chkdsk tool. ... running on Windows XP and the NTFS system. ...
    (microsoft.public.windowsxp.general)
  • Re: Unlock the drive
    ... I want to unlock the drive programmatically? ... is there an api ... For instance, when i run chkdsk with /F parameter, i ... Windows to close those files, at least not in desktop editions of Windows. ...
    (microsoft.public.dotnet.languages.vc)
  • Unlock the drive
    ... I want to unlock the drive programmatically? ... is there an api ... For instance, when i run chkdsk with /F parameter, i ...
    (comp.programming)
  • Unlock the drive
    ... I want to unlock the drive programmatically? ... is there an api ... For instance, when i run chkdsk with /F parameter, i ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Scan disk
    ... When I schedule scan disk using chkdsk /f, on the restart the function can ... Any pointers on how to unlock the c drive so I can run the chkdsk tool. ...
    (microsoft.public.windowsxp.general)