- Problem With NdisRegisterDeviceEx/IOCTL On Vista
- Posted by Soquel Dude on September 2nd, 2006
I'm porting an NDIS miniport driver for a WLAN device from XP to Vista.
This
driver supported an IOCTL interface for query/set requests from the client
application.
Following the mux sample driver in the WDK, the driver now calls
NdisRegisterDeviceEx() to register the device. Stepping through this in
WinDbg, I see the call succeed and return NDIS_STATUS_SUCCESS. However,
when
the client application calls CreateFile(), the call fails and
GetLastError()
returns 53 (ERROR_BAD_NETPATH).
This was seen on Vista build 5536.
Does Vista's NWF framework allow NDIS miniport drivers to export their own
IOCTL interface? If not, what should NWF miniport drivers do instead?
- Posted by fat_boy on September 4th, 2006
I have the same problem, the user mode code cant open the device, it
gets an acces denied. This is regardles of what security string I put
in the call to NdisRegisterDeviceEx().
I think this is just plain broken. (along with quite a lot of the rest
of Vista)
What you could do for the moment is prototype the old version of this
func in your ode and link to the old verion in ndis.lib. This does at
least still work.
Soquel Dude wrote:
- Posted by Eliyas Yakub [MSFT] on September 7th, 2006
There are several inbox and test drivers using this function. So I suspect
that you are doing something wrong.
Can you post the code that calls NdisRegisterDeviceEx?
Can you break into the debugger and see if the deviceobject and symbolic
link are created?
kd> !object \Device
kd> !object \GLOBAL??
-Eliyas
"fat_boy" <zzebowa@hotmail.com> wrote in message
news:1157368278.385896.11260@b28g2000cwb.googlegro ups.com...
- Posted by fat_boy on September 8th, 2006
Yeah. the symbolic link is there, and the CreateFile() call uses
MAXIMUM_ALLOWED so it should suceed with at least something.
Here is the code from the driver:
RtlInitUnicodeString( &sddlString,
L"D:P(A;;GA;;;SY)(A;;GA;;;BA)(A;;GA;;;BU)(A;;GA;;; WD)");
NdisZeroMemory(DispatchTable, (IRP_MJ_MAXIMUM_FUNCTION+1) *
sizeof(PDRIVER_DISPATCH));
DispatchTable[IRP_MJ_CREATE] = GPRSioctlDispatch;
DispatchTable[IRP_MJ_CLEANUP] = GPRSioctlDispatch;
DispatchTable[IRP_MJ_CLOSE] = GPRSioctlDispatch;
DispatchTable[IRP_MJ_DEVICE_CONTROL] = GPRSioctlDispatch;
DispatchTable[IRP_MJ_READ] = GPRSioctlDispatch;
RtlStringCbPrintfW(deviceString, 64, L"\\Device\\GTNDIS%d", i);
RtlStringCbPrintfW(linkString, 64, L"\\DosDevices\\GTNDIS%d", i);
NdisInitUnicodeString(&deviceName, deviceString);
NdisInitUnicodeString(&linkName, linkString);
NdisZeroMemory(&devObjAttrs, sizeof( NDIS_DEVICE_OBJECT_ATTRIBUTES));
devObjAttrs.Header.Type = NDIS_OBJECT_TYPE_DEVICE_OBJECT_ATTRIBUTES;
devObjAttrs.Header.Revision =
NDIS_DEVICE_OBJECT_ATTRIBUTES_REVISION_1;
devObjAttrs.Header.Size = sizeof(NDIS_DEVICE_OBJECT_ATTRIBUTES);
devObjAttrs.DeviceName = &deviceName;
devObjAttrs.SymbolicName = &linkName;
devObjAttrs.MajorFunctions = &DispatchTable[0];
devObjAttrs.ExtensionSize = 10;
devObjAttrs.DefaultSDDLString = &sddlString;
devObjAttrs.DeviceClassGuid = 0;
Status = NdisRegisterDeviceEx(GPRSNdisMiniportDriverHandle,
&devObjAttrs,
&pAdapter->pIoctlDevice,
&pAdapter->ioctlHandle);
And it returns NDIS_STATUS_SUCCESS
Cheers.
Eliyas Yakub [MSFT] wrote:
- Posted by Eliyas Yakub [MSFT] on September 12th, 2006
I plugged in your code as is in one of my ndis 60 sample and it worked fine.
So it's time for you to hook up a debugger, step thru CreateFile fail code
and find out why it fails.
--
-Eliyas
This posting is provided "AS IS" with no warranties, and confers no rights.
http://www.microsoft.com/whdc/driver/tips/default.mspx
- Posted by fat_boy on September 20th, 2006
Eliyas Yakub [MSFT] wrote:
What parameters did you use for CreateFile()? Perhaps Vista wants a
different set to XP?
- Posted by fat_boy on September 20th, 2006
Eliyas Yakub [MSFT] wrote:
Scrub that, it works on RC1.
- Posted by fat_boy on September 20th, 2006
Eliyas Yakub [MSFT] wrote:
Scrub that, it is still broken. I had an Ndis 5.1 driver running by
mistake.
So, what params did you use to get CreateFile() to work?
- Posted by Eliyas Yakub [MSFT] on September 20th, 2006
I used the testapp of netvmini (network\ndis\netvmini) sample. If you open
the main source file and scroll all the way down, there is a function to
open the device and send ioctl to it.
-Eliyas
"fat_boy" <zzebowa@hotmail.com> wrote in message
news:1158753812.002020.155280@m73g2000cwd.googlegr oups.com...
- Posted by fat_boy on September 28th, 2006
Ah, I am using MAXIMUM_ALLOWED because GENERIC_READ | GENERIC_WRITE
fails in a non admin profile on XP.
Eliyas Yakub [MSFT] wrote: