How to port NDIS 6.2 to NDIS 6.3 using NDIS_SUPPORT_NDIS630?

I have NDIS 6.2 Supporting Miniport Driver . Now I want to port NDIS 6.2 to NDIS 6.3 .

https://msdn.microsoft.com/en-us/library/windows/hardware/dn232191(v=vs.85).aspx

Using this link I changed some general requirements and Power Management for Enhancements in NDIS 6.30 .

i put all changes are in same NDIS 6.2 file .

The changes are (miniport.cpp)

*********************************

ndisMiniportDriverCharacteristics.MajorNdisVersion = 6;
ndisMiniportDriverCharacteristics.MinorNdisVersion = 30;

ndisMiniportDriverCharacteristics.MajorDriverVersion = VERSION_MAJOR_NUM;
ndisMiniportDriverCharacteristics.MinorDriverVersion = VERSION_MINOR_NUM;

ndisMiniportDriverCharacteristics.SetOptionsHandler = CMiniport::SetOptions;
ndisMiniportDriverCharacteristics.InitializeHandlerEx = CMiniport::InitializeEx;

**********************************

then inside InitializeEx() funcion the changes for NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES are :

**********************************************

NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES ndisMiniportAdapterRegistrationAttributes;
NdisZeroMemory(&ndisMiniportAdapterRegistrationAttributes, sizeof(NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES));

#if (NDIS_SUPPORT_NDIS630)

C_ASSERT(sizeof(NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES) >= NDIS_SIZEOF_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_2);
ndisMiniportAdapterRegistrationAttributes.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES;
ndisMiniportAdapterRegistrationAttributes.Header.Size = NDIS_SIZEOF_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_2;
ndisMiniportAdapterRegistrationAttributes.Header.Revision = NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_2;

#else

C_ASSERT(sizeof(NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES) >= NDIS_SIZEOF_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_1);
ndisMiniportAdapterRegistrationAttributes.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES;
ndisMiniportAdapterRegistrationAttributes.Header.Size = NDIS_SIZEOF_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_1;
ndisMiniportAdapterRegistrationAttributes.Header.Revision = NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_1;

#endif // NDIS MINIPORT VERSION

ndisMiniportAdapterRegistrationAttributes.MiniportAdapterContext = CMiniport::m_pMiniport;

#if (NDIS_SUPPORT_NDIS630)

ndisMiniportAdapterRegistrationAttributes.AttributeFlags |= NDIS_MINIPORT_ATTRIBUTES_NO_PAUSE_ON_SUSPEND;

#else

ndisMiniportAdapterRegistrationAttributes.AttributeFlags = NDIS_MINIPORT_ATTRIBUTES_SURPRISE_REMOVE_OK | NDIS_MINIPORT_ATTRIBUTES_NDIS_WDM;

#endif

ndisMiniportAdapterRegistrationAttributes.CheckForHangTimeInSeconds = 5;

**********************************

and for the change NDIS_PM_CAPABILITIES i wrote like this :

********************************

NDIS_PM_CAPABILITIES ndisPmCapabilities;
NdisZeroMemory(&ndisPmCapabilities, sizeof(NDIS_PM_CAPABILITIES));

#if (NDIS_SUPPORT_NDIS630)

C_ASSERT(sizeof(NDIS_PM_CAPABILITIES) >= NDIS_SIZEOF_NDIS_PM_CAPABILITIES_REVISION_2);
ndisPmCapabilities.Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
ndisPmCapabilities.Header.Size = NDIS_SIZEOF_NDIS_PM_CAPABILITIES_REVISION_2;
ndisPmCapabilities.Header.Revision = NDIS_PM_CAPABILITIES_REVISION_2;

ndisPmCapabilities.MinMagicPacketWakeUp = NdisDeviceStateUnspecified;
ndisPmCapabilities.MinPatternWakeUp = NdisDeviceStateUnspecified;
ndisPmCapabilities.MinLinkChangeWakeUp = NdisDeviceStateUnspecified;

#else

C_ASSERT(sizeof(NDIS_PM_CAPABILITIES) >= NDIS_SIZEOF_NDIS_PM_CAPABILITIES_REVISION_1);
ndisPmCapabilities.Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
ndisPmCapabilities.Header.Size = NDIS_SIZEOF_NDIS_PM_CAPABILITIES_REVISION_1;
ndisPmCapabilities.Header.Revision = NDIS_PM_CAPABILITIES_REVISION_1;

ndisPmCapabilities.MinMagicPacketWakeUp = NdisDeviceStateUnspecified;
ndisPmCapabilities.MinPatternWakeUp = NdisDeviceStateUnspecified;
ndisPmCapabilities.MinLinkChangeWakeUp = NdisDeviceStateUnspecified;

#endif // NDIS MINIPORT VERSION

**********************************************

So my doubts are :

can i use this NDIS 6.30 for windows 7 NDIS 6.2 ?
how to activate NDIS_SUPPORT_NDIS630 macro ?

in ndis.h WDK file the macros are like this :

****************************
#if !defined(NDIS_SUPPORT_NDIS630)
#if (((defined (NDIS_MINIPORT_MAJOR_VERSION) && (NDIS_MINIPORT_MAJOR_VERSION >= 6)) && \
(defined (NDIS_MINIPORT_MINOR_VERSION) && (NDIS_MINIPORT_MINOR_VERSION >= 30))) || \
(defined (NDIS630)) || NDIS_WRAPPER)
#define NDIS_SUPPORT_NDIS630 1
#else
#define NDIS_SUPPORT_NDIS630 0
#endif
#endif // !defined(NDIS_SUPPORT_NDIS630)

