The documentation says:
“The handle used here must be a Volume handle and have been opened with any
access. Note that only Administrators can open Volume handles.”
So open with GENERIC_READ | GENERIC_WRITE and make sure you’re an
administrator.
Ken
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ramananda
Ramachandra
Sent: Thursday, December 07, 2006 4:13 AM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] FSCTL_GET_VOLUME_BITMAP giving STATUS_ACCESS_DENIED
Hi
I am able to open the handle to the volume and the same handle works fine
for FSCTL_GET_NTFS_VOLUME_DATA.
When I use this handle for FSCTL_GET_VOLUME_BITMAP, I get 0xC0000022
(STATUS_ACCESS_DENIED)
I tried different combinations in opening the volume handle without any
success.
The one I tried is
ntStatVolume = NtCreateFile(&g_hVolume,
FILE_READ_ATTRIBUTES,
&objAttrsVolume,
&ioStatusVolume,
0,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_OPEN,
FILE_DIRECTORY_FILE,
NULL,
0);
Is there any restriction in getting the volume bitmap from a native
application.
Thanks for your help in advance,
Cheers
Ramananda
“Ramananda Ramachandra” wrote in message
news:xxxxx@ntfsd…
> Hi
>
> I am writing a native application to defragment a given file.
>
> For this I am opening the volume handles as below
>
> ntStatVolume = NtOpenFile(&g_hVolume, GENERIC_READ | SYNCHRONIZE,
> &objAttrs, &ioStatus, FILE_SHARE_READ | FILE_SHARE_WRITE,
> FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_ALERT);
>
> But when I use this handle in NtFsControlFile with
> FSCTL_GET_VOLUME_BITMAP, I am getting STATUS_ACCESS_DENIED (0xc0000022).
>
> I succeeded in doing the above operation with CreateFile and
> DeviceIOControl in a Win32 application with the above access rights.
>
> Could you please let me know if I am doing anything wrong in opening the
> handle.
>
> Thanks in advance,
> Ramananda
>
>
—
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@comcast.net
To unsubscribe send a blank email to xxxxx@lists.osr.com