windows-pr 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +444 -438
  3. data/MANIFEST +68 -65
  4. data/README +154 -153
  5. data/Rakefile +42 -37
  6. data/doc/conversion_guide.txt +37 -37
  7. data/lib/windows/clipboard.rb +61 -61
  8. data/lib/windows/com.rb +192 -192
  9. data/lib/windows/com/accessibility.rb +16 -16
  10. data/lib/windows/com/automation.rb +149 -149
  11. data/lib/windows/com/variant.rb +24 -24
  12. data/lib/windows/console.rb +114 -114
  13. data/lib/windows/debug.rb +35 -35
  14. data/lib/windows/device_io.rb +248 -248
  15. data/lib/windows/directory.rb +27 -27
  16. data/lib/windows/error.rb +504 -498
  17. data/lib/windows/eventlog.rb +80 -80
  18. data/lib/windows/file.rb +264 -264
  19. data/lib/windows/file_mapping.rb +25 -25
  20. data/lib/windows/filesystem.rb +15 -15
  21. data/lib/windows/gdi/bitmap.rb +65 -65
  22. data/lib/windows/gdi/device_context.rb +46 -46
  23. data/lib/windows/gdi/metafile.rb +40 -40
  24. data/lib/windows/gdi/painting_drawing.rb +115 -115
  25. data/lib/windows/handle.rb +23 -23
  26. data/lib/windows/library.rb +44 -44
  27. data/lib/windows/limits.rb +34 -34
  28. data/lib/windows/mailslot.rb +24 -24
  29. data/lib/windows/memory.rb +128 -128
  30. data/lib/windows/msvcrt/buffer.rb +75 -75
  31. data/lib/windows/msvcrt/directory.rb +31 -31
  32. data/lib/windows/msvcrt/file.rb +47 -47
  33. data/lib/windows/msvcrt/io.rb +73 -73
  34. data/lib/windows/msvcrt/string.rb +182 -182
  35. data/lib/windows/msvcrt/time.rb +169 -169
  36. data/lib/windows/national.rb +580 -580
  37. data/lib/windows/network/management.rb +525 -525
  38. data/lib/windows/network/snmp.rb +92 -92
  39. data/lib/windows/network/winsock.rb +128 -128
  40. data/lib/windows/nio.rb +50 -50
  41. data/lib/windows/ntfs/winternl.rb +117 -117
  42. data/lib/windows/path.rb +143 -143
  43. data/lib/windows/pipe.rb +42 -42
  44. data/lib/windows/process.rb +176 -176
  45. data/lib/windows/registry.rb +171 -171
  46. data/lib/windows/security.rb +479 -479
  47. data/lib/windows/security/authentication.rb +32 -32
  48. data/lib/windows/security/sspi.rb +153 -0
  49. data/lib/windows/service.rb +142 -142
  50. data/lib/windows/shell.rb +171 -171
  51. data/lib/windows/socket.rb +86 -86
  52. data/lib/windows/sound.rb +39 -39
  53. data/lib/windows/synchronize.rb +133 -133
  54. data/lib/windows/system_info.rb +229 -229
  55. data/lib/windows/thread.rb +64 -64
  56. data/lib/windows/time.rb +48 -48
  57. data/lib/windows/tool_helper.rb +36 -36
  58. data/lib/windows/unicode.rb +155 -155
  59. data/lib/windows/volume.rb +61 -61
  60. data/lib/windows/window.rb +81 -81
  61. data/lib/windows/window/classes.rb +59 -59
  62. data/lib/windows/window/dialog.rb +91 -91
  63. data/lib/windows/window/menu.rb +102 -102
  64. data/lib/windows/window/message.rb +297 -297
  65. data/lib/windows/window/properties.rb +20 -20
  66. data/lib/windows/window/timer.rb +19 -19
  67. data/lib/windows/wsa.rb +102 -102
  68. data/test/tc_clipboard.rb +41 -41
  69. data/test/tc_com.rb +32 -32
  70. data/test/tc_com_automation.rb +15 -15
  71. data/test/tc_console.rb +108 -108
  72. data/test/tc_debug.rb +48 -48
  73. data/test/tc_device_io.rb +29 -29
  74. data/test/tc_directory.rb +25 -25
  75. data/test/tc_error.rb +38 -38
  76. data/test/tc_eventlog.rb +58 -58
  77. data/test/tc_file.rb +67 -67
  78. data/test/tc_file_mapping.rb +38 -38
  79. data/test/tc_filesystem.rb +27 -27
  80. data/test/tc_gdi_bitmap.rb +25 -25
  81. data/test/tc_gdi_metafile.rb +23 -23
  82. data/test/tc_handle.rb +36 -36
  83. data/test/tc_library.rb +37 -37
  84. data/test/tc_limits.rb +34 -34
  85. data/test/tc_mailslot.rb +22 -22
  86. data/test/tc_memory.rb +44 -44
  87. data/test/tc_msvcrt_buffer.rb +63 -63
  88. data/test/tc_msvcrt_directory.rb +96 -96
  89. data/test/tc_msvcrt_file.rb +80 -80
  90. data/test/tc_msvcrt_io.rb +48 -48
  91. data/test/tc_msvcrt_string.rb +94 -94
  92. data/test/tc_msvcrt_time.rb +19 -19
  93. data/test/tc_national.rb +38 -38
  94. data/test/tc_network_management.rb +32 -32
  95. data/test/tc_network_snmp.rb +31 -31
  96. data/test/tc_network_winsock.rb +34 -34
  97. data/test/tc_nio.rb +32 -32
  98. data/test/tc_ntfs_winternl.rb +48 -48
  99. data/test/tc_path.rb +90 -90
  100. data/test/tc_pipe.rb +53 -53
  101. data/test/tc_process.rb +24 -24
  102. data/test/tc_registry.rb +29 -29
  103. data/test/tc_security.rb +104 -104
  104. data/test/tc_security_authentication.rb +34 -34
  105. data/test/tc_security_sspi.rb +23 -0
  106. data/test/tc_service.rb +57 -57
  107. data/test/tc_shell.rb +34 -34
  108. data/test/tc_socket.rb +20 -20
  109. data/test/tc_sound.rb +37 -37
  110. data/test/tc_synchronize.rb +75 -75
  111. data/test/tc_system_info.rb +33 -33
  112. data/test/tc_thread.rb +29 -29
  113. data/test/tc_time.rb +32 -32
  114. data/test/tc_tool_helper.rb +29 -29
  115. data/test/tc_unicode.rb +83 -83
  116. data/test/tc_volume.rb +47 -47
  117. data/test/tc_window.rb +45 -45
  118. data/test/tc_window_classes.rb +33 -33
  119. data/test/tc_window_dialog.rb +33 -33
  120. data/test/tc_window_menu.rb +29 -29
  121. data/test/tc_window_message.rb +33 -33
  122. data/test/tc_window_properties.rb +29 -29
  123. data/test/tc_window_timer.rb +29 -29
  124. data/test/tc_wsa.rb +19 -19
  125. data/windows-pr.gemspec +33 -34
  126. metadata +31 -32
