ZwMapViewOfSection

Hi, I’m making a File Filter System Driver to deny access to files with viruses.
I intercept the CREATE calls and handle reentrancy ok. Then I search viruses in the file. Can I use ZwMapViewOfSection to read the file? Will that work even if it is a very big file? Or should I use several ZwReadFile using non paged memory buffers?
Thanks.


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

ZwMapViewOfSection maps memory in the user virtual address space. Will
you be accessing this memory in a known process context?

-----Original Message-----
From: Ratmil Torres [mailto:xxxxx@seg.inf.cu]
Sent: Tuesday, October 23, 2001 3:49 PM
To: File Systems Developers
Subject: [ntfsd] ZwMapViewOfSection

Hi, I’m making a File Filter System Driver to deny access to files with
viruses.
I intercept the CREATE calls and handle reentrancy ok. Then I search
viruses in the file. Can I use ZwMapViewOfSection to read the file? Will
that work even if it is a very big file? Or should I use several
ZwReadFile using non paged memory buffers?
Thanks.


You are currently subscribed to ntfsd as: xxxxx@nsisoftware.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 do it once, use it, unmap the view and close the section, in the same process, at PASSIVE_LEVEL. I don’t know what process it is, but it all happens in the same function, so that’s OK, isn’t it?
----- Original Message -----
From: Rob Fuller
To: File Systems Developers
Sent: Wednesday, October 24, 2001 8:22 AM
Subject: [ntfsd] RE: ZwMapViewOfSection

ZwMapViewOfSection maps memory in the user virtual address space. Will you be accessing this memory in a known process context?
-----Original Message-----
From: Ratmil Torres [mailto:xxxxx@seg.inf.cu]
Sent: Tuesday, October 23, 2001 3:49 PM
To: File Systems Developers
Subject: [ntfsd] ZwMapViewOfSection

Hi, I’m making a File Filter System Driver to deny access to files with viruses.
I intercept the CREATE calls and handle reentrancy ok. Then I search viruses in the file. Can I use ZwMapViewOfSection to read the file? Will that work even if it is a very big file? Or should I use several ZwReadFile using non paged memory buffers?
Thanks.


You are currently subscribed to ntfsd as: xxxxx@nsisoftware.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

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

I would be concerned about side effects, especially if I’m mapping a
large file. For example, while you’re scanning the virus, the process
may try to allocate memory and fail because you’ve consumed the
remainder of its virtual address space.

-----Original Message-----
From: Ratmil Torres [mailto:xxxxx@seg.inf.cu]
Sent: Wednesday, October 24, 2001 9:50 AM
To: File Systems Developers
Subject: [ntfsd] RE: ZwMapViewOfSection

Yes. I do it once, use it, unmap the view and close the section, in the
same process, at PASSIVE_LEVEL. I don’t know what process it is, but it
all happens in the same function, so that’s OK, isn’t it?

----- Original Message -----
From: Rob mailto:xxxxx Fuller
To: File Systems mailto:xxxxx Developers
Sent: Wednesday, October 24, 2001 8:22 AM
Subject: [ntfsd] RE: ZwMapViewOfSection

ZwMapViewOfSection maps memory in the user virtual address space. Will
you be accessing this memory in a known process context?

-----Original Message-----
From: Ratmil Torres [mailto:xxxxx@seg.inf.cu]
Sent: Tuesday, October 23, 2001 3:49 PM
To: File Systems Developers
Subject: [ntfsd] ZwMapViewOfSection

Hi, I’m making a File Filter System Driver to deny access to files with
viruses.
I intercept the CREATE calls and handle reentrancy ok. Then I search
viruses in the file. Can I use ZwMapViewOfSection to read the file? Will
that work even if it is a very big file? Or should I use several
ZwReadFile using non paged memory buffers?
Thanks.


You are currently subscribed to ntfsd as: xxxxx@nsisoftware.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: xxxxx@seg.inf.cu
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


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

