카테고리 없음

[kernel] IoIsWdmVersionAvailable함수

WeZZ 2008. 10. 15. 01:36


 

IoIsWdmVersionAvailable

The IoIsWdmVersionAvailable routine checks whether a given WDM version is supported by the operating system.

BOOLEAN
  IoIsWdmVersionAvailable(
    IN UCHAR  MajorVersion,
    IN UCHAR  MinorVersion
    );

Parameters

MajorVersion
Specifies the major version number of WDM that is requested.
MinorVersion
Specifies the minor version number of WDM that is requested.

Return Value

IoIsWdmVersionAvailable returns TRUE if the version of WDM that the operating system provides is greater than or equal to the version number of WDM being requested.

Comments

Drivers should use the RtlIsNtDdiVersionAvailable function instead of the IoIsWdmVersionAvailable function.

Cross-platform drivers should use this routine to check the WDM version before performing any operations that vary by platform or are not supported in all versions of WDM.

The constants WDM_MAJORVERSION and WDM_MINORVERSION are defined in wdm.h. The following lists the WDM version provided with each operating system.

Operating system WDM major version WDM minor version
Windows Vista 6 0x00
Windows Server 2003 1 0x30
Windows XP 1 0x20
Windows 2000 1 0x10
Windows Me 1 0x05
Windows 98 1 0x00

Note that the minor version number is defined as a hexadecimal value.

Later versions of WDM support all the features available in earlier versions of WDM; that is, each version of WDM is a superset of the previous WDM version.

The following call returns TRUE on any of the listed operating systems, because all these systems support all the features of WDM 1.0:

bVersion = IoIsWdmVersionAvailable(1,0);

The following example shows how a driver can dynamically detect the current operating system:

if (IoIsWdmVersionAvailable(1, 0x10)) {
    //
    //If WDM 1.10 is supported, this is Windows 2000
    //or better.
    //
} else if (IoIsWdmVersionAvailable(1, 5)) {
    //
    //If WDM 1.05 is supported, this is Windows ME
    //or better.
    //
} else {
    //
    //WDM 1.0 is always supported, so this is Windows 98, 
    //Windows 98 SE, or better.
    //
}

As the example shows, calling IoIsWdmVersionAvailable(1, 5) returns TRUE on Windows Me, Windows 2000, and any succeeding operating systems, but FALSE on Windows 98 and Windows 98 SE.

Requirements

IRQL: PASSIVE_LEVEL

Headers: Declared in wdm.h. Include wdm.h, ntddk.h, or ntifs.h.


위의 DDK의 설명과 같이 윈도우즈의 버전을 구하기 위해 사용된다..
예로 만들 자면..


// define 선언 부분..
#define OSVER_WIN98  10
#define OSVER_WINME  11
#define OSVER_WIN2K  12
#define OSVER_WINXP  13
#define OSVER_WIN2K3 14
#define OSVER_VISTA  15
 

ULONG GetWindowsVersion()
{
    if( IoIsWdmVersionAvailable( 6, 0x00 ) ) return OSVER_VISTA;
    if( IoIsWdmVersionAvailable( 1, 0x30 ) ) return OSVER_WIN2K3; 
    if( IoIsWdmVersionAvailable( 1, 0x20 ) ) return OSVER_WINXP;
    if( IoIsWdmVersionAvailable( 1, 0x10 ) ) return OSVER_WIN2K;
    if( IoIsWdmVersionAvailable( 1, 0x05 ) ) return OSVER_WINME; 
    if( IoIsWdmVersionAvailable( 1, 0x00 ) ) return OSVER_WIN98;

    return FALSE;
}



호완성을 위해.. 혹은 Os별.. .DDK 함수들이 다르니 꼭 Entry에서 확인 후 실행하는 것이 좋을듯...