From - Mon Oct 13 11:15:48 1997 Path: news.mitre.org!blanket.mitre.org!agate!newsgate.duke.edu!nntprelay.mathworks.com!news.mathworks.com!uunet!in4.uu.net!lard.ftp.com!not-for-mail From: Slava Monich Newsgroups: comp.os.ms-windows.programmer.nt.kernel-mode Subject: Re: "IoCompleteRequest();" before "return STATUS_PENDING;"? Date: Fri, 10 Oct 1997 11:32:34 -0400 Organization: FTP Software, Inc. Lines: 35 Message-ID: <343E4A92.FBD8E10C@ftp.com> References: <343bcc92.0@luxy.d.ginster.de> NNTP-Posting-Host: smonich-3.ftp.com Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.03 [en] (WinNT; U) To: Dirk Juelich Dirk Juelich wrote: > > I have a basic device driver design problem. Is it allowed to call > IoCompleteRequest() for an IRP after IoMarkIrpPending() but _before_ > the dispatch routine has returned STATUS_PENDING? What your dispatch routine returns ABSOLUTELY DOES NOT MATTER. The IoCallDriver code (IofCallDriver actually) does not seem to make any assumptions based on what your dispatch routine returns. It returns immediately (debug version additionaly checks IRQ level before/after the call) and propagates the status you returned to the caller of IoCallDriver. *If* the driver which calls IoCallDriver does not make any assumptions either (it should not), it all should work out just fine. If it does, it's his problem, not yous or NT kernel's. NTDDK help says: ] An IRP passed in a call to IoCallDriver becomes inaccessible to ] the higher-level driver, unless the higher-level driver has set ] up its IoCompletion routine for the IRP with IoSetCompletionRoutine. which makes it pretty clear that the callers of IoCallDriver must not make any assumptions about the fate of the IRP *especially* based on the value returned by IoCallDriver. What NTDDK help does *not* say is that IoCallDriver does not use the value returned by your dispatch routine in any way. Without a kernel mode debugger the documentation is half useless :-) Basically, the status returned by IoCallDriver is meaningless. From my point of view, IoCallDriver should not return anything. Regards, -Slava