From: SMTP%"Mason@osr.com" 16-JAN-1998 13:31:54.23 To: "Vijay, Jim" , ntfsd@atria.com CC: Subj: RE: [ntfsd] IoSetCompletionRoutine usage with allocated Irp's Return-Path: owner-ntfsd@atria.com Received: by arisia.gce.com (UCX V4.1-12C, OpenVMS V7.1 VAX); Fri, 16 Jan 1998 13:31:35 -0500 Received: by gw.atria.com id Fri, 16 Jan 1998 11:16:33 -0500 Received: from queball.osr.com by gw.atria.com id Fri, 16 Jan 1998 11:16:28 -0500 Received: by queball.osr.com with Internet Mail Service (5.0.1457.3) id ; Fri, 16 Jan 1998 11:15:36 -0500 Message-ID: <9116A17ECE4BD111858F006008332C3E046EA6@queball.osr.com> From: Mason To: "Vijay, Jim" , ntfsd@atria.com Subject: RE: [ntfsd] IoSetCompletionRoutine usage with allocated Irp's Date: Fri, 16 Jan 1998 11:15:36 -0500 X-Priority: 3 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.0.1457.3) Content-Type: text/plain Sender: owner-ntfsd@atria.com Precedence: bulk X-Majordomo-Taboo: ntfsd Jim, The device object passed to your completion routine comes from the current I/O stack location. If you create a driver in your IRP you don't HAVE an I/O stack location (the completion routine, however, is stored in the NEXT I/O stack location.) The I/O Manager has to pass NULL to your completion routine in this case. You can "fix" this by allocating an additional I/O stack location, advancing the I/O stack pointer (see IoSetNextIrpStackLocation), setting the DeviceObject pointer (in the now "current" stack location) and setting your completion routine. This does require an extra stack location, but you will be passed your device object pointer. Regards, Tony Tony Mason Consulting Partner OSR Open Systems Resources, Inc. http://www.osr.com -----Original Message----- From: Vijay, Jim [mailto:jvijay@whovision.com] Sent: Thursday, January 15, 1998 7:29 PM To: ntfsd@atria.com Subject: [ntfsd] IoSetCompletionRoutine usage with allocated Irp's I am having a problem using IoSetCompletionRoutine with Irp's allocated using IoAllocateIrp. I initialize and pass the allocated Irp down using IoCallDriver. When the IO Manager calls my completion routine, which has the form NTSTATUS MyCompletionRoutine( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context), the DeviceObject is always NULL. This happens only with Irp's that I have allocated. With an Irp the IO Mgr sends to my driver, after I pend it with IoMarkIrpPending and pass it down, everything works as it should. I.e. the completion routine gets the DeviceObject correctly. What should one do to get the DeviceObject passed correctly to the completion routine with an Irp that the Driver has allocated? Thanks Jim - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [ To unsubscribe, send email to ntfsd-request@atria.com with body UNSUBSCRIBE (the subject is ignored). ] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [ To unsubscribe, send email to ntfsd-request@atria.com with body UNSUBSCRIBE (the subject is ignored). ]