Thanks.
But it is not probably to have a larger than 1GB file, User virtual space is 2GB.
But I will consider that.
I posted a message because I can’t successfully call ZwCreateSection.
Do you know the reason why I get invalid 6th parameter?
Thank you.
----- Original Message -----
From: Rob Fuller
To: File Systems Developers
Sent: Wednesday, October 24, 2001 11:28 AM
Subject: [ntfsd] RE: ZwMapViewOfSection

I would be concerned about side effects, especially if I’m mapping a large file. For example, while you’re scanning the virus, the process may try to allocate memory and fail because you’ve consumed the remainder of its virtual address space.
-----Original Message-----
From: Ratmil Torres [mailto:xxxxx@seg.inf.cu]
Sent: Wednesday, October 24, 2001 9:50 AM
To: File Systems Developers
Subject: [ntfsd] RE: ZwMapViewOfSection

Yes. I do it once, use it, unmap the view and close the section, in the same process, at PASSIVE_LEVEL. I don’t know what process it is, but it all happens in the same function, so that’s OK, isn’t it?
----- Original Message -----
From: Rob Fuller
To: File Systems Developers
Sent: Wednesday, October 24, 2001 8:22 AM
Subject: [ntfsd] RE: ZwMapViewOfSection

ZwMapViewOfSection maps memory in the user virtual address space. Will you be accessing this memory in a known process context?
-----Original Message-----
From: Ratmil Torres [mailto:xxxxx@seg.inf.cu]
Sent: Tuesday, October 23, 2001 3:49 PM
To: File Systems Developers
Subject: [ntfsd] ZwMapViewOfSection

Hi, I’m making a File Filter System Driver to deny access to files with viruses.
I intercept the CREATE calls and handle reentrancy ok. Then I search viruses in the file. Can I use ZwMapViewOfSection to read the file? Will that work even if it is a very big file? Or should I use several ZwReadFile using non paged memory buffers?
Thanks.


You are currently subscribed to ntfsd as: xxxxx@nsisoftware.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You are currently subscribed to ntfsd as: xxxxx@seg.inf.cu
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You are currently subscribed to ntfsd as: xxxxx@nsisoftware.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

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

And… If you do this in the system process context, it will map the
section into the user address space of the system process; which is all
but emty, so you can get up to the entire 2 gig or 3 gig.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rob Fuller
Sent: Wednesday, October 24, 2001 5:23 AM
To: File Systems Developers
Subject: [ntfsd] RE: ZwMapViewOfSection

ZwMapViewOfSection maps memory in the user virtual address space. Will
you be accessing this memory in a known process context?

-----Original Message-----
From: Ratmil Torres [mailto:xxxxx@seg.inf.cu]
Sent: Tuesday, October 23, 2001 3:49 PM
To: File Systems Developers
Subject: [ntfsd] ZwMapViewOfSection

Hi, I’m making a File Filter System Driver to deny access to files with
viruses.
I intercept the CREATE calls and handle reentrancy ok. Then I search
viruses in the file. Can I use ZwMapViewOfSection to read the file? Will
that work even if it is a very big file? Or should I use several
ZwReadFile using non paged memory buffers?
Thanks.


You are currently subscribed to ntfsd as: xxxxx@nsisoftware.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


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

Do this from a system thread. It will give you almost 2 gig of address
space.

On another note, I am not sure that it is a good idea to scan like this.
I would read the data using NO_INTERMEDIATE_BUFFERING and always get the
data directly from the disk; remeber, you must read on sector aligned
boundries. THis may prove to be the fastest and most efficent way. Why
brig in the cache manager? I think, if I remember the quote correctly,
75% of file system are not data related. So, there are many opens and
closes that get file attribute information, and the likes, but read no
data; even if the file is opened with read access.

In your scenario, you will be creating, reading and taring down your
section object more than required.

Maybe the ultimate solution is to initiate the scan on the first read of
the data from the file. This would improve performance of the virus
scanner by “leaps and bounds”.

