janlelis/clipboard

FFI::NullPointerError on Win10

Inversion-des opened this issue · 3 comments

Just tried to do this
Clipboard.copy '1111'

and it always fails with an exception:

…/gems/clipboard-1.3.5/lib/clipboard/windows.rb:76:in `put_bytes': invalid memory write at address=0x0000000000000000 (FFI::NullPointerError)
        from …/gems/3.0.0/gems/clipboard-1.3.5/lib/clipboard/windows.rb:76:in `copy'
        from …/gems/3.0.0/gems/clipboard-1.3.5/lib/clipboard.rb:62:in `copy'

Ruby: ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x64-mingw32]
gems:

fiddle - v1.0.6 (ruby)
clipboard - v1.3.5 (ruby)
open3 - v0.1.1 (ruby)
ffi - v1.15.3 (x64-mingw32)

Is it only for me or there is some problem?

Hi there, it's probably not just you. I'll take a look, but I am also pretty busy at the moment, so I don't know when...

If someone wants to tackle this, feel free!

Hi @janlelis,

I was able to correct the User32 Functions signatures.

Let me know if you are happy with the changes.

Cheers

Works for me. Thank you, @P3t3rU5
Probably issue will be closed when the PR accepted.