*************************************

but when i use

ndisPmCapabilities.Header.Revision = NDIS_PM_CAPABILITIES_REVISION_2; directly i got error like NDIS_PM_CAPABILITIES_REVISION_2 is not defined .

How to use this NDIS_SUPPORT_NDIS630 macro ?

xxxxx@gmail.com wrote:

I have NDIS 6.2 Supporting Miniport Driver . Now I want to port NDIS 6.2 to NDIS 6.3 .

Using this link I changed some general requirements and Power Management for Enhancements in NDIS 6.30 .

You were doing Windows CE before. Is that no longer true? CE doesn’t
do 6.30.

can i use this NDIS 6.30 for windows 7 NDIS 6.2 ?
how to activate NDIS_SUPPORT_NDIS630 macro ?

in ndis.h WDK file the macros are like this :

****************************
#if !defined(NDIS_SUPPORT_NDIS630)
#if (((defined (NDIS_MINIPORT_MAJOR_VERSION) && (NDIS_MINIPORT_MAJOR_VERSION >= 6)) && \
(defined (NDIS_MINIPORT_MINOR_VERSION) && (NDIS_MINIPORT_MINOR_VERSION >= 30))) || \
(defined (NDIS630)) || NDIS_WRAPPER)
#define NDIS_SUPPORT_NDIS630 1
#else
#define NDIS_SUPPORT_NDIS630 0
#endif
#endif // !defined(NDIS_SUPPORT_NDIS630)

*************************************

And are you #defining NDIS_MINIPORT_MINOR_VERSION to 30 somewhere? That
is the key to turning on the 6.30 support in the include files. It can
be done in your vcxproj properties, or in your source, as long as you do
it before you #include <ndis.h>.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.</ndis.h>

ok . thanks . But when i build i got error like this :
" NDIS: Wrong NDIS or DDI version specified " in .vcxproj file .

i change all

NDIS620_MINIPORT=1 to NDIS630_MINIPORT=1

and i want to know how the system know whether i am selecting Windows 7 or windows 8 . because i think the error due to this os problems .

when i use NDIS 6.2 , i think it take windows 7 but now i want to get Windows 8 as os . How to get this ?

in ndis.h file :

//
// Make sure the target platform is consistent with miniport version
//
#if (NDIS_MINIPORT_MINIMUM_MAJOR_VERSION == 6) && \
((NDIS_MINIPORT_MINIMUM_MINOR_VERSION == 40 && NTDDI_VERSION < NTDDI_WIN8) || \
(NDIS_MINIPORT_MINIMUM_MINOR_VERSION == 30 && NTDDI_VERSION < NTDDI_WIN8) || \
(NDIS_MINIPORT_MINIMUM_MINOR_VERSION == 20 && NTDDI_VERSION < NTDDI_WIN7) || \
(NDIS_MINIPORT_MINIMUM_MINOR_VERSION == 1 && NTDDI_VERSION < NTDDI_VISTA) || \
(NDIS_MINIPORT_MINIMUM_MINOR_VERSION == 0 && NTDDI_VERSION < NTDDI_VISTA))
#error NDIS: Wrong NDIS or DDI version specified
#elif ((NDIS_MINIPORT_MINIMUM_MAJOR_VERSION == 5) && \
(((NDIS_MINIPORT_MINIMUM_MINOR_VERSION == 1) && (NTDDI_VERSION < NTDDI_WINXP)) || \
((NDIS_MINIPORT_MINIMUM_MINOR_VERSION == 0) && (NTDDI_VERSION < NTDDI_WIN2K))))
#error NDIS: Wrong NDIS or DDI version specified
#endif

#endif // NDIS_MINIPORT_DRIVER

and in my code :

.vcxproj file :

i change all

NDIS620_MINIPORT=1 to NDIS630_MINIPORT=1

like :



NDIS_MINIPORT_DRIVER=1;NDIS630_MINIPORT=1;NDIS_WDM=1;%(PreprocessorDefinitions)



runtime.lib;wdmsec.lib;rtlver.lib;ndis.lib;%(AdditionalDependencies)




NDIS_MINIPORT_DRIVER=1;NDIS630_MINIPORT=1;NDIS_WDM=1;%(PreprocessorDefinitions)



runtime.lib;wdmsec.lib;rtlver.lib;ndis.lib;%(AdditionalDependencies)

Ok it solved . But after changing NDIS 6.2 to NDIS 6.3 and when i installed NDIS 6.3 on windows 7 , i got error like :

using debugview :

DriverEntry(): NdisMRegisterMiniportDriver() failed, status C0010004

C0010004 means

#define NDIS_STATUS_BAD_VERSION ((NDIS_STATUS)0xC0010004L)

why ?

xxxxx@gmail.com wrote:

Ok it solved . But after changing NDIS 6.2 to NDIS 6.3 and when i installed NDIS 6.3 on windows 7 , i got error like :

#define NDIS_STATUS_BAD_VERSION ((NDIS_STATUS)0xC0010004L)

why ?

Why did you expect it to work? NDIS 6.30 requires Windows 8. You
showed us the code yesterday that enforces that in the include files.


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

Because i got Blue screen crash when i use NDIS 6.2 driver on windows 8 . So after debugging the dump file , i got Ntoskrnl.exe error . I think it may due to power failure . So that’s why i use NDIS 6.3 for windows 8 , windows 8.1 .