From: SMTP%"mason@osr.com" 2-DEC-1997 16:29:08.09 To: Subramanya Rao , ntfsd@atria.com CC: Subj: Re: [ntfsd] Getting the pointer to device object. Return-Path: owner-ntfsd@atria.com Received: by arisia.gce.com (UCX V4.1-12C, OpenVMS V7.1 VAX); Tue, 2 Dec 1997 16:24:51 -0500 Received: from gw.atria.com (gw.atria.com [192.88.237.2]) by mercury.mv.net (8.8.8/mem-971025) with SMTP id PAA25944 for ; Tue, 2 Dec 1997 15:30:23 -0500 (EST) Received: by gw.atria.com id Tue, 2 Dec 1997 12:34:44 -0500 Received: from relay4.smtp.psi.net by gw.atria.com id Tue, 2 Dec 1997 12:34:40 -0500 Received: from queball.osr.com by relay4.smtp.psi.net (8.8.3/SMI-5.4-PSI) id MAA03562; Tue, 2 Dec 1997 12:34:30 -0500 (EST) Received: from feanor.osr.com by queball.osr.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.0.1457.7) id YCADLHWQ; Tue, 2 Dec 1997 12:34:01 -0000 Message-Id: <3.0.3.32.19971202123209.043a1680@mailserver.osr.com> X-Sender: mason@mailserver.osr.com X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.3 (32) Date: Tue, 02 Dec 1997 12:32:09 -0500 To: Subramanya Rao , ntfsd@atria.com From: Tony Mason Subject: Re: [ntfsd] Getting the pointer to device object. In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Sender: owner-ntfsd@atria.com Precedence: bulk -----BEGIN PGP SIGNED MESSAGE----- At 03:34 PM 12/2/97 +0500, Subramanya Rao wrote: >I want to write a filter driver to intercept IRPs made to the floppy >disks. I have looked at NTFILMON source code. The only problem is that I >can't get a handle to the floppy device object by opening a file in the >floppy drive ( which is the method used in NTFILMON ). This method will >fail if there is no floppy disk at the time of loading the driver. > >What are the other ways of getting the pointer to the floppy device >driver? Or is there any other way to attach to the floppy device driver? The best way to accomplish this is to use IoGetDeviceObjectPointer and specify FILE_ANY_ACCESS. This will keep from generating the hard error popup when you are probing the drive. This will then return a file object and device object. The file object will contain a pointer to the physical media device object (FileObject- >DeviceObject) in the case of the floppy drive. Thus, you'd do something like: IoGetDeviceObjectPointer(L"\??\A:", FILE_ANY_ACCESS, &FileObject, &DeviceObject); MediaDeviceObject = FileObject->DeviceObject; ObDereferenceObject(FileObject); Now you can call IoAttachDeviceToDeviceStack (NT 4.0) or IoAttachDeviceByPointer (NT 3.51.) Regards, Tony -----BEGIN PGP SIGNATURE----- Version: PGP for Personal Privacy 5.0 Charset: noconv iQEVAwUBNIRGGImxeMUNM60pAQHplwgAws1NBuRkqSLAEbAe3MKqOaC7yjJx3tKz yegcv1PRP4cTrnM4ysLEi24cvtHdQbxkosDbXpSL8QRnPT6CAM5vPbu5Ns4A7BP3 tTqZ8J0WeXFIfIaHFXums2pottdREPamo4ZLEUwZNPOH1bAk+8ZFUAmhAePttAxu BqfubDaEcEYCZnycoae9SK+VAf4ik1XPOP3egktplu9SAqET2quL9AhUOywqyE/U SeCB14+oVyTCKSMFHesL2VHQUV1VrWH6Tr7Sxx2x66fKdrXfqh+t9pYnpeyHIT0W 1ynnn8HqH1FQgDV/LiUM5jvRydwy1farggkIXHBsPK4ZL6sGPmzgDA== =QRPj -----END PGP SIGNATURE----- Tony Mason Consulting Partner OSR Open Systems Resources, Inc. mason@osr.com http://www.osr.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [ To unsubscribe, send email to ntfsd-request@atria.com with body UNSUBSCRIBE (the subject is ignored). ]