Problem in locking and unlocking volumes

hi,
I am looking for getting volumes locked in the kernal
mode for my application. I am trying to use the
FSCTL_LOCK_VOLUME and FSCTL_DISMOUNT_VOLUME
respectively using the ZwFsControlFile() API. Locking
operation works but the dismount miserably fails with
and error saying “handle invalid”.
Also unlocking the volume resulted in error “volume
dismounted” error.
Please provide some pointer to correct me if i am
doing something wrong.

Thanks in advance,
Amol.


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Are you using a different handle to dismount than the one that you used
to lock. Once you lock the volume, only that handle can be used.

Harish

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-253983-
xxxxx@lists.osr.com] On Behalf Of Amol Tasgaonkar
Sent: Monday, June 12, 2006 11:55 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Problem in locking and unlocking volumes

hi,
I am looking for getting volumes locked in the kernal
mode for my application. I am trying to use the
FSCTL_LOCK_VOLUME and FSCTL_DISMOUNT_VOLUME
respectively using the ZwFsControlFile() API. Locking
operation works but the dismount miserably fails with
and error saying “handle invalid”.
Also unlocking the volume resulted in error “volume
dismounted” error.
Please provide some pointer to correct me if i am
doing something wrong.

Thanks in advance,
Amol.


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

I am using the same handle.
-Amol.

— Harish Arora wrote:

> Are you using a different handle to dismount than
> the one that you used
> to lock. Once you lock the volume, only that handle
> can be used.
>
> Harish
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> [mailto:bounce-253983-
> > xxxxx@lists.osr.com] On Behalf Of Amol Tasgaonkar
> > Sent: Monday, June 12, 2006 11:55 PM
> > To: Windows System Software Devs Interest List
> > Subject: [ntdev] Problem in locking and unlocking
> volumes
> >
> > hi,
> > I am looking for getting volumes locked in the
> kernal
> > mode for my application. I am trying to use the
> > FSCTL_LOCK_VOLUME and FSCTL_DISMOUNT_VOLUME
> > respectively using the ZwFsControlFile() API.
> Locking
> > operation works but the dismount miserably fails
> with
> > and error saying “handle invalid”.
> > Also unlocking the volume resulted in error
> “volume
> > dismounted” error.
> > Please provide some pointer to correct me if i am
> > doing something wrong.
> >
> > Thanks in advance,
> > Amol.
> >
> >
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > To unsubscribe, visit the List Server section of
> OSR Online at
> > http://www.osronline.com/page.cfm?name=ListServer
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR
> Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Unless you open a handle with the OBJ_KERNEL_HANDLE set in
OBJECT_ATTRIBUTES.Attributes, the handle is only valid in the context
the process that was running when you called ZwCreateFile. You should
probably specify OBJ_KERNEL_HANDLE, or guarantee that your code is
running in the same process as was running when you called ZwCreateFile.
The first solution is usually the easiest and best.

– arlie

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Amol Tasgaonkar
Sent: Wednesday, June 14, 2006 12:30 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Problem in locking and unlocking volumes

I am using the same handle.
-Amol.

— Harish Arora wrote:

> Are you using a different handle to dismount than the one that you
> used to lock. Once you lock the volume, only that handle can be used.
>
> Harish
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> [mailto:bounce-253983-
> > xxxxx@lists.osr.com] On Behalf Of Amol Tasgaonkar
> > Sent: Monday, June 12, 2006 11:55 PM
> > To: Windows System Software Devs Interest List
> > Subject: [ntdev] Problem in locking and unlocking
> volumes
> >
> > hi,
> > I am looking for getting volumes locked in the
> kernal
> > mode for my application. I am trying to use the FSCTL_LOCK_VOLUME
> > and FSCTL_DISMOUNT_VOLUME respectively using the ZwFsControlFile()
> > API.
> Locking
> > operation works but the dismount miserably fails
> with
> > and error saying “handle invalid”.
> > Also unlocking the volume resulted in error
> “volume
> > dismounted” error.
> > Please provide some pointer to correct me if i am doing something
> > wrong.
> >
> > Thanks in advance,
> > Amol.
> >
> >
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > To unsubscribe, visit the List Server section of
> OSR Online at
> > http://www.osronline.com/page.cfm?name=ListServer
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer