?
Solved

Why ndisuio doesn't work?

Posted on 2005-04-08
6
Medium Priority
?
2,000 Views
Last Modified: 2013-12-09
Hi expert,

I meet a problem in experiencing the sample program of ndisuio in Win ddk xp 2600 in windows xp sp2 environment.

When I run the test program, I only get an error message.

uiotest.exe -e
IOCTL_NDISIO_BIND_WAIT failed, error 32
Failed to open \\.\\Ndisuio

What I try before are followed by the instructions of doc in win ddk
1. complie the driver and test program
2. install the protocol driver into system
3. disable wireless zero configuration service
4. run the test program

How to solove the tough problem?  Thanks!

Liang
0
Comment
Question by:overlook
  • 3
  • 2
6 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 13744548
The error code (i.e. 32) should be a tip to you being that it is:  ERROR_SHARING_VIOLATION

Text:

The process cannot access the file because it is being used by another process.

The problem is that Windows WZC (Wireless Zero Configuration) opens NDISUIO with exclusive access.  So to open it yourself with the uiotest application you must STOP the WZC service.  

OK?
0
 

Author Comment

by:overlook
ID: 13749601
I have already stop the wzc service in the system service windows.  But the problem still remains.  My platform is ibm thinkpad x40, is it possible that the configuration service integrated in the laptop causes the side effects to ndisuio?

Liang
0
 
LVL 4

Expert Comment

by:opanza
ID: 13790182
When you open the NDISUIO driver, what value has dwShareMode in the call to CreateFile?

Maybe it is worth to try dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE.

    hNdisuioHandle = CreateFile( NDISUIO_DEVICE_NAME,
                                               GENERIC_READ | GENERIC_WRITE,
                                               FILE_SHARE_READ | FILE_SHARE_WRITE,
                                               NULL,
                                               OPEN_EXISTING,
                                               FILE_ATTRIBUTE_NORMAL| FILE_FLAG_OVERLAPPED,
                                              (HANDLE) INVALID_HANDLE_VALUE );
0
Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

 

Author Comment

by:overlook
ID: 13856018
Excuse me for the delayed reply, because I was scheduled to other task last week.

I tried to modify the shareMode in "uiotest.c", the test program of ndisuio in WinDDK 2600.  Unfortuantely, it still fails when it trys to bind the ndisuio driver.

Best regards,

-Liang

HANDLE
OpenHandle(
    CHAR    *pDeviceName
)
{
    DWORD   DesiredAccess;
    DWORD   ShareMode;
    LPSECURITY_ATTRIBUTES   lpSecurityAttributes = NULL;

    DWORD   CreationDistribution;
    DWORD   FlagsAndAttributes;
    HANDLE  TemplateFile;
    HANDLE  Handle;
    DWORD   BytesReturned;

    DesiredAccess = GENERIC_READ|GENERIC_WRITE;

    //ShareMode = 0;
    ShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;  //modified by the suggestion
   
    CreationDistribution = OPEN_EXISTING;
    FlagsAndAttributes = FILE_ATTRIBUTE_NORMAL;
    TemplateFile = (HANDLE)INVALID_HANDLE_VALUE;

    Handle = CreateFile(
                pDeviceName,
                DesiredAccess,
                ShareMode,
                lpSecurityAttributes,
                CreationDistribution,
                FlagsAndAttributes,
                TemplateFile
            );

    //
    //  Wait for the driver to finish binding.
    //
    if (!DeviceIoControl(
                Handle,
                IOCTL_NDISUIO_BIND_WAIT,
                NULL,
                0,
                NULL,
                0,
                &BytesReturned,
                NULL))
    {
      /**************************************************
      *   The process fails at here.
      **************************************************/


        DEBUGP(("IOCTL_NDISIO_BIND_WAIT failed, error %x\n", GetLastError()));
        CloseHandle(Handle);
        Handle = INVALID_HANDLE_VALUE;
    }

    return (Handle);
}
0
 
LVL 4

Accepted Solution

by:
opanza earned 2000 total points
ID: 13856718
Two ideas:

1) Have you tried FILE_FLAG_OVERLAPPED in combination with FILE_ATTRIBUTE_NORMAL?

2) If you are sure that the WZC Service is disabled, there might be another process that has the device opened. If you are using the WRAPI.dll from your test program, this dll is loaded at initialization (InitInstance is executed) and the device is opened. Maybe you are trying to reopen it from your test program (ERROR_SHARING_VIOLATION).
0
 

Author Comment

by:overlook
ID: 13856848
The first idea works.  When I change the flag, the test program for ndisuio can read the device information from kernel.  I will move on the wrapi.
Thank you!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When I was a beginner in Windows Mobile programming, even for small test I used to create a single MFC dialog-based application with one button, and put my test code in the OnLButtonDown method. For Pocket PC it worked fine, on some Windows CE d…
Progress means simplifying, not complicating. Bruno Munari Preface How to detect the name of the internal storage or an SD-card on Windows Mobile device from the desktop application? I got this question, when I was working on a PC applicati…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question