windows-pr 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +13 -0
- data/MANIFEST +1 -1
- data/lib/windows/com.rb +2 -3
- data/lib/windows/console.rb +4 -13
- data/lib/windows/debug.rb +2 -4
- data/lib/windows/error.rb +1 -1
- data/lib/windows/eventlog.rb +2 -3
- data/lib/windows/file.rb +6 -9
- data/lib/windows/library.rb +2 -4
- data/lib/windows/memory.rb +1 -1
- data/lib/windows/msvcrt/file.rb +1 -1
- data/lib/windows/msvcrt/io.rb +1 -1
- data/lib/windows/msvcrt/string.rb +1 -1
- data/lib/windows/network/management.rb +2 -2
- data/lib/windows/network/snmp.rb +1 -1
- data/lib/windows/network/winsock.rb +2 -2
- data/lib/windows/nio.rb +2 -3
- data/lib/windows/ntfs/winternl.rb +4 -3
- data/lib/windows/process.rb +2 -4
- data/lib/windows/registry.rb +2 -4
- data/lib/windows/security.rb +6 -6
- data/lib/windows/shell.rb +2 -3
- data/lib/windows/system_info.rb +2 -3
- data/lib/windows/thread.rb +2 -3
- data/lib/windows/time.rb +2 -3
- data/lib/windows/volume.rb +4 -6
- data/lib/windows/window.rb +2 -4
- data/test/tc_msvcrt_directory.rb +2 -1
- data/test/tc_ntfs_winternl.rb +29 -0
- data/windows-pr.gemspec +3 -3
- metadata +6 -4
data/CHANGES
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
= 0.9.9 - 1-Feb-2009
|
2
|
+
* Now explicitly checks for Win32::API::LoadLibraryError in the method
|
3
|
+
declarations instead of Windows::API::Error. The latter no longer exists,
|
4
|
+
and the former is a better way to check for methods that don't exist on
|
5
|
+
particular versions of Windows. This change requires windows-api 0.3.0
|
6
|
+
and win32-api 1.3.0.
|
7
|
+
* Added a few functions to the Windows::Security module.
|
8
|
+
* Added the NtQuerySystemInformation function to the Windows::NTFS::Winternl
|
9
|
+
module.
|
10
|
+
* Added tests for the Windows::NTFS::Winternl module.
|
11
|
+
* Declaration fix in Windows::Security module for Win2k.
|
12
|
+
* Fixed a directory test for Win2k.
|
13
|
+
|
1
14
|
= 0.9.8 - 15-Dec-2008
|
2
15
|
* Added many more functions and a few constants to the Windows::Security
|
3
16
|
module.
|
data/MANIFEST
CHANGED
data/lib/windows/com.rb
CHANGED
@@ -161,11 +161,10 @@ module Windows
|
|
161
161
|
API.new('StringFromGUID2', 'PPI', 'I', 'ole32')
|
162
162
|
API.new('StringFromIID', 'PP', 'L', 'ole32')
|
163
163
|
|
164
|
-
# Windows Vista
|
165
164
|
begin
|
166
165
|
API.new('CoDisconnectContext', 'L', 'L', 'ole32')
|
167
|
-
rescue
|
168
|
-
#
|
166
|
+
rescue Win32::API::LoadLibraryError
|
167
|
+
# Windows Vista
|
169
168
|
end
|
170
169
|
end
|
171
170
|
end
|
data/lib/windows/console.rb
CHANGED
@@ -66,7 +66,8 @@ module Windows
|
|
66
66
|
API.new('GetConsoleMode', 'LP', 'B')
|
67
67
|
API.new('GetConsoleOutputCP', 'V', 'I')
|
68
68
|
API.new('GetConsoleScreenBufferInfo', 'LP', 'B')
|
69
|
-
API.new('GetConsoleTitle', 'PL', 'L')
|
69
|
+
API.new('GetConsoleTitle', 'PL', 'L')
|
70
|
+
API.new('GetConsoleWindow', 'V', 'L')
|
70
71
|
API.new('GetLargestConsoleWindowSize', 'L', 'L')
|
71
72
|
API.new('GetNumberOfConsoleInputEvents', 'LP', 'B')
|
72
73
|
API.new('GetNumberOfConsoleMouseButtons', 'L', 'B')
|
@@ -96,7 +97,6 @@ module Windows
|
|
96
97
|
API.new('WriteConsoleOutputAttribute', 'LPLLP', 'B')
|
97
98
|
API.new('WriteConsoleOutputCharacter', 'LPLLP', 'B')
|
98
99
|
|
99
|
-
# Windows XP or later
|
100
100
|
begin
|
101
101
|
API.new('AttachConsole', 'L', 'B')
|
102
102
|
API.new('GetConsoleDisplayMode', 'P', 'L')
|
@@ -105,17 +105,8 @@ module Windows
|
|
105
105
|
API.new('GetConsoleSelectionInfo', 'P', 'B')
|
106
106
|
API.new('GetCurrentConsoleFont' , 'LIP', 'B')
|
107
107
|
API.new('SetConsoleDisplayMode', 'LLP', 'B')
|
108
|
-
rescue
|
109
|
-
#
|
110
|
-
# check for the existence of the constant in your code.
|
111
|
-
end
|
112
|
-
|
113
|
-
# Windows 2000 or later
|
114
|
-
begin
|
115
|
-
API.new('GetConsoleWindow', 'V', 'L')
|
116
|
-
rescue Windows::API::Error
|
117
|
-
# Do nothing - not supported on current platform. It's up to you to
|
118
|
-
# check for the existence of the constant in your code.
|
108
|
+
rescue Win32::API::LoadLibraryError
|
109
|
+
# Windows XP or later
|
119
110
|
end
|
120
111
|
end
|
121
112
|
end
|
data/lib/windows/debug.rb
CHANGED
@@ -21,15 +21,13 @@ module Windows
|
|
21
21
|
API.new('WaitForDebugEvent', 'PL', 'B')
|
22
22
|
API.new('WriteProcessMemory', 'LLPLP', 'B')
|
23
23
|
|
24
|
-
# Windows XP or later
|
25
24
|
begin
|
26
25
|
API.new('CheckRemoteDebuggerPresent', 'LP', 'B')
|
27
26
|
API.new('DebugActiveProcessStop', 'L', 'B')
|
28
27
|
API.new('DebugBreakProcess', 'L', 'B')
|
29
28
|
API.new('DebugSetProcessKillOnExit', 'I', 'B')
|
30
|
-
rescue
|
31
|
-
#
|
32
|
-
# check for the existence of the constant in your code.
|
29
|
+
rescue Win32::API::LoadLibraryError
|
30
|
+
# Windows XP or later
|
33
31
|
end
|
34
32
|
end
|
35
33
|
end
|
data/lib/windows/error.rb
CHANGED
data/lib/windows/eventlog.rb
CHANGED
@@ -35,7 +35,6 @@ module Windows
|
|
35
35
|
API.new('RegisterEventSource', 'SS', 'L', 'advapi32')
|
36
36
|
API.new('ReportEvent', 'LIILPILPP', 'B', 'advapi32')
|
37
37
|
|
38
|
-
# Windows Vista or later
|
39
38
|
begin
|
40
39
|
API.new('EvtArchiveExportedLog', 'LPLL', 'B', 'wevtapi')
|
41
40
|
API.new('EvtCancel', 'L', 'B', 'wevtapi')
|
@@ -72,8 +71,8 @@ module Windows
|
|
72
71
|
API.new('EvtSetChannelConfigProperty', 'LLLP', 'B', 'wevtapi')
|
73
72
|
API.new('EvtSubscribe', 'LLPPLPKL', 'L', 'wevtapi')
|
74
73
|
API.new('EvtUpdateBookmark', 'LL', 'B', 'wevtapi')
|
75
|
-
rescue
|
76
|
-
#
|
74
|
+
rescue Win32::API::LoadLibraryError
|
75
|
+
# Windows Vista or later
|
77
76
|
end
|
78
77
|
end
|
79
78
|
end
|
data/lib/windows/file.rb
CHANGED
@@ -233,32 +233,29 @@ module Windows
|
|
233
233
|
API.new('WriteFile', 'LPLPP', 'B')
|
234
234
|
API.new('WriteFileEx', 'LPLPK', 'B')
|
235
235
|
|
236
|
-
# XP or later
|
237
236
|
begin
|
238
237
|
API.new('SetFileShortName', 'LP', 'B')
|
239
238
|
API.new('SetFileValidData', 'LL', 'B')
|
240
|
-
rescue
|
241
|
-
#
|
239
|
+
rescue Win32::API::LoadLibraryError
|
240
|
+
# Windows XP or later
|
242
241
|
end
|
243
242
|
|
244
|
-
# XP 64-bit and later
|
245
243
|
begin
|
246
244
|
API.new('Wow64DisableWow64FsRedirection', 'P', 'B')
|
247
245
|
API.new('Wow64EnableWow64FsRedirection', 'I', 'I')
|
248
246
|
API.new('Wow64RevertWow64FsRedirection', 'L', 'B')
|
249
|
-
rescue
|
250
|
-
#
|
247
|
+
rescue Win32::API::LoadLibraryError
|
248
|
+
# Windows XP 64-bit and later
|
251
249
|
end
|
252
250
|
|
253
|
-
# Windows Vista
|
254
251
|
begin
|
255
252
|
API.new('CreateSymbolicLink', 'SSL', 'B')
|
256
253
|
API.new('CreateSymbolicLinkTransacted', 'SSLL', 'B')
|
257
254
|
API.new('GetFileInformationByHandleEx', 'LLPL', 'B')
|
258
255
|
API.new('GetFinalPathNameByHandle', 'LPLL', 'L')
|
259
256
|
API.new('SetFileInformationByHandle', 'LLPL', 'B')
|
260
|
-
rescue
|
261
|
-
#
|
257
|
+
rescue Win32::API::LoadLibraryError
|
258
|
+
# Windows Vista
|
262
259
|
end
|
263
260
|
end
|
264
261
|
end
|
data/lib/windows/library.rb
CHANGED
@@ -31,14 +31,12 @@ module Windows
|
|
31
31
|
API.new('LoadLibraryEx', 'PLL', 'L')
|
32
32
|
API.new('LoadModule', 'PP', 'L')
|
33
33
|
|
34
|
-
# Windows XP or later
|
35
34
|
begin
|
36
35
|
API.new('GetDllDirectory', 'LP', 'L')
|
37
36
|
API.new('GetModuleHandleEx', 'LPP', 'I')
|
38
37
|
API.new('SetDllDirectory', 'P', 'I')
|
39
|
-
rescue
|
40
|
-
#
|
41
|
-
# check for the existence of the constant in your code.
|
38
|
+
rescue Win32::API::LoadLibraryError
|
39
|
+
# Windows XP or later
|
42
40
|
end
|
43
41
|
end
|
44
42
|
end
|
data/lib/windows/memory.rb
CHANGED
@@ -119,7 +119,7 @@ module Windows
|
|
119
119
|
begin
|
120
120
|
API.new('HeapQueryInformation', 'LIPLL', 'B')
|
121
121
|
API.new('HeapSetInformation', 'LIPL', 'B')
|
122
|
-
rescue
|
122
|
+
rescue Win32::API::LoadLibraryError
|
123
123
|
# Do nothing - you must check for their existence
|
124
124
|
end
|
125
125
|
end
|
data/lib/windows/msvcrt/file.rb
CHANGED
@@ -37,7 +37,7 @@ module Windows
|
|
37
37
|
API.new('_mktemp_s', 'PL', 'L', MSVCRT_DLL)
|
38
38
|
API.new('_umask_s', 'IP', 'L', MSVCRT_DLL)
|
39
39
|
API.new('_wmktemp_s', 'PL', 'L', MSVCRT_DLL)
|
40
|
-
rescue
|
40
|
+
rescue Win32::API::LoadLibraryError
|
41
41
|
# Ignore - you must check for it via 'defined?'
|
42
42
|
end
|
43
43
|
end
|
data/lib/windows/msvcrt/io.rb
CHANGED
@@ -63,7 +63,7 @@ module Windows
|
|
63
63
|
API.new('_sopen_s', 'PPIII', 'L', MSVCRT_DLL)
|
64
64
|
API.new('_tmpfile_s', 'P', 'L', MSVCRT_DLL)
|
65
65
|
API.new('_wsopen_s', 'PPIII', 'L', MSVCRT_DLL)
|
66
|
-
rescue
|
66
|
+
rescue Win32::API::LoadLibraryError
|
67
67
|
# Ignore - you must check for it via 'defined?'
|
68
68
|
end
|
69
69
|
end
|
@@ -190,7 +190,7 @@ module Windows
|
|
190
190
|
begin
|
191
191
|
API.new('GetNetScheduleAccountInformation', 'PLP', 'L', 'mstask')
|
192
192
|
API.new('SetNetScheduleAccountInformation', 'PPP', 'L', 'netapi32')
|
193
|
-
rescue
|
193
|
+
rescue Win32::API::LoadLibraryError
|
194
194
|
# Do nothing. Not supported on current platform.
|
195
195
|
end
|
196
196
|
|
@@ -515,7 +515,7 @@ module Windows
|
|
515
515
|
def SetNetScheduleAccountInformation(server, account, password)
|
516
516
|
SetNetScheduleAccountInformation.call(server, account, password) == NERR_Success
|
517
517
|
end
|
518
|
-
rescue
|
518
|
+
rescue Win32::API::LoadLibraryError
|
519
519
|
# Do nothing. It's up to you to check for their existence.
|
520
520
|
end
|
521
521
|
end
|
data/lib/windows/network/snmp.rb
CHANGED
@@ -82,7 +82,7 @@ module Windows
|
|
82
82
|
API.new('SnmpCreateSession', 'LLKP', 'L', 'wsnmp32')
|
83
83
|
API.new('SnmpCleanupEx', 'V', 'I', 'wsnmp32')
|
84
84
|
API.new('SnmpStartupEx', 'PPPPP', 'L', 'wsnmp32')
|
85
|
-
rescue
|
85
|
+
rescue Win32::API::LoadLibraryError
|
86
86
|
# Do nothing. It's up to you to check for their existence.
|
87
87
|
end
|
88
88
|
end
|
@@ -106,7 +106,7 @@ module Windows
|
|
106
106
|
API.new('DisconnectEx', 'LPLL', 'B', 'mswsock')
|
107
107
|
API.new('GetAddrInfoW', 'PPPP', 'I', 'mswsock')
|
108
108
|
API.new('GetNameInfoW', 'PLPLPLI', 'I', 'ws2_32')
|
109
|
-
rescue
|
109
|
+
rescue Win32::API::LoadLibraryError
|
110
110
|
# Do nothing, not supported on your platform.
|
111
111
|
end
|
112
112
|
|
@@ -118,7 +118,7 @@ module Windows
|
|
118
118
|
API.new('WSAConnectByName', 'LPPPPPPP', 'B', 'ws2_32')
|
119
119
|
API.new('WSADeleteSocketPeerTargetName', 'LPPPP', 'I', 'ws2_32')
|
120
120
|
API.new('WSAPoll', 'PLI', 'I', 'ws2_32')
|
121
|
-
rescue
|
121
|
+
rescue Win32::API::LoadLibraryError
|
122
122
|
# Do nothing, not supported on your platform.
|
123
123
|
end
|
124
124
|
end
|
data/lib/windows/nio.rb
CHANGED
@@ -37,12 +37,11 @@ module Windows
|
|
37
37
|
API.new('SetFilePointerEx', 'LLPL', 'B')
|
38
38
|
API.new('WriteFileGather', 'LPLPP', 'B')
|
39
39
|
|
40
|
-
# Windows Vista or later
|
41
40
|
begin
|
42
41
|
API.new('CancelIoEx', 'LP', 'B')
|
43
42
|
API.new('CancelSynchronousIo', 'L', 'B')
|
44
|
-
rescue
|
45
|
-
#
|
43
|
+
rescue Win32::API::LoadLibraryError
|
44
|
+
# Windows Vista or later
|
46
45
|
end
|
47
46
|
end
|
48
47
|
end
|
@@ -56,6 +56,7 @@ module Windows
|
|
56
56
|
|
57
57
|
API.new('NtQueryInformationFile', 'LPPLL', 'L', 'ntdll')
|
58
58
|
API.new('NtQueryObject', 'LLPLP', 'L', 'ntdll')
|
59
|
+
API.new('NtQuerySystemInformation', 'LPLP', 'L', 'ntdll')
|
59
60
|
|
60
61
|
# Should work for Windows XP/2000
|
61
62
|
unless defined? GetFinalPathNameByHandle
|
@@ -65,16 +66,16 @@ module Windows
|
|
65
66
|
|
66
67
|
def GetFinalPathNameByHandle(file)
|
67
68
|
begin
|
68
|
-
|
69
|
+
max_path = 256
|
69
70
|
fh = File.open(file, 'r')
|
70
71
|
handle = get_osfhandle(fh.fileno)
|
71
|
-
object_name_information = 0.chr * (8 + (
|
72
|
+
object_name_information = 0.chr * (8 + (max_path*2))
|
72
73
|
|
73
74
|
status = NtQueryObject(
|
74
75
|
handle,
|
75
76
|
ObjectNameInformation,
|
76
77
|
object_name_information,
|
77
|
-
object_name_information.size
|
78
|
+
object_name_information.size,
|
78
79
|
0
|
79
80
|
)
|
80
81
|
|
data/lib/windows/process.rb
CHANGED
@@ -97,13 +97,11 @@ module Windows
|
|
97
97
|
API.new('WaitForInputIdle', 'LL', 'L', 'user32')
|
98
98
|
API.new('WTSEnumerateProcesses', 'LLLPP', 'B', 'wtsapi32')
|
99
99
|
|
100
|
-
# Windows XP or later
|
101
100
|
begin
|
102
101
|
API.new('GetProcessId', 'L', 'L')
|
103
102
|
API.new('GetProcessHandleCount', 'LP', 'B')
|
104
|
-
rescue
|
105
|
-
#
|
106
|
-
# check for the existence of the constant in your code.
|
103
|
+
rescue Win32::API::LoadLibraryError
|
104
|
+
# Windows XP or later
|
107
105
|
end
|
108
106
|
end
|
109
107
|
end
|
data/lib/windows/registry.rb
CHANGED
@@ -117,12 +117,10 @@ module Windows
|
|
117
117
|
API.new('RegSetValueEx', 'LPLLPL', 'L', 'advapi32')
|
118
118
|
API.new('RegUnLoadKey', 'LP', 'L', 'advapi32')
|
119
119
|
|
120
|
-
# Windows XP or later
|
121
120
|
begin
|
122
121
|
API.new('RegSaveKeyEx', 'LPPL', 'L', 'advapi32')
|
123
|
-
rescue
|
124
|
-
#
|
125
|
-
# check for the existence of the constant in your code.
|
122
|
+
rescue Win32::API::LoadLibraryError
|
123
|
+
# Windows XP or later
|
126
124
|
end
|
127
125
|
end
|
128
126
|
end
|
data/lib/windows/security.rb
CHANGED
@@ -400,18 +400,15 @@ module Windows
|
|
400
400
|
API.new('DeleteAce', 'PL', 'B', 'advapi32')
|
401
401
|
API.new('DuplicateToken', 'LPP', 'B', 'advapi32')
|
402
402
|
API.new('DuplicateTokenEx', 'LLPLLP', 'B', 'advapi32')
|
403
|
-
API.new('EqualDomainSid', 'PPP', 'B', 'advapi32')
|
404
403
|
API.new('EqualPrefixSid', 'PP', 'B', 'advapi32')
|
405
404
|
API.new('EqualSid', 'PP', 'B', 'advapi32')
|
406
405
|
API.new('FindFirstFreeAce', 'PP', 'B', 'advapi32')
|
407
|
-
API.new('FreeInheritedFromArray', 'PIP', 'B', 'advapi32')
|
408
406
|
API.new('FreeSid', 'P', 'L', 'advapi32')
|
409
407
|
API.new('GetAce', 'LLP', 'B', 'advapi32')
|
410
408
|
API.new('GetAclInformation', 'PPLI', 'B', 'advapi32')
|
411
409
|
API.new('GetFileSecurity', 'PLPLP', 'B', 'advapi32')
|
412
410
|
API.new('GetFileSecurityA', 'PLPLP', 'B', 'advapi32')
|
413
411
|
API.new('GetFileSecurityW', 'PLPLP', 'B', 'advapi32')
|
414
|
-
API.new('GetInheritanceSource', 'PLLIPLPPLP', 'L', 'advapi32')
|
415
412
|
API.new('GetLengthSid', 'P', 'L', 'advapi32')
|
416
413
|
API.new('GetSecurityDescriptorControl', 'PPP', 'B', 'advapi32')
|
417
414
|
API.new('GetSecurityDescriptorDacl', 'PPPP', 'B', 'advapi32')
|
@@ -435,7 +432,6 @@ module Windows
|
|
435
432
|
API.new('IsValidAcl', 'P', 'B', 'advapi32')
|
436
433
|
API.new('IsValidSecurityDescriptor', 'P', 'B', 'advapi32')
|
437
434
|
API.new('IsValidSid', 'P', 'B', 'advapi32')
|
438
|
-
API.new('IsWellKnownSid', 'PI', 'B', 'advapi32')
|
439
435
|
API.new('LookupAccountName', 'PPPPPPP', 'B', 'advapi32')
|
440
436
|
API.new('LookupAccountSid', 'PLPPPPP', 'B', 'advapi32')
|
441
437
|
API.new('LookupPrivilegeDisplayName', 'PPPPP', 'B', 'advapi32')
|
@@ -461,7 +457,11 @@ module Windows
|
|
461
457
|
begin
|
462
458
|
API.new('CreateWellKnownSid', 'IPPP', 'B', 'advapi32')
|
463
459
|
API.new('AddMandatoryAce', 'PLLLP', 'B', 'advapi32')
|
464
|
-
|
460
|
+
API.new('EqualDomainSid', 'PPP', 'B', 'advapi32')
|
461
|
+
API.new('FreeInheritedFromArray', 'PIP', 'B', 'advapi32')
|
462
|
+
API.new('GetInheritanceSource', 'PLLIPLPPLP', 'L', 'advapi32')
|
463
|
+
API.new('IsWellKnownSid', 'PI', 'B', 'advapi32')
|
464
|
+
rescue Win32::API::LoadLibraryError
|
465
465
|
# Windows XP or later
|
466
466
|
end
|
467
467
|
|
@@ -470,7 +470,7 @@ module Windows
|
|
470
470
|
API.new('AuditComputeEffectivePolicyByToken', 'LPLP', 'B', 'advapi32')
|
471
471
|
API.new('AuditEnumerateCategories', 'PP', 'B', 'advapi32')
|
472
472
|
API.new('AuditEnumeratePerUserPolicy', 'P', 'B', 'advapi32')
|
473
|
-
rescue
|
473
|
+
rescue Win32::API::LoadLibraryError
|
474
474
|
# Windows Vista or later
|
475
475
|
end
|
476
476
|
end
|
data/lib/windows/shell.rb
CHANGED
@@ -158,13 +158,12 @@ module Windows
|
|
158
158
|
API.new('SHGetSpecialFolderLocation', 'LIP', 'L', 'shell32')
|
159
159
|
API.new('SHGetSpecialFolderPath', 'LPLL','L', 'shell32')
|
160
160
|
|
161
|
-
# Windows Vista
|
162
161
|
begin
|
163
162
|
API.new('SHGetKnownFolderPath', 'LLLP', 'L', 'shell32')
|
164
163
|
API.new('SHGetKnownFolderIDList', 'LLLP', 'L', 'shell32')
|
165
164
|
API.new('SHGetNameFromIDList', 'PLP', 'L', 'shell32')
|
166
|
-
rescue
|
167
|
-
#
|
165
|
+
rescue Win32::API::LoadLibraryError
|
166
|
+
# Windows Vista or later
|
168
167
|
end
|
169
168
|
end
|
170
169
|
end
|
data/lib/windows/system_info.rb
CHANGED
@@ -80,11 +80,10 @@ module Windows
|
|
80
80
|
API.new('GetVersionEx', 'P', 'B')
|
81
81
|
API.new('GetWindowsDirectory', 'PI', 'I')
|
82
82
|
|
83
|
-
# XP or later
|
84
83
|
begin
|
85
84
|
API.new('GetSystemWow64Directory', 'PI', 'I')
|
86
|
-
rescue
|
87
|
-
#
|
85
|
+
rescue Win32::API::LoadLibraryError
|
86
|
+
# XP or later
|
88
87
|
end
|
89
88
|
|
90
89
|
# These macros are from windef.h, but I've put them here for now
|
data/lib/windows/thread.rb
CHANGED
@@ -52,12 +52,11 @@ module Windows
|
|
52
52
|
API.new('TlsGetValue', 'L', 'L')
|
53
53
|
API.new('TlsSetValue', 'LL', 'B')
|
54
54
|
|
55
|
-
# Windows XP or later
|
56
55
|
begin
|
57
56
|
API.new('AttachThreadInput', 'LLI', 'B')
|
58
57
|
API.new('GetThreadIOPendingFlag', 'LP', 'B')
|
59
|
-
rescue
|
60
|
-
#
|
58
|
+
rescue Win32::API::LoadLibraryError
|
59
|
+
# Windows XP or later
|
61
60
|
end
|
62
61
|
end
|
63
62
|
end
|
data/lib/windows/time.rb
CHANGED
@@ -36,12 +36,11 @@ module Windows
|
|
36
36
|
API.new('SystemTimeToFileTime', 'PP', 'B')
|
37
37
|
API.new('SystemTimeToTzSpecificLocalTime', 'PPP', 'B')
|
38
38
|
|
39
|
-
# Windows XP or later
|
40
39
|
begin
|
41
40
|
API.new('GetSystemTimes', 'PPP', 'B')
|
42
41
|
API.new('TzSpecificLocalTimeToSystemTime', 'PPP', 'B')
|
43
|
-
rescue
|
44
|
-
#
|
42
|
+
rescue Win32::API::LoadLibraryError
|
43
|
+
# Windows XP or later
|
45
44
|
end
|
46
45
|
end
|
47
46
|
end
|
data/lib/windows/volume.rb
CHANGED
@@ -33,18 +33,16 @@ module Windows
|
|
33
33
|
API.new('SetVolumeLabel', 'SS', 'B')
|
34
34
|
API.new('SetVolumeMountPoint', 'SS', 'B')
|
35
35
|
|
36
|
-
# Windows XP or later
|
37
36
|
begin
|
38
37
|
API.new('GetVolumePathNamesForVolumeName', 'SPLL', 'B')
|
39
|
-
rescue
|
40
|
-
#
|
38
|
+
rescue Win32::API::LoadLibraryError
|
39
|
+
# Windows XP or later
|
41
40
|
end
|
42
41
|
|
43
|
-
# Windows Vista or later
|
44
42
|
begin
|
45
43
|
API.new('GetVolumeInformationByHandleW', 'LPLPPPPL', 'B')
|
46
|
-
rescue
|
47
|
-
#
|
44
|
+
rescue Win32::API::LoadLibraryError
|
45
|
+
# Windows Vista or later
|
48
46
|
end
|
49
47
|
end
|
50
48
|
end
|
data/lib/windows/window.rb
CHANGED
@@ -50,12 +50,10 @@ module Windows
|
|
50
50
|
API.new('GetWindowTextLength', 'L', 'I', 'user32')
|
51
51
|
API.new('GetWindowThreadProcessId', 'LP', 'L', 'user32')
|
52
52
|
|
53
|
-
# Windows XP or later
|
54
53
|
begin
|
55
54
|
API.new('GetLayeredWindowAttributes', 'LPBL', 'B', 'user32')
|
56
|
-
rescue
|
57
|
-
#
|
58
|
-
# to check for the existence of the constant in your code.
|
55
|
+
rescue Win32::API::LoadLibraryError
|
56
|
+
# Windows XP or later
|
59
57
|
end
|
60
58
|
end
|
61
59
|
end
|
data/test/tc_msvcrt_directory.rb
CHANGED
@@ -81,7 +81,8 @@ class TC_Windows_MSVCRT_Directory < Test::Unit::TestCase
|
|
81
81
|
def test_searchenv
|
82
82
|
possible = [
|
83
83
|
"c:\\winnt\\system32\\notepad.exe",
|
84
|
-
"c:\\windows\\system32\\notepad.exe"
|
84
|
+
"c:\\windows\\system32\\notepad.exe",
|
85
|
+
"c:\\windows\\notepad.exe"
|
85
86
|
]
|
86
87
|
assert_respond_to(self, :searchenv)
|
87
88
|
assert_nothing_raised{ searchenv("notepad.exe", "PATH", @buf) }
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#####################################################################
|
2
|
+
# test_ntfs_winternl.rb
|
3
|
+
#
|
4
|
+
# Test case for the Windows::NTFS::Winternl module.
|
5
|
+
#####################################################################
|
6
|
+
require "windows/ntfs/winternl"
|
7
|
+
require "test/unit"
|
8
|
+
|
9
|
+
class WinternlFoo
|
10
|
+
include Windows::NTFS::Winternl
|
11
|
+
end
|
12
|
+
|
13
|
+
class TC_Windows_NTFS_Winternl < Test::Unit::TestCase
|
14
|
+
def setup
|
15
|
+
@foo = WinternlFoo.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_numeric_constants
|
19
|
+
assert_equal(8, WinternlFoo::FileAccessInformation)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_method_constants
|
23
|
+
assert_not_nil(WinternlFoo::NtQueryInformationFile)
|
24
|
+
end
|
25
|
+
|
26
|
+
def teardown
|
27
|
+
@foo = nil
|
28
|
+
end
|
29
|
+
end
|
data/windows-pr.gemspec
CHANGED
@@ -2,7 +2,7 @@ require "rubygems"
|
|
2
2
|
|
3
3
|
spec = Gem::Specification.new do |gem|
|
4
4
|
gem.name = 'windows-pr'
|
5
|
-
gem.version = '0.9.
|
5
|
+
gem.version = '0.9.9'
|
6
6
|
gem.authors = ['Daniel J. Berger', 'Park Heesob']
|
7
7
|
gem.email = 'djberg96@gmail.com'
|
8
8
|
gem.homepage = 'http://www.rubyforge.org/projects/win32utils'
|
@@ -17,8 +17,8 @@ spec = Gem::Specification.new do |gem|
|
|
17
17
|
gem.files.reject! { |fn| fn.include? "CVS" }
|
18
18
|
gem.require_path = "lib"
|
19
19
|
gem.extra_rdoc_files = ['MANIFEST', 'README', 'CHANGES']
|
20
|
-
gem.add_dependency('windows-api', '>= 0.
|
21
|
-
gem.add_dependency('win32-api', '>= 1.
|
20
|
+
gem.add_dependency('windows-api', '>= 0.3.0')
|
21
|
+
gem.add_dependency('win32-api', '>= 1.3.0')
|
22
22
|
end
|
23
23
|
|
24
24
|
if $0 == __FILE__
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: windows-pr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2009-02-01 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
requirements:
|
22
22
|
- - ">="
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: 0.
|
24
|
+
version: 0.3.0
|
25
25
|
version:
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: win32-api
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.
|
34
|
+
version: 1.3.0
|
35
35
|
version:
|
36
36
|
description: Windows functions and constants bundled via Win32::API
|
37
37
|
email: djberg96@gmail.com
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- test/tc_network_management.rb
|
122
122
|
- test/tc_network_snmp.rb
|
123
123
|
- test/tc_nio.rb
|
124
|
+
- test/tc_ntfs_winternl.rb
|
124
125
|
- test/tc_path.rb
|
125
126
|
- test/tc_pipe.rb
|
126
127
|
- test/tc_process.rb
|
@@ -197,6 +198,7 @@ test_files:
|
|
197
198
|
- test/tc_network_management.rb
|
198
199
|
- test/tc_network_snmp.rb
|
199
200
|
- test/tc_nio.rb
|
201
|
+
- test/tc_ntfs_winternl.rb
|
200
202
|
- test/tc_path.rb
|
201
203
|
- test/tc_pipe.rb
|
202
204
|
- test/tc_process.rb
|