Hi all,
What’s wrong with this code? It sends an I/O control code to an NTFS volume,
but the ZwDeviceIoControlFile command always returns
STATUS_NOT_IMPLEMENTED - no matter what I/O control code I send to the
volume, not just FSCTL_GET_NTFS_VOLUME_DATA. The ioStatusBlock parameter is
left unchanged.
I have also tryed the hard way using
IoBuildDeviceIoControlRequest/IoCallDriver, but the result is basicly the
same.
My driver is not attached to any volumes. Just a CDO has been created.
I have no problems sending I/O control codes to the volume from user mode
using DeviceIoControl.
{
HANDLE handle;
OBJECT_ATTRIBUTES objectAttributes;
UNICODE_STRING volumeName;
NTFS_VOLUME_DATA_BUFFER volumeDataBuffer;
IO_STATUS_BLOCK ioStatusBlock;
NTSTATUS status;
RtlInitUnicodeString( &volumeName, L"\Device\HarddiskVolume1" );
InitializeObjectAttributes( &objectAttributes,
&volumeName,
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
NULL,
NULL );
status = ZwCreateFile( &handle,
FILE_READ_ATTRIBUTES | SYNCHRONIZE,
&objectAttributes,
&ioStatusBlock,
NULL,
0,
FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_OPEN,
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT,
NULL,
0 );
if (NT_SUCCESS( status ))
{
status = ZwDeviceIoControlFile( handle,
NULL,
NULL,
NULL,
&ioStatusBlock,
FSCTL_GET_NTFS_VOLUME_DATA,
NULL,
0,
&volumeDataBuffer,
sizeof(NTFS_VOLUME_DATA_BUFFER) );
}
}
Thanks in advance,
Carsten Schmidt