NDIS6.1 miniport driver development shows bad characteristics error??

Dear Developers,
Greetings!!
Hi, The structure is initialize as in DriverEntry function : -

/**********************************************************
Global Variables
**********************************************************/
PHYTEC_HANDLE ghMiniportDriverContext = NULL;
PHYTEC_HANDLE ghNdisWrapperHandle = NULL, ghNdisMiniportDriverHandle = NULL;

NDIS_MINIPORT_DRIVER_CHARACTERISTICS PHYMiniChar;

PHY_DEBUGMSG(TRUE,(TEXT(“+phytec_miniport_characteristics.\r\n”)));
#if PHY_RTL
PHY_RTLMSG(TRUE,(TEXT(“+phytec_miniport_characteristics.\r\n”)));
#endif

NdisZeroMemory(&PHYMiniChar, sizeof(PHYMiniChar));

//----Filling Ndis Characteristics Structure----
PHYMiniChar.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_DRIVER_CHARACTERISTICS;
PHYMiniChar.Header.Revision = NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_1;
PHYMiniChar.Header.Size = NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_1;
PHYMiniChar.MajorNdisVersion = PHY_NDIS_MAJOR_VERSION_6;
PHYMiniChar.MinorNdisVersion = PHY_NDIS_MINOR_VERSION_1;
PHYMiniChar.MajorDriverVersion = PHY_DRIVER_MAJOR_VERSION_1;
PHYMiniChar.MinorDriverVersion = PHY_DRIVER_MINOR_VERSION_0;
PHYMiniChar.Flags = NDIS_WDM_DRIVER;
PHYMiniChar.CheckForHangHandlerEx = phytec_CheckForHang;
PHYMiniChar.DevicePnPEventNotifyHandler = phytec_DevicepPnP;
PHYMiniChar.UnloadHandler = phytec_Unload;
PHYMiniChar.HaltHandlerEx = phytec_Halt;
PHYMiniChar.InitializeHandlerEx = phytec_Initialize;
PHYMiniChar.OidRequestHandler = phytec_OidRequest;
PHYMiniChar.SendNetBufferListsHandler = phytec_SendNetBufferLists;
PHYMiniChar.ReturnNetBufferListsHandler = phytec_ReturnNetBufferLists;
PHYMiniChar.CancelSendHandler = phytec_CancelSend;
PHYMiniChar.PauseHandler = phytec_Pause;
PHYMiniChar.ResetHandlerEx = phytec_Reset;
PHYMiniChar.RestartHandler = phytec_Restart;
PHYMiniChar.SetOptionsHandler = phytec_SetOptions;
PHYMiniChar.ShutdownHandlerEx = phytec_ShutDown;

//----Registering Miniport Driver with ndis library----
status = NdisMRegisterMiniportDriver(DriverObject,
RegistryPath,
(PHYTEC_HANDLE)ghMiniportDriverContext,
&PHYMiniChar,
&ghNdisMiniportDriverHandle);

Its only giving error in the ndisMRegisterMiniportDriver…
What can i do and how can i check, i tried various ways but still trying to solve the issue with different method …

If you are supporting NDIS 6.1 or higher I think you need NDIS_MINIPORT_DRIVER_CHARACTERSITICS_REVISION_2

This is pretty easy to see in the definition of NDIS_MINIPORT_DRIVER_CHARACTERSITICS in NDIS.H.

Good Luck,
Dave Cattley

Sent from Mail for Windows 10

From: xxxxx@gmail.com
Sent: Wednesday, October 21, 2015 2:29 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] NDIS6.1 miniport driver development shows bad characteristics error??

Dear Developers,
Greetings!!
Hi, The structure is initialize as in DriverEntry function : -

/**********************************************************
                                        Global Variables
**********************************************************/
PHYTEC_HANDLE ghMiniportDriverContext = NULL;
PHYTEC_HANDLE ghNdisWrapperHandle = NULL, ghNdisMiniportDriverHandle = NULL;

