Share via


DEPRECATE_DDK_FUNCTIONS

Use the DEPRECATE_DDK_FUNCTIONS environment variable to enable the Deprecated Function Checking feature in the build environment. This feature is available in build environments for Windows Server 2003 and later versions of Windows. The DEPRECATE_DDK_FUNCTIONS environment variable is set by default in the Windows Vista and Windows 7 checked build environments of the Windows Driver Kit (WDK) for Windows Vista and later versions of Windows.

When Deprecated Function Checking is enabled, the compiler displays a warning message when it encounters a call to a function or macro that has the DECLSPEC_DEPRECATED_DDK annotation in the function declaration. The warning also provides information to help you find a suitable replacement for the function call.

Typically, functions that are declared to be deprecated are obsolete in a build environment and have been replaced by another function or a preferred method. Some are no longer supported or only supported under limited conditions. Calls to unsupported function have undetermined results.

The deprecated functions that the Deprecated Function Checking feature detects are only a subset of the functions that have been declared as obsolete. For a more complete list, search for the term "obsolete" in the WDK documentation.

Deprecated Function Warning

When the compiler identifies a call to a function that is deprecated in that build environment, it generates a warning message that has the following format:

DriverFile(LineNumber) : error ErrorNumber: 'FunctionName' was declared deprecated

HeaderFile(LineNumber) : error see declaration of 'FunctionName'

The first statement in a deprecated function warning identifies the source file and line number on which the deprecated function appears in the driver. The second statement identifies the source file and line number on which the deprecated function appears in the specified header file.

For example:

\test\mydriver.c(1785) : error C4996: 'RtlExtendedIntegerMultiply' was declared deprecated

winddk\WinXP\inc\ddk\wxp\ntddk.h(3106) : error see declaration of 'RtlExtendedntegerMultiply'

Replacing Deprecated Functions

To find a replacement for a call to a deprecated function, refer to the header file and line number that is specified in the warning message.

For example, if you search for RtlExtendedIntegerMultiple on line 3106 of Ntddk.h, you will find the following entry, which begins with the DECLSPEC_DEPRECATED_DDK annotation. This entry suggests that you use the native 64-bit integer operations that are built into the compiler, instead of a call to RtlExtendedIntegerMultiple.

DECLSPEC_DEPRECATED_DDK          // Use native __int64 math
        NTSYSAPI
        LARGE_INTEGER
        NTAPI
        RtlExtendedIntegerMultiply 
                LARGE_INTEGER Multiplicand,
                LONG Multiplier
                );

You can also search for the name of the deprecated function in the WDK documentation. The documentation lists the name of the deprecated function and suggests replacements.

 

 

Send comments about this topic to Microsoft

Build date: 5/3/2011