Re: Writing to a file

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Stephan Wolf (stewo68_at_hotmail.com)
Date: 03/30/04


Date: 30 Mar 2004 01:00:43 -0800

There is no "NDIS way" for an NDIS driver to (directly) write to a
file. The NdisOpenFile() etc. is only there for read-only purposes.

One should usually use NdisWriteErrorLogEntry() to write log entries.
The 'ErrorCode' does *not* need to be an actual error code, i.e. it
can also be a warning or an informational entry. More, although tbe
docs say about the 'ErrorCode' that it "Specifies the NDIS_STATUS_XXX
code describing the I/O error", it does not actually need to be an
NDIS_STATUS_XXX code. Instead, you can define your own codes. Then you
can add a message file to your driver (compiled with MC - the message
compiler), which contains messages for each code that you define. That
will enable the Event Viewer to display your codes along with a
meaningful message.

For more information see "Logging Errors" in the DDK docs:

 http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/other_92jr.asp
 -> "Defining Custom Error Types"

Note that I have never used NdisWriteEventLogEntry() ("event"), which
may also be an option for you.

Stephan

---
"Ram Nayak" <spam@spam.com> wrote in message news:<#tHEZbdFEHA.2416@TK2MSFTNGP12.phx.gbl>...
> I am trying to create a log file from the driver.
> 
> I will need to log to a file from the send/receive functions.
> 
> ..Ram
> 
> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
> news:elxiPZdFEHA.3084@TK2MSFTNGP09.phx.gbl...
> >        From what path? Bind/unbind? or send? or receive?
> >
> > -- 
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > maxim@storagecraft.com
> > http://www.storagecraft.com
> >
> >
> > "Ram Nayak" <spam@spam.com> wrote in message
> > news:O0jECWdFEHA.4008@TK2MSFTNGP10.phx.gbl...
> > > How can I open a file on the disk and write to it from a NDIS miniport
> > > driver?
> > >
> > > Thanks,
> > >
> > > ..Ram
> > >
> > >
> >
> >


Relevant Pages

  • Re: Problem with getting nonpaged system-space virtual address
    ... "Peter" wrote in message ... >> Maxim Shatskih, Windows DDK MVP ... >>> My driver I/O is set to DIRECT_IO. ...
    (microsoft.public.development.device.drivers)
  • Re: Incorrect server name
    ... There is no primary WINS server defined for this adapter. ... Broadcom BCM5708C NetXtreme II GigE (NDIS VBD Client) ... Network Monitor Driver ...
    (microsoft.public.windows.server.general)
  • Re: Question about FILE_OBJECT
    ... NDIS IM is a driver that fully conforms to the model, ... I.E. every time they allocated a new context object they ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Access GPIO on W83627
    ... >> Maxim Shatskih, Windows DDK MVP ... >> StorageCraft Corporation ... The driver ...
    (microsoft.public.development.device.drivers)
  • Re: getting the driver names from a device stack
    ... then take the PDO pointer (provided to ... Use ObQueryNameString on driver objects. ... >> Maxim Shatskih, Windows DDK MVP ...
    (microsoft.public.development.device.drivers)