NDIS_MINIPORT_DRIVER_CHARACTERISTICS PHYMiniChar;

        PHY_DEBUGMSG(TRUE,(TEXT(“+phytec_miniport_characteristics.\r\n”)));
        #if PHY_RTL
                PHY_RTLMSG(TRUE,(TEXT(“+phytec_miniport_characteristics.\r\n”)));
        #endif
               

        NdisZeroMemory(&PHYMiniChar, sizeof(PHYMiniChar));

        //----Filling Ndis Characteristics Structure----
        PHYMiniChar.Header.Type                                         = NDIS_OBJECT_TYPE_MINIPORT_DRIVER_CHARACTERISTICS;
        PHYMiniChar.Header.Revision                                     = NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_1;
        PHYMiniChar.Header.Size                                         = NDIS_SIZEOF_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_1;
        PHYMiniChar.MajorNdisVersion                            = PHY_NDIS_MAJOR_VERSION_6;
        PHYMiniChar.MinorNdisVersion                            = PHY_NDIS_MINOR_VERSION_1;
        PHYMiniChar.MajorDriverVersion                          = PHY_DRIVER_MAJOR_VERSION_1;
        PHYMiniChar.MinorDriverVersion                          = PHY_DRIVER_MINOR_VERSION_0;
        PHYMiniChar.Flags                                                       = NDIS_WDM_DRIVER;
        PHYMiniChar.CheckForHangHandlerEx                       = phytec_CheckForHang;
        PHYMiniChar.DevicePnPEventNotifyHandler         = phytec_DevicepPnP;
        PHYMiniChar.UnloadHandler                                       = phytec_Unload;
        PHYMiniChar.HaltHandlerEx                                       = phytec_Halt;
        PHYMiniChar.InitializeHandlerEx                  = phytec_Initialize;
        PHYMiniChar.OidRequestHandler                           = phytec_OidRequest;
        PHYMiniChar.SendNetBufferListsHandler           = phytec_SendNetBufferLists;
        PHYMiniChar.ReturnNetBufferListsHandler     = phytec_ReturnNetBufferLists;
        PHYMiniChar.CancelSendHandler                           = phytec_CancelSend;
        PHYMiniChar.PauseHandler                                        = phytec_Pause;
        PHYMiniChar.ResetHandlerEx                                      = phytec_Reset;
        PHYMiniChar.RestartHandler                                      = phytec_Restart;
        PHYMiniChar.SetOptionsHandler                           = phytec_SetOptions;
        PHYMiniChar.ShutdownHandlerEx                           = phytec_ShutDown;

//----Registering Miniport Driver with ndis library----
        status = NdisMRegisterMiniportDriver(DriverObject,
                                                                        RegistryPath,
                                                                        (PHYTEC_HANDLE)ghMiniportDriverContext,
                                                                        &PHYMiniChar,
                                                                        &ghNdisMiniportDriverHandle);

Its only giving error in the ndisMRegisterMiniportDriver…
What can i do and how can i check, i tried various ways but still trying to solve the issue with different method …


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!!  See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Dave Cattley wrote:

If you are supporting NDIS 6.1 or higher I think you need
NDIS_MINIPORT_DRIVER_CHARACTERSITICS_REVISION_2

This is pretty easy to see in the definition of
NDIS_MINIPORT_DRIVER_CHARACTERSITICS in NDIS.H.

Yes, but there seems to be some disagreement over whether Windows CE 7
(which is his target) supports anything newer than 6.0.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

xxxxx@gmail.com wrote:

Dear Developers,
Greetings!!
Hi, The structure is initialize as in DriverEntry function : -


PHYMiniChar.MajorNdisVersion = PHY_NDIS_MAJOR_VERSION_6;
PHYMiniChar.MinorNdisVersion = PHY_NDIS_MINOR_VERSION_1;

And PHY_NDIS_MINOR_VERSION_1 now has the value 0, right? This is why
this kind of naming convention is dangerous.

Its only giving error in the ndisMRegisterMiniportDriver…
What can i do and how can i check, i tried various ways but still trying to solve the issue with different method …

You are going to have to use the debugger to step into the function and
figure out where it’s complaining. It looks like there isn’t enough
detailed Win CE 7 experience here to point out an obvious problem.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Hi partap,

As of my information for NDIS, For registering with NDIS library your 3rd
and 5th arguments should be of type NDIS_HANDLE.

So define those shown below,
NDIS_HANDLE hMiniportDriverContext = NULL;
NDIS_HANDLE hNdisMiniportDriverHandle = NULL;

status=NdisMRegisterMiniportDriver(DriverObject,
RegistryPath,

(PNDIS_HANDLE)hMiniportDriverContext, &PHYMiniChar,
&hNdisMiniportDriverHandle);

Hope this will help you…:slight_smile:

Regards,
Sachin

sachinkumar butte wrote:

So define those shown below,

NDIS_HANDLE hMiniportDriverContext = NULL;
NDIS_HANDLE hNdisMiniportDriverHandle = NULL;

For reasons that are not clear to me, he has created his own typedefs
for the standard names. Plus, I think we can all agree that a NULL is a
NULL is a NULL here. He would have received a compiler error otherwise.

status=NdisMRegisterMiniportDriver(DriverObject,
RegistryPath,

(PNDIS_HANDLE)hMiniportDriverContext, &PHYMiniChar,

&hNdisMiniportDriverHandle);