I loaded NAI a few weeks ago to do some compatibility testing and I was
amazed at the hit on system performance I noticed. Each open caused the
disk to thrash.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rob Fuller
Sent: Wednesday, October 24, 2001 8:28 AM
To: File Systems Developers
Subject: [ntfsd] RE: ZwMapViewOfSection

I would be concerned about side effects, especially if I’m mapping a
large file. For example, while you’re scanning the virus, the process
may try to allocate memory and fail because you’ve consumed the
remainder of its virtual address space.

-----Original Message-----
From: Ratmil Torres [mailto:xxxxx@seg.inf.cu]
Sent: Wednesday, October 24, 2001 9:50 AM
To: File Systems Developers
Subject: [ntfsd] RE: ZwMapViewOfSection

Yes. I do it once, use it, unmap the view and close the section, in the
same process, at PASSIVE_LEVEL. I don’t know what process it is, but it
all happens in the same function, so that’s OK, isn’t it?

----- Original Message -----
From: Rob mailto:xxxxx Fuller
To: File Systems Developers mailto:xxxxx
Sent: Wednesday, October 24, 2001 8:22 AM
Subject: [ntfsd] RE: ZwMapViewOfSection

ZwMapViewOfSection maps memory in the user virtual address space. Will
you be accessing this memory in a known process context?

-----Original Message-----
From: Ratmil Torres [mailto:xxxxx@seg.inf.cu]
Sent: Tuesday, October 23, 2001 3:49 PM
To: File Systems Developers
Subject: [ntfsd] ZwMapViewOfSection

Hi, I’m making a File Filter System Driver to deny access to files with
viruses.
I intercept the CREATE calls and handle reentrancy ok. Then I search
viruses in the file. Can I use ZwMapViewOfSection to read the file? Will
that work even if it is a very big file? Or should I use several
ZwReadFile using non paged memory buffers?
Thanks.


You are currently subscribed to ntfsd as: xxxxx@nsisoftware.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: xxxxx@seg.inf.cu
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: xxxxx@nsisoftware.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


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</mailto:xxxxx></mailto:xxxxx>

Wow. I sure have sloppy fingers today; not to mention I reinstalled
outlook and forgot to turn on auto-spell check :slight_smile:

I apologize for the horrid grammar ad spelling in this posting :slight_smile:

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jamey Kirby
Sent: Wednesday, October 24, 2001 2:23 AM
To: File Systems Developers
Subject: [ntfsd] RE: ZwMapViewOfSection

Do this from a system thread. It will give you almost 2 gig of address
space.

On another note, I am not sure that it is a good idea to scan like this.
I would read the data using NO_INTERMEDIATE_BUFFERING and always get the
data directly from the disk; remeber, you must read on sector aligned
boundries. THis may prove to be the fastest and most efficent way. Why
brig in the cache manager? I think, if I remember the quote correctly,
75% of file system are not data related. So, there are many opens and
closes that get file attribute information, and the likes, but read no
data; even if the file is opened with read access.

In your scenario, you will be creating, reading and taring down your
section object more than required.

Maybe the ultimate solution is to initiate the scan on the first read of
the data from the file. This would improve performance of the virus
scanner by “leaps and bounds”.

I loaded NAI a few weeks ago to do some compatibility testing and I was
amazed at the hit on system performance I noticed. Each open caused the
disk to thrash.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rob Fuller
Sent: Wednesday, October 24, 2001 8:28 AM
To: File Systems Developers
Subject: [ntfsd] RE: ZwMapViewOfSection

I would be concerned about side effects, especially if I’m mapping a
large file. For example, while you’re scanning the virus, the process
may try to allocate memory and fail because you’ve consumed the
remainder of its virtual address space.

-----Original Message-----
From: Ratmil Torres [mailto:xxxxx@seg.inf.cu]
Sent: Wednesday, October 24, 2001 9:50 AM
To: File Systems Developers
Subject: [ntfsd] RE: ZwMapViewOfSection

Yes. I do it once, use it, unmap the view and close the section, in the
same process, at PASSIVE_LEVEL. I don’t know what process it is, but it
all happens in the same function, so that’s OK, isn’t it?

