Dear All,
I have two Unicode strings named linkFileName and linkFullFileName. I have
to convert an integer to Unicode string (linkFileName), and then append that
Unicode string to the other Unicode String, linkFullFileName.
I have been able to convert the integer to Unicode string but when I append
this Unicode string to other Unicode string, it doesn’t works and the system
crashes with Stop Code:
KMODE_EXCEPTION_NOT_HANDLED 0x1E having first parameter as 0xC0000005
For that I have written following code:
////////////////////////////////////////////////////////////////////////////
////////////////
int dummy;
UNICODE_STRING temp;
UNICODE_STRING linkFileName;
UNICODE_STRING linkFullFileName;
linkFileName.MaximumLength = 30;
linkFileName.Buffer = ExAllocatePoolWithTag(NonPagedPool,
linkFileName.MaximumLength,‘2leM’);
linkFullFileName.MaximumLength = 50 ;
linkFullFileName.Buffer = ExAllocatePoolWithTag(NonPagedPool,
linkFullFileName.MaximumLength,‘2leM’);
LINE1) dummy = 7; // Initialize value of dummy of integer type
LINE2) _itow(dummy,linkFileName.Buffer, 10); // placing it into
linkFileName.Buffer
LINE3) RtlInitUnicodeString(&temp,L"BOND00"); //temp is initialized to BOND
LINE4) RtlCopyUnicodeString(&linkFullFileName, &temp);
LINE5) RtlAppendUnicodeStringToString(&linkFullFileName, &linkFileName); //
NOT WORKING ,Why??
LINE6) DbgPrint(“\n #NEW CODE linkFileName = %wZ”,&linkFileName); //
Result > #NEW CODE linkFileName = 7
LINE7) DbgPrint(“\n #NEW CODE linkFullFileName = %wZ”,&linkFullFileName);
//NOT WORKING FINE
// Result > #NEW CODE linkFullFileName = BOND00
//Where as it should print “BOND007”
ExFreePoolWithTag(linkFileName.Buffer,‘pmoC’);
ExFreePoolWithTag(linkFullFileName.Buffer,‘pmoC’);
////////////////////////////////////////////////////////////////////////////
////////////////
Please suggest a way out to solve this problem or any alternate way to
achieve the same.
Regards,
Rohit