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: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

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: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

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
mailto:xxxxx ]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: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com</mailto:xxxxx>

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
mailto:xxxxx ]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: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com</mailto:xxxxx>

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

Yes I am opening volume only. Is this L \?\F:\ <file:>
volume opening?

Thanks
Ramaraj

-----Original Message-----
From: Hrdina Pavel [mailto:xxxxx@compelson.com]
Sent: Friday, June 01, 2001 5:10 PM
To: File Systems Developers
Subject: [ntfsd] RE: ZwFsControlFile
Importance: High

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


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</file:>

No, it’s root directory open because of the last backslash.
When you want to open the volume you have to pass something
like \??\F:" only. Also you can’t specify FILE_DIRECTORY_FILE
in the ZwCreateFile or else it will return error that file isn’t
directory.
?
Paul

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Ramaraj Pandian
Sent: Saturday, June 02, 2001 3:00 AM
To: File Systems Developers
Subject: [ntfsd] RE: ZwFsControlFile

Yes I am opening volume only. Is this? L \?\F:\?volume opening?
?
Thanks
Ramaraj
?

-----Original Message-----
From: Hrdina Pavel [mailto:xxxxx@compelson.com]
Sent: Friday, June 01, 2001 5:10 PM
To: File Systems Developers
Subject: [ntfsd] RE: ZwFsControlFile
Importance: High

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


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

RE: [ntfsd] ZwFsControlFileI have some curious. ZwFsControlFile has more Parameters but inside the implementation how come Only hFile parameters are using to invoke 0x2e Interrupt ? Does This function is really working ?

Regards,
Satish K.S

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;
}


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

K.S. wrote:

I have some curious. ZwFsControlFile has more Parameters but inside
the implementation how come Only hFile parameters are using to invoke
0x2e Interrupt ? Does This function is really working ?
{
NTSTATUS NtStatus;
void **lpParameterStack = &hFile;

_asm{
mov eax,0000003Bh
mov edx,lpParameterStack
int 2Eh
mov NtStatus,eax
}
return NtStatus;
}

This should work because you pass the pointer to the user mode stack
frame (where the arguments of the native call are) rather than the value of hFile itself.

Regards,
Alex


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

Ramaraj wrote:

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
);

There’s the difference how control performed by nt and 2k.
In 2k all FSCTL go through ZwFsControlFile while in nt some
do but others use ZwDeviceIoControlFile (i don’t remember which
codes exactly).

Regards,
Alex.


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

RE: [ntfsd] ZwFsControlFileNo. this is root directory opening. Use \??\f:"
to opening the volume.

Jamey
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Ramaraj Pandian
Sent: Friday, June 01, 2001 6:00 PM
To: File Systems Developers
Subject: [ntfsd] RE: ZwFsControlFile

Yes I am opening volume only. Is this L\?\F:\ volume opening?

Thanks
Ramaraj

-----Original Message-----
From: Hrdina Pavel [mailto:xxxxx@compelson.com]
Sent: Friday, June 01, 2001 5:10 PM
To: File Systems Developers
Subject: [ntfsd] RE: ZwFsControlFile
Importance: High

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

You are currently subscribed to ntfsd as: xxxxx@storagecraft.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

For cdrom drive which has cd - L \?\F <file:> :, I am getting
error STATUS_INVALID_DEVICE_REQUEST always with ZwFsControlFile call. I
tried to check the vpb device object, it always shows null. Is this a
reason?

Thanks
Ramaraj

-----Original Message-----
From: Hrdina Pavel [mailto:xxxxx@compelson.com]
Sent: Friday, June 01, 2001 6:14 PM
To: File Systems Developers
Subject: [ntfsd] RE: ZwFsControlFile
Importance: High

No, it’s root directory open because of the last backslash.
When you want to open the volume you have to pass something
like \??\F: <file:> " only. Also you can’t specify
FILE_DIRECTORY_FILE
in the ZwCreateFile or else it will return error that file isn’t directory.

Paul

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Ramaraj Pandian
Sent: Saturday, June 02, 2001 3:00 AM
To: File Systems Developers
Subject: [ntfsd] RE: ZwFsControlFile

Yes I am opening volume only. Is this L \?\F:\ <file:>
volume opening?

Thanks
Ramaraj

-----Original Message-----
From: Hrdina Pavel [mailto:xxxxx@compelson.com]
Sent: Friday, June 01, 2001 5:10 PM
To: File Systems Developers
Subject: [ntfsd] RE: ZwFsControlFile
Importance: High

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


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: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com</file:></file:></file:>