----- Original Message -----
From: Rob Fuller mailto:xxxxx
To: File Systems Developers mailto:xxxxx
Sent: Wednesday, October 24, 2001 8:22 AM
Subject: [ntfsd] RE: ZwMapViewOfSection

ZwMapViewOfSection maps memory in the user virtual address space. Will
you be accessing this memory in a known process context?

-----Original Message-----
From: Ratmil Torres [mailto:xxxxx@seg.inf.cu]
Sent: Tuesday, October 23, 2001 3:49 PM
To: File Systems Developers
Subject: [ntfsd] ZwMapViewOfSection

Hi, I’m making a File Filter System Driver to deny access to files with
viruses.
I intercept the CREATE calls and handle reentrancy ok. Then I search
viruses in the file. Can I use ZwMapViewOfSection to read the file? Will
that work even if it is a very big file? Or should I use several
ZwReadFile using non paged memory buffers?
Thanks.


You are currently subscribed to ntfsd as: xxxxx@nsisoftware.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: xxxxx@seg.inf.cu
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: xxxxx@nsisoftware.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


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: 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</mailto:xxxxx></mailto:xxxxx>

MessageSorry if I ask too much.
By creating a work item (ExInitializeWorkItem) I get called in system context. Isn’t it?
NO_INTERMEDIATE_BUFFERING? Ok, I’m reading the DDK help about it.

----- Original Message -----
From: Jamey Kirby
To: File Systems Developers
Sent: Wednesday, October 24, 2001 5:22 AM
Subject: [ntfsd] RE: ZwMapViewOfSection

Do this from a system thread. It will give you almost 2 gig of address space.

On another note, I am not sure that it is a good idea to scan like this. I would read the data using NO_INTERMEDIATE_BUFFERING and always get the data directly from the disk; remeber, you must read on sector aligned boundries. THis may prove to be the fastest and most efficent way. Why brig in the cache manager? I think, if I remember the quote correctly, 75% of file system are not data related. So, there are many opens and closes that get file attribute information, and the likes, but read no data; even if the file is opened with read access.

In your scenario, you will be creating, reading and taring down your section object more than required.

Maybe the ultimate solution is to initiate the scan on the first read of the data from the file. This would improve performance of the virus scanner by “leaps and bounds”.

I loaded NAI a few weeks ago to do some compatibility testing and I was amazed at the hit on system performance I noticed. Each open caused the disk to thrash.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Rob Fuller
Sent: Wednesday, October 24, 2001 8:28 AM
To: File Systems Developers
Subject: [ntfsd] RE: ZwMapViewOfSection

I would be concerned about side effects, especially if I’m mapping a large file. For example, while you’re scanning the virus, the process may try to allocate memory and fail because you’ve consumed the remainder of its virtual address space.
-----Original Message-----
From: Ratmil Torres [mailto:xxxxx@seg.inf.cu]
Sent: Wednesday, October 24, 2001 9:50 AM
To: File Systems Developers
Subject: [ntfsd] RE: ZwMapViewOfSection

Yes. I do it once, use it, unmap the view and close the section, in the same process, at PASSIVE_LEVEL. I don’t know what process it is, but it all happens in the same function, so that’s OK, isn’t it?
----- Original Message -----
From: Rob Fuller
To: File Systems Developers
Sent: Wednesday, October 24, 2001 8:22 AM
Subject: [ntfsd] RE: ZwMapViewOfSection

ZwMapViewOfSection maps memory in the user virtual address space. Will you be accessing this memory in a known process context?
-----Original Message-----
From: Ratmil Torres [mailto:xxxxx@seg.inf.cu]
Sent: Tuesday, October 23, 2001 3:49 PM
To: File Systems Developers
Subject: [ntfsd] ZwMapViewOfSection

Hi, I’m making a File Filter System Driver to deny access to files with viruses.
I intercept the CREATE calls and handle reentrancy ok. Then I search viruses in the file. Can I use ZwMapViewOfSection to read the file? Will that work even if it is a very big file? Or should I use several ZwReadFile using non paged memory buffers?
Thanks.


