From: hemant@internetdevices.com
To: fchabot@labcal.qc.ca
Subject: Re: Imsamp IO control and etc
Date: Wed, 17 Dec 1997 14:51:33 -0600
Message-ID: <882390142.906362891@dejanews.com>
Newsgroups: comp.os.ms-windows.programmer.nt.kernel-mode
Organization: Deja News Posting Service
Path: news.mitre.org!blanket.mitre.org!agate!newsgate.cuhk.edu.hk!logbridge.uoregon.edu!nntp2.dejanews.com!grunt.dejanews.com!not-for-mail
References: <881772600.1740963842@dejanews.com>
X-Article-Creation-Date: Wed Dec 17 20:22:22 1997 GMT
X-Authenticated-Sender: hemant@internetdevices.com
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 4.0; Windows 95)  via proxy gateway  CERN-HTTPD/3.0 libwww/2.17
X-Originating-IP-Addr: 205.138.236.250 (idi-fk-gw.abhiweb.com)
Lines: 99

Here is a sample for IOCTL:

 case IRP_MJ_DEVICE_CONTROL:  //
  // get control code from stack and perform the operation
  //
  ioControlCode = irpStack->Parameters.DeviceIoControl.IoControlCode;
 
  switch (ioControlCode) {
   // IOCTL HANDLER to toggle logging of traffic
  case IOCTL_TOGGLEFLAG:
   ImDbgOut( DBG_TRACE, DBG_FCHABOT, ("TOGGLE A FLAG\n" ));
   if (FCHABOTflag)
    FCHABOTflag = 0;
   else
    FCHABOTflag = 1;
   Status = STATUS_SUCCESS;
   break;
  default:
   ImDbgOut( DBG_INFO, DBG_IO,
      ("unknown IRP_MJ_DEVICE_CONTROL ?? \n = %X\n",ioControlCode));
   Status = STATUS_INVALID_PARAMETER;
   break;
  }
  break;
 default:
  ImDbgOut(DBG_INFO, DBG_IO,
     ("unknown IRP major function = %08X\n", irpStack->MajorFunction));
  Status = STATUS_UNSUCCESSFUL;
  break;
 }
 //
 // all requests complete synchronously; notify caller of status
 //
 Irp->IoStatus.Status = Status;
 Irp->IoStatus.Information = outputBufferLength;
 IoCompleteRequest(Irp, IO_NO_INCREMENT);
 return Status;
} // ImIoctl


In article <881772600.1740963842@dejanews.com>,
  fchabot@labcal.qc.ca wrote:
>
> Hi,
> I really hope some one here can help my out,
>
> Problem definition :
> /////////////////////////////////////////////////////////////////////////
> //////////// NDIS intermediairy driver: How to acces DeviceIOControl
> interface correctly in	the ImSamp example
> /////////////////////////////////////////////////////////////////////////
> ////////////
>
> DEV - PlateForme Pentium 166MMX 48Megs memory WindowsNT 4.0 free build
> 1381 (service pack 3) 3Com Ethernet adapter FAST Etherlink XL last
> version  DDK last version WIN32 last version DEVS C++
> /////////////////////////////////////////////////////////////////////////
> /////////////
>
> I've install the NIDIS Imsamp driver  and it is working,(just to be sure
> I put a comment mark just in front of the NDISendPacket function found
> in send.c and tested the driver... BOUM! the network was down)
>
> Now I'm trying to speak with this little fellow  using CreateFile() and
> Device IOControl()
>
> WDMSUP.C
> function IMIoctl()
> ...
> in the switch ( irpSp->Parameters.DeviceIoControl.IoControlCode )
>     {
>     case IOCTL_TEST:
>
>     If I validate the IO accces  like this
>
>     Irp->IoStatus.Status = STATUS_SUCCESS;
>    IoCompleteRequest( Irp, IO_NO_INCREMENT );
>
> I alway get a " the instruction XXXXX reference memory at 0x0000003 the
> memory	could not by writen...
>
> a few things you should also  know:
>
> (1) if	rp->IoStatus.Status = a other VALUE than succes IO is refuse and
> there is no wild pointer fault ; (2) special IOCTL codes have been define
> (has in ioctl.h from the DDK) (3) the memory fault  occur during a
> DeviceIoControl Call
>
> Thank You
>  Any comments or advices also appreciated
> would be nice if some one had a working example (with ImSamp)
>
> Frederic Chabot
>
> -------------------==== Posted via Deja News ====-----------------------
>       http://www.dejanews.com/     Search, Read, Post to Usenet

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet
