class DontHideCursor
PAGE_EXECUTE_READWRITE = 0x40
def initialize
@getModuleHandle=Win32API.new('kernel32.dll','GetModuleHandleA','p','i')
@getProcAddress=Win32API.new('kernel32.dll','GetProcAddress','ip','i')
@virtualProtect=Win32API.new('kernel32.dll','VirtualProtect','iiip','i')
@memcpy=Win32API.new('kernel32.dll','RtlMoveMemory','ipi','v')
end
def InstallHook
hMod = @getModuleHandle.call('user32.dll')
@FuncAddr = @getProcAddress.call(hMod,'SetCursor')
unless @FuncAddr == 0
oldProtect = "\000" * 4
if @virtualProtect.call(@FuncAddr,5,PAGE_EXECUTE_READWRITE,oldProtect) != 0
@memcpy.call(@FuncAddr,"\xC2\x04\x00",3)
@virtualProtect.call(@FuncAddr,5,oldProtect.unpack('I')[0],nil)
end
end
end
end
DontHideCursor.new.InstallHook
class DontHideCursor
PAGE_EXECUTE_READWRITE = 0x40
def initialize
@getModuleHandle=Win32API.new('kernel32.dll','GetModuleHandleA','p','i')
@getProcAddress=Win32API.new('kernel32.dll','GetProcAddress','ip','i')
@virtualProtect=Win32API.new('kernel32.dll','VirtualProtect','iiip','i')
@memcpy=Win32API.new('kernel32.dll','RtlMoveMemory','ipi','v')
end
def InstallHook
hMod = @getModuleHandle.call('user32.dll')
@FuncAddr = @getProcAddress.call(hMod,'SetCursor')
unless @FuncAddr == 0
oldProtect = "\000" * 4
if @virtualProtect.call(@FuncAddr,5,PAGE_EXECUTE_READWRITE,oldProtect) != 0
@memcpy.call(@FuncAddr,"\xC2\x04\x00",3)
@virtualProtect.call(@FuncAddr,5,oldProtect.unpack('I')[0],nil)
end
end
end
end
DontHideCursor.new.InstallHook