Hope this will help you…:slight_smile:

The 3rd parameter should not need a cast. It’s an NDIS_HANDLE, not a
PNDIS_HANDLE.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

True. But if MSDN is to be trusted it says it does.

I know it has been suggested that the OP try the simple step of building an NDIS 6.0 variant.

The only thing I wanted to clarify was that *if* NDIS 6.1 is to be the version of the miniport, the newer (larger) structure seems to be necessary.

I am just not bored enough at the moment to go install a WinCE environment. The only ones I have collecting dust are up through CE6.

Cheers,
Dave Cattley

Sent from Mail for Windows 10

Dear developers,
Greetings…

I will implement the according to the suggestion given by developers then I will intimate you soon.

Dear Developers,
Greetings!!!

@David
Thanks for sharing your comments but I am developing miniport for WinCE 7 that supports NDIS6.0

@Tim
Thanks for sharing you comments, I made changes in the third arguments but still the nature of error is same…
And you are saying to debug the driver. I am building the driver in debug mode only. Can tell me brief that what thing i can do to debug it in debug mode.

Dear Developers,
Greetings!!!

As, i was not using PHYMiniChar.CancelOidRequestHandler = phytec_CancelOidRequest; in the structure entry and without using this case I am getting a NDIS_STATUS_BAD_CHARACTERISTICS error but after adding this entry I am getting a data ebort error as shown below : -

7915 PID:400002 TID:9e0006 OSAXST1: >>> Loading Module ‘phywl18xx.dll’ (0x9E431F64) at address 0xA7FF0000-0xA7FF5000 in Process ‘NK.EXE’ (0x87D7FAD0)
PB Debugger Loaded symbols for ‘C:\WINCE700\OSDESIGN\PHYTEC_OPENBOARD\PHYTEC_OPENBOARD\RELDIR\PHYTEC_AM335X_BSP_ARMV7_DEBUG\PHYWL18XX.DLL’
7924 PID:400002 TID:9e0006 +NDIS Driver Entry Point…
7925 PID:400002 TID:9e0006 +NDIS DriverEntry: Driver Object & RegistryPath is (0x9E431F64, 0x1)
7925 PID:400002 TID:9e0006 +phytec_miniport_characteristics.
7926 PID:400002 TID:9e0006 The major version is 6
7927 PID:400002 TID:9e0006 The minor version is 0
7928 PID:400002 TID:9e0006 ==>NdisMRegisterMiniportDriver: DriverObject 9E431F64
7929 PID:400002 TID:9e0006 Exception ‘Data Abort’ (0x4): Thread-Id=009e0006(pth=9e4074c4), Proc-Id=00400002(pprc=87d7fad0) ‘NK.EXE’, VM-active=0044003a(pprc=9e418d84) ‘udevice.exe’
7929 PID:400002 TID:9e0006 PC=ef23b060(ndis.dll+0x0009b060) RA=ef28d3fc(ndis.dll+0x000ed3fc) SP=a763e43c, BVA=00000001
7932 PID:400002 TID:9e0006 OSAXST1: <<< Unloading Module ‘phywl18xx.dll’ (0x9E431F64) at address 0xA7FF0000-0xA7FF5000 in Process ‘NK.EXE’ (0x87D7FAD0)
PB Debugger Unloaded symbols for ‘C:\WINCE700\OSDESIGN\PHYTEC_OPENBOARD\PHYTEC_OPENBOARD\RELDIR\PHYTEC_AM335X_BSP_ARMV7_DEBUG\PHYWL18XX.DLL’
7936 PID:400002 TID:be0006 NDIS:: CeGetPowerCapabilitiesForPm(): Adapter [ASYNCMAC1] is not power manageable.
7943 PID:400002 TID:9e0006 OSAXST1: >>> Loading Module ‘am33x_sdhc.dll’ (0x9E431F64) at address 0xEDFC0000-0xEDFE2000 in Process ‘NK.EXE’ (0x87D7FAD0)

Dear Developers,
Greetings!!

I have read some where the NdisMRegisterMiniportDriver somes through exception because of wrong registry bus related values.

I think I m adding the correct registry values as shown below: -

[HKEY_LOCAL_MACHINE\Comm\phywl18xx]
“DisplayName”=“PHYTECWL1835”
“Group”=“NDIS”
“ImagePath”=“phywl18xx.dll”

[HKEY_LOCAL_MACHINE\Comm\phywl18xx\Linkage]
“Route”=multi_sz:“phywl18xx1”

[HKEY_LOCAL_MACHINE\Comm\phywl18xx1]
“DisplayName”=“PHYTECWL1835 miniport driver”
“Group”=“NDIS”
“ImagePath”=“phywl18xx.dll”

