Hi
I am using Win32 API to fetch filesystem configuration information such as
MFT file record size etc. On Windows 2000 I am using DeviceIoControl() with
FSCTL_GET_NTFS_VOLUME_DATA as the control code. However this code is not
available on NT4.0.
I used another undocumented API call NtFsControlFile() which returns the
same information as returned by the DeviceIoControl() on Win2K. So my
question is - In order to have portable code, is it safe to use
NtFsControlFile() on Win2K also (even though it is obsolete)?
I am not clear about the difference between the 2 methods - i.e. using
DeviceIoControl(FSCTL_GET_NTFS_VOLUME_DATA) and NtFsControlFile(). What is
the extra information provided by the former that is not available in
NtFsControlFile() (Since NtFsControlFile() has been deprecated in Win2K)
Any pointers in this regard would be very useful.
Thanks in advance
Siddharth
NtFsControlFile should not be used at all. These are internal APIs that can
change in the future. So its not portable. In this particular case the
windows 2000 version of DeviceIoControl is different than the NT 4.0 version
of DeviceIoControl. The NT 4.0 version only supported a very select number
of FSCTLs via the WIN32 APIs. So while the IOCTL is implemented by the
filesystem it was not officially exported to the SDK. In Win2K we opened
this API for all control codes with FILE_DEVICE_FILESYSTEM device type. This
is why it works in NtFsControlFile but does not work with DeviceIoControl.
–
Nar Ganapathy
Windows Core OS group
This posting is provided “AS IS” with no warranties, and confers no rights.
“Siddharth Aggarwal” wrote in message
news:xxxxx@ntfsd…
>
> Hi
>
> I am using Win32 API to fetch filesystem configuration information such as
> MFT file record size etc. On Windows 2000 I am using DeviceIoControl()
with
> FSCTL_GET_NTFS_VOLUME_DATA as the control code. However this code is not
> available on NT4.0.
>
> I used another undocumented API call NtFsControlFile() which returns the
> same information as returned by the DeviceIoControl() on Win2K. So my
> question is - In order to have portable code, is it safe to use
> NtFsControlFile() on Win2K also (even though it is obsolete)?
>
> I am not clear about the difference between the 2 methods - i.e. using
> DeviceIoControl(FSCTL_GET_NTFS_VOLUME_DATA) and NtFsControlFile(). What is
> the extra information provided by the former that is not available in
> NtFsControlFile() (Since NtFsControlFile() has been deprecated in Win2K)
>
> Any pointers in this regard would be very useful.
>
> Thanks in advance
> Siddharth
>
>
>
>