IOCTL_NDISRD_READ_PACKET without packets

Home Forums Discussions Support IOCTL_NDISRD_READ_PACKET without packets

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #4848
    bk
    Participant

      It’s not clear from the documentation what happens calling IOCTL_NDISRD_READ_PACKET when there are no packets in the queue. How do I check when I’ve read the last packet in the queue?

      #5556
      Vadim Smirnov
      Keymaster

        You should check the returned status, when there are no packets in the queue WinpkFilter driver returnes NDIS_STATUS_FAILURE.

        #5557
        bk
        Participant

          Pardon me, the status returned by what?

          #5558
          bk
          Participant

            I’ve done some tests, it seems that IoCallDriver returns STATUS_INVALID_PARAMETER when I try a IOCTL_NDISRD_READ_PACKET on an adapter without packets in queue. Is this correct?

            I’m also receiving a STATUS_INVALID_PARAMETER when I try a IOCTL_NDISRD_FLUSH_QUEUE on an adapter with an empty queue. Is this correct?

            #5559
            Vadim Smirnov
            Keymaster

              NDIS_STATUS_FAILURE is the same as STATUS_UNSUCCESSFUL. Are you sure that you get STATUS_INVALID_PARAMETER?

              #5560
              bk
              Participant

                @SerpentFly wrote:

                NDIS_STATUS_FAILURE is the same as STATUS_UNSUCCESSFUL. Are you sure that you get STATUS_INVALID_PARAMETER?

                Yes, pretty sure. I’m not at work, so I cannot post the exact code, but roughly is:

                … initialize the irp structure …

                status = IoCallDriver( devObj, irp );

                if( status == STATUS_PENDING )
                WaitForSingleObject( devObj, …);
                else if ( status == STATUS_INVALID_PARAMETER ) {
                DbgPrint(“Invalid parameter”);
                }

                This code is called in a cycle: where there are packets in queue, the status is correct, but on the last cycle, where there are no more packets on queue, it prints “invalid parameter”. Sadly I’m not at work so I can’t give you the exact hex value, but if I remember correctly it’s 0xC000000D.

                The same happens with IOCTL_NDISRD_FLUSH_QUEUE on an empty queue.

                #5561
                Vadim Smirnov
                Keymaster

                  I have rechecked the code, and yes you are right. Internal request processing routine returnes STATUS_UNSUCCESFULL, but higher level dispatching routine returnes STATUS_INVALID_PARAMETER for any status different from STATUS_SUCCESS. So your code is pretty correct.

                Viewing 7 posts - 1 through 7 (of 7 total)
                • You must be logged in to reply to this topic.