NDISUIO, problem reading packets

Discussion in 'Windows Vista Drivers' started by NDISUIO sample, Sep 6, 2003.

  1. Hello,

    I was wondering if someone could help me, I am using
    the standard NDISUIO sample of the Windows XP DDK in
    a WIndows 2000 FREE build environment.

    I have managed to install it successfully under WIndows 98
    and 2000 and XP but run into the following problems:
    - Under Windows 2000 none of the adapters bind
    - Under Windows 98 I can't seem to retrieve the packets
    that are sent back using an MJ_READ command.

    The packets I get back do have the correct Header
    information (802.1X EAPOL) and the sizes are correct.
    60 bytes for the EAPOL Identity. But the data returned
    using the IRPS is full of hex 0xAFAFAFAF.

    Retrieving and setting OIDS works perfectly.

    Has anyone else run into these problems?

    I do remember someone stating that MJ_READ and MJ_WRITE
    not working with a Windows 98 driver and is this what
    I am experiencing? I don't know what is going wrong under
    Windows 2000 but maybe the inf file is incorrect.

    Thanks

    Tom Rixom
     
    NDISUIO sample, Sep 6, 2003
    #1
    1. Advertisements

  2. I recall the same comment about MJ_READ and MJ_WRITE not working on 98, but
    I'm not able to immediately find the exact reference. If I do, I'll post
    it later. But just use Device IO Control.

    On Windows 2000, check the INF for the adapters (their upper edge) and the
    lower edge of your protocol -- as a starting place. I would expect "ndis5"
    to be specified in both, and therefore the first requirement for binding is
    satisfied. But that's a place to start.

    Is your bind adapter handler getting called at all? Does your protocol
    show up in the adapter's properties at all (you may have to check your
    flags in your INF to make sure that it's not hidden)?

    Bryan S. Burgin


    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Bryan S. Burgin [MSFT], Sep 6, 2003
    #2
    1. Advertisements

  3. NDISUIO sample

    Tom Rixom Guest

    I recall the thread to and it was Thomas F. Divine who
    stated that MJ_READ will not work for Windows 98/ME
    but he did not reveal why...

    I am using the inf file provided with the WIndows XP DDK.
    And I just tested the driver on XP and this gives the
    same problems. My bind adapter handler is not being
    called.

    But I have now got my device driver dumping the output
    from the NDISQuery and it is full of junk. THe size
    is correct but the buffer contains AFAFAFAFAFAF.

    BTW. When using Device IO I will have to create a message
    like NDISUIO_READ_PACKET I guess. Is it then possible to
    use the MDLAddress of the IRP of this call, which means I
    can simple queue the IRP and respond to it using the
    serviceReads function or do I have to respond directly by
    reading the first packet of the packet queue. The latter
    is not really what I want as it would require a sort of
    polling mechanism.

    Also I checked the documentation of using IRPs and it
    states when using buffered IO you cannot use the
    MDLaddress of an IRP. I find this strange as the
    serviceReads actually does use the MDLAddress to transfer
    the data and when looking at the definiton of the READ in
    ndisuio.h it uses the METHOD_BUFFERED flag which means
    the call is using buffered IO right?

    Thanks,

    Tom.
    confers no rights.
     
    Tom Rixom, Sep 7, 2003
    #3
  4. NDISUIO sample

    Tom Rixom Guest

    I am testing on Windows XP SP1 now.

    I have changed the inf file so the protocol now shows up
    in the adapter properties. This means (I think) the
    installation is proceeding correctly. But again the bind
    adapter is not called. So when I do a query bindings it
    returns empty.

    I am using the standard INF and source from the Windows
    XP DDK but I have changed the name of the sys to my own
    name. Maybe I screwed up here...

    The standard ndisuio driver running on WinXP does work.

    T.
     
    Tom Rixom, Sep 7, 2003
    #4
  5. Tom,

    1) Below, I copied the INF that I use. It needed several modifications to
    work on 9x/me do declare the DevLoader and DeviceVxDs. Also, for Windows
    ME, you MUST declare all three flavors of NDIS: "ndis3,ndis4,ndis5". See
    KB 282778 (http://support.microsoft.com/default.aspx?scid=kb;[LN];282778).

    2) Keep in mind that the driver and console app are built in the NT-based
    world (2K/XP/etc) and it expects that its strings are Unicode. However,
    when the 9x/me operating system calls your Bind Adapter handler, it calls
    it with an ASCII adapter name. This is fine -- whatever name you receive,
    just pass to NdisOpenAdapter unaltered. However, NDISUIO also caches a
    copy of each adapter to binds to so that it can report these names when
    your console app asks to enumerate the list. When you make this copy, I
    found it best to convert the cached copy to Unicode. The adapter names in
    9x/ME are usually "0000" or "0001", etc. Passing this ASCII string ("0000"
    being 0x3030303000) to a console application that is expecting Unicode
    (0x00300030003000300000) will make the string look like garbage.

    3) The last problem I can remember is that the CreateFile in the colsole
    application tries to open "\\\\.\\\\ndisuio", which, notwithstanding the
    extra backslashes, works on 2K fails in 9x/ME. It should be
    "\\\\.\\ndisuio".

    As always, make sure that your device name in the INF matches the name you
    pass to NdisRegisterProtocol, and by tradition, I always have that match my
    binary name.


    Bryan S. Burgin


    This posting is provided "AS IS" with no warranties, and confers no rights.



    ; NDISUIO.INF
    ;
    ; NDISUIO Transport
    ;
    ; Copyright 2001, Microsoft Corporation

    [version]
    signature="$CHICAGO$"
    Class=NetTrans
    provider=%V_MS%

    [Manufacturer]
    %V_MS%=MS

    [MS]
    %NDISUIO.DeviceDesc%= NDISUIO.ndi, NDISUIO


    ;***************************************************************************
    *
    ; NDISUIO
    ;***************************************************************************
    *
    [NDISUIO.ndi]
    CopyFiles=NDISUIO.CopyFiles
    AddReg=NDISUIO.ndi.reg
    DeviceID=NDISUIO
    MaxInstance=8

    [NDISUIO.ndi.reg]
    HKR,Ndi,DeviceID,,NDISUIO
    HKR,Ndi,MaxInstance,,8
    ;;;HKR,Ndi,NdiInstaller,,"MyNdi.dll,MyNdiProc"

    ; NDIS info
    HKR,NDIS,LogDriverName,,"NDISUIO"
    HKR,NDIS,MajorNdisVersion,1,05
    HKR,NDIS,MinorNdisVersion,1,00

    ; Interfaces
    HKR,Ndi\Interfaces,DefUpper,,""
    HKR,Ndi\Interfaces,DefLower,,"ndis3,ndis4,ndis5"
    HKR,Ndi\Interfaces,UpperRange,,""
    HKR,Ndi\Interfaces,LowerRange,,"ndis3,ndis4,ndis5"

    ; Install-Remove Sections
    HKR,Ndi\Install,,,"NDISUIO.Install"
    HKR,Ndi\Remove,,,"NDISUIO.Remove"

    ; Context help
    HKR,Ndi,HelpText,,%NDISUIO_HELP%

    [NDISUIO.Install]
    AddReg=NDISUIO.AddReg
    DelReg=NDISUIO.Ins.DelReg
    CopyFiles=NDISUIO.CopyFiles

    [NDISUIO.AddReg]
    HKR,,DevLoader,,*ndis,*ntkern
    HKR,,DeviceVxDs,,"ndisuio.sys"

    [NDISUIO.CopyFiles]
    ndisuio.sys

    [NDISUIO.Remove]
    DelReg=NDISUIO.Rmv.DelReg
    DelFiles=NDISUIO.CopyFiles

    [NDISUIO.Rmv.DelReg]

    ;***************************************************************************
    *
    ; Destination Directories
    ;***************************************************************************
    *
    [DestinationDirs]
    NDISUIO.CopyFiles = 11 ; LDID_SYS

    [SourceDisksNames]

    [SourceDisksFiles]

    ;***************************************************************************
    *
    ; Localizable Strings
    ;***************************************************************************
    *
    [strings]
    V_MS="Microsoft"
    V_CLASSNAME="Network Protocol"

    ; Devices
    NDISUIO.DeviceDesc="Sample NDISUIO Protocol Driver"

    ; Parameters
    PARAM_YES="Yes"
    PARAM_NO="No"
    PARAM_OFF="Off"
    PARAM_NONE="None"

    ; Context help
    NDISUIO_HELP="Sample Protocol Driver"
     
    Bryan S. Burgin [MSFT], Sep 7, 2003
    #5
  6. NDISUIO sample

    Tom Rixom Guest

    Thanks!

    I found the error and it was indeed something to do with
    the names used for your driver (Do not use a "_" as it
    will not bind under WIndows 2000 or XP, Windows 98 doesnt
    seem to mind). I got it working now on both Windows 2000
    and XP.

    I am still having trouble with the Windows 98 version
    though. I am outputting the buffer from the
    NDISQueryBuffer using the DEBUGPDUMP macro (in the driver
    itself) and all I get is the AFAFAF I have been talking
    about. Any ideas what I am doing wrong here? Like I said
    I am using an unaltered NDISUIO sample. Off course this
    works fine on XP and 2K.

    Tom.
    NDIS: "ndis3,ndis4,ndis5". See
     
    Tom Rixom, Sep 8, 2003
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.