In the process of writing a simple minifilter driver, I can't seem to figure out how to do this. Admittedly, I have extremely limited experience with C/C++ (although I have a decade's worth of other languages). The following works in a C project:
Code:
PUNICODE_STRING _d;
_d = malloc(sizeof(UNICODE_STRING));
NTSTATUS _d_status = RtlUnicodeStringInit(_d, d);
// Check status...
// Where _c is an existing PUNICODE_STRING
NTSTATUS _c_d_status = RtlStringCbCatA(_c, sizeof(_c), _d);
// Check status...
printf("_c_d: %wZ\r\n", _c);
When done in a KMDF project, I use ExAllocatePool2 instead. Fails on the first RtlUnicodeStringInit with 0xc0000005.