windows-pr 1.1.3 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +15 -0
- data/MANIFEST +65 -65
- data/README +149 -149
- data/Rakefile +37 -52
- data/doc/conversion_guide.txt +37 -37
- data/lib/windows/clipboard.rb +2 -0
- data/lib/windows/com.rb +2 -0
- data/lib/windows/com/accessibility.rb +12 -10
- data/lib/windows/com/automation.rb +149 -147
- data/lib/windows/com/variant.rb +24 -22
- data/lib/windows/console.rb +114 -112
- data/lib/windows/debug.rb +35 -33
- data/lib/windows/device_io.rb +248 -246
- data/lib/windows/directory.rb +2 -0
- data/lib/windows/error.rb +2 -0
- data/lib/windows/eventlog.rb +2 -0
- data/lib/windows/file.rb +264 -262
- data/lib/windows/file_mapping.rb +25 -23
- data/lib/windows/filesystem.rb +2 -0
- data/lib/windows/gdi/bitmap.rb +65 -63
- data/lib/windows/gdi/device_context.rb +46 -44
- data/lib/windows/gdi/metafile.rb +40 -38
- data/lib/windows/gdi/painting_drawing.rb +115 -113
- data/lib/windows/handle.rb +2 -0
- data/lib/windows/library.rb +2 -0
- data/lib/windows/limits.rb +34 -31
- data/lib/windows/mailslot.rb +2 -0
- data/lib/windows/memory.rb +2 -0
- data/lib/windows/msvcrt/buffer.rb +75 -73
- data/lib/windows/msvcrt/directory.rb +31 -29
- data/lib/windows/msvcrt/file.rb +47 -45
- data/lib/windows/msvcrt/io.rb +62 -60
- data/lib/windows/msvcrt/string.rb +2 -0
- data/lib/windows/msvcrt/time.rb +169 -167
- data/lib/windows/national.rb +580 -578
- data/lib/windows/network/management.rb +525 -523
- data/lib/windows/network/snmp.rb +92 -90
- data/lib/windows/network/winsock.rb +128 -126
- data/lib/windows/nio.rb +2 -0
- data/lib/windows/ntfs/winternl.rb +96 -82
- data/lib/windows/path.rb +143 -141
- data/lib/windows/pipe.rb +42 -40
- data/lib/windows/process.rb +2 -0
- data/lib/windows/registry.rb +171 -126
- data/lib/windows/security.rb +479 -477
- data/lib/windows/security/authentication.rb +32 -30
- data/lib/windows/service.rb +142 -140
- data/lib/windows/shell.rb +171 -169
- data/lib/windows/socket.rb +86 -0
- data/lib/windows/sound.rb +39 -37
- data/lib/windows/synchronize.rb +133 -131
- data/lib/windows/system_info.rb +4 -2
- data/lib/windows/thread.rb +2 -0
- data/lib/windows/time.rb +48 -46
- data/lib/windows/tool_helper.rb +36 -34
- data/lib/windows/unicode.rb +2 -0
- data/lib/windows/volume.rb +61 -59
- data/lib/windows/window.rb +81 -79
- data/lib/windows/window/classes.rb +59 -57
- data/lib/windows/window/dialog.rb +91 -89
- data/lib/windows/window/menu.rb +102 -100
- data/lib/windows/window/message.rb +297 -295
- data/lib/windows/window/properties.rb +20 -18
- data/lib/windows/window/timer.rb +19 -17
- data/lib/windows/wsa.rb +102 -0
- data/test/tc_clipboard.rb +41 -41
- data/test/tc_com.rb +32 -32
- data/test/tc_com_automation.rb +15 -15
- data/test/tc_console.rb +108 -108
- data/test/tc_debug.rb +48 -48
- data/test/tc_device_io.rb +29 -29
- data/test/tc_directory.rb +25 -25
- data/test/tc_error.rb +38 -50
- data/test/tc_eventlog.rb +58 -58
- data/test/tc_file.rb +67 -67
- data/test/tc_file_mapping.rb +38 -38
- data/test/tc_filesystem.rb +27 -27
- data/test/tc_gdi_bitmap.rb +25 -25
- data/test/tc_gdi_metafile.rb +23 -23
- data/test/tc_handle.rb +36 -36
- data/test/tc_library.rb +37 -37
- data/test/tc_limits.rb +34 -34
- data/test/tc_mailslot.rb +22 -22
- data/test/tc_memory.rb +44 -44
- data/test/tc_msvcrt_buffer.rb +59 -68
- data/test/tc_msvcrt_directory.rb +96 -98
- data/test/tc_msvcrt_file.rb +80 -80
- data/test/tc_msvcrt_io.rb +48 -48
- data/test/tc_msvcrt_string.rb +94 -93
- data/test/tc_msvcrt_time.rb +19 -29
- data/test/tc_national.rb +38 -38
- data/test/tc_network_management.rb +32 -32
- data/test/tc_network_snmp.rb +31 -31
- data/test/tc_network_winsock.rb +34 -34
- data/test/tc_nio.rb +32 -32
- data/test/tc_ntfs_winternl.rb +33 -18
- data/test/tc_path.rb +90 -90
- data/test/tc_pipe.rb +53 -53
- data/test/tc_process.rb +24 -24
- data/test/tc_registry.rb +29 -29
- data/test/tc_security.rb +104 -104
- data/test/tc_security_authentication.rb +34 -34
- data/test/tc_service.rb +57 -57
- data/test/tc_shell.rb +34 -34
- data/test/tc_socket.rb +20 -0
- data/test/tc_sound.rb +37 -37
- data/test/tc_synchronize.rb +75 -75
- data/test/tc_system_info.rb +33 -43
- data/test/tc_thread.rb +29 -29
- data/test/tc_time.rb +32 -32
- data/test/tc_tool_helper.rb +29 -29
- data/test/tc_unicode.rb +62 -62
- data/test/tc_volume.rb +47 -47
- data/test/tc_window.rb +45 -45
- data/test/tc_window_classes.rb +33 -33
- data/test/tc_window_dialog.rb +33 -33
- data/test/tc_window_menu.rb +29 -29
- data/test/tc_window_message.rb +33 -33
- data/test/tc_window_properties.rb +29 -29
- data/test/tc_window_timer.rb +29 -29
- data/test/tc_wsa.rb +19 -0
- data/windows-pr.gemspec +1 -1
- metadata +13 -7
@@ -1,18 +1,20 @@
|
|
1
|
-
require 'windows/api'
|
2
|
-
|
3
|
-
module Windows
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
1
|
+
require 'windows/api'
|
2
|
+
|
3
|
+
module Windows
|
4
|
+
module Window
|
5
|
+
module Properties
|
6
|
+
API.auto_namespace = 'Windows::Window::Properties'
|
7
|
+
API.auto_constant = true
|
8
|
+
API.auto_method = true
|
9
|
+
API.auto_unicode = true
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
API.new('EnumProps', 'LK', 'I', 'user32')
|
14
|
+
API.new('EnumPropsEx', 'LKL', 'I', 'user32')
|
15
|
+
API.new('GetProp', 'LP', 'L', 'user32')
|
16
|
+
API.new('RemoveProp', 'LP', 'L', 'user32')
|
17
|
+
API.new('SetProp', 'LPL', 'B', 'user32')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/windows/window/timer.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
|
-
require 'windows/api'
|
2
|
-
|
3
|
-
module Windows
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
1
|
+
require 'windows/api'
|
2
|
+
|
3
|
+
module Windows
|
4
|
+
module Window
|
5
|
+
module Timer
|
6
|
+
API.auto_namespace = 'Windows::Window::Timer'
|
7
|
+
API.auto_constant = true
|
8
|
+
API.auto_method = true
|
9
|
+
API.auto_unicode = false
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
API.new('KillTimer', 'LP', 'B', 'user32')
|
14
|
+
API.new('QueryPerformanceCounter', 'P', 'B')
|
15
|
+
API.new('QueryPerformanceFrequency', 'P', 'B')
|
16
|
+
API.new('SetTimer', 'LIIK', 'P', 'user32')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/windows/wsa.rb
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'windows/api'
|
2
|
+
|
3
|
+
module Windows
|
4
|
+
module WSA
|
5
|
+
API.auto_namespace = 'Windows::WSA'
|
6
|
+
API.auto_constant = true
|
7
|
+
API.auto_method = true
|
8
|
+
API.auto_unicode = true
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
# Constants
|
13
|
+
|
14
|
+
WSA_FLAG_OVERLAPPED = 0x01
|
15
|
+
WSA_FLAG_MULTIPOINT_C_ROOT = 0x02
|
16
|
+
WSA_FLAG_MULTIPOINT_C_LEAF = 0x04
|
17
|
+
WSA_FLAG_MULTIPOINT_D_ROOT = 0x08
|
18
|
+
WSA_FLAG_MULTIPOINT_D_LEAF = 0x10
|
19
|
+
WSA_FLAG_ACCESS_SYSTEM_SECURITY = 0x40
|
20
|
+
WSA_FLAG_NO_HANDLE_INHERIT = 0x80
|
21
|
+
|
22
|
+
RNRSERVICE_REGISTER = 0
|
23
|
+
RNRSERVICE_DEREGISTER = 1
|
24
|
+
RNRSERVICE_DELETE = 2
|
25
|
+
|
26
|
+
# Functions
|
27
|
+
|
28
|
+
API.new('WSAAccept', 'LPPKP', 'L', 'ws2_32')
|
29
|
+
API.new('WSAAddressToString', 'PLPPP', 'I', 'ws2_32')
|
30
|
+
API.new('WSAAsyncGetHostByAddr', 'LISIIPI', 'L', 'ws2_32')
|
31
|
+
API.new('WSAAsyncGetHostByName', 'LISPI', 'L', 'ws2_32')
|
32
|
+
API.new('WSAAsyncGetProtoByName', 'LISPI', 'L', 'ws2_32')
|
33
|
+
API.new('WSAAsyncGetProtoByNumber', 'LISPI', 'L', 'ws2_32')
|
34
|
+
API.new('WSAAsyncGetServByName', 'LISSPI', 'L', 'ws2_32')
|
35
|
+
API.new('WSAAsyncGetServByPort', 'LIISPI', 'L', 'ws2_32')
|
36
|
+
API.new('WSAAsyncSelect', 'LLIL', 'I', 'ws2_32')
|
37
|
+
API.new('WSACancelAsyncRequest', 'L', 'I', 'ws2_32')
|
38
|
+
API.new('WSACleanup', 'V', 'I', 'ws2_32')
|
39
|
+
API.new('WSACloseEvent', 'I', 'B', 'ws2_32')
|
40
|
+
API.new('WSAConnect', 'LPIPPPP', 'I', 'ws2_32')
|
41
|
+
API.new('WSACreateEvent', 'V', 'L', 'ws2_32')
|
42
|
+
API.new('WSADuplicateSocket', 'LLP', 'I', 'ws2_32')
|
43
|
+
API.new('WSAEnumNetworkEvents', 'LLP', 'I', 'ws2_32')
|
44
|
+
API.new('WSAEnumProtocols', 'PPP', 'I', 'ws2_32')
|
45
|
+
API.new('WSAEventSelect', 'LLL', 'I', 'ws2_32')
|
46
|
+
API.new('WSAGetLastError', 'V', 'I', 'ws2_32')
|
47
|
+
API.new('WSAGetOverlappedResult', 'LPPIP', 'B', 'ws2_32')
|
48
|
+
API.new('WSAGetQOSByName', 'LPP', 'B', 'ws2_32')
|
49
|
+
API.new('WSAGetServiceClassInfo', 'PPPP', 'I', 'ws2_32')
|
50
|
+
API.new('WSAGetServiceClassNameByClassId', 'PPP', 'I', 'ws2_32')
|
51
|
+
API.new('WSAHtonl', 'LLP', 'I', 'ws2_32')
|
52
|
+
API.new('WSAHtons', 'LIP', 'I', 'ws2_32')
|
53
|
+
API.new('WSAInstallServiceClass', 'P', 'I', 'ws2_32')
|
54
|
+
API.new('WSAIoctl', 'LLPLPLPPP', 'I', 'ws2_32')
|
55
|
+
API.new('WSAJoinLeaf', 'LPIPPPPL', 'L', 'ws2_32')
|
56
|
+
API.new('WSALookupServiceBegin', 'PLP', 'I', 'ws2_32')
|
57
|
+
API.new('WSALookupServiceEnd', 'L', 'I', 'ws2_32')
|
58
|
+
API.new('WSALookupServiceNext', 'LLPP', 'I', 'ws2_32')
|
59
|
+
API.new('WSANtohl', 'LLP', 'I', 'ws2_32')
|
60
|
+
API.new('WSANtohs', 'LIP', 'I', 'ws2_32')
|
61
|
+
API.new('WSAProviderConfigChange', 'PPP', 'I', 'ws2_32')
|
62
|
+
API.new('WSARecv', 'LPLPPPP', 'I', 'ws2_32')
|
63
|
+
API.new('WSARecvDisconnect', 'LP', 'I', 'ws2_32')
|
64
|
+
API.new('WSARecvEx', 'LPIP', 'I', 'mswsock')
|
65
|
+
API.new('WSARecvFrom', 'LPLPPPPPP', 'I', 'ws2_32')
|
66
|
+
API.new('WSARemoveServiceClass', 'P', 'I', 'ws2_32')
|
67
|
+
API.new('WSAResetEvent', 'L', 'B', 'ws2_32')
|
68
|
+
API.new('WSASend', 'LPLPLPP', 'I', 'ws2_32')
|
69
|
+
API.new('WSASendDisconnect', 'LP', 'I', 'ws2_32')
|
70
|
+
API.new('WSASendTo', 'LPLPLPIPP', 'I', 'ws2_32')
|
71
|
+
API.new('WSASetEvent', 'L', 'B', 'ws2_32')
|
72
|
+
API.new('WSASetLastError', 'I', 'V', 'ws2_32')
|
73
|
+
API.new('WSASetService', 'PIL', 'I', 'ws2_32')
|
74
|
+
API.new('WSAStartup', 'LP', 'I', 'ws2_32')
|
75
|
+
API.new('WSASocket', 'IIIPLL', 'L', 'ws2_32')
|
76
|
+
API.new('WSAStringToAddress', 'PIPPP', 'I', 'ws2_32')
|
77
|
+
API.new('WSAWaitForMultipleEvents', 'LPILI', 'L', 'ws2_32')
|
78
|
+
|
79
|
+
begin
|
80
|
+
API.new('WSAConnectByList', 'LPPPPPPP', 'B', 'ws2_32')
|
81
|
+
API.new('WSAConnectByName', 'LPPPPPPP', 'B', 'ws2_32')
|
82
|
+
API.new('WSADeleteSocketPeerTargetName', 'LPLPP', 'L', 'fwpuclnt')
|
83
|
+
API.new('WSAEnumNameSpaceProvidersEx', 'PP', 'I', 'ws2_32')
|
84
|
+
API.new('WSAPoll', 'PLI', 'I', 'ws2_32')
|
85
|
+
API.new('WSAQuerySocketSecurity', 'LPLPPPP', 'I', 'fwpuclnt')
|
86
|
+
API.new('WSARevertImpersonation', 'V', 'I', 'fwpuclnt')
|
87
|
+
API.new('WSASendMsg', 'LPLPPP', 'I', 'ws2_32')
|
88
|
+
API.new('WSASetSocketPeerTargetName', 'LPLPP', 'I', 'fwpuclnt')
|
89
|
+
API.new('WSASetSocketSecurity', 'LPLPP', 'I', 'fwpuclnt')
|
90
|
+
rescue Win32::API::LoadLibraryError
|
91
|
+
# Vista or later
|
92
|
+
end
|
93
|
+
|
94
|
+
begin
|
95
|
+
API.new('WSAEnumNameSpaceProviders', 'PP', 'I', 'ws2_32')
|
96
|
+
API.new('WSAImpersonateSocketPeer', 'LPL', 'I', 'fwpuclnt')
|
97
|
+
API.new('WSANSPIoctl', 'LLPLPLPP', 'I', 'ws2_32')
|
98
|
+
rescue Win32::API::LoadLibraryError
|
99
|
+
# XP or later
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
data/test/tc_clipboard.rb
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
-
#####################################################################
|
2
|
-
# tc_clipboard.rb
|
3
|
-
#
|
4
|
-
# Test case for the Windows::Clipboard module.
|
5
|
-
#####################################################################
|
6
|
-
require 'windows/clipboard'
|
7
|
-
require 'test/unit'
|
8
|
-
|
9
|
-
class TC_Windows_Clipboard < Test::Unit::TestCase
|
10
|
-
include Windows::Clipboard
|
11
|
-
|
12
|
-
def test_methods
|
13
|
-
assert_respond_to(self, :OpenClipboard)
|
14
|
-
assert_respond_to(self, :CloseClipboard)
|
15
|
-
assert_respond_to(self, :GetClipboardData)
|
16
|
-
assert_respond_to(self, :EmptyClipboard)
|
17
|
-
assert_respond_to(self, :SetClipboardData)
|
18
|
-
assert_respond_to(self, :CountClipboardFormats)
|
19
|
-
assert_respond_to(self, :IsClipboardFormatAvailable)
|
20
|
-
assert_respond_to(self, :GetClipboardFormatName)
|
21
|
-
assert_respond_to(self, :EnumClipboardFormats)
|
22
|
-
assert_respond_to(self, :RegisterClipboardFormat)
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_constants
|
26
|
-
assert_equal(1, CF_TEXT)
|
27
|
-
assert_equal(2, CF_BITMAP)
|
28
|
-
assert_equal(3, CF_METAFILEPICT)
|
29
|
-
assert_equal(4, CF_SYLK)
|
30
|
-
assert_equal(5, CF_DIF)
|
31
|
-
assert_equal(6, CF_TIFF)
|
32
|
-
assert_equal(7, CF_OEMTEXT)
|
33
|
-
assert_equal(8, CF_DIB)
|
34
|
-
assert_equal(9, CF_PALETTE)
|
35
|
-
assert_equal(10, CF_PENDATA)
|
36
|
-
assert_equal(11, CF_RIFF)
|
37
|
-
assert_equal(12, CF_WAVE)
|
38
|
-
assert_equal(13, CF_UNICODETEXT)
|
39
|
-
assert_equal(14, CF_ENHMETAFILE)
|
40
|
-
end
|
41
|
-
end
|
1
|
+
#####################################################################
|
2
|
+
# tc_clipboard.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::Clipboard module.
|
5
|
+
#####################################################################
|
6
|
+
require 'windows/clipboard'
|
7
|
+
require 'test/unit'
|
8
|
+
|
9
|
+
class TC_Windows_Clipboard < Test::Unit::TestCase
|
10
|
+
include Windows::Clipboard
|
11
|
+
|
12
|
+
def test_methods
|
13
|
+
assert_respond_to(self, :OpenClipboard)
|
14
|
+
assert_respond_to(self, :CloseClipboard)
|
15
|
+
assert_respond_to(self, :GetClipboardData)
|
16
|
+
assert_respond_to(self, :EmptyClipboard)
|
17
|
+
assert_respond_to(self, :SetClipboardData)
|
18
|
+
assert_respond_to(self, :CountClipboardFormats)
|
19
|
+
assert_respond_to(self, :IsClipboardFormatAvailable)
|
20
|
+
assert_respond_to(self, :GetClipboardFormatName)
|
21
|
+
assert_respond_to(self, :EnumClipboardFormats)
|
22
|
+
assert_respond_to(self, :RegisterClipboardFormat)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_constants
|
26
|
+
assert_equal(1, CF_TEXT)
|
27
|
+
assert_equal(2, CF_BITMAP)
|
28
|
+
assert_equal(3, CF_METAFILEPICT)
|
29
|
+
assert_equal(4, CF_SYLK)
|
30
|
+
assert_equal(5, CF_DIF)
|
31
|
+
assert_equal(6, CF_TIFF)
|
32
|
+
assert_equal(7, CF_OEMTEXT)
|
33
|
+
assert_equal(8, CF_DIB)
|
34
|
+
assert_equal(9, CF_PALETTE)
|
35
|
+
assert_equal(10, CF_PENDATA)
|
36
|
+
assert_equal(11, CF_RIFF)
|
37
|
+
assert_equal(12, CF_WAVE)
|
38
|
+
assert_equal(13, CF_UNICODETEXT)
|
39
|
+
assert_equal(14, CF_ENHMETAFILE)
|
40
|
+
end
|
41
|
+
end
|
data/test/tc_com.rb
CHANGED
@@ -1,32 +1,32 @@
|
|
1
|
-
#####################################################################
|
2
|
-
# tc_com.rb
|
3
|
-
#
|
4
|
-
# Test case for the Windows::COM module.
|
5
|
-
#####################################################################
|
6
|
-
require "windows/com"
|
7
|
-
require "test/unit"
|
8
|
-
|
9
|
-
class TC_Windows_COM < Test::Unit::TestCase
|
10
|
-
include Windows::COM
|
11
|
-
|
12
|
-
def test_method_constants
|
13
|
-
assert_respond_to(self, :BindMoniker)
|
14
|
-
assert_respond_to(self, :CLSIDFromProgID)
|
15
|
-
assert_respond_to(self, :CLSIDFromProgIDEx)
|
16
|
-
assert_respond_to(self, :CoAddRefServerProcess)
|
17
|
-
assert_respond_to(self, :CoAllowSetForegroundWindow)
|
18
|
-
assert_respond_to(self, :CoCancelCall)
|
19
|
-
assert_respond_to(self, :CoCopyProxy)
|
20
|
-
assert_respond_to(self, :CoCreateFreeThreadedMarshaler)
|
21
|
-
assert_respond_to(self, :CoCreateGuid)
|
22
|
-
assert_respond_to(self, :CoCreateInstance)
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_numeric_constants
|
26
|
-
assert_equal(0, VT_EMPTY)
|
27
|
-
assert_equal(1, VT_NULL)
|
28
|
-
assert_equal(2, VT_I2)
|
29
|
-
assert_equal(3, VT_I4)
|
30
|
-
assert_equal(4, VT_R4)
|
31
|
-
end
|
32
|
-
end
|
1
|
+
#####################################################################
|
2
|
+
# tc_com.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::COM module.
|
5
|
+
#####################################################################
|
6
|
+
require "windows/com"
|
7
|
+
require "test/unit"
|
8
|
+
|
9
|
+
class TC_Windows_COM < Test::Unit::TestCase
|
10
|
+
include Windows::COM
|
11
|
+
|
12
|
+
def test_method_constants
|
13
|
+
assert_respond_to(self, :BindMoniker)
|
14
|
+
assert_respond_to(self, :CLSIDFromProgID)
|
15
|
+
assert_respond_to(self, :CLSIDFromProgIDEx)
|
16
|
+
assert_respond_to(self, :CoAddRefServerProcess)
|
17
|
+
assert_respond_to(self, :CoAllowSetForegroundWindow)
|
18
|
+
assert_respond_to(self, :CoCancelCall)
|
19
|
+
assert_respond_to(self, :CoCopyProxy)
|
20
|
+
assert_respond_to(self, :CoCreateFreeThreadedMarshaler)
|
21
|
+
assert_respond_to(self, :CoCreateGuid)
|
22
|
+
assert_respond_to(self, :CoCreateInstance)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_numeric_constants
|
26
|
+
assert_equal(0, VT_EMPTY)
|
27
|
+
assert_equal(1, VT_NULL)
|
28
|
+
assert_equal(2, VT_I2)
|
29
|
+
assert_equal(3, VT_I4)
|
30
|
+
assert_equal(4, VT_R4)
|
31
|
+
end
|
32
|
+
end
|
data/test/tc_com_automation.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
#####################################################################
|
2
|
-
# tc_com_automation.rb
|
3
|
-
#
|
4
|
-
# Test case for the Windows::COM::Automation module.
|
5
|
-
#####################################################################
|
6
|
-
require 'windows/com/automation'
|
7
|
-
require 'test/unit'
|
8
|
-
|
9
|
-
class TC_Windows_COM_Automation < Test::Unit::TestCase
|
10
|
-
include Windows::COM::Automation
|
11
|
-
|
12
|
-
def test_method_constants
|
13
|
-
assert_respond_to(self, :BstrFromVector)
|
14
|
-
end
|
15
|
-
end
|
1
|
+
#####################################################################
|
2
|
+
# tc_com_automation.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::COM::Automation module.
|
5
|
+
#####################################################################
|
6
|
+
require 'windows/com/automation'
|
7
|
+
require 'test/unit'
|
8
|
+
|
9
|
+
class TC_Windows_COM_Automation < Test::Unit::TestCase
|
10
|
+
include Windows::COM::Automation
|
11
|
+
|
12
|
+
def test_method_constants
|
13
|
+
assert_respond_to(self, :BstrFromVector)
|
14
|
+
end
|
15
|
+
end
|
data/test/tc_console.rb
CHANGED
@@ -1,108 +1,108 @@
|
|
1
|
-
######################################################################
|
2
|
-
# tc_console.rb
|
3
|
-
#
|
4
|
-
# Test case for the Windows::Console module.
|
5
|
-
######################################################################
|
6
|
-
require 'windows/console'
|
7
|
-
require 'test/unit'
|
8
|
-
|
9
|
-
class TC_Windows_Console < Test::Unit::TestCase
|
10
|
-
include Windows::Console
|
11
|
-
|
12
|
-
def setup
|
13
|
-
@ver = `ver`.chomp
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_numeric_constants
|
17
|
-
assert_equal(0, CTRL_C_EVENT)
|
18
|
-
assert_equal(1, CTRL_BREAK_EVENT)
|
19
|
-
assert_equal(5, CTRL_LOGOFF_EVENT)
|
20
|
-
assert_equal(6, CTRL_SHUTDOWN_EVENT)
|
21
|
-
assert_equal(0x0001, ENABLE_PROCESSED_INPUT)
|
22
|
-
assert_equal(0x0002, ENABLE_LINE_INPUT)
|
23
|
-
assert_equal(0x0002, ENABLE_WRAP_AT_EOL_OUTPUT)
|
24
|
-
assert_equal(0x0004, ENABLE_ECHO_INPUT)
|
25
|
-
assert_equal(0x0008, ENABLE_WINDOW_INPUT)
|
26
|
-
assert_equal(0x0010, ENABLE_MOUSE_INPUT)
|
27
|
-
assert_equal(0x0020, ENABLE_INSERT_MODE)
|
28
|
-
assert_equal(0x0040, ENABLE_QUICK_EDIT_MODE)
|
29
|
-
assert_equal(-10, STD_INPUT_HANDLE)
|
30
|
-
assert_equal(-11, STD_OUTPUT_HANDLE)
|
31
|
-
assert_equal(-12, STD_ERROR_HANDLE)
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_method_constants
|
35
|
-
assert_respond_to(self, :AddConsoleAlias)
|
36
|
-
assert_respond_to(self, :AllocConsole)
|
37
|
-
assert_respond_to(self, :CreateConsoleScreenBuffer)
|
38
|
-
assert_respond_to(self, :FillConsoleOutputAttribute)
|
39
|
-
assert_respond_to(self, :FillConsoleOutputCharacter)
|
40
|
-
assert_respond_to(self, :FlushConsoleInputBuffer)
|
41
|
-
assert_respond_to(self, :FreeConsole)
|
42
|
-
assert_respond_to(self, :GenerateConsoleCtrlEvent)
|
43
|
-
assert_respond_to(self, :GetConsoleAlias)
|
44
|
-
assert_respond_to(self, :GetConsoleAliases)
|
45
|
-
assert_respond_to(self, :GetConsoleAliasesLength)
|
46
|
-
assert_respond_to(self, :GetConsoleAliasExes)
|
47
|
-
assert_respond_to(self, :GetConsoleAliasExesLength)
|
48
|
-
assert_respond_to(self, :GetConsoleCP)
|
49
|
-
assert_respond_to(self, :GetConsoleCursorInfo)
|
50
|
-
assert_respond_to(self, :GetConsoleMode)
|
51
|
-
assert_respond_to(self, :GetConsoleOutputCP)
|
52
|
-
assert_respond_to(self, :GetConsoleScreenBufferInfo)
|
53
|
-
assert_respond_to(self, :GetConsoleTitle)
|
54
|
-
assert_respond_to(self, :GetConsoleWindow)
|
55
|
-
assert_respond_to(self, :GetLargestConsoleWindowSize)
|
56
|
-
assert_respond_to(self, :GetNumberOfConsoleInputEvents)
|
57
|
-
assert_respond_to(self, :GetNumberOfConsoleMouseButtons)
|
58
|
-
assert_respond_to(self, :GetStdHandle)
|
59
|
-
assert_respond_to(self, :PeekConsoleInput)
|
60
|
-
assert_respond_to(self, :ReadConsole)
|
61
|
-
assert_respond_to(self, :ReadConsoleInput)
|
62
|
-
assert_respond_to(self, :ReadConsoleOutput)
|
63
|
-
assert_respond_to(self, :ReadConsoleOutputAttribute)
|
64
|
-
assert_respond_to(self, :ReadConsoleOutputCharacter)
|
65
|
-
assert_respond_to(self, :ScrollConsoleScreenBuffer)
|
66
|
-
assert_respond_to(self, :SetConsoleActiveScreenBuffer)
|
67
|
-
assert_respond_to(self, :SetConsoleCP)
|
68
|
-
assert_respond_to(self, :SetConsoleCtrlHandler)
|
69
|
-
assert_respond_to(self, :SetConsoleCursorInfo)
|
70
|
-
assert_respond_to(self, :SetConsoleCursorPosition)
|
71
|
-
assert_respond_to(self, :SetConsoleMode)
|
72
|
-
assert_respond_to(self, :SetConsoleOutputCP)
|
73
|
-
assert_respond_to(self, :SetConsoleScreenBufferSize)
|
74
|
-
assert_respond_to(self, :SetConsoleTextAttribute)
|
75
|
-
assert_respond_to(self, :SetConsoleTitle)
|
76
|
-
assert_respond_to(self, :SetConsoleWindowInfo)
|
77
|
-
assert_respond_to(self, :SetStdHandle)
|
78
|
-
assert_respond_to(self, :WriteConsole)
|
79
|
-
assert_respond_to(self, :WriteConsoleInput)
|
80
|
-
assert_respond_to(self, :WriteConsoleOutput)
|
81
|
-
assert_respond_to(self, :WriteConsoleOutputAttribute)
|
82
|
-
assert_respond_to(self, :WriteConsoleOutputCharacter)
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_method_constants_xp_or_later
|
86
|
-
if @ver =~ /XP/
|
87
|
-
assert_respond_to(self, :AttachConsole)
|
88
|
-
assert_respond_to(self, :GetConsoleDisplayMode)
|
89
|
-
assert_respond_to(self, :GetConsoleFontSize)
|
90
|
-
assert_respond_to(self, :GetConsoleProcessList)
|
91
|
-
assert_respond_to(self, :GetConsoleSelectionInfo)
|
92
|
-
assert_respond_to(self, :GetCurrentConsoleFont)
|
93
|
-
assert_respond_to(self, :SetConsoleDisplayMode)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_explicit_ansi
|
98
|
-
assert_respond_to(self, :GetConsoleAliasA)
|
99
|
-
end
|
100
|
-
|
101
|
-
def test_explicit_unicode
|
102
|
-
assert_respond_to(self, :GetConsoleAliasW)
|
103
|
-
end
|
104
|
-
|
105
|
-
def teardown
|
106
|
-
@ver = nil
|
107
|
-
end
|
108
|
-
end
|
1
|
+
######################################################################
|
2
|
+
# tc_console.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::Console module.
|
5
|
+
######################################################################
|
6
|
+
require 'windows/console'
|
7
|
+
require 'test/unit'
|
8
|
+
|
9
|
+
class TC_Windows_Console < Test::Unit::TestCase
|
10
|
+
include Windows::Console
|
11
|
+
|
12
|
+
def setup
|
13
|
+
@ver = `ver`.chomp
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_numeric_constants
|
17
|
+
assert_equal(0, CTRL_C_EVENT)
|
18
|
+
assert_equal(1, CTRL_BREAK_EVENT)
|
19
|
+
assert_equal(5, CTRL_LOGOFF_EVENT)
|
20
|
+
assert_equal(6, CTRL_SHUTDOWN_EVENT)
|
21
|
+
assert_equal(0x0001, ENABLE_PROCESSED_INPUT)
|
22
|
+
assert_equal(0x0002, ENABLE_LINE_INPUT)
|
23
|
+
assert_equal(0x0002, ENABLE_WRAP_AT_EOL_OUTPUT)
|
24
|
+
assert_equal(0x0004, ENABLE_ECHO_INPUT)
|
25
|
+
assert_equal(0x0008, ENABLE_WINDOW_INPUT)
|
26
|
+
assert_equal(0x0010, ENABLE_MOUSE_INPUT)
|
27
|
+
assert_equal(0x0020, ENABLE_INSERT_MODE)
|
28
|
+
assert_equal(0x0040, ENABLE_QUICK_EDIT_MODE)
|
29
|
+
assert_equal(-10, STD_INPUT_HANDLE)
|
30
|
+
assert_equal(-11, STD_OUTPUT_HANDLE)
|
31
|
+
assert_equal(-12, STD_ERROR_HANDLE)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_method_constants
|
35
|
+
assert_respond_to(self, :AddConsoleAlias)
|
36
|
+
assert_respond_to(self, :AllocConsole)
|
37
|
+
assert_respond_to(self, :CreateConsoleScreenBuffer)
|
38
|
+
assert_respond_to(self, :FillConsoleOutputAttribute)
|
39
|
+
assert_respond_to(self, :FillConsoleOutputCharacter)
|
40
|
+
assert_respond_to(self, :FlushConsoleInputBuffer)
|
41
|
+
assert_respond_to(self, :FreeConsole)
|
42
|
+
assert_respond_to(self, :GenerateConsoleCtrlEvent)
|
43
|
+
assert_respond_to(self, :GetConsoleAlias)
|
44
|
+
assert_respond_to(self, :GetConsoleAliases)
|
45
|
+
assert_respond_to(self, :GetConsoleAliasesLength)
|
46
|
+
assert_respond_to(self, :GetConsoleAliasExes)
|
47
|
+
assert_respond_to(self, :GetConsoleAliasExesLength)
|
48
|
+
assert_respond_to(self, :GetConsoleCP)
|
49
|
+
assert_respond_to(self, :GetConsoleCursorInfo)
|
50
|
+
assert_respond_to(self, :GetConsoleMode)
|
51
|
+
assert_respond_to(self, :GetConsoleOutputCP)
|
52
|
+
assert_respond_to(self, :GetConsoleScreenBufferInfo)
|
53
|
+
assert_respond_to(self, :GetConsoleTitle)
|
54
|
+
assert_respond_to(self, :GetConsoleWindow)
|
55
|
+
assert_respond_to(self, :GetLargestConsoleWindowSize)
|
56
|
+
assert_respond_to(self, :GetNumberOfConsoleInputEvents)
|
57
|
+
assert_respond_to(self, :GetNumberOfConsoleMouseButtons)
|
58
|
+
assert_respond_to(self, :GetStdHandle)
|
59
|
+
assert_respond_to(self, :PeekConsoleInput)
|
60
|
+
assert_respond_to(self, :ReadConsole)
|
61
|
+
assert_respond_to(self, :ReadConsoleInput)
|
62
|
+
assert_respond_to(self, :ReadConsoleOutput)
|
63
|
+
assert_respond_to(self, :ReadConsoleOutputAttribute)
|
64
|
+
assert_respond_to(self, :ReadConsoleOutputCharacter)
|
65
|
+
assert_respond_to(self, :ScrollConsoleScreenBuffer)
|
66
|
+
assert_respond_to(self, :SetConsoleActiveScreenBuffer)
|
67
|
+
assert_respond_to(self, :SetConsoleCP)
|
68
|
+
assert_respond_to(self, :SetConsoleCtrlHandler)
|
69
|
+
assert_respond_to(self, :SetConsoleCursorInfo)
|
70
|
+
assert_respond_to(self, :SetConsoleCursorPosition)
|
71
|
+
assert_respond_to(self, :SetConsoleMode)
|
72
|
+
assert_respond_to(self, :SetConsoleOutputCP)
|
73
|
+
assert_respond_to(self, :SetConsoleScreenBufferSize)
|
74
|
+
assert_respond_to(self, :SetConsoleTextAttribute)
|
75
|
+
assert_respond_to(self, :SetConsoleTitle)
|
76
|
+
assert_respond_to(self, :SetConsoleWindowInfo)
|
77
|
+
assert_respond_to(self, :SetStdHandle)
|
78
|
+
assert_respond_to(self, :WriteConsole)
|
79
|
+
assert_respond_to(self, :WriteConsoleInput)
|
80
|
+
assert_respond_to(self, :WriteConsoleOutput)
|
81
|
+
assert_respond_to(self, :WriteConsoleOutputAttribute)
|
82
|
+
assert_respond_to(self, :WriteConsoleOutputCharacter)
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_method_constants_xp_or_later
|
86
|
+
if @ver =~ /XP/
|
87
|
+
assert_respond_to(self, :AttachConsole)
|
88
|
+
assert_respond_to(self, :GetConsoleDisplayMode)
|
89
|
+
assert_respond_to(self, :GetConsoleFontSize)
|
90
|
+
assert_respond_to(self, :GetConsoleProcessList)
|
91
|
+
assert_respond_to(self, :GetConsoleSelectionInfo)
|
92
|
+
assert_respond_to(self, :GetCurrentConsoleFont)
|
93
|
+
assert_respond_to(self, :SetConsoleDisplayMode)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_explicit_ansi
|
98
|
+
assert_respond_to(self, :GetConsoleAliasA)
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_explicit_unicode
|
102
|
+
assert_respond_to(self, :GetConsoleAliasW)
|
103
|
+
end
|
104
|
+
|
105
|
+
def teardown
|
106
|
+
@ver = nil
|
107
|
+
end
|
108
|
+
end
|