The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at C28159.

warning C28159: Consider using another function instead.

This warning is reported for Drivers is suggesting that you use a preferred function call that is semantically equivalent to the function that the driver is calling. This is a general warning message; the annotation __drv_preferredFunction was used (possibly with a conditional a __drv_when() annotation) to flag a bad coding practice.

The following code example generates this warning:

char buff[MAX_PATH];  
OemToChar(buff, input);  
    // if strlen(input) > MAX_PATH  
....// leads to buffer overrun  

The following code example avoids this warning:

char buff[MAX_PATH];  
OemToCharBuff(buff, input, MAX_PATH);