Sha256: 1c9bf78a46e1965dfa1af2d0efa081eb33b845581e9a8f4ec10f6740f36b2547

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

Contents

require 'Win32API'

module Windows
   module Handle
      INVALID_HANDLE_VALUE = -1
      
      HANDLE_FLAG_INHERIT            = 0x00000001
      HANDLE_FLAG_PROTECT_FROM_CLOSE = 0x00000002
      
      CloseHandle          = Win32API.new('kernel32', 'CloseHandle', 'L', 'I')
      DuplicateHandle      = Win32API.new('kernel32', 'DuplicateHandle', 'LLLLLIL', 'I')
      GetHandleInformation = Win32API.new('kernel32', 'GetHandleInformation', 'LL', 'I')
      SetHandleInformation = Win32API.new('kernel32', 'SetHandleInformation', 'LLL', 'I')
      
      def CloseHandle(handle)
         CloseHandle.call(handle) != 0
      end
      
      def DuplicateHandle(sphandle, shandle, thandle, access, ihandle, opts)
         DuplicateHandle.call(sphandle, shandle, thandle, access, ihandle, opts) != 0
      end
      
      def GetHandleInformation(handle, flags)
         GetHandleInformation.call(handle, flags) != 0
      end
      
      def SetHandleInformation(handle, mask, flags)
         SetHandleInformation.call(handle, mask, flags) != 0
      end 
   end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
IOWA-1.0.3 external/windows-pr/lib/windows/handle.rb
IOWA-1.0.2 external/windows-pr/lib/windows/handle.rb
IOWA-1.0.0 external/windows-pr/lib/windows/handle.rb
windows-pr-0.5.2-mswin32 lib/windows/handle.rb
windows-pr-0.5.3 lib/windows/handle.rb
windows-pr-0.6.0 lib/windows/handle.rb
windows-pr-0.5.4 lib/windows/handle.rb
windows-pr-0.5.5 lib/windows/handle.rb