Hi all,
I’m trying to obtain partitioning information on a physical hard disk in
a Windows NT native application (linking to ntdll.lib). I’m trying to
open a hard disk volume via NtCreateFile() and then use
NtFsControlFile() to issue a IOCTL_DISK_GET_DRIVE_LAYOUT.
First, I can’t seem to get NtFsControlFile() to open a hard disk volume.
I’m always getting back an “invalid handle” error. That’s what I’m
using:
…
InitializeObjectAttributes (&ObjectAttributes,
&Device, /* \Device\HardDisk0 */
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
…
ntStatus = NtCreateFile(&hDisk,
FILE_READ_DATA | SYNCHRONIZE,
&ObjectAttributes,
&IoStatus,
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_OPEN,
FILE_SYNCHRONOUS_IO_NONALERT,
NULL,
0);
I think I’ve tried all possible parameter combinations for
NtCreateFile(), but I’m always getting the same error. Can anybody help?
Second, how do I issue the IOCTL_DISK_GET_DRIVE_LAYOUT control code in a
native application? Will it work with NtFsControlFile()? Somehow I doubt
it because IIRC NtFsControlFile() wants FSCTL_* control codes that are
defined differently from IOCTL_* codes.
Thanks!
Ralf.
You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com