AW: Help!! Getting File size in IRP_MJ_CREATE...

This is not a poor idea but you must be careful not to end up in an infinite
loop. Tell us more about the error you’re getting. I assume your system
instantly reboots without a bluescreen.

-----Urspr?ngliche Nachricht-----
Von: Kim Byeong-Kyun [mailto:xxxxx@naver.com]
Gesendet: Dienstag, 14. Januar 2003 10:00
An: File Systems Developers
Betreff: [ntfsd] Help!! Getting File size in IRP_MJ_CREATE…

hi…

i want to get file size in IRP_MJ_CREATE…
i called ZwQueryInformationFile with FILE_STANDARD_INFORMATION option,
in IRP_MJ_CREATE dispatch routine.

maybe… this is very poor idea…

please, Help me…

thanks…


You are currently subscribed to ntfsd as: xxxxx@gdata.de
To unsubscribe send a blank email to xxxxx@lists.osr.com


Virus checked by G DATA AntiVirusKit
Version: AVK 12.0.92 from 14.01.2003
Virus news: www.antiviruslab.com

hi.

help or advise me…

i cannot get file size in IRP_MJ_CREATE…
when i use ZwQueryInformationFile with FILE_STANDARD_INFORMATION for
getting file size, the function(ZwQueryInformationFile) always returns 0.

MSDN describes that ZwQueryInformationFile must run in PASSIVE_LEVEL.
so, i checked it by using KeCurrentIrql(). and i saw the level is
PASSIVE_LEVEL.
is it wrong way that calling ZwQueryInformation function in IRP_MJ_CREATE
dispath routine?

i was persuaded by other answer; use FSRTL_COMMON_FCB_HEADER structure.
but i don’t know how to use it… :frowning:

PLEASE advise me…
how can i get file size in IRP_MJ_CREATE???

Try this:

  1. Open the file yourself
  2. Do your query
  3. Close the file
  4. Continue with the processing of the original IRP

To open the file you will need to either roll your own
IRP or use ZwCreateFile. I don’t know how to roll a
create IRP and I haven’t been able to find any
samples. Just a lot of comments saying “Its hard”.
If you use ZwCreateFile you will need to worry about
reentrancy into your filter as this will generate a
new IRP_MJ_CREATE. You need to detect this and just
pass it through. See the OSR FAQ for the correct way
to do this.

Randy Cook
Lucid Systems Inc.

— Kim Byeong-Kyun wrote:
> hi.
>
> help or advise me…
>
> i cannot get file size in IRP_MJ_CREATE…
> when i use ZwQueryInformationFile with
> FILE_STANDARD_INFORMATION for
> getting file size, the
> function(ZwQueryInformationFile) always returns 0.
>
> MSDN describes that ZwQueryInformationFile must run
> in PASSIVE_LEVEL.
> so, i checked it by using KeCurrentIrql(). and i saw
> the level is
> PASSIVE_LEVEL.
> is it wrong way that calling ZwQueryInformation
> function in IRP_MJ_CREATE
> dispath routine?
>
> i was persuaded by other answer; use
> FSRTL_COMMON_FCB_HEADER structure.
> but i don’t know how to use it… :frowning:
>
> PLEASE advise me…
> how can i get file size in IRP_MJ_CREATE???
>
> —
> You are currently subscribed to ntfsd as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
xxxxx@lists.osr.com

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

The best way is just to roll your own query information IRP and send it
down using the file object initialized by the filesystem after you send
down the create. If for some reason he wants the file size before he
sends down the create, then this won’t work.

  • Nicholas Ryan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Randy Cook
Sent: Wednesday, January 15, 2003 8:25 AM
To: File Systems Developers
Subject: [ntfsd] Re: Help!! Getting File size in IRP_MJ_CREATE…

Try this:

  1. Open the file yourself
  2. Do your query
  3. Close the file
  4. Continue with the processing of the original IRP

To open the file you will need to either roll your own
IRP or use ZwCreateFile. I don’t know how to roll a
create IRP and I haven’t been able to find any
samples. Just a lot of comments saying “Its hard”.
If you use ZwCreateFile you will need to worry about
reentrancy into your filter as this will generate a
new IRP_MJ_CREATE. You need to detect this and just
pass it through. See the OSR FAQ for the correct way
to do this.

