[Win32utils-devel] Fwd: win32-clipboard and Unicode zero bytes

Daniel Berger djberg96 at gmail.com
Thu Feb 2 19:28:59 EST 2006


Berger, Daniel wrote:

>>-----Original Message-----
>>From: win32utils-devel-bounces at rubyforge.org 
>>[mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of 
>>Park Heesob
>>Sent: Thursday, February 02, 2006 5:07 AM
>>To: Development and ideas for win32utils projects
>>Subject: Re: [Win32utils-devel] Fwd: win32-clipboard and 
>>Unicode zero bytes
>>    
>>
>
><snip>
>
>  
>
>>Here is some patches of clipboard.c
>>
>>Line 70:
>>   hMem = GlobalAlloc(GHND, strlen(data) + sizeof(TCHAR*));
>>to
>>   hMem = GlobalAlloc(GHND, RSTRING(rbData)->len + sizeof(TCHAR*));
>>
>>Line 75:
>>   strcpy((TCHAR *)GlobalLock(hMem), data);
>>to
>>   memcpy((TCHAR *)GlobalLock(hMem), data, RSTRING(rbData)->len);
>>
>>HTH,
>>
>>Park Heesob
>>    
>>
>
>Works great, thanks!  Please commit.
>
>Dan
>
>_______________________________________________
>win32utils-devel mailing list
>win32utils-devel at rubyforge.org
>http://rubyforge.org/mailman/listinfo/win32utils-devel
>
>  
>
Nevermind, I'll commit it now and put out a new release shortly.

Here's a question for everyone, though - in the age of Unicode, is 
strcpy obsolete?  Should we always use memcpy?

Dan


More information about the win32utils-devel mailing list