[HKEY_LOCAL_MACHINE\comm\phywl18xx1\Parms]
“BusNumber”=dword:0
“BusType”=dword:0
;“RebindOnResume”=dword:0
;“*IfType”=dword:1 ; for IF_TYPE_OTHER
;“*MediaType”=dword:0 ; for NdisMedium802_3 0
;“*PhysicalMediaType”=dword:0 ; for NdisPhysicalMediumUnspecified 0
;“*NdisDeviceType”=dword:1 ; for NDIS_DEVICE_TYPE_ENDPOINT 0x00000001
;;[HKEY_LOCAL_MACHINE\comm\phywl18xx\Linkage]
;;“Route”=multi_sz:“phywl18xx”

[HKEY_LOCAL_MACHINE\Comm\phywl18xx1\Parms\TcpIp]
;“EnableWINS”=dword:1
“EnableDHCP”=dword:1

xxxxx@gmail.com wrote:

As, i was not using PHYMiniChar.CancelOidRequestHandler = phytec_CancelOidRequest; in the structure entry and without using this case I am getting a NDIS_STATUS_BAD_CHARACTERISTICS error…

Yes, because the documentation shows that entry point is required.

Now, this is all still just a fake driver, right? I hope you understand
that you can only get so far with a fake driver. Sooner or later, the
system is going to ask your driver to function, and when it can’t
function, it will cause problems. The CE kernel is not as robust about
error checking as the NT kernel, so conditions that might have been
caught in NT can explode in CE.

but after adding this entry I am getting a data ebort error as shown below : -

7915 PID:400002 TID:9e0006 OSAXST1: >>> Loading Module ‘phywl18xx.dll’ (0x9E431F64) at address 0xA7FF0000-0xA7FF5000 in Process ‘NK.EXE’ (0x87D7FAD0)
PB Debugger Loaded symbols for ‘C:\WINCE700\OSDESIGN\PHYTEC_OPENBOARD\PHYTEC_OPENBOARD\RELDIR\PHYTEC_AM335X_BSP_ARMV7_DEBUG\PHYWL18XX.DLL’
7924 PID:400002 TID:9e0006 +NDIS Driver Entry Point…
7925 PID:400002 TID:9e0006 +NDIS DriverEntry: Driver Object & RegistryPath is (0x9E431F64, 0x1)

7929 PID:400002 TID:9e0006 Exception ‘Data Abort’ (0x4): Thread-Id=009e0006(pth=9e4074c4), Proc-Id=00400002(pprc=87d7fad0) ‘NK.EXE’, VM-active=0044003a(pprc=9e418d84) ‘udevice.exe’
7929 PID:400002 TID:9e0006 PC=ef23b060(ndis.dll+0x0009b060) RA=ef28d3fc(ndis.dll+0x000ed3fc) SP=a763e43c, BVA=00000001
7932 PID:400002 TID:9e0006 OSAXST1: <<< Unloading Module ‘phywl18xx.dll’ (0x9E431F64) at address 0xA7FF0000-0xA7FF5000 in Process ‘NK.EXE’ (0x87D7FAD0)

“Data Abort” in the ARM world means you referenced an invalid address.
In this case, the bad address is 00000001. I can’t help but notice
that’s the value you have shown for the RegistryPath, which I do not
understand. Others have said that it’s not unusual to have a NULL value
for the RegistryPath in CE, but 1 doesn’t make any sense. As an
experiment, you might try passing NULL to NdisMRegisterMiniportDriver
instead of the registry path, but that’s only a hack.

And you are saying to debug the driver. I am building the driver in debug mode only. Can tell me brief that what thing i can do to debug it in debug mode.

Surely you must have experience in using a debugger, where you set a
breakpoint at the start of your own code, then step through it line by
line, watching the registers and the memory values change. That’s what
I mean. You can move into the operating system code and step through
the assembly code. You need to have a basic understand of ARM assembler
if you are going to be writing and debugging drivers on ARM systems.

You must already have PowerBuilder configured to talk to the kernel
debugger, otherwise you wouldn’t be seeing those traces.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Dear Developers,
Greetings!!!

Hi Tim,
I was doing the same thing for debugging the driver. I can see the change in the values.

Details are below : -

S.No DriverObject RegistryPath Assemblycommand

  1. mov r12 sp
    0xefe812d8 0x9e432c4c 0xa763e564 0xa763e564

  2. push r0 r1
    0xefe812d8 0x9e432c4c 0x9e432c4c 0x00000001

  3. push r12 lr
    0x763e1c0 0xa763e590 0x763e564 0xefe81088

  4. sub sp, sp, #0x18

Hi,
Here r1 is culprit that is giving 0x00000001 as registrypath