You are currently subscribed to ntfsd as: xxxxx@nsisoftware.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You are currently subscribed to ntfsd as: xxxxx@seg.inf.cu
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You are currently subscribed to ntfsd as: xxxxx@nsisoftware.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

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: xxxxx@seg.inf.cu
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

MessageSorry again.
I get the same error in ZwMapViewOfSection that I got in ZwCreateSection (invalid 8th parameter). I’m doing just as the DDK Help says, this 8th is InheritDisposition and is said to be set to 0.

If I use ZwReadFile, the memory to read data from the file should not be non paged pool. I should not abuse of this small memory.
So I will use paged memory, in the system virtual space. What if I get a page fault? Wouldn’t that be the same as using file mapping?

I have in mind to scan the file only the first time just like you say.
----- Original Message -----
From: Jamey Kirby
To: File Systems Developers
Sent: Wednesday, October 24, 2001 5:22 AM
Subject: [ntfsd] RE: ZwMapViewOfSection

Do this from a system thread. It will give you almost 2 gig of address space.

On another note, I am not sure that it is a good idea to scan like this. I would read the data using NO_INTERMEDIATE_BUFFERING and always get the data directly from the disk; remeber, you must read on sector aligned boundries. THis may prove to be the fastest and most efficent way. Why brig in the cache manager? I think, if I remember the quote correctly, 75% of file system are not data related. So, there are many opens and closes that get file attribute information, and the likes, but read no data; even if the file is opened with read access.

In your scenario, you will be creating, reading and taring down your section object more than required.

Maybe the ultimate solution is to initiate the scan on the first read of the data from the file. This would improve performance of the virus scanner by “leaps and bounds”.

I loaded NAI a few weeks ago to do some compatibility testing and I was amazed at the hit on system performance I noticed. Each open caused the disk to thrash.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Rob Fuller
Sent: Wednesday, October 24, 2001 8:28 AM
To: File Systems Developers
Subject: [ntfsd] RE: ZwMapViewOfSection

I would be concerned about side effects, especially if I’m mapping a large file. For example, while you’re scanning the virus, the process may try to allocate memory and fail because you’ve consumed the remainder of its virtual address space.
-----Original Message-----
From: Ratmil Torres [mailto:xxxxx@seg.inf.cu]
Sent: Wednesday, October 24, 2001 9:50 AM
To: File Systems Developers
Subject: [ntfsd] RE: ZwMapViewOfSection

Yes. I do it once, use it, unmap the view and close the section, in the same process, at PASSIVE_LEVEL. I don’t know what process it is, but it all happens in the same function, so that’s OK, isn’t it?
----- Original Message -----
From: Rob Fuller
To: File Systems Developers
Sent: Wednesday, October 24, 2001 8:22 AM
Subject: [ntfsd] RE: ZwMapViewOfSection

ZwMapViewOfSection maps memory in the user virtual address space. Will you be accessing this memory in a known process context?
-----Original Message-----
From: Ratmil Torres [mailto:xxxxx@seg.inf.cu]
Sent: Tuesday, October 23, 2001 3:49 PM
To: File Systems Developers
Subject: [ntfsd] ZwMapViewOfSection

Hi, I’m making a File Filter System Driver to deny access to files with viruses.
I intercept the CREATE calls and handle reentrancy ok. Then I search viruses in the file. Can I use ZwMapViewOfSection to read the file? Will that work even if it is a very big file? Or should I use several ZwReadFile using non paged memory buffers?
Thanks.


You are currently subscribed to ntfsd as: xxxxx@nsisoftware.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You are currently subscribed to ntfsd as: xxxxx@seg.inf.cu
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You are currently subscribed to ntfsd as: xxxxx@nsisoftware.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

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: xxxxx@seg.inf.cu
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

MessagePlease see the SECTION_INHERIT definition in NTIFS.H

