Share via


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.

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