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,35 +1,35 @@
1
- require 'windows/api'
2
-
3
- module Windows
4
- module Debug
5
- API.auto_namespace = 'Windows::Debug'
6
- API.auto_constant = true
7
- API.auto_method = true
8
- API.auto_unicode = false
9
-
10
- private
11
-
12
- API.new('ContinueDebugEvent', 'LLL', 'B')
13
- API.new('DebugActiveProcess', 'L', 'B')
14
- API.new('DebugBreak', 'V', 'V')
15
- API.new('FatalExit', 'I', 'V')
16
- API.new('FlushInstructionCache', 'LLL', 'B')
17
- API.new('GetThreadContext', 'LP', 'B')
18
- API.new('GetThreadSelectorEntry', 'LLP', 'B')
19
- API.new('IsDebuggerPresent', 'V', 'B')
20
- API.new('OutputDebugString', 'P', 'V')
21
- API.new('ReadProcessMemory', 'LLPLP', 'B')
22
- API.new('SetThreadContext', 'LP', 'B')
23
- API.new('WaitForDebugEvent', 'PL', 'B')
24
- API.new('WriteProcessMemory', 'LLPLP', 'B')
25
-
26
- begin
27
- API.new('CheckRemoteDebuggerPresent', 'LP', 'B')
28
- API.new('DebugActiveProcessStop', 'L', 'B')
29
- API.new('DebugBreakProcess', 'L', 'B')
30
- API.new('DebugSetProcessKillOnExit', 'I', 'B')
31
- rescue Win32::API::LoadLibraryError
32
- # Windows XP or later
33
- end
34
- end
35
- end
1
+ require 'windows/api'
2
+
3
+ module Windows
4
+ module Debug
5
+ API.auto_namespace = 'Windows::Debug'
6
+ API.auto_constant = true
7
+ API.auto_method = true
8
+ API.auto_unicode = false
9
+
10
+ private
11
+
12
+ API.new('ContinueDebugEvent', 'LLL', 'B')
13
+ API.new('DebugActiveProcess', 'L', 'B')
14
+ API.new('DebugBreak', 'V', 'V')
15
+ API.new('FatalExit', 'I', 'V')
16
+ API.new('FlushInstructionCache', 'LLL', 'B')
17
+ API.new('GetThreadContext', 'LP', 'B')
18
+ API.new('GetThreadSelectorEntry', 'LLP', 'B')
19
+ API.new('IsDebuggerPresent', 'V', 'B')
20
+ API.new('OutputDebugString', 'P', 'V')
21
+ API.new('ReadProcessMemory', 'LLPLP', 'B')
22
+ API.new('SetThreadContext', 'LP', 'B')
23
+ API.new('WaitForDebugEvent', 'PL', 'B')
24
+ API.new('WriteProcessMemory', 'LLPLP', 'B')
25
+
26
+ begin
27
+ API.new('CheckRemoteDebuggerPresent', 'LP', 'B')
28
+ API.new('DebugActiveProcessStop', 'L', 'B')
29
+ API.new('DebugBreakProcess', 'L', 'B')
30
+ API.new('DebugSetProcessKillOnExit', 'I', 'B')
31
+ rescue Win32::API::LoadLibraryError
32
+ # Windows XP or later
33
+ end
34
+ end
35
+ end
@@ -1,248 +1,248 @@
1
- require 'windows/api'
2
-
3
- module Windows
4
- module DeviceIO
5
- API.auto_namespace = 'Windows::DeviceIO'
6
- API.auto_constant = true
7
- API.auto_method = true
8
- API.auto_unicode = false
9
-
10
- private
11
-
12
- # Device Types
13
- FILE_DEVICE_BEEP = 0x00000001
14
- FILE_DEVICE_CD_ROM = 0x00000002
15
- FILE_DEVICE_CD_ROM_FILE_SYSTEM = 0x00000003
16
- FILE_DEVICE_CONTROLLER = 0x00000004
17
- FILE_DEVICE_DATALINK = 0x00000005
18
- FILE_DEVICE_DFS = 0x00000006
19
- FILE_DEVICE_DISK = 0x00000007
20
- FILE_DEVICE_DISK_FILE_SYSTEM = 0x00000008
21
- FILE_DEVICE_FILE_SYSTEM = 0x00000009
22
- FILE_DEVICE_INPORT_PORT = 0x0000000a
23
- FILE_DEVICE_KEYBOARD = 0x0000000b
24
- FILE_DEVICE_MAILSLOT = 0x0000000c
25
- FILE_DEVICE_MIDI_IN = 0x0000000d
26
- FILE_DEVICE_MIDI_OUT = 0x0000000e
27
- FILE_DEVICE_MOUSE = 0x0000000f
28
- FILE_DEVICE_MULTI_UNC_PROVIDER = 0x00000010
29
- FILE_DEVICE_NAMED_PIPE = 0x00000011
30
- FILE_DEVICE_NETWORK = 0x00000012
31
- FILE_DEVICE_NETWORK_BROWSER = 0x00000013
32
- FILE_DEVICE_NETWORK_FILE_SYSTEM = 0x00000014
33
- FILE_DEVICE_NULL = 0x00000015
34
- FILE_DEVICE_PARALLEL_PORT = 0x00000016
35
- FILE_DEVICE_PHYSICAL_NETCARD = 0x00000017
36
- FILE_DEVICE_PRINTER = 0x00000018
37
- FILE_DEVICE_SCANNER = 0x00000019
38
- FILE_DEVICE_SERIAL_MOUSE_PORT = 0x0000001a
39
- FILE_DEVICE_SERIAL_PORT = 0x0000001b
40
- FILE_DEVICE_SCREEN = 0x0000001c
41
- FILE_DEVICE_SOUND = 0x0000001d
42
- FILE_DEVICE_STREAMS = 0x0000001e
43
- FILE_DEVICE_TAPE = 0x0000001f
44
- FILE_DEVICE_TAPE_FILE_SYSTEM = 0x00000020
45
- FILE_DEVICE_TRANSPORT = 0x00000021
46
- FILE_DEVICE_UNKNOWN = 0x00000022
47
- FILE_DEVICE_VIDEO = 0x00000023
48
- FILE_DEVICE_VIRTUAL_DISK = 0x00000024
49
- FILE_DEVICE_WAVE_IN = 0x00000025
50
- FILE_DEVICE_WAVE_OUT = 0x00000026
51
- FILE_DEVICE_8042_PORT = 0x00000027
52
- FILE_DEVICE_NETWORK_REDIRECTOR = 0x00000028
53
- FILE_DEVICE_BATTERY = 0x00000029
54
- FILE_DEVICE_BUS_EXTENDER = 0x0000002a
55
- FILE_DEVICE_MODEM = 0x0000002b
56
- FILE_DEVICE_VDM = 0x0000002c
57
- FILE_DEVICE_MASS_STORAGE = 0x0000002d
58
- FILE_DEVICE_SMB = 0x0000002e
59
- FILE_DEVICE_KS = 0x0000002f
60
- FILE_DEVICE_CHANGER = 0x00000030
61
- FILE_DEVICE_SMARTCARD = 0x00000031
62
- FILE_DEVICE_ACPI = 0x00000032
63
- FILE_DEVICE_DVD = 0x00000033
64
- FILE_DEVICE_FULLSCREEN_VIDEO = 0x00000034
65
- FILE_DEVICE_DFS_FILE_SYSTEM = 0x00000035
66
- FILE_DEVICE_DFS_VOLUME = 0x00000036
67
- FILE_DEVICE_SERENUM = 0x00000037
68
- FILE_DEVICE_TERMSRV = 0x00000038
69
- FILE_DEVICE_KSEC = 0x00000039
70
- FILE_DEVICE_FIPS = 0x0000003A
71
- FILE_DEVICE_INFINIBAND = 0x0000003B
72
-
73
- IOCTL_DISK_BASE = FILE_DEVICE_DISK
74
-
75
- FILE_ANY_ACCESS = 0
76
- FILE_READ_ACCESS = 0x0001
77
- FILE_WRITE_ACCESS = 0x0002
78
- FILE_SPECIAL_ACCESS = FILE_ANY_ACCESS
79
-
80
- METHOD_BUFFERED = 0
81
- METHOD_IN_DIRECT = 1
82
- METHOD_OUT_DIRECT = 2
83
- METHOD_NEITHER = 3
84
-
85
- API.new('DeviceIoControl', 'LLPLPLPP', 'B')
86
-
87
- # Macros from WinIoCtl.h
88
-
89
- def CTL_CODE(device, function, method, access)
90
- ((device) << 16) | ((access) << 14) | ((function) << 2) | (method)
91
- end
92
-
93
- def FSCTL_SET_COMPRESSION
94
- CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 16, METHOD_BUFFERED, 3)
95
- end
96
-
97
- def FSCTL_ENUM_USN_DATA
98
- CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 44, METHOD_NEITHER, 0)
99
- end
100
-
101
- def FSCTL_READ_USN_JOURNAL
102
- CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 46, METHOD_NEITHER, 0)
103
- end
104
-
105
- def FSCTL_SET_SPARSE
106
- CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, 0)
107
- end
108
-
109
- def FSCTL_CREATE_USN_JOURNAL
110
- CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 57, METHOD_NEITHER, 0)
111
- end
112
-
113
- def FSCTL_READ_FILE_USN_DATA
114
- CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 58, METHOD_NEITHER, 0)
115
- end
116
-
117
- def FSCTL_WRITE_USN_CLOSE_RECORD
118
- CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 59, METHOD_NEITHER, 0)
119
- end
120
-
121
- def FSCTL_EXTEND_VOLUME
122
- CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 60, METHOD_BUFFERED, 0)
123
- end
124
-
125
- def FSCTL_QUERY_USN_JOURNAL
126
- CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 61, METHOD_BUFFERED, 0)
127
- end
128
-
129
- def FSCTL_DELETE_USN_JOURNAL
130
- CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 62, METHOD_BUFFERED, 0)
131
- end
132
-
133
- def IOCTL_DISK_GET_DRIVE_GEOMETRY
134
- CTL_CODE(IOCTL_DISK_BASE, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
135
- end
136
-
137
- def IOCTL_DISK_GET_PARTITION_INFO
138
- CTL_CODE(IOCTL_DISK_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
139
- end
140
-
141
- def IOCTL_DISK_SET_PARTITION_INFO
142
- CTL_CODE(IOCTL_DISK_BASE, 0x0002, METHOD_BUFFERED,
143
- FILE_READ_ACCESS | FILE_WRITE_ACCESS
144
- )
145
- end
146
-
147
- def IOCTL_DISK_GET_DRIVE_LAYOUT
148
- CTL_CODE(IOCTL_DISK_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
149
- end
150
-
151
- def IOCTL_DISK_SET_DRIVE_LAYOUT
152
- CTL_CODE(IOCTL_DISK_BASE, 0x0004, METHOD_BUFFERED,
153
- FILE_READ_ACCESS | FILE_WRITE_ACCESS)
154
- end
155
-
156
- def IOCTL_DISK_VERIFY
157
- CTL_CODE(IOCTL_DISK_BASE, 0x0005, METHOD_BUFFERED, FILE_ANY_ACCESS)
158
- end
159
-
160
- def IOCTL_DISK_FORMAT_TRACKS
161
- CTL_CODE(IOCTL_DISK_BASE, 0x0006, METHOD_BUFFERED,
162
- FILE_READ_ACCESS | FILE_WRITE_ACCESS
163
- )
164
- end
165
-
166
- def IOCTL_DISK_REASSIGN_BLOCKS
167
- CTL_CODE(IOCTL_DISK_BASE, 0x0007, METHOD_BUFFERED,
168
- FILE_READ_ACCESS | FILE_WRITE_ACCESS
169
- )
170
- end
171
-
172
- def IOCTL_DISK_PERFORMANCE
173
- CTL_CODE(IOCTL_DISK_BASE, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
174
- end
175
-
176
- def IOCTL_DISK_IS_WRITABLE
177
- CTL_CODE(IOCTL_DISK_BASE, 0x0009, METHOD_BUFFERED, FILE_ANY_ACCESS)
178
- end
179
-
180
- def IOCTL_DISK_LOGGING
181
- CTL_CODE(IOCTL_DISK_BASE, 0x000a, METHOD_BUFFERED, FILE_ANY_ACCESS)
182
- end
183
-
184
- def IOCTL_DISK_FORMAT_TRACKS_EX
185
- CTL_CODE(IOCTL_DISK_BASE, 0x000b, METHOD_BUFFERED,
186
- FILE_READ_ACCESS | FILE_WRITE_ACCESS
187
- )
188
- end
189
-
190
- def IOCTL_DISK_HISTOGRAM_STRUCTURE
191
- CTL_CODE(IOCTL_DISK_BASE, 0x000c, METHOD_BUFFERED, FILE_ANY_ACCESS)
192
- end
193
-
194
- def IOCTL_DISK_HISTOGRAM_DATA
195
- CTL_CODE(IOCTL_DISK_BASE, 0x000d, METHOD_BUFFERED, FILE_ANY_ACCESS)
196
- end
197
-
198
- def IOCTL_DISK_HISTOGRAM_RESET
199
- CTL_CODE(IOCTL_DISK_BASE, 0x000e, METHOD_BUFFERED, FILE_ANY_ACCESS)
200
- end
201
-
202
- def IOCTL_DISK_REQUEST_STRUCTURE
203
- CTL_CODE(IOCTL_DISK_BASE, 0x000f, METHOD_BUFFERED, FILE_ANY_ACCESS)
204
- end
205
-
206
- def IOCTL_DISK_REQUEST_DATA
207
- CTL_CODE(IOCTL_DISK_BASE, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
208
- end
209
-
210
- def IOCTL_DISK_PERFORMANCE_OFF
211
- CTL_CODE(IOCTL_DISK_BASE, 0x0018, METHOD_BUFFERED, FILE_ANY_ACCESS)
212
- end
213
-
214
- def IOCTL_DISK_GET_PARTITION_INFO_EX
215
- CTL_CODE(IOCTL_DISK_BASE, 0x0012, METHOD_BUFFERED, FILE_ANY_ACCESS)
216
- end
217
-
218
- def IOCTL_DISK_SET_PARTITION_INFO_EX
219
- CTL_CODE(IOCTL_DISK_BASE, 0x0013, METHOD_BUFFERED,
220
- FILE_READ_ACCESS | FILE_WRITE_ACCESS
221
- )
222
- end
223
-
224
- def IOCTL_DISK_GET_DRIVE_LAYOUT_EX
225
- CTL_CODE(IOCTL_DISK_BASE, 0x0014, METHOD_BUFFERED, FILE_ANY_ACCESS)
226
- end
227
-
228
- def IOCTL_DISK_SET_DRIVE_LAYOUT_EX
229
- CTL_CODE(IOCTL_DISK_BASE, 0x0015, METHOD_BUFFERED,
230
- FILE_READ_ACCESS | FILE_WRITE_ACCESS
231
- )
232
- end
233
-
234
- def IOCTL_DISK_CREATE_DISK
235
- CTL_CODE(IOCTL_DISK_BASE, 0x0016, METHOD_BUFFERED,
236
- FILE_READ_ACCESS | FILE_WRITE_ACCESS
237
- )
238
- end
239
-
240
- def IOCTL_DISK_GET_LENGTH_INFO
241
- CTL_CODE(IOCTL_DISK_BASE, 0x0017, METHOD_BUFFERED, FILE_READ_ACCESS)
242
- end
243
-
244
- def IOCTL_DISK_GET_DRIVE_GEOMETRY_EX
245
- CTL_CODE(IOCTL_DISK_BASE, 0x0028, METHOD_BUFFERED, FILE_ANY_ACCESS)
246
- end
247
- end
248
- end
1
+ require 'windows/api'
2
+
3
+ module Windows
4
+ module DeviceIO
5
+ API.auto_namespace = 'Windows::DeviceIO'
6
+ API.auto_constant = true
7
+ API.auto_method = true
8
+ API.auto_unicode = false
9
+
10
+ private
11
+
12
+ # Device Types
13
+ FILE_DEVICE_BEEP = 0x00000001
14
+ FILE_DEVICE_CD_ROM = 0x00000002
15
+ FILE_DEVICE_CD_ROM_FILE_SYSTEM = 0x00000003
16
+ FILE_DEVICE_CONTROLLER = 0x00000004
17
+ FILE_DEVICE_DATALINK = 0x00000005
18
+ FILE_DEVICE_DFS = 0x00000006
19
+ FILE_DEVICE_DISK = 0x00000007
20
+ FILE_DEVICE_DISK_FILE_SYSTEM = 0x00000008
21
+ FILE_DEVICE_FILE_SYSTEM = 0x00000009
22
+ FILE_DEVICE_INPORT_PORT = 0x0000000a
23
+ FILE_DEVICE_KEYBOARD = 0x0000000b
24
+ FILE_DEVICE_MAILSLOT = 0x0000000c
25
+ FILE_DEVICE_MIDI_IN = 0x0000000d
26
+ FILE_DEVICE_MIDI_OUT = 0x0000000e
27
+ FILE_DEVICE_MOUSE = 0x0000000f
28
+ FILE_DEVICE_MULTI_UNC_PROVIDER = 0x00000010
29
+ FILE_DEVICE_NAMED_PIPE = 0x00000011
30
+ FILE_DEVICE_NETWORK = 0x00000012
31
+ FILE_DEVICE_NETWORK_BROWSER = 0x00000013
32
+ FILE_DEVICE_NETWORK_FILE_SYSTEM = 0x00000014
33
+ FILE_DEVICE_NULL = 0x00000015
34
+ FILE_DEVICE_PARALLEL_PORT = 0x00000016
35
+ FILE_DEVICE_PHYSICAL_NETCARD = 0x00000017
36
+ FILE_DEVICE_PRINTER = 0x00000018
37
+ FILE_DEVICE_SCANNER = 0x00000019
38
+ FILE_DEVICE_SERIAL_MOUSE_PORT = 0x0000001a
39
+ FILE_DEVICE_SERIAL_PORT = 0x0000001b
40
+ FILE_DEVICE_SCREEN = 0x0000001c
41
+ FILE_DEVICE_SOUND = 0x0000001d
42
+ FILE_DEVICE_STREAMS = 0x0000001e
43
+ FILE_DEVICE_TAPE = 0x0000001f
44
+ FILE_DEVICE_TAPE_FILE_SYSTEM = 0x00000020
45
+ FILE_DEVICE_TRANSPORT = 0x00000021
46
+ FILE_DEVICE_UNKNOWN = 0x00000022
47
+ FILE_DEVICE_VIDEO = 0x00000023
48
+ FILE_DEVICE_VIRTUAL_DISK = 0x00000024
49
+ FILE_DEVICE_WAVE_IN = 0x00000025
50
+ FILE_DEVICE_WAVE_OUT = 0x00000026
51
+ FILE_DEVICE_8042_PORT = 0x00000027
52
+ FILE_DEVICE_NETWORK_REDIRECTOR = 0x00000028
53
+ FILE_DEVICE_BATTERY = 0x00000029
54
+ FILE_DEVICE_BUS_EXTENDER = 0x0000002a
55
+ FILE_DEVICE_MODEM = 0x0000002b
56
+ FILE_DEVICE_VDM = 0x0000002c
57
+ FILE_DEVICE_MASS_STORAGE = 0x0000002d
58
+ FILE_DEVICE_SMB = 0x0000002e
59
+ FILE_DEVICE_KS = 0x0000002f
60
+ FILE_DEVICE_CHANGER = 0x00000030
61
+ FILE_DEVICE_SMARTCARD = 0x00000031
62
+ FILE_DEVICE_ACPI = 0x00000032
63
+ FILE_DEVICE_DVD = 0x00000033
64
+ FILE_DEVICE_FULLSCREEN_VIDEO = 0x00000034
65
+ FILE_DEVICE_DFS_FILE_SYSTEM = 0x00000035
66
+ FILE_DEVICE_DFS_VOLUME = 0x00000036
67
+ FILE_DEVICE_SERENUM = 0x00000037
68
+ FILE_DEVICE_TERMSRV = 0x00000038
69
+ FILE_DEVICE_KSEC = 0x00000039
70
+ FILE_DEVICE_FIPS = 0x0000003A
71
+ FILE_DEVICE_INFINIBAND = 0x0000003B
72
+
73
+ IOCTL_DISK_BASE = FILE_DEVICE_DISK
74
+
75
+ FILE_ANY_ACCESS = 0
76
+ FILE_READ_ACCESS = 0x0001
77
+ FILE_WRITE_ACCESS = 0x0002
78
+ FILE_SPECIAL_ACCESS = FILE_ANY_ACCESS
79
+
80
+ METHOD_BUFFERED = 0
81
+ METHOD_IN_DIRECT = 1
82
+ METHOD_OUT_DIRECT = 2
83
+ METHOD_NEITHER = 3
84
+
85
+ API.new('DeviceIoControl', 'LLPLPLPP', 'B')
86
+
87
+ # Macros from WinIoCtl.h
88
+
89
+ def CTL_CODE(device, function, method, access)
90
+ ((device) << 16) | ((access) << 14) | ((function) << 2) | (method)
91
+ end
92
+
93
+ def FSCTL_SET_COMPRESSION
94
+ CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 16, METHOD_BUFFERED, 3)
95
+ end
96
+
97
+ def FSCTL_ENUM_USN_DATA
98
+ CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 44, METHOD_NEITHER, 0)
99
+ end
100
+
101
+ def FSCTL_READ_USN_JOURNAL
102
+ CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 46, METHOD_NEITHER, 0)
103
+ end
104
+
105
+ def FSCTL_SET_SPARSE
106
+ CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, 0)
107
+ end
108
+
109
+ def FSCTL_CREATE_USN_JOURNAL
110
+ CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 57, METHOD_NEITHER, 0)
111
+ end
112
+
113
+ def FSCTL_READ_FILE_USN_DATA
114
+ CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 58, METHOD_NEITHER, 0)
115
+ end
116
+
117
+ def FSCTL_WRITE_USN_CLOSE_RECORD
118
+ CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 59, METHOD_NEITHER, 0)
119
+ end
120
+
121
+ def FSCTL_EXTEND_VOLUME
122
+ CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 60, METHOD_BUFFERED, 0)
123
+ end
124
+
125
+ def FSCTL_QUERY_USN_JOURNAL
126
+ CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 61, METHOD_BUFFERED, 0)
127
+ end
128
+
129
+ def FSCTL_DELETE_USN_JOURNAL
130
+ CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 62, METHOD_BUFFERED, 0)
131
+ end
132
+
133
+ def IOCTL_DISK_GET_DRIVE_GEOMETRY
134
+ CTL_CODE(IOCTL_DISK_BASE, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
135
+ end
136
+
137
+ def IOCTL_DISK_GET_PARTITION_INFO
138
+ CTL_CODE(IOCTL_DISK_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
139
+ end
140
+
141
+ def IOCTL_DISK_SET_PARTITION_INFO
142
+ CTL_CODE(IOCTL_DISK_BASE, 0x0002, METHOD_BUFFERED,
143
+ FILE_READ_ACCESS | FILE_WRITE_ACCESS
144
+ )
145
+ end
146
+
147
+ def IOCTL_DISK_GET_DRIVE_LAYOUT
148
+ CTL_CODE(IOCTL_DISK_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
149
+ end
150
+
151
+ def IOCTL_DISK_SET_DRIVE_LAYOUT
152
+ CTL_CODE(IOCTL_DISK_BASE, 0x0004, METHOD_BUFFERED,
153
+ FILE_READ_ACCESS | FILE_WRITE_ACCESS)
154
+ end
155
+
156
+ def IOCTL_DISK_VERIFY
157
+ CTL_CODE(IOCTL_DISK_BASE, 0x0005, METHOD_BUFFERED, FILE_ANY_ACCESS)
158
+ end
159
+
160
+ def IOCTL_DISK_FORMAT_TRACKS
161
+ CTL_CODE(IOCTL_DISK_BASE, 0x0006, METHOD_BUFFERED,
162
+ FILE_READ_ACCESS | FILE_WRITE_ACCESS
163
+ )
164
+ end
165
+
166
+ def IOCTL_DISK_REASSIGN_BLOCKS
167
+ CTL_CODE(IOCTL_DISK_BASE, 0x0007, METHOD_BUFFERED,
168
+ FILE_READ_ACCESS | FILE_WRITE_ACCESS
169
+ )
170
+ end
171
+
172
+ def IOCTL_DISK_PERFORMANCE
173
+ CTL_CODE(IOCTL_DISK_BASE, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
174
+ end
175
+
176
+ def IOCTL_DISK_IS_WRITABLE
177
+ CTL_CODE(IOCTL_DISK_BASE, 0x0009, METHOD_BUFFERED, FILE_ANY_ACCESS)
178
+ end
179
+
180
+ def IOCTL_DISK_LOGGING
181
+ CTL_CODE(IOCTL_DISK_BASE, 0x000a, METHOD_BUFFERED, FILE_ANY_ACCESS)
182
+ end
183
+
184
+ def IOCTL_DISK_FORMAT_TRACKS_EX
185
+ CTL_CODE(IOCTL_DISK_BASE, 0x000b, METHOD_BUFFERED,
186
+ FILE_READ_ACCESS | FILE_WRITE_ACCESS
187
+ )
188
+ end
189
+
190
+ def IOCTL_DISK_HISTOGRAM_STRUCTURE
191
+ CTL_CODE(IOCTL_DISK_BASE, 0x000c, METHOD_BUFFERED, FILE_ANY_ACCESS)
192
+ end
193
+
194
+ def IOCTL_DISK_HISTOGRAM_DATA
195
+ CTL_CODE(IOCTL_DISK_BASE, 0x000d, METHOD_BUFFERED, FILE_ANY_ACCESS)
196
+ end
197
+
198
+ def IOCTL_DISK_HISTOGRAM_RESET
199
+ CTL_CODE(IOCTL_DISK_BASE, 0x000e, METHOD_BUFFERED, FILE_ANY_ACCESS)
200
+ end
201
+
202
+ def IOCTL_DISK_REQUEST_STRUCTURE
203
+ CTL_CODE(IOCTL_DISK_BASE, 0x000f, METHOD_BUFFERED, FILE_ANY_ACCESS)
204
+ end
205
+
206
+ def IOCTL_DISK_REQUEST_DATA
207
+ CTL_CODE(IOCTL_DISK_BASE, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
208
+ end
209
+
210
+ def IOCTL_DISK_PERFORMANCE_OFF
211
+ CTL_CODE(IOCTL_DISK_BASE, 0x0018, METHOD_BUFFERED, FILE_ANY_ACCESS)
212
+ end
213
+
214
+ def IOCTL_DISK_GET_PARTITION_INFO_EX
215
+ CTL_CODE(IOCTL_DISK_BASE, 0x0012, METHOD_BUFFERED, FILE_ANY_ACCESS)
216
+ end
217
+
218
+ def IOCTL_DISK_SET_PARTITION_INFO_EX
219
+ CTL_CODE(IOCTL_DISK_BASE, 0x0013, METHOD_BUFFERED,
220
+ FILE_READ_ACCESS | FILE_WRITE_ACCESS
221
+ )
222
+ end
223
+
224
+ def IOCTL_DISK_GET_DRIVE_LAYOUT_EX
225
+ CTL_CODE(IOCTL_DISK_BASE, 0x0014, METHOD_BUFFERED, FILE_ANY_ACCESS)
226
+ end
227
+
228
+ def IOCTL_DISK_SET_DRIVE_LAYOUT_EX
229
+ CTL_CODE(IOCTL_DISK_BASE, 0x0015, METHOD_BUFFERED,
230
+ FILE_READ_ACCESS | FILE_WRITE_ACCESS
231
+ )
232
+ end
233
+
234
+ def IOCTL_DISK_CREATE_DISK
235
+ CTL_CODE(IOCTL_DISK_BASE, 0x0016, METHOD_BUFFERED,
236
+ FILE_READ_ACCESS | FILE_WRITE_ACCESS
237
+ )
238
+ end
239
+
240
+ def IOCTL_DISK_GET_LENGTH_INFO
241
+ CTL_CODE(IOCTL_DISK_BASE, 0x0017, METHOD_BUFFERED, FILE_READ_ACCESS)
242
+ end
243
+
244
+ def IOCTL_DISK_GET_DRIVE_GEOMETRY_EX
245
+ CTL_CODE(IOCTL_DISK_BASE, 0x0028, METHOD_BUFFERED, FILE_ANY_ACCESS)
246
+ end
247
+ end
248
+ end