본문 바로가기

Windows Driver/NDIS

[NDISWDM] NDIS 버전 설정

Sources파일을 열어 보면 아래와 같이 TARGET OS 에 따라서 

NDIS 5.0 또는  NDIS 5.1로 컴파일 되도록 되어있으며, 각 Compile Flags는 아래의 링크를 참고하도록 한다.

NDIS Driver Compile Flags - March 15, 2004 


!if !defined(DDK_TARGET_OS) || "$(DDK_TARGET_OS)"=="Win2K"
#
# The driver is built in the Win2K build environment
#
C_DEFINES=$(C_DEFINES) -DNDIS50_MINIPORT=1 
!else 
#
# The driver is built in the XP or .NET build environment
# So let us build NDIS 5.1 version.
#
C_DEFINES=$(C_DEFINES) -DNDIS51_MINIPORT=1  
!endif


또한 위에서 추가된 Flag에 따라

ndiswdm.h에서는 아래의 내용이 적용된다.


#if defined(NDIS50_MINIPORT)
    #define MP_NDIS_MAJOR_VERSION       5
    #define MP_NDIS_MINOR_VERSION       0
#elif defined(NDIS51_MINIPORT)
    #define MP_NDIS_MAJOR_VERSION       5
    #define MP_NDIS_MINOR_VERSION       1
#else
    #error Unsupported NDIS version
#endif




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

NDIS drivers use the compile flags described in this section to direct NDIS to conditionally include a set of commands at compile time. The following compile flags can be enabled in the driver's sources file or embedded at the start of the driver's source code before the ndis.hheader file is included:

BINARY_COMPATIBLE

Compiles a binary of an NDIS driver that can run on Windows 98/Me platforms and NT-based platforms.

NDIS_WDM

Directs NDIS to include the appropriate WDM header file.

USE_KLOCKS

Directs spin locks of NDIS drivers built for Windows 98/Me platforms to operate; otherwise, these spin locks do not operate.

WIRELESS_WAN

Directs NDIS to include a set of commands related to a wireless wide area network (WAN). This flag is obsolete for Windows 2000 and later.

Although NDIS_WRAPPER is a compile flag, NDIS drivers must not use it.

If a compile flag is included in the driver's sources file, it is preceded with "-D". To enable a compile flag, you must assign it a nonzero value. The following statement shows how to enable the NDIS_WDM compile flag in a sources file:

C_DEFINES=$(C_DEFINES) -DNDIS_WDM=1

The following code shows how to enable the NDIS_WDM compile flag in a driver's source code:

#define NDIS_WDM 1