win-ffi 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/win-ffi/enums/comdlg32/find_replace.rb +27 -27
- data/lib/win-ffi/enums/comdlg32/font.rb +32 -32
- data/lib/win-ffi/enums/system_info.rb +53 -53
- data/lib/win-ffi/enums/user32/pointer_flags.rb +81 -81
- data/lib/win-ffi/functions/advapi32/process.rb +32 -32
- data/lib/win-ffi/functions/advapi32/system_info.rb +16 -16
- data/lib/win-ffi/functions/comdlg32.rb +6 -6
- data/lib/win-ffi/functions/comdlg32/error.rb +5 -5
- data/lib/win-ffi/functions/comdlg32/find_replace.rb +9 -9
- data/lib/win-ffi/functions/msvcrt/handle.rb +12 -12
- data/lib/win-ffi/functions/ntdll/system_info.rb +13 -13
- data/lib/win-ffi/functions/secur32/system_info.rb +29 -29
- data/lib/win-ffi/functions/thread.rb +229 -229
- data/lib/win-ffi/functions/user32/cursor.rb +2 -0
- data/lib/win-ffi/functions/user32/mouse.rb +1 -1
- data/lib/win-ffi/functions/user32/window/window.rb +12 -11
- data/lib/win-ffi/functions/winmm.rb +546 -546
- data/lib/win-ffi/functions/wtsapi32/process.rb +11 -11
- data/lib/win-ffi/struct.rb +15 -15
- data/lib/win-ffi/structs/comdlg32/choose_color.rb +22 -22
- data/lib/win-ffi/structs/comdlg32/choose_font.rb +27 -27
- data/lib/win-ffi/structs/comdlg32/find_replace.rb +23 -23
- data/lib/win-ffi/structs/gdi32/abc.rb +8 -8
- data/lib/win-ffi/structs/gdi32/abcfloat.rb +10 -10
- data/lib/win-ffi/structs/gdi32/bitmap.rb +12 -12
- data/lib/win-ffi/structs/gdi32/bitmap_info.rb +10 -10
- data/lib/win-ffi/structs/gdi32/bitmap_info_header.rb +16 -16
- data/lib/win-ffi/structs/gdi32/blend_function.rb +9 -9
- data/lib/win-ffi/structs/gdi32/display_device.rb +11 -11
- data/lib/win-ffi/structs/gdi32/handle_table.rb +6 -6
- data/lib/win-ffi/structs/gdi32/kerning_pair.rb +8 -8
- data/lib/win-ffi/structs/gdi32/log_brush.rb +10 -10
- data/lib/win-ffi/structs/gdi32/meta_file_pict.rb +9 -9
- data/lib/win-ffi/structs/gdi32/palette_entry.rb +9 -9
- data/lib/win-ffi/structs/gdi32/pixel_format_descriptor.rb +56 -56
- data/lib/win-ffi/structs/gdi32/rgb_quad.rb +9 -9
- data/lib/win-ffi/structs/os_version_info.rb +9 -9
- data/lib/win-ffi/structs/point.rb +9 -9
- data/lib/win-ffi/structs/rect.rb +41 -27
- data/lib/win-ffi/structs/size.rb +5 -5
- data/lib/win-ffi/structs/user32/controls/combobox_info.rb +14 -12
- data/lib/win-ffi/structs/user32/controls/scroll_info.rb +12 -12
- data/lib/win-ffi/structs/user32/controls/scrollbar_info.rb +14 -12
- data/lib/win-ffi/structs/user32/cursor_info.rb +11 -9
- data/lib/win-ffi/structs/user32/display_device.rb +11 -11
- data/lib/win-ffi/structs/user32/draw_text_params.rb +10 -10
- data/lib/win-ffi/structs/user32/icon_info.rb +10 -10
- data/lib/win-ffi/structs/user32/icon_info_ex.rb +14 -14
- data/lib/win-ffi/structs/user32/last_input_info.rb +7 -7
- data/lib/win-ffi/structs/user32/mouse_move_point.rb +9 -9
- data/lib/win-ffi/structs/user32/msg.rb +18 -16
- data/lib/win-ffi/structs/user32/pointer_info.rb +24 -24
- data/lib/win-ffi/structs/user32/pointer_pen_info.rb +18 -18
- data/lib/win-ffi/structs/user32/pointer_touch_info.rb +18 -17
- data/lib/win-ffi/structs/user32/raw_input_device_list.rb +9 -9
- data/lib/win-ffi/structs/user32/raw_input_header.rb +9 -9
- data/lib/win-ffi/structs/user32/touch_hit_testing_input.rb +13 -10
- data/lib/win-ffi/structs/user32/touch_hit_testing_proximity_evaluation.rb +9 -7
- data/lib/win-ffi/structs/user32/track_mouse_event.rb +9 -9
- data/lib/win-ffi/structs/user32/window/alt_tab_info.rb +17 -17
- data/lib/win-ffi/structs/user32/window/bs_info.rb +11 -11
- data/lib/win-ffi/structs/user32/window/dlg_template.rb +13 -13
- data/lib/win-ffi/structs/user32/window/flashw_info.rb +1 -1
- data/lib/win-ffi/structs/user32/window/gui_thread_info.rb +17 -17
- data/lib/win-ffi/structs/user32/window/luid.rb +7 -7
- data/lib/win-ffi/structs/user32/window/menu_info.rb +12 -12
- data/lib/win-ffi/structs/user32/window/menu_item_info.rb +17 -17
- data/lib/win-ffi/structs/user32/window/menu_item_template.rb +8 -8
- data/lib/win-ffi/structs/user32/window/menubar_info.rb +13 -11
- data/lib/win-ffi/structs/user32/window/msgbox_params.rb +15 -15
- data/lib/win-ffi/structs/user32/window/title_bar_info.rb +3 -1
- data/lib/win-ffi/structs/user32/window/tpm_params.rb +9 -7
- data/lib/win-ffi/structs/user32/window/update_layered_window_info.rb +21 -21
- data/lib/win-ffi/structs/user32/window/window_placement.rb +32 -32
- data/lib/win-ffi/structs/user32/window/window_pos.rb +46 -46
- data/lib/win-ffi/version.rb +1 -1
- metadata +5 -6
@@ -1,10 +1,10 @@
|
|
1
|
-
module WinFFI
|
2
|
-
module Gdi32
|
3
|
-
class PALETTEENTRY < FFIStruct
|
4
|
-
layout :peRed, :byte,
|
5
|
-
:peGreen, :byte,
|
6
|
-
:peBlue, :byte,
|
7
|
-
:peFlags, :byte
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module WinFFI
|
2
|
+
module Gdi32
|
3
|
+
class PALETTEENTRY < FFIStruct
|
4
|
+
layout :peRed, :byte,
|
5
|
+
:peGreen, :byte,
|
6
|
+
:peBlue, :byte,
|
7
|
+
:peFlags, :byte
|
8
|
+
end
|
9
|
+
end
|
10
10
|
end
|
@@ -1,57 +1,57 @@
|
|
1
|
-
require_relative '../../enums/gdi32/pfd_flags'
|
2
|
-
|
3
|
-
module WinFFI
|
4
|
-
module Gdi32
|
5
|
-
class PIXELFORMATDESCRIPTOR < FFIStruct
|
6
|
-
FLAGS_INV = PFDFlags.to_hash.reduce(Hash.new{|h,k| h[k] = []}){|h,(k,v)| h[v] << k; h}.freeze
|
7
|
-
|
8
|
-
layout :nSize, :ushort,
|
9
|
-
:nVersion, :ushort,
|
10
|
-
:dwFlags, :uint,
|
11
|
-
:iPixelType, :char,
|
12
|
-
:cColorBits, :char,
|
13
|
-
:cRedBits, :char,
|
14
|
-
:cRedShift, :char,
|
15
|
-
:cGreenBits, :char,
|
16
|
-
:cGreenShift, :char,
|
17
|
-
:cBlueBits, :char,
|
18
|
-
:cBlueShift, :char,
|
19
|
-
:cAlphaBits, :char,
|
20
|
-
:cAlphaShift, :char,
|
21
|
-
:cAccumBits, :char,
|
22
|
-
:cAccumRedBits, :char,
|
23
|
-
:cAccumGreenBits, :char,
|
24
|
-
:cAccumBlueBits, :char,
|
25
|
-
:cAccumAlphaBits, :char,
|
26
|
-
:cDepthBits, :char,
|
27
|
-
:cStencilBits, :char,
|
28
|
-
:cAuxBuffers, :char,
|
29
|
-
:iLayerType, :char,
|
30
|
-
:bReserved, :char,
|
31
|
-
:dwLayerMask, :uint,
|
32
|
-
:dwVisibleMask, :uint,
|
33
|
-
:dwDamageMask, :uint
|
34
|
-
|
35
|
-
#TODO
|
36
|
-
#undef_method :nSize=
|
37
|
-
|
38
|
-
def initialize
|
39
|
-
super
|
40
|
-
self
|
41
|
-
end
|
42
|
-
|
43
|
-
def dwFlags
|
44
|
-
val = self
|
45
|
-
Set.new(FLAGS_INV.select{|k,_| val & k != 0}.reduce([]) {|a,(_,v)| a << v}.flatten)
|
46
|
-
end
|
47
|
-
|
48
|
-
def dwFlags=(flags)
|
49
|
-
self
|
50
|
-
end
|
51
|
-
|
52
|
-
def to_s
|
53
|
-
[:iPixelType, :cColorBits, :cAccumBits, :cDepthBits, :iLayerType, :dwFlags].map{|n| "#{n} = #{send(n).inspect}"}.join(', ')
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
1
|
+
require_relative '../../enums/gdi32/pfd_flags'
|
2
|
+
|
3
|
+
module WinFFI
|
4
|
+
module Gdi32
|
5
|
+
class PIXELFORMATDESCRIPTOR < FFIStruct
|
6
|
+
FLAGS_INV = PFDFlags.to_hash.reduce(Hash.new{|h,k| h[k] = []}){|h,(k,v)| h[v] << k; h}.freeze
|
7
|
+
|
8
|
+
layout :nSize, :ushort,
|
9
|
+
:nVersion, :ushort,
|
10
|
+
:dwFlags, :uint,
|
11
|
+
:iPixelType, :char,
|
12
|
+
:cColorBits, :char,
|
13
|
+
:cRedBits, :char,
|
14
|
+
:cRedShift, :char,
|
15
|
+
:cGreenBits, :char,
|
16
|
+
:cGreenShift, :char,
|
17
|
+
:cBlueBits, :char,
|
18
|
+
:cBlueShift, :char,
|
19
|
+
:cAlphaBits, :char,
|
20
|
+
:cAlphaShift, :char,
|
21
|
+
:cAccumBits, :char,
|
22
|
+
:cAccumRedBits, :char,
|
23
|
+
:cAccumGreenBits, :char,
|
24
|
+
:cAccumBlueBits, :char,
|
25
|
+
:cAccumAlphaBits, :char,
|
26
|
+
:cDepthBits, :char,
|
27
|
+
:cStencilBits, :char,
|
28
|
+
:cAuxBuffers, :char,
|
29
|
+
:iLayerType, :char,
|
30
|
+
:bReserved, :char,
|
31
|
+
:dwLayerMask, :uint,
|
32
|
+
:dwVisibleMask, :uint,
|
33
|
+
:dwDamageMask, :uint
|
34
|
+
|
35
|
+
#TODO
|
36
|
+
#undef_method :nSize=
|
37
|
+
|
38
|
+
def initialize
|
39
|
+
super
|
40
|
+
self.nSize = self.size
|
41
|
+
end
|
42
|
+
|
43
|
+
def dwFlags
|
44
|
+
val = self.dwFlags
|
45
|
+
Set.new(FLAGS_INV.select{|k,_| val & k != 0}.reduce([]) {|a,(_,v)| a << v}.flatten)
|
46
|
+
end
|
47
|
+
|
48
|
+
def dwFlags=(flags)
|
49
|
+
self.dwFlags = [*flags].reduce(0) {|a,f| a | PFDFlags[f].to_i}
|
50
|
+
end
|
51
|
+
|
52
|
+
def to_s
|
53
|
+
[:iPixelType, :cColorBits, :cAccumBits, :cDepthBits, :iLayerType, :dwFlags].map{|n| "#{n} = #{send(n).inspect}"}.join(', ')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
57
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
module WinFFI
|
2
|
-
module Gdi32
|
3
|
-
class RGBQUAD < FFIStruct
|
4
|
-
layout :rgbBlue, :byte,
|
5
|
-
:rgbGreen, :byte,
|
6
|
-
:rgbRed, :byte,
|
7
|
-
:rgbReserved, :byte
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module WinFFI
|
2
|
+
module Gdi32
|
3
|
+
class RGBQUAD < FFIStruct
|
4
|
+
layout :rgbBlue, :byte,
|
5
|
+
:rgbGreen, :byte,
|
6
|
+
:rgbRed, :byte,
|
7
|
+
:rgbReserved, :byte
|
8
|
+
end
|
9
|
+
end
|
10
10
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
module WinFFI
|
2
|
-
class OSVERSIONINFO < FFIStruct
|
3
|
-
layout :dwOSVersionInfoSize, :ulong,
|
4
|
-
:dwMajorVersion, :ulong,
|
5
|
-
:dwMinorVersion, :ulong,
|
6
|
-
:dwBuildNumber, :ulong,
|
7
|
-
:dwPlatformId, :ulong,
|
8
|
-
:szCSDVersion, [:char, 128]
|
9
|
-
end
|
1
|
+
module WinFFI
|
2
|
+
class OSVERSIONINFO < FFIStruct
|
3
|
+
layout :dwOSVersionInfoSize, :ulong,
|
4
|
+
:dwMajorVersion, :ulong,
|
5
|
+
:dwMinorVersion, :ulong,
|
6
|
+
:dwBuildNumber, :ulong,
|
7
|
+
:dwPlatformId, :ulong,
|
8
|
+
:szCSDVersion, [:char, 128]
|
9
|
+
end
|
10
10
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
module WinFFI
|
2
|
-
class POINT < FFIStruct
|
3
|
-
layout :x, :long,
|
4
|
-
:y, :long
|
5
|
-
|
6
|
-
def to_s
|
7
|
-
"(x = #{x}, y = #{y})"
|
8
|
-
end
|
9
|
-
end
|
1
|
+
module WinFFI
|
2
|
+
class POINT < FFIStruct
|
3
|
+
layout :x, :long,
|
4
|
+
:y, :long
|
5
|
+
|
6
|
+
def to_s
|
7
|
+
"(x = #{x}, y = #{y})"
|
8
|
+
end
|
9
|
+
end
|
10
10
|
end
|
data/lib/win-ffi/structs/rect.rb
CHANGED
@@ -1,28 +1,42 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
1
|
+
require 'win-ffi/struct'
|
2
|
+
|
3
|
+
module WinFFI
|
4
|
+
class RECT < FFIStruct
|
5
|
+
layout :left, :long,
|
6
|
+
:top, :long,
|
7
|
+
:right, :long,
|
8
|
+
:bottom, :long
|
9
|
+
|
10
|
+
# def initialize(left, top, right, bottom)
|
11
|
+
# self.left, self.top, self.right, self.bottom = left, top, right, bottom
|
12
|
+
# end
|
13
|
+
|
14
|
+
def area
|
15
|
+
width * height
|
16
|
+
end
|
17
|
+
|
18
|
+
def perimeter
|
19
|
+
2 * width + 2 * height
|
20
|
+
end
|
21
|
+
|
22
|
+
def width
|
23
|
+
right - left
|
24
|
+
end
|
25
|
+
|
26
|
+
def width=(v)
|
27
|
+
self.right = left + v
|
28
|
+
end
|
29
|
+
|
30
|
+
def height
|
31
|
+
bottom - top
|
32
|
+
end
|
33
|
+
|
34
|
+
def height=(v)
|
35
|
+
self.bottom = top + v
|
36
|
+
end
|
37
|
+
|
38
|
+
def to_s
|
39
|
+
"(left = #{left}, top = #{top}, width = #{width}, height = #{height})"
|
40
|
+
end
|
41
|
+
end
|
28
42
|
end
|
data/lib/win-ffi/structs/size.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
module WinFFI
|
2
|
-
class SIZE < FFIStruct
|
3
|
-
layout :cx, :long,
|
4
|
-
:cy, :long
|
5
|
-
end
|
1
|
+
module WinFFI
|
2
|
+
class SIZE < FFIStruct
|
3
|
+
layout :cx, :long,
|
4
|
+
:cy, :long
|
5
|
+
end
|
6
6
|
end
|
@@ -1,13 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
|
12
|
-
|
1
|
+
require 'lib/win-ffi/structs/rect'
|
2
|
+
|
3
|
+
module WinFFI
|
4
|
+
module User32
|
5
|
+
class COMBOBOXINFO < FFIStruct
|
6
|
+
layout :cbSize, :dword,
|
7
|
+
:rcItem, RECT,
|
8
|
+
:rcButton, RECT,
|
9
|
+
:stateButton, :dword,
|
10
|
+
:hwndCombo, :hwnd,
|
11
|
+
:hwndItem, :hwnd,
|
12
|
+
:hwndList, :hwnd
|
13
|
+
end
|
14
|
+
end
|
13
15
|
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
module WinFFI
|
2
|
-
module User32
|
3
|
-
class SCROLLINFO < FFIStruct
|
4
|
-
layout :cbSize, :uint,
|
5
|
-
:fMask, :uint,
|
6
|
-
:nMin, :int,
|
7
|
-
:nMax, :int,
|
8
|
-
:nPage, :uint,
|
9
|
-
:nPos, :int,
|
10
|
-
:nTrackPos, :int
|
11
|
-
end
|
12
|
-
end
|
1
|
+
module WinFFI
|
2
|
+
module User32
|
3
|
+
class SCROLLINFO < FFIStruct
|
4
|
+
layout :cbSize, :uint,
|
5
|
+
:fMask, :uint,
|
6
|
+
:nMin, :int,
|
7
|
+
:nMax, :int,
|
8
|
+
:nPage, :uint,
|
9
|
+
:nPos, :int,
|
10
|
+
:nTrackPos, :int
|
11
|
+
end
|
12
|
+
end
|
13
13
|
end
|
@@ -1,13 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
|
12
|
-
|
1
|
+
require 'win-ffi/structs/rect'
|
2
|
+
|
3
|
+
module WinFFI
|
4
|
+
module User32
|
5
|
+
class SCROLLBARINFO < FFIStruct
|
6
|
+
layout :cbSize, :dword,
|
7
|
+
:rcScrollBar, RECT,
|
8
|
+
:dxyLineButton, :int,
|
9
|
+
:xyThumbTop, :int,
|
10
|
+
:xyThumbBottom, :int,
|
11
|
+
:reserved, :int,
|
12
|
+
:rgstate, :dword
|
13
|
+
end
|
14
|
+
end
|
13
15
|
end
|
@@ -1,10 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
:
|
8
|
-
|
9
|
-
|
1
|
+
require 'win-ffi/structs/point'
|
2
|
+
|
3
|
+
module WinFFI
|
4
|
+
module User32
|
5
|
+
class CURSORINFO < FFIStruct
|
6
|
+
layout :cbSize, :dword,
|
7
|
+
:flags, :dword,
|
8
|
+
:hCursor, :hcursor,
|
9
|
+
:ptScreenPos, POINT
|
10
|
+
end
|
11
|
+
end
|
10
12
|
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
module WinFFI
|
2
|
-
module User32
|
3
|
-
class DISPLAY_DEVICE < FFIStruct
|
4
|
-
layout :cb, :dword,
|
5
|
-
:DeviceName, [:char, 32],
|
6
|
-
:DeviceString, [:char, 128],
|
7
|
-
:StateFlags, :dword,
|
8
|
-
:DeviceID, [:char, 128],
|
9
|
-
:DeviceKey, [:char, 128]
|
10
|
-
end
|
11
|
-
end
|
1
|
+
module WinFFI
|
2
|
+
module User32
|
3
|
+
class DISPLAY_DEVICE < FFIStruct
|
4
|
+
layout :cb, :dword,
|
5
|
+
:DeviceName, [:char, 32],
|
6
|
+
:DeviceString, [:char, 128],
|
7
|
+
:StateFlags, :dword,
|
8
|
+
:DeviceID, [:char, 128],
|
9
|
+
:DeviceKey, [:char, 128]
|
10
|
+
end
|
11
|
+
end
|
12
12
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
module WinFFI
|
2
|
-
module User32
|
3
|
-
class DRAWTEXTPARAMS < FFIStruct
|
4
|
-
layout :cbSize, :uint,
|
5
|
-
:iTabLength, :int,
|
6
|
-
:iLeftMargin, :int,
|
7
|
-
:iRightMargin, :int,
|
8
|
-
:uiLengthDrawn, :uint
|
9
|
-
end
|
10
|
-
end
|
1
|
+
module WinFFI
|
2
|
+
module User32
|
3
|
+
class DRAWTEXTPARAMS < FFIStruct
|
4
|
+
layout :cbSize, :uint,
|
5
|
+
:iTabLength, :int,
|
6
|
+
:iLeftMargin, :int,
|
7
|
+
:iRightMargin, :int,
|
8
|
+
:uiLengthDrawn, :uint
|
9
|
+
end
|
10
|
+
end
|
11
11
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
module WinFFI
|
2
|
-
module User32
|
3
|
-
class ICONINFO < FFIStruct
|
4
|
-
layout :fIcon, :bool,
|
5
|
-
:xHotspot, :dword,
|
6
|
-
:yHotspot, :dword,
|
7
|
-
:hbmMask, :pointer,
|
8
|
-
:hbmColor, :pointer
|
9
|
-
end
|
10
|
-
end
|
1
|
+
module WinFFI
|
2
|
+
module User32
|
3
|
+
class ICONINFO < FFIStruct
|
4
|
+
layout :fIcon, :bool,
|
5
|
+
:xHotspot, :dword,
|
6
|
+
:yHotspot, :dword,
|
7
|
+
:hbmMask, :pointer,
|
8
|
+
:hbmColor, :pointer
|
9
|
+
end
|
10
|
+
end
|
11
11
|
end
|