On 10/23/2014 21:07, Shuai Meng wrote:
Thanks for commenting.

2014-10-21 0:20 GMT+08:00 Nikolay Sivov <bunglehead@gmail.com>:
On 10/20/2014 19:58, Shuai Meng wrote:
Thank you very much for commenting on this patch.

2014-10-20 0:06 GMT+08:00 Nikolay Sivov <bunglehead@gmail.com>:
+    str = SysAllocStringLen(NULL, 1023);
+    newstr = SysAllocStringLen(NULL, 1023);
Where this length comes from?
Well, I tested String on windows xp, and found that 1023 was the limit, when given a number bigger than that, the output kept the length of 1023.
Can you add this too as a test? In some compact way if possible.
I tried again and I found that maybe you were right. The number of 1023 was got like this: I wrote vbscript with a common text editor on xp, and save it as xx.vbs, then double clicked it. I used this method and found that MsgBox String(1024, 65) only printed "a...(the length is 1023)....a".
Tragedy is today I write MsgBox Len(String(1024, 65)), and it prints 1024! It's the same with the other numbers greater than 1023!   So I  was cheated yesterday. The true limit may be 32768 * 16384 * 1.25, but I am not sure. I need to know the exact limit of the length of the string subtype, however experiments show difference with the documents of microsoft which claims the limit is about 2 billion.
In that case we don't care about exact limit if any. Just allocate what's requested and fail with proper error code if allocation failed.