@@ -1,92 +1,92 @@
1
- require 'windows/api'
2
-
3
- module Windows
4
- module Network
5
- module SNMP
6
- API.auto_namespace = 'Windows::Network::SNMP'
7
- API.auto_constant = true
8
- API.auto_method = true
9
- API.auto_unicode = false
10
-
11
- private
12
-
13
- SNMPAPI_FAILURE = 0
14
- SNMPAPI_SUCCESS = 1
15
- SNMPAPI_ALLOC_ERROR = 2
16
- SNMPAPI_CONTEXT_INVALID = 3
17
- SNMPAPI_CONTEXT_UNKNOWN = 4
18
- SNMPAPI_ENTITY_INVALID = 5
19
- SNMPAPI_ENTITY_UNKNOWN = 6
20
- SNMPAPI_INDEX_INVALID = 7
21
- SNMPAPI_NOOP = 8
22
- SNMPAPI_OID_INVALID = 9
23
- SNMPAPI_OPERATION_INVALID = 10
24
- SNMPAPI_OUTPUT_TRUNCATED = 11
25
- SNMPAPI_PDU_INVALID = 12
26
- SNMPAPI_SESSION_INVALID = 13
27
- SNMPAPI_SYNTAX_INVALID = 14
28
- SNMPAPI_VBL_INVALID = 15
29
- SNMPAPI_MODE_INVALID = 16
30
- SNMPAPI_SIZE_INVALID = 17
31
- SNMPAPI_NOT_INITIALIZED = 18
32
- SNMPAPI_MESSAGE_INVALID = 19
33
- SNMPAPI_HWND_INVALID = 20
34
- SNMPAPI_OTHER_ERROR = 99
35
- SNMPAPI_TL_NOT_INITIALIZED = 100
36
- SNMPAPI_TL_NOT_SUPPORTED = 101
37
- SNMPAPI_TL_NOT_AVAILABLE = 102
38
- SNMPAPI_TL_RESOURCE_ERROR = 103
39
- SNMPAPI_TL_UNDELIVERABLE = 104
40
- SNMPAPI_TL_SRC_INVALID = 105
41
- SNMPAPI_TL_INVALID_PARAM = 106
42
- SNMPAPI_TL_IN_USE = 107
43
- SNMPAPI_TL_TIMEOUT = 108
44
- SNMPAPI_TL_PDU_TOO_BIG = 109
45
- SNMPAPI_TL_OTHER = 199
46
-
47
- SNMPAPI_TRANSLATED = 0
48
- SNMPAPI_UNTRANSLATED_V1 = 1
49
- SNMPAPI_UNTRANSLATED_V2 = 2
50
- SNMPAPI_NO_SUPPORT = 0
51
- SNMPAPI_V1_SUPPORT = 1
52
- SNMPAPI_V2_SUPPORT = 2
53
- SNMPAPI_M2M_SUPPORT = 3
54
- SNMPAPI_OFF = 0
55
- SNMPAPI_ON = 1
56
-
57
- API.new('SnmpCancelMsg', 'LI', 'I', 'wsnmp32')
58
- API.new('SnmpCleanup', 'V', 'I', 'wsnmp32')
59
- API.new('SnmpClose', 'L', 'I', 'wsnmp32')
60
- API.new('SnmpContextToStr', 'LP', 'I', 'wsnmp32')
61
- API.new('SnmpDecodeMsg', 'LPPPPP', 'I', 'wsnmp32')
62
- API.new('SnmpEncodeMsg', 'LLLLLP', 'I', 'wsnmp32')
63
- API.new('SnmpEntityToStr', 'LLP', 'I', 'wsnmp32')
64
- API.new('SnmpFreeContext', 'L', 'I', 'wsnmp32')
65
- API.new('SnmpFreeDescriptor', 'LP', 'I', 'wsnmp32')
66
- API.new('SnmpFreeEntity', 'L', 'I', 'wsnmp32')
67
- API.new('SnmpGetLastError', 'L', 'I', 'wsnmp32')
68
- API.new('SnmpListen', 'LL', 'I', 'wsnmp32')
69
- API.new('SnmpOidCompare', 'PPLP', 'I', 'wsnmp32')
70
- API.new('SnmpOidCopy', 'PP', 'I', 'wsnmp32')
71
- API.new('SnmpOidToStr', 'PLP', 'I', 'wsnmp32')
72
- API.new('SnmpOpen', 'LL', 'L', 'wsnmp32')
73
- API.new('SnmpRecvMsg', 'LPPPP', 'I', 'wsnmp32')
74
- API.new('SnmpRegister', 'LLLLPL', 'I', 'wsnmp32')
75
- API.new('SnmpSendMsg', 'LLLLL', 'I', 'wsnmp32')
76
- API.new('SnmpSetPort', 'LL', 'I', 'wsnmp32')
77
- API.new('SnmpStartup', 'PPPPP', 'I', 'wsnmp32')
78
- API.new('SnmpStrToContext', 'LP', 'I', 'wsnmp32')
79
- API.new('SnmpStrToEntity', 'LP', 'I', 'wsnmp32')
80
- API.new('SnmpStrToOid', 'PP', 'I', 'wsnmp32')
81
-
82
- # Windows 2003 Server or later and/or WinSNMP 2.0 or later
83
- begin
84
- API.new('SnmpCreateSession', 'LLKP', 'L', 'wsnmp32')
85
- API.new('SnmpCleanupEx', 'V', 'I', 'wsnmp32')
86
- API.new('SnmpStartupEx', 'PPPPP', 'L', 'wsnmp32')
87
- rescue Win32::API::LoadLibraryError
88
- # Do nothing. It's up to you to check for their existence.
89
- end
90
- end
91
- end
92
- end
1
+ require 'windows/api'
2
+
3
+ module Windows
4
+ module Network
5
+ module SNMP
6
+ API.auto_namespace = 'Windows::Network::SNMP'
7
+ API.auto_constant = true
8
+ API.auto_method = true
9
+ API.auto_unicode = false
10
+
11
+ private
12
+
13
+ SNMPAPI_FAILURE = 0
14
+ SNMPAPI_SUCCESS = 1
15
+ SNMPAPI_ALLOC_ERROR = 2
16
+ SNMPAPI_CONTEXT_INVALID = 3
17
+ SNMPAPI_CONTEXT_UNKNOWN = 4
18
+ SNMPAPI_ENTITY_INVALID = 5
19
+ SNMPAPI_ENTITY_UNKNOWN = 6
20
+ SNMPAPI_INDEX_INVALID = 7
21
+ SNMPAPI_NOOP = 8
22
+ SNMPAPI_OID_INVALID = 9
23
+ SNMPAPI_OPERATION_INVALID = 10
24
+ SNMPAPI_OUTPUT_TRUNCATED = 11
25
+ SNMPAPI_PDU_INVALID = 12
26
+ SNMPAPI_SESSION_INVALID = 13
27
+ SNMPAPI_SYNTAX_INVALID = 14
28
+ SNMPAPI_VBL_INVALID = 15
29
+ SNMPAPI_MODE_INVALID = 16
30
+ SNMPAPI_SIZE_INVALID = 17
31
+ SNMPAPI_NOT_INITIALIZED = 18
32
+ SNMPAPI_MESSAGE_INVALID = 19
33
+ SNMPAPI_HWND_INVALID = 20
34
+ SNMPAPI_OTHER_ERROR = 99
35
+ SNMPAPI_TL_NOT_INITIALIZED = 100
36
+ SNMPAPI_TL_NOT_SUPPORTED = 101
37
+ SNMPAPI_TL_NOT_AVAILABLE = 102
38
+ SNMPAPI_TL_RESOURCE_ERROR = 103
39
+ SNMPAPI_TL_UNDELIVERABLE = 104
40
+ SNMPAPI_TL_SRC_INVALID = 105
41
+ SNMPAPI_TL_INVALID_PARAM = 106
42
+ SNMPAPI_TL_IN_USE = 107
43
+ SNMPAPI_TL_TIMEOUT = 108
44
+ SNMPAPI_TL_PDU_TOO_BIG = 109
45
+ SNMPAPI_TL_OTHER = 199
46
+
47
+ SNMPAPI_TRANSLATED = 0
48
+ SNMPAPI_UNTRANSLATED_V1 = 1
49
+ SNMPAPI_UNTRANSLATED_V2 = 2
50
+ SNMPAPI_NO_SUPPORT = 0
51
+ SNMPAPI_V1_SUPPORT = 1
52
+ SNMPAPI_V2_SUPPORT = 2
53
+ SNMPAPI_M2M_SUPPORT = 3
54
+ SNMPAPI_OFF = 0
55
+ SNMPAPI_ON = 1
56
+
57
+ API.new('SnmpCancelMsg', 'LI', 'I', 'wsnmp32')
58
+ API.new('SnmpCleanup', 'V', 'I', 'wsnmp32')
59
+ API.new('SnmpClose', 'L', 'I', 'wsnmp32')
60
+ API.new('SnmpContextToStr', 'LP', 'I', 'wsnmp32')
61
+ API.new('SnmpDecodeMsg', 'LPPPPP', 'I', 'wsnmp32')
62
+ API.new('SnmpEncodeMsg', 'LLLLLP', 'I', 'wsnmp32')
63
+ API.new('SnmpEntityToStr', 'LLP', 'I', 'wsnmp32')
64
+ API.new('SnmpFreeContext', 'L', 'I', 'wsnmp32')
65
+ API.new('SnmpFreeDescriptor', 'LP', 'I', 'wsnmp32')
66
+ API.new('SnmpFreeEntity', 'L', 'I', 'wsnmp32')
67
+ API.new('SnmpGetLastError', 'L', 'I', 'wsnmp32')
68
+ API.new('SnmpListen', 'LL', 'I', 'wsnmp32')
69
+ API.new('SnmpOidCompare', 'PPLP', 'I', 'wsnmp32')
70
+ API.new('SnmpOidCopy', 'PP', 'I', 'wsnmp32')
71
+ API.new('SnmpOidToStr', 'PLP', 'I', 'wsnmp32')
72
+ API.new('SnmpOpen', 'LL', 'L', 'wsnmp32')
73
+ API.new('SnmpRecvMsg', 'LPPPP', 'I', 'wsnmp32')
74
+ API.new('SnmpRegister', 'LLLLPL', 'I', 'wsnmp32')
75
+ API.new('SnmpSendMsg', 'LLLLL', 'I', 'wsnmp32')
76
+ API.new('SnmpSetPort', 'LL', 'I', 'wsnmp32')
77
+ API.new('SnmpStartup', 'PPPPP', 'I', 'wsnmp32')
78
+ API.new('SnmpStrToContext', 'LP', 'I', 'wsnmp32')
79
+ API.new('SnmpStrToEntity', 'LP', 'I', 'wsnmp32')
80
+ API.new('SnmpStrToOid', 'PP', 'I', 'wsnmp32')
81
+
82
+ # Windows 2003 Server or later and/or WinSNMP 2.0 or later
83
+ begin
84
+ API.new('SnmpCreateSession', 'LLKP', 'L', 'wsnmp32')
85
+ API.new('SnmpCleanupEx', 'V', 'I', 'wsnmp32')
86
+ API.new('SnmpStartupEx', 'PPPPP', 'L', 'wsnmp32')
87
+ rescue Win32::API::LoadLibraryError
88
+ # Do nothing. It's up to you to check for their existence.
89
+ end
90
+ end
91
+ end
92
+ end
@@ -1,128 +1,128 @@
1
- require 'windows/api'
2
-
3
- module Windows
4
- module Network
5
- module Winsock
6
- API.auto_namespace = 'Windows::Network::Winsock'
7
- API.auto_constant = true
8
- API.auto_method = true
9
- API.auto_unicode = true
10
-
11
- private
12
-
13
- # Namespace constants
14
- NS_DEFAULT = 0
15
- NS_SAP = 1
16
- NS_NDS = 2
17
- NS_PEER_BROWSE = 3
18
- NS_TCPIP_LOCAL = 10
19
- NS_TCPIP_HOSTS = 11
20
- NS_DNS = 12
21
- NS_NETBT = 13
22
- NS_WINS = 14
23
- NS_NBP = 20
24
- NS_MS = 30
25
- NS_STDA = 31
26
- NS_NTDS = 32
27
- NS_X500 = 40
28
- NS_NIS = 41
29
- NS_VNS = 50
30
-
31
- # Resolution flags
32
- RES_SOFT_SEARCH = 0x00000001
33
- RES_FIND_MULTIPLE = 0x00000002
34
- RES_SERVICE = 0x00000004
35
-
36
- API.new('accept', 'LPP', 'L', 'ws2_32')
37
- API.new('AcceptEx', 'LLPLLLPP', 'B', 'mswsock')
38
- API.new('bind', 'LPL', 'I', 'ws2_32')
39
- API.new('closesocket', 'L', 'I', 'ws2_32')
40
- API.new('connect', 'LPI', 'I', 'ws2_32')
41
- API.new('EnumProtocols', 'PPP', 'I', 'mswsock')
42
- API.new('GetAcceptExSockaddrs', 'PLLLPPPP', 'V', 'mswsock')
43
- API.new('GetAddressByName', 'LPPPLPPPPP', 'V', 'mswsock')
44
- API.new('gethostbyaddr', 'PII', 'L', 'ws2_32')
45
- API.new('gethostbyname', 'P', 'L', 'ws2_32')
46
- API.new('gethostname', 'PI', 'I', 'ws2_32')
47
- API.new('GetNameByType', 'PPL', 'I', 'mswsock')
48
- API.new('getpeername', 'LPP', 'I', 'ws2_32')
49
- API.new('getprotobyname', 'P', 'L', 'ws2_32')
50
- API.new('getprotobynumber', 'L', 'L', 'ws2_32')
51
- API.new('getservbyname', 'PP', 'L', 'ws2_32')
52
- API.new('getservbyport', 'IP', 'L', 'ws2_32')
53
- API.new('GetService', 'LPPLPPP', 'I', 'mswsock')
54
- API.new('getsockname', 'LPP', 'I', 'ws2_32')
55
- API.new('getsockopt', 'LIIPP', 'I', 'ws2_32')
56
- API.new('GetTypeByName', 'PP', 'I', 'mswsock')
57
- API.new('htonl', 'L', 'L', 'ws2_32')
58
- API.new('htons', 'I', 'I', 'ws2_32')
59
- API.new('inet_addr', 'P', 'L', 'ws2_32')
60
- API.new('inet_ntoa', 'P', 'P', 'ws2_32')
61
- API.new('ioctlsocket', 'LLP', 'I', 'ws2_32')
62
- API.new('listen', 'LI', 'I', 'ws2_32')
63
- API.new('ntohl', 'L', 'L', 'ws2_32')
64
- API.new('ntohs', 'I', 'I', 'ws2_32')
65
- API.new('recv', 'LPII', 'I', 'ws2_32')
66
- API.new('recvfrom', 'LPIIPP', 'I', 'ws2_32')
67
- API.new('select', 'IPPPP', 'I', 'ws2_32')
68
- API.new('send', 'LPII', 'I', 'ws2_32')
69
- API.new('sendto', 'LPIIPI', 'I', 'ws2_32')
70
- API.new('SetService', 'LLLPPP', 'I', 'mswsock')
71
- API.new('setsockopt', 'LIIPI', 'I', 'ws2_32')
72
- API.new('shutdown', 'LI', 'I', 'ws2_32')
73
- API.new('socket', 'III', 'L', 'ws2_32')
74
- API.new('TransmitFile', 'LLLLPPL', 'B', 'mswsock')
75
-
76
- API.new('WSAAccept', 'PPPKL', 'I', 'ws2_32')
77
- API.new('WSAAddressToString', 'PLPPP', 'I', 'ws2_32')
78
- API.new('WSAAsyncGetHostByAddr', 'LIPIIPI', 'L', 'ws2_32')
79
- API.new('WSAAsyncGetHostByName', 'LIPPI', 'L', 'ws2_32')
80
- API.new('WSAAsyncGetProtoByName', 'LIPPI', 'L', 'ws2_32')
81
- API.new('WSAAsyncGetServByName', 'LIPPPL', 'L', 'ws2_32')
82
- API.new('WSAAsyncGetServByPort', 'LIIPPI', 'L', 'ws2_32')
83
- API.new('WSAAsyncSelect', 'PLIL', 'I', 'ws2_32')
84
- API.new('WSACleanup', 'V', 'I', 'ws2_32')
85
- API.new('WSACloseEvent', 'L', 'B', 'ws2_32')
86
- API.new('WSAConnect', 'LPIPPPP', 'I', 'ws2_32')
87
- API.new('WSACreateEvent', 'V', 'L', 'ws2_32')
88
- API.new('WSADuplicateSocket', 'LLP', 'I', 'ws2_32')
89
- API.new('WSAEnumNameSpaceProviders', 'PP', 'I', 'ws2_32')
90
- API.new('WSAEnumNetworkEvents', 'LLP', 'I', 'ws2_32')
91
- API.new('WSAEnumProtocols', 'PPP', 'I', 'ws2_32')
92
- API.new('WSAEventSelect', 'LLL', 'I', 'ws2_32')
93
- API.new('WSAGetLastError', 'V', 'I', 'ws2_32')
94
- API.new('WSAIoctl', 'LLPLPLPPP', 'I', 'ws2_32')
95
- API.new('WSARecv', 'LPLPPPP', 'I', 'ws2_32')
96
- API.new('WSASocket', 'IIIPIL', 'L', 'ws2_32')
97
- API.new('WSAStartup', 'IP', 'I', 'ws2_32')
98
- API.new('WSAStringToAddress', 'PIPPP', 'I', 'ws2_32')
99
- API.new('WSAWaitForMultipleEvents', 'LPBLB', 'L', 'ws2_32')
100
-
101
- # XP or later
102
- begin
103
- API.new('ConnectEx', 'LPIPLPP', 'B', 'mswsock')
104
- API.new('DisconnectEx', 'LPLL', 'B', 'mswsock')
105
- API.new('freeaddrinfo', 'P', 'V', 'ws2_32')
106
- API.new('FreeAddrInfoW', 'P', 'V', 'ws2_32')
107
- API.new('getaddrinfo', 'PPPP', 'I', 'ws2_32')
108
- API.new('GetAddrInfoW', 'PPPP', 'I', 'mswsock')
109
- API.new('getnameinfo', 'PLPLPLI', 'I', 'ws2_32')
110
- API.new('GetNameInfoW', 'PLPLPLI', 'I', 'ws2_32')
111
- rescue Win32::API::LoadLibraryError
112
- # Do nothing, not supported on your platform.
113
- end
114
-
115
- # Vista or later
116
- begin
117
- API.new('FreeAddrInfoEx', 'P', 'V', 'ws2_32')
118
- API.new('GetAddrInfoEx', 'PPLPPPPPPP', 'I', 'ws2_32')
119
- API.new('WSAConnectByList', 'LPPPPPPP', 'B', 'ws2_32')
120
- API.new('WSAConnectByName', 'LPPPPPPP', 'B', 'ws2_32')
121
- API.new('WSADeleteSocketPeerTargetName', 'LPPPP', 'I', 'ws2_32')
122
- API.new('WSAPoll', 'PLI', 'I', 'ws2_32')
123
- rescue Win32::API::LoadLibraryError
124
- # Do nothing, not supported on your platform.
125
- end
126
- end
127
- end
128
- end
1
+ require 'windows/api'
2
+
3
+ module Windows
4
+ module Network
5
+ module Winsock
6
+ API.auto_namespace = 'Windows::Network::Winsock'
7
+ API.auto_constant = true
8
+ API.auto_method = true
9
+ API.auto_unicode = true
10
+
11
+ private
12
+
13
+ # Namespace constants
14
+ NS_DEFAULT = 0
15
+ NS_SAP = 1
16
+ NS_NDS = 2
17
+ NS_PEER_BROWSE = 3
18
+ NS_TCPIP_LOCAL = 10
19
+ NS_TCPIP_HOSTS = 11
20
+ NS_DNS = 12
21
+ NS_NETBT = 13
22
+ NS_WINS = 14
23
+ NS_NBP = 20
24
+ NS_MS = 30
25
+ NS_STDA = 31
26
+ NS_NTDS = 32
27
+ NS_X500 = 40
28
+ NS_NIS = 41
29
+ NS_VNS = 50
30
+
31
+ # Resolution flags
32
+ RES_SOFT_SEARCH = 0x00000001
33
+ RES_FIND_MULTIPLE = 0x00000002
34
+ RES_SERVICE = 0x00000004
35
+
36
+ API.new('accept', 'LPP', 'L', 'ws2_32')
37
+ API.new('AcceptEx', 'LLPLLLPP', 'B', 'mswsock')
38
+ API.new('bind', 'LPL', 'I', 'ws2_32')
39
+ API.new('closesocket', 'L', 'I', 'ws2_32')
40
+ API.new('connect', 'LPI', 'I', 'ws2_32')
41
+ API.new('EnumProtocols', 'PPP', 'I', 'mswsock')
42
+ API.new('GetAcceptExSockaddrs', 'PLLLPPPP', 'V', 'mswsock')
43
+ API.new('GetAddressByName', 'LPPPLPPPPP', 'V', 'mswsock')
44
+ API.new('gethostbyaddr', 'PII', 'L', 'ws2_32')
45
+ API.new('gethostbyname', 'P', 'L', 'ws2_32')
46
+ API.new('gethostname', 'PI', 'I', 'ws2_32')
47
+ API.new('GetNameByType', 'PPL', 'I', 'mswsock')
48
+ API.new('getpeername', 'LPP', 'I', 'ws2_32')
49
+ API.new('getprotobyname', 'P', 'L', 'ws2_32')
50
+ API.new('getprotobynumber', 'L', 'L', 'ws2_32')
51
+ API.new('getservbyname', 'PP', 'L', 'ws2_32')
52
+ API.new('getservbyport', 'IP', 'L', 'ws2_32')
53
+ API.new('GetService', 'LPPLPPP', 'I', 'mswsock')
54
+ API.new('getsockname', 'LPP', 'I', 'ws2_32')
55
+ API.new('getsockopt', 'LIIPP', 'I', 'ws2_32')
56
+ API.new('GetTypeByName', 'PP', 'I', 'mswsock')
57
+ API.new('htonl', 'L', 'L', 'ws2_32')
58
+ API.new('htons', 'I', 'I', 'ws2_32')
59
+ API.new('inet_addr', 'P', 'L', 'ws2_32')
60
+ API.new('inet_ntoa', 'P', 'P', 'ws2_32')
61
+ API.new('ioctlsocket', 'LLP', 'I', 'ws2_32')
62
+ API.new('listen', 'LI', 'I', 'ws2_32')
63
+ API.new('ntohl', 'L', 'L', 'ws2_32')
64
+ API.new('ntohs', 'I', 'I', 'ws2_32')
65
+ API.new('recv', 'LPII', 'I', 'ws2_32')
66
+ API.new('recvfrom', 'LPIIPP', 'I', 'ws2_32')
67
+ API.new('select', 'IPPPP', 'I', 'ws2_32')
68
+ API.new('send', 'LPII', 'I', 'ws2_32')
69
+ API.new('sendto', 'LPIIPI', 'I', 'ws2_32')
70
+ API.new('SetService', 'LLLPPP', 'I', 'mswsock')
71
+ API.new('setsockopt', 'LIIPI', 'I', 'ws2_32')
72
+ API.new('shutdown', 'LI', 'I', 'ws2_32')
73
+ API.new('socket', 'III', 'L', 'ws2_32')
74
+ API.new('TransmitFile', 'LLLLPPL', 'B', 'mswsock')
75
+
76
+ API.new('WSAAccept', 'PPPKL', 'I', 'ws2_32')
77
+ API.new('WSAAddressToString', 'PLPPP', 'I', 'ws2_32')
78
+ API.new('WSAAsyncGetHostByAddr', 'LIPIIPI', 'L', 'ws2_32')
79
+ API.new('WSAAsyncGetHostByName', 'LIPPI', 'L', 'ws2_32')
80
+ API.new('WSAAsyncGetProtoByName', 'LIPPI', 'L', 'ws2_32')
81
+ API.new('WSAAsyncGetServByName', 'LIPPPL', 'L', 'ws2_32')
82
+ API.new('WSAAsyncGetServByPort', 'LIIPPI', 'L', 'ws2_32')
83
+ API.new('WSAAsyncSelect', 'PLIL', 'I', 'ws2_32')
84
+ API.new('WSACleanup', 'V', 'I', 'ws2_32')
85
+ API.new('WSACloseEvent', 'L', 'B', 'ws2_32')
86
+ API.new('WSAConnect', 'LPIPPPP', 'I', 'ws2_32')
87
+ API.new('WSACreateEvent', 'V', 'L', 'ws2_32')
88
+ API.new('WSADuplicateSocket', 'LLP', 'I', 'ws2_32')
89
+ API.new('WSAEnumNameSpaceProviders', 'PP', 'I', 'ws2_32')
90
+ API.new('WSAEnumNetworkEvents', 'LLP', 'I', 'ws2_32')
91
+ API.new('WSAEnumProtocols', 'PPP', 'I', 'ws2_32')
92
+ API.new('WSAEventSelect', 'LLL', 'I', 'ws2_32')
93
+ API.new('WSAGetLastError', 'V', 'I', 'ws2_32')
94
+ API.new('WSAIoctl', 'LLPLPLPPP', 'I', 'ws2_32')
95
+ API.new('WSARecv', 'LPLPPPP', 'I', 'ws2_32')
96
+ API.new('WSASocket', 'IIIPIL', 'L', 'ws2_32')
97
+ API.new('WSAStartup', 'IP', 'I', 'ws2_32')
98
+ API.new('WSAStringToAddress', 'PIPPP', 'I', 'ws2_32')
99
+ API.new('WSAWaitForMultipleEvents', 'LPBLB', 'L', 'ws2_32')
100
+
101
+ # XP or later
102
+ begin
103
+ API.new('ConnectEx', 'LPIPLPP', 'B', 'mswsock')
104
+ API.new('DisconnectEx', 'LPLL', 'B', 'mswsock')
105
+ API.new('freeaddrinfo', 'P', 'V', 'ws2_32')
106
+ API.new('FreeAddrInfoW', 'P', 'V', 'ws2_32')
107
+ API.new('getaddrinfo', 'PPPP', 'I', 'ws2_32')
108
+ API.new('GetAddrInfoW', 'PPPP', 'I', 'mswsock')
109
+ API.new('getnameinfo', 'PLPLPLI', 'I', 'ws2_32')
110
+ API.new('GetNameInfoW', 'PLPLPLI', 'I', 'ws2_32')
111
+ rescue Win32::API::LoadLibraryError
112
+ # Do nothing, not supported on your platform.
113
+ end
114
+
115
+ # Vista or later
116
+ begin
117
+ API.new('FreeAddrInfoEx', 'P', 'V', 'ws2_32')
118
+ API.new('GetAddrInfoEx', 'PPLPPPPPPP', 'I', 'ws2_32')
119
+ API.new('WSAConnectByList', 'LPPPPPPP', 'B', 'ws2_32')
120
+ API.new('WSAConnectByName', 'LPPPPPPP', 'B', 'ws2_32')
121
+ API.new('WSADeleteSocketPeerTargetName', 'LPPPP', 'I', 'ws2_32')
122
+ API.new('WSAPoll', 'PLI', 'I', 'ws2_32')
123
+ rescue Win32::API::LoadLibraryError
124
+ # Do nothing, not supported on your platform.
125
+ end
126
+ end
127
+ end
128
+ end
@@ -1,50 +1,50 @@
1
- require 'windows/api'
2
-
3
- module Windows
4
- module NIO
5
- API.auto_namespace = 'Windows::NIO'
6
- API.auto_constant = true
7
- API.auto_method = true
8
- API.auto_unicode = false
9
-
10
- private
11
-
12
- # OpenFile() constants
13
-
14
- OF_READ = 0x00000000
15
- OF_WRITE = 0x00000001
16
- OF_READWRITE = 0x00000002
17
- OF_SHARE_COMPAT = 0x00000000
18
- OF_SHARE_EXCLUSIVE = 0x00000010
19
- OF_SHARE_DENY_WRITE = 0x00000020
20
- OF_SHARE_DENY_READ = 0x00000030
21
- OF_SHARE_DENY_NONE = 0x00000040
22
- OF_PARSE = 0x00000100
23
- OF_DELETE = 0x00000200
24
- OF_VERIFY = 0x00000400
25
- OF_CANCEL = 0x00000800
26
- OF_CREATE = 0x00001000
27
- OF_PROMPT = 0x00002000
28
- OF_EXIST = 0x00004000
29
- OF_REOPEN = 0x00008000
30
-
31
- API.new('CancelIo', 'L', 'B')
32
- API.new('CreateIoCompletionPort', 'LLPL', 'L')
33
- API.new('FlushFileBuffers', 'L', 'B')
34
- API.new('GetQueuedCompletionStatus', 'LPPPL', 'B')
35
- API.new('OpenFile', 'PPI', 'L')
36
- API.new('PostQueuedCompletionStatus', 'LLPP', 'B')
37
- API.new('ReadFileScatter', 'LPLPP', 'B')
38
- API.new('SetEndOfFile', 'L', 'B')
39
- API.new('SetFilePointer', 'LLPL', 'L')
40
- API.new('SetFilePointerEx', 'LLPL', 'B')
41
- API.new('WriteFileGather', 'LPLPP', 'B')
42
-
43
- begin
44
- API.new('CancelIoEx', 'LP', 'B')
45
- API.new('CancelSynchronousIo', 'L', 'B')
46
- rescue Win32::API::LoadLibraryError
47
- # Windows Vista or later
48
- end
49
- end
50
- end
1
+ require 'windows/api'
2
+
3
+ module Windows
4
+ module NIO
5
+ API.auto_namespace = 'Windows::NIO'
6
+ API.auto_constant = true
7
+ API.auto_method = true
8
+ API.auto_unicode = false
9
+
10
+ private
11
+
12
+ # OpenFile() constants
13
+
14
+ OF_READ = 0x00000000
15
+ OF_WRITE = 0x00000001
16
+ OF_READWRITE = 0x00000002
17
+ OF_SHARE_COMPAT = 0x00000000
18
+ OF_SHARE_EXCLUSIVE = 0x00000010
19
+ OF_SHARE_DENY_WRITE = 0x00000020
20
+ OF_SHARE_DENY_READ = 0x00000030
21
+ OF_SHARE_DENY_NONE = 0x00000040
22
+ OF_PARSE = 0x00000100
23
+ OF_DELETE = 0x00000200
24
+ OF_VERIFY = 0x00000400
25
+ OF_CANCEL = 0x00000800
26
+ OF_CREATE = 0x00001000
27
+ OF_PROMPT = 0x00002000
28
+ OF_EXIST = 0x00004000
29
+ OF_REOPEN = 0x00008000
30
+
31
+ API.new('CancelIo', 'L', 'B')
32
+ API.new('CreateIoCompletionPort', 'LLPL', 'L')
33
+ API.new('FlushFileBuffers', 'L', 'B')
34
+ API.new('GetQueuedCompletionStatus', 'LPPPL', 'B')
35
+ API.new('OpenFile', 'PPI', 'L')
36
+ API.new('PostQueuedCompletionStatus', 'LLPP', 'B')
37
+ API.new('ReadFileScatter', 'LPLPP', 'B')
38
+ API.new('SetEndOfFile', 'L', 'B')
39
+ API.new('SetFilePointer', 'LLPL', 'L')
40
+ API.new('SetFilePointerEx', 'LLPL', 'B')
41
+ API.new('WriteFileGather', 'LPLPP', 'B')
42
+
43
+ begin
44
+ API.new('CancelIoEx', 'LP', 'B')
45
+ API.new('CancelSynchronousIo', 'L', 'B')
46
+ rescue Win32::API::LoadLibraryError
47
+ # Windows Vista or later
48
+ end
49
+ end
50
+ end