Hello all,
I have a problem using RtlStringCbPrintfA when using dynamic allocation. Here is my example :
PCHAR buffer;
NTSTATUS ntStatus;
buffer = (PCHAR)ExAllocatePoolWithtag(NonPagedPool, 100, ‘0uel’);
ntStatus = RtlStringCbPrintfA(buffer, 100, “hello there %s”, string);
if (NT_SUCCESS(ntStatus))
{
ntStatus = ZwWriteFile(hFile, NULL, NULL, NULL, &ioStatusBlock, buffer, 100, NULL, NULL);
}
It seems to not work when using dynamic allocation. But when I declare the buffer staticaly as buffer[512] for example, it works. I think it’s the problem when passing from CHAR to PCHAR in the example.
What do you think ?
Thank you in advance.