Hi! Now I have encountered a big problem.
Our application is a native NT app(such as AUTOCHK). And it is not a Win32
application. I want to eject automatically the removable device(such as MO
drive) when the app run under the native mode.
The code is as follows:
InitializeObjectAttributes(
&ObjectAttributes,
&filename, //“\Device\Harddisk1\DP(1)0-0+2”(MO device name)
OBJ_CASE_INSENSITIVE,
NULL,
NULL
);
ntstatus=NtCreateFile(
&hf,
GENERIC_WRITE|SYNCHRONIZE|GENERIC_READ,
&ObjectAttributes,
&IoStatusBlock,
0,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_DELETE,
FILE_OPEN,
FILE_SYNCHRONOUS_IO_NONALERT|FILE_WRITE_THROUGH,
NULL,
0
);
ZwFsControlFile(
hVolume,
NULL,NULL, NULL,
&IoStatusBlock,
IOCTL_STORAGE_EJECT_MEDIA,
NULL, 0,NULL, 0);
But it seem that the removable device can not respond the code
IOCTL_STORAGE_EJECT_MEDIA. Who can help me solve the problem? Or tell me
the helpful way?
Thanks in advance.
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