Re: ndisuio question

From: Jeff Kelley [MS] (jeffkel_at_online.microsoft.com)
Date: 10/28/04


Date: Thu, 28 Oct 2004 13:44:44 -0700

You need to set the binding's current packet filter. See my reply to your
other post for more details.

-- 
Jeff Kelley
Microsoft / Windows CE Networking
This posting is provided AS IS with no warranties, and confers no rights.
"Boyd D. Mills" <BMills@VCIControls.ca> wrote in message
news:ey1DlEQvEHA.1264@TK2MSFTNGP12.phx.gbl...
> The following is the bulk of a sample task used to access ndisuio in
Windows
> CE 4.1 CEPC platform.
> I thought it odd that ndisuio by default uses Ethernet frame 0x8001 - odd
in
> that this is not a "well known" frame type.  I change it to 0x800
instead -
> ip frames for the purpose of testing.
> Everything reports success except the task never returns from the
ReadFile.
> There is plenty ip traffic on the network!
> If I pass a bogus NIC name to IOCTL_NDISUIO_OPEN_DEVICE I do get an error
> message.
> Am I missing something?  Does something else have to be set before issuing
a
> ReadFile?
>
> /Boyd
> ============
> USHORT usNewType = 0x800;
> HANDLE hLAN = CreateFile(  L"UIO1:", GENERIC_READ|GENERIC_WRITE,
>       FILE_SHARE_READ | FILE_SHARE_WRITE,  NULL,     OPEN_EXISTING,
>       FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
>   INVALID_HANDLE_VALUE );
>  if ( hLAN != INVALID_HANDLE_VALUE )
>  {
>
>    DeviceIoControl(  hLAN, IOCTL_NDISUIO_QUERY_BINDING,
>      pQueryBinding, sizeof(NDISUIO_QUERY_BINDING),
>      NULL,  1024,  &dwReturnedBytes, NULL);
>
>    memcpy(tcDevName,  &Buf[pQueryBinding->DeviceNameOffset ],
> pQueryBinding->DeviceNameLength );
>    if ( ! DeviceIoControl(    hLAN, IOCTL_NDISUIO_OPEN_DEVICE,
>     tcDevName, wcslen(tcDevName) * sizeof(TCHAR),
>                 NULL, 0,  &dwReturnedBytes, NULL) )
>    {
>     printf( "deviceiocontrol failed OPEN_DEVICE %d\n", GetLastError());
>    }
>    else if ( ! DeviceIoControl(   hLAN, IOCTL_NDISUIO_SET_ETHER_TYPE,
>              &usNewType, sizeof(usNewType), NULL, 0,  &dwReturnedBytes,
> NULL) )
>    {
>     printf( "deviceiocontrol failed SET_ETHER_TYPE %d\n", GetLastError());
>    }
>    else
>    {
>     while (  icount++ < 12 )
>     {
>      if ( ReadFile( hLAN, t, 2048, &dwIn, NULL ) && dwIn  )
>      {
>       printf( "0x%x ", t[0] );
>      }
>      else Sleep( 5000 );
>     }
>     printf("\n" );
>    }
>   CloseHandle( hLAN );
>  }
>
>
>
>