Skip to content

Commit

Permalink
windows.rb: can call win32api using nil as NULL for pointer argument
Browse files Browse the repository at this point in the history
Exception occurred when interrupted with Ctrl+C on legacy conhost
  • Loading branch information
YO4 committed Oct 31, 2024
1 parent 235367d commit 93a23bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/reline/io/windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def initialize(dllname, func, import, export = "0", calltype = :stdcall)
def call(*args)
import = @proto.split("")
args.each_with_index do |x, i|
args[i], = [x == 0 ? nil : +x].pack("p").unpack(POINTER_TYPE) if import[i] == "S"
args[i], = [x == 0 ? nil : x&.+@].pack("p").unpack(POINTER_TYPE) if import[i] == "S"
args[i], = [x].pack("I").unpack("i") if import[i] == "I"
end
ret, = @func.call(*args)
Expand Down

0 comments on commit 93a23bc

Please sign in to comment.