Share via


C28159

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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.

Example

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);