views:

127

answers:

1

hello everyone,

I have 2 unicode strings which I like to concat.

everytime I try to concat using RtlAppendUnicodeStringToString it telling me "STATUS_BUFFER_TOO_SMALL", even though im increasing my destination unicodestring.length to big numbers.

what is the method to concat 2 unicode strings ? thanks

+2  A: 

I believe you should change MaximumLength, not Length of the destination buffer.

Michael
And of course, make sure MaximumLength is accurate by allocating enough memory.
Logan Capaldo
In other words, two bytes per char, not one...
Steven Sudit
UTF-16 can be 4 bytes per char.
Craig McQueen
UTF-8 can also use up to 4 bytes per character. According to the online docs, "RtlAppendUnicodeStringToString copies bytes from the source up to the length of the destination buffer. "So your worst case is (<Destination max character count> + <Source max character count>) * 4.And have you allocated the memory already or just declared the size?
DaveE