typedef enum _SECTION_INHERIT {
ViewShare = 1,
ViewUnmap = 2
} SECTION_INHERIT;

There is no member of zero value.
So you have to pass probably ViewUnmap.

Paul

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Ratmil Torres
Sent: Thursday, October 25, 2001 5:28 PM
To: File Systems Developers
Subject: [ntfsd] RE: ZwMapViewOfSection

Sorry again.
I get the same error in ZwMapViewOfSection that I got in ZwCreateSection
(invalid 8th parameter). I’m doing just as the DDK Help says, this 8th is
InheritDisposition and is said to be set to 0.

If I use ZwReadFile, the memory to read data from the file should not be
non paged pool. I should not abuse of this small memory.
So I will use paged memory, in the system virtual space. What if I get a
page fault? Wouldn’t that be the same as using file mapping?

I have in mind to scan the file only the first time just like you say.
----- Original Message -----
From: Jamey Kirby
To: File Systems Developers
Sent: Wednesday, October 24, 2001 5:22 AM
Subject: [ntfsd] RE: ZwMapViewOfSection

Do this from a system thread. It will give you almost 2 gig of address
space.

On another note, I am not sure that it is a good idea to scan like this.
I would read the data using NO_INTERMEDIATE_BUFFERING and always get the
data directly from the disk; remeber, you must read on sector aligned
boundries. THis may prove to be the fastest and most efficent way. Why brig
in the cache manager? I think, if I remember the quote correctly, 75% of
file system are not data related. So, there are many opens and closes that
get file attribute information, and the likes, but read no data; even if the
file is opened with read access.

In your scenario, you will be creating, reading and taring down your
section object more than required.

Maybe the ultimate solution is to initiate the scan on the first read of
the data from the file. This would improve performance of the virus scanner
by “leaps and bounds”.

I loaded NAI a few weeks ago to do some compatibility testing and I was
amazed at the hit on system performance I noticed. Each open caused the disk
to thrash.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rob Fuller
Sent: Wednesday, October 24, 2001 8:28 AM
To: File Systems Developers
Subject: [ntfsd] RE: ZwMapViewOfSection

I would be concerned about side effects, especially if I’m mapping a
large file. For example, while you’re scanning the virus, the process may
try to allocate memory and fail because you’ve consumed the remainder of its
virtual address space.
-----Original Message-----
From: Ratmil Torres [mailto:xxxxx@seg.inf.cu]
Sent: Wednesday, October 24, 2001 9:50 AM
To: File Systems Developers
Subject: [ntfsd] RE: ZwMapViewOfSection

Yes. I do it once, use it, unmap the view and close the section, in
the same process, at PASSIVE_LEVEL. I don’t know what process it is, but it
all happens in the same function, so that’s OK, isn’t it?
----- Original Message -----
From: Rob Fuller
To: File Systems Developers
Sent: Wednesday, October 24, 2001 8:22 AM
Subject: [ntfsd] RE: ZwMapViewOfSection

ZwMapViewOfSection maps memory in the user virtual address space.
Will you be accessing this memory in a known process context?
-----Original Message-----
From: Ratmil Torres [mailto:xxxxx@seg.inf.cu]
Sent: Tuesday, October 23, 2001 3:49 PM
To: File Systems Developers
Subject: [ntfsd] ZwMapViewOfSection

Hi, I’m making a File Filter System Driver to deny access to
files with viruses.
I intercept the CREATE calls and handle reentrancy ok. Then I
search viruses in the file. Can I use ZwMapViewOfSection to read the file?
Will that work even if it is a very big file? Or should I use several
ZwReadFile using non paged memory buffers?
Thanks.


You are currently subscribed to ntfsd as:
xxxxx@nsisoftware.com
To unsubscribe send a blank email to
leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You are currently subscribed to ntfsd as: xxxxx@seg.inf.cu
To unsubscribe send a blank email to
leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You are currently subscribed to ntfsd as: xxxxx@nsisoftware.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

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: xxxxx@seg.inf.cu
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