C28159

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

For the latest documentation on Visual Studio 2017, see C28159 on docs.microsoft.com. 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);  

Show: