Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Re: Win32::Clipboard and Unicodeby John M. Dlugosz (Monsignor) |
on Apr 22, 2003 at 19:38 UTC ( [id://252344]=note: print w/replies, xml ) | Need Help?? |
I suppose doing a simple patch would be easier than trying to write a valid XS from scratch, especially since the interface doesn't change. Where can I find the source code for the current/latest version of Win32::Clipboard? (I have ActiveState Perl, which is a binary distribution. Their "source code" download AP806_source.zip doesn't contain any file named Clipboard.*) The MS API GetClipboardData provides no way to get the length of the data returned. Quite an unfortunate design. Hmm, it actually returns a HANDLE to a global memory block, which is as far as I can tell the only remaining use for such a thing. In Win32 HGLOBAL's have been replaced by normal memory pointers and the documentation mostly missing. Anyway, the Win32 function GlobalSize will return the length. Do that before copying via memcpy what GlobalLock returns, instead of using a strcpy. However, it also says, “The size of a memory block may be larger than the size requested when the memory was allocated.” so perhaps this shows the rounded-up capacity, not the requested size. If a function returned a pointer like you suggest, rather than copying it, how will Perl know to free it eventually? To find the bytes 00 00, why not use a regex instead of a eq substr? /.*?\0\0/ or somesuch. —John
In Section
Seekers of Perl Wisdom
|
|