Module: Windows::Handle

Defined in:
lib/windows/handle.rb

Constant Summary collapse

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')
GetOSFHandle =
Win32API.new('msvcrt', '_get_osfhandle', 'I', 'L')
OpenOSFHandle =
Win32API.new('msvcrt', '_open_osfhandle', 'LI', 'I')

Instance Method Summary collapse

Instance Method Details

#CloseHandle(handle) ⇒ Object



18
19
20
# File 'lib/windows/handle.rb', line 18

def CloseHandle(handle)
   CloseHandle.call(handle) != 0
end

#DuplicateHandle(sphandle, shandle, thandle, access, ihandle, opts) ⇒ Object



22
23
24
# File 'lib/windows/handle.rb', line 22

def DuplicateHandle(sphandle, shandle, thandle, access, ihandle, opts)
   DuplicateHandle.call(sphandle, shandle, thandle, access, ihandle, opts) != 0
end

#get_osfhandle(fd) ⇒ Object



34
35
36
# File 'lib/windows/handle.rb', line 34

def get_osfhandle(fd)
   GetOSFHandle.call(fd)
end

#GetHandleInformation(handle, flags) ⇒ Object



26
27
28
# File 'lib/windows/handle.rb', line 26

def GetHandleInformation(handle, flags)
   GetHandleInformation.call(handle, flags) != 0
end

#open_osfhandle(handle, flags) ⇒ Object



38
39
40
# File 'lib/windows/handle.rb', line 38

def open_osfhandle(handle, flags)
   OpenOSFHandle.call(handle, flags)
end

#SetHandleInformation(handle, mask, flags) ⇒ Object



30
31
32
# File 'lib/windows/handle.rb', line 30

def SetHandleInformation(handle, mask, flags)
   SetHandleInformation.call(handle, mask, flags) != 0
end