Yes, you’re right. I’ve verified your code once again and find out
that?you must open some directory. But that FSCTL reuqires
opened volume, not either directory nor file.
?
Paul
?
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Ramaraj Pandian
Sent: Saturday, June 02, 2001 1:55 AM
To: File Systems Developers
Subject: [ntfsd] RE: ZwFsControlFile
ZwFsControlFile returns always STATUS_INVALID_PARAMETER:
I believe I am passing valid parameters.
Can anybody help me out?
?
?ntStatus = ZwFsControlFile (
???FileHandle,
???NULL, NULL, NULL,
???&ioStatus,?
???FSCTL_LOCK_VOLUME,
???NULL,
???0,
???NULL,
???0
???);
-----Original Message-----
From: Ramaraj Pandian [mailto:xxxxx@dvdjukebox.com]
Sent: Friday, June 01, 2001 3:19 PM
To: File Systems Developers
Subject: [ntfsd] RE: ZwFsControlFile
Thank you very much Paul,
Before I was getting linker error with prototype which I got?from
archive.
With this, it is working fine. Yeah I am using unnecessarily pointers,?I
removed it now.
?
Thanks
Ramaraj
?
-----Original Message-----
From: Hrdina Pavel [mailto:xxxxx@compelson.com]
Sent: Friday, June 01, 2001 2:14 PM
To: File Systems Developers
Subject: [ntfsd] RE: ZwFsControlFile
Importance: High
The first thing I don’t understand is the last routine -
ZwFsControlFile.
Why do you do such strange things like implement that routine in your
own way ?
Both NtFsControlFile and ZwFsControlFile are exported by NTOSKRNL
so there is no need to do such non-portable things - you probably know
that the service index (3Bh in your case) can change from build to
build.
The only thing you really need is the correct prototype - here is that
one:
NTSYSAPI
NTSTATUS
NTAPI
ZwFsControlFile (
??? IN HANDLE FileHandle,
??? IN HANDLE Event OPTIONAL,
??? IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
??? IN PVOID ApcContext OPTIONAL,
??? OUT PIO_STATUS_BLOCK IoStatusBlock,
??? IN ULONG FsControlCode,
??? IN PVOID InputBuffer OPTIONAL,
??? IN ULONG InputBufferLength,
??? OUT PVOID OutputBuffer OPTIONAL,
??? IN ULONG OutputBufferLength
??? );
But your problem is probably elsewhere. What are those arguments
like InputBuffer, *InputBufferLength, OutputBuffer and
*OutputBufferLength ?
And also what exception are you getting ? I guess
STATUS_ACCESS_VIOLATION.
Paul
-----Original Message-----
From: xxxxx@lists.osr.com [
mailto:xxxxx@lists.osr.com]On Behalf Of Ramaraj Pandian
Sent: Friday, June 01, 2001 8:21 PM
To: File Systems Developers
Subject: [ntfsd] ZwFsControlFile
Hi,
I am getting exception while calling ZwFsControlFile always.
Here is what I learned to do from NTFSD archive:
??? RtlInitUnicodeString( &fileNameUnicodeString, filename );
??? InitializeObjectAttributes( &object_attributes,
&fileNameUnicodeString,
???
OBJ_CASE_INSENSITIVE, NULL, NULL );
??? ntStatus = ZwCreateFile( &FileHandle, SYNCHRONIZE,
??? ??? ??? ? ??? ??? ??? &object_attributes,
&ioStatus, NULL, 0, FILE_SHARE_READ|FILE_SHARE_WRITE,
??? ??? ??? ? ??? ??? ??? FILE_OPEN,
???
FILE_SYNCHRONOUS_IO_NONALERT|FILE_DIRECTORY_FILE,
??? ??? ??? ? ??? ??? ??? NULL, 0 );
??? if( !NT_SUCCESS( ntStatus ) ) {
??? ??? DbgPrint((“PwrFilter: Could not open drive %c: %x\n”,
DriveLetter, ntStatus ));
??? ??? return ntStatus;
??? }
??? ntStatus = ZwFsControlFile(
??? FileHandle,??? ??? ? ??? // handle of the
device
??? 0,??? // (in) HANDLE Event (OPTIONAL)
??? NULL,??? // (in) PIO_APC_ROUTINE
ApcRoutine
(OPTIONAL)
??? NULL,??? // (in) PVOID ApcContext
(OPTIONAL)
??? &ioStatus,
??? FSCTL_LOCK_VOLUME,??? ??? ? // control code of
operation to perform
??? InputBuffer,??? // address of input buffer
??? *InputBufferLength,??? // size of input buffer; not
used;
must be zero
??? OutputBuffer,??? // address of output buffer
??? *OutputBufferLength);??? // size of output buffer
Protoype and definition are:
extern NTSTATUS
ZwFsControlFile(
?IN HANDLE hFile,
?IN HANDLE hEvent OPTIONAL,
?IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL,
?IN PVOID IoApcContext OPTIONAL,
?OUT PIO_STATUS_BLOCK pIoStatusBlock,
?IN ULONG FileSystemControlCode,
?IN PVOID InBuffer OPTIONAL,
?IN ULONG InBufferLength,
?OUT PVOID OutBuffer OPTIONAL,
?IN ULONG OutBufferLength
);
NTSTATUS
ZwFsControlFile(
?IN HANDLE hFile,
?IN HANDLE hEvent OPTIONAL,
?IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL,
?IN PVOID IoApcContext OPTIONAL,
?OUT PIO_STATUS_BLOCK pIoStatusBlock,
?IN ULONG FileSystemControlCode,
?IN PVOID InBuffer OPTIONAL,
?IN ULONG InBufferLength,
?OUT PVOID OutBuffer OPTIONAL,
?IN ULONG OutBufferLength
)
{
??? NTSTATUS NtStatus;
??? void **lpParameterStack = &hFile;
??? _asm{
??? mov eax,0000003Bh
??? mov edx,lpParameterStack
??? int 2Eh
??? mov NtStatus,eax
??? }
??? return NtStatus;
}
Thanks
Ramaraj
You are currently subscribed to ntfsd as: xxxxx@compelson.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
You are currently subscribed to ntfsd as: xxxxx@dvdjukebox.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
You are currently subscribed to ntfsd as: xxxxx@dvdjukebox.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
You are currently subscribed to ntfsd as: xxxxx@compelson.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
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