overlook
asked on
Why ndisuio doesn't work?
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
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
ASKER
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
Liang
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 );
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 );
ASKER
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_VAL UE;
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);
}
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_VAL
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
CloseHandle(Handle);
Handle = INVALID_HANDLE_VALUE;
}
return (Handle);
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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!
Thank you!
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?