Question

I am trying to use RtlStringCbPrintf with Winsock Kernel. I have included Ntstrsafe.h but the compiler gives me the error

Error 4 error C3861: 'RtlStringCbPrintf': identifier not found  c:\bw\epic_sl\musslcomm\musslcomm\commmessenger\socketx.h   124 1   CommMessenger

If I use RtlStringCbPrintfA or RtlStringCbPrintfW then it does compile. Why can't I use the generic version? Looking in Ntstrsafe.h I see prototype declarations of RtlStringCbPrintfA and RtlStringCbPrintfW but no declaration for RtlStringCbPrintf although the comments refer to it. Why can't I use the generic form so that my Character Set property selects which version to use? My Character Set property is set to Use Multi-Byte Character Set

Was it helpful?

Solution

Because windows does not provide RtlStringCbPrintf define for this two functions. From msdn:

Use RtlStringCbPrintfW to handle Unicode strings and RtlStringCbPrintfA to handle ANSI strings. The form you use depends on your data..

The example from msdn use RtlStringCbPrintfW() function, not RtlStringCbPrintf().

You can define RtlStringCbPrintf() yourself:

#if defined(UNICODE)
# define RtlStringCbPrintf RtlStringCbPrintfA
#else
# define RtlStringCbPrintf RtlStringCbPrintfW
#endif
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top