Randy Cook
Lucid Systems Inc.

— Kim Byeong-Kyun wrote:
> > hi.
> >
> > help or advise me…
> >
> > i cannot get file size in IRP_MJ_CREATE…
> > when i use ZwQueryInformationFile with FILE_STANDARD_INFORMATION for
> > getting file size, the
> > function(ZwQueryInformationFile) always returns 0.
> >
> > MSDN describes that ZwQueryInformationFile must run
> > in PASSIVE_LEVEL.
> > so, i checked it by using KeCurrentIrql(). and i saw
> > the level is
> > PASSIVE_LEVEL.
> > is it wrong way that calling ZwQueryInformation
> > function in IRP_MJ_CREATE
> > dispath routine?
> >
> > i was persuaded by other answer; use
> > FSRTL_COMMON_FCB_HEADER structure.
> > but i don’t know how to use it… :frowning:
> >
> > PLEASE advise me…
> > how can i get file size in IRP_MJ_CREATE???
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@yahoo.com
> > To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com


You are currently subscribed to ntfsd as: xxxxx@nryan.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

A sample of how to do this is in the filemon source
code. The functions to look at are FilemonQueryFile
and FilemonQueryFileComplete. You can get filemon
from www.sysinternals.com.

Randy Cook
Lucid Systems Inc.

— Nicholas Ryan wrote:
> The best way is just to roll your own query
> information IRP and send it
> down using the file object initialized by the
> filesystem after you send
> down the create. If for some reason he wants the
> file size before he
> sends down the create, then this won’t work.
>
> - Nicholas Ryan
>
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf
> Of Randy Cook
> > Sent: Wednesday, January 15, 2003 8:25 AM
> > To: File Systems Developers
> > Subject: [ntfsd] Re: Help!! Getting File size in
> IRP_MJ_CREATE…
> >
> >
> > Try this:
> > 1. Open the file yourself
> > 2. Do your query
> > 3. Close the file
> > 4. Continue with the processing of the original
> IRP
> >
> > To open the file you will need to either roll your
> own
> > IRP or use ZwCreateFile. I don’t know how to roll
> a
> > create IRP and I haven’t been able to find any
> > samples. Just a lot of comments saying “Its
> hard”.
> > If you use ZwCreateFile you will need to worry
> about
> > reentrancy into your filter as this will generate
> a
> > new IRP_MJ_CREATE. You need to detect this and
> just
> > pass it through. See the OSR FAQ for the correct
> way
> > to do this.
> >
> > Randy Cook
> > Lucid Systems Inc.
> >
> > — Kim Byeong-Kyun wrote:
> > > hi.
> > >
> > > help or advise me…
> > >
> > > i cannot get file size in IRP_MJ_CREATE…
> > > when i use ZwQueryInformationFile with
> FILE_STANDARD_INFORMATION for
> > > getting file size, the
> > > function(ZwQueryInformationFile) always returns
> 0.
> > >
> > > MSDN describes that ZwQueryInformationFile must
> run
> > > in PASSIVE_LEVEL.
> > > so, i checked it by using KeCurrentIrql(). and i
> saw
> > > the level is
> > > PASSIVE_LEVEL.
> > > is it wrong way that calling ZwQueryInformation
> > > function in IRP_MJ_CREATE
> > > dispath routine?
> > >
> > > i was persuaded by other answer; use
> > > FSRTL_COMMON_FCB_HEADER structure.
> > > but i don’t know how to use it… :frowning:
> > >
> > > PLEASE advise me…
> > > how can i get file size in IRP_MJ_CREATE???
> > >
> > > —
> > > You are currently subscribed to ntfsd as:
> xxxxx@yahoo.com
> > > To unsubscribe send a blank email to
> > xxxxx@lists.osr.com
> >
> >
> >
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> http://mailplus.yahoo.com
>
>
> —
> You are currently subscribed to ntfsd as:
> xxxxx@nryan.com
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
>
>
> —
> You are currently subscribed to ntfsd as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
xxxxx@lists.osr.com


Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com