windows-pr 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,11 @@
1
+ = 1.0.8 - 24-Aug-2009
2
+ * Several return value constants that were set at -1 are now set to
3
+ 0xFFFFFFFF instead because win32-api returns unsigned longs.
4
+ * Removed the two mailslot constants from the Windows::File module. They're
5
+ defined in the Windows::Mailslot module.
6
+ * Added the windows_version method to the Windows::SystemInfo module. It
7
+ returns a float in 'major.minor' format.
8
+
1
9
  = 1.0.7 - 20-Aug-2009
2
10
  * Added the Windows::Mailslot module.
3
11
  * The IsProcessInJob function in the Windows::Process module is now wrapped
data/lib/windows/file.rb CHANGED
@@ -101,8 +101,6 @@ module Windows
101
101
  FILE_NOTIFY_CHANGE_LAST_ACCESS = 32
102
102
  FILE_NOTIFY_CHANGE_CREATION = 64
103
103
  FILE_NOTIFY_CHANGE_SECURITY = 256
104
- MAILSLOT_NO_MESSAGE = -1
105
- MAILSLOT_WAIT_FOREVER = -1
106
104
  FILE_CASE_SENSITIVE_SEARCH = 1
107
105
  FILE_CASE_PRESERVED_NAMES = 2
108
106
  FILE_UNICODE_ON_DISK = 4
@@ -154,11 +152,14 @@ module Windows
154
152
 
155
153
  # Errors
156
154
 
157
- INVALID_FILE_ATTRIBUTES = -1
158
- INVALID_HANDLE_VALUE = -1
159
- INVALID_SET_FILE_POINTER = -1
155
+ INVALID_FILE_ATTRIBUTES = 0xFFFFFFFF
156
+ INVALID_SET_FILE_POINTER = 0xFFFFFFFF
160
157
  INVALID_FILE_SIZE = 0xFFFFFFFF
161
158
 
159
+ # Defined in Windows::Handle as well. Here for convenience.
160
+
161
+ INVALID_HANDLE_VALUE = 0xFFFFFFFF unless defined? INVALID_HANDLE_VALUE
162
+
162
163
  # Misc
163
164
 
164
165
  LOCKFILE_EXCLUSIVE_LOCK = 0x00000001
@@ -7,7 +7,7 @@ module Windows
7
7
  API.auto_method = true
8
8
  API.auto_unicode = false
9
9
 
10
- INVALID_HANDLE_VALUE = -1
10
+ INVALID_HANDLE_VALUE = 0xFFFFFFFF
11
11
  HANDLE_FLAG_INHERIT = 0x00000001
12
12
  HANDLE_FLAG_PROTECT_FROM_CLOSE = 0x00000002
13
13
 
@@ -12,8 +12,8 @@ module Windows
12
12
 
13
13
  # Constants
14
14
 
15
- MAILSLOT_WAIT_FOREVER = -1
16
- MAILSLOT_NO_MESSAGE = -1
15
+ MAILSLOT_WAIT_FOREVER = 0xFFFFFFFF
16
+ MAILSLOT_NO_MESSAGE = 0xFFFFFFFF
17
17
 
18
18
  API.new('CreateMailslot', 'SLLP', 'L')
19
19
  API.new('GetMailslotInfo', 'LPPPP', 'B')
@@ -70,7 +70,7 @@ module Windows
70
70
  NERR_BadAsgType = NERR_BASE + 151
71
71
  NERR_DeviceIsShared = NERR_BASE + 152
72
72
 
73
- MAX_PREFERRED_LENGTH = -1
73
+ MAX_PREFERRED_LENGTH = 0xFFFFFFFF
74
74
 
75
75
  # Taken from LMServer.h
76
76
  SV_TYPE_WORKSTATION = 0x00000001
@@ -1,5 +1,8 @@
1
1
  require 'windows/api'
2
2
 
3
+ # This library exposes functions from ntdll, which are typically undocumented.
4
+ # The name is derived from winternl.h which contains only function prototypes.
5
+
3
6
  module Windows
4
7
  module NTFS
5
8
  module Winternl
@@ -57,6 +60,8 @@ module Windows
57
60
  API.new('NtQueryInformationFile', 'LPPLL', 'L', 'ntdll')
58
61
  API.new('NtQueryObject', 'LLPLP', 'L', 'ntdll')
59
62
  API.new('NtQuerySystemInformation', 'LPLP', 'L', 'ntdll')
63
+ API.new('RtlAdjustPrivilege', 'LIIP', 'L', 'ntdll')
64
+ API.new('RtlSetProcessIsCritical', 'IPI', 'L', 'ntdll')
60
65
 
61
66
  # Should work for Windows XP/2000
62
67
  unless defined? GetFinalPathNameByHandle
@@ -114,6 +114,16 @@ module Windows
114
114
  w >> 8
115
115
  end
116
116
 
117
+ # Returns a float indicating the major and minor version of Windows,
118
+ # e.g. 5.1, 6.0, etc.
119
+ #
120
+ def windows_version
121
+ version = GetVersion()
122
+ major = LOBYTE(LOWORD(version))
123
+ minor = HIBYTE(LOWORD(version))
124
+ eval("Float(#{major}.#{minor})")
125
+ end
126
+
117
127
  # Custom methods that may come in handy
118
128
 
119
129
  # Returns true if the current platform is Vista (any variant) or Windows
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 = '1.0.7'
5
+ gem.version = '1.0.8'
6
6
  gem.license = 'Artistic 2.0'
7
7
  gem.authors = ['Daniel J. Berger', 'Park Heesob']
8
8
  gem.email = 'djberg96@gmail.com'
@@ -22,7 +22,7 @@ spec = Gem::Specification.new do |gem|
22
22
  ]
23
23
 
24
24
  gem.add_dependency('windows-api', '>= 0.3.0')
25
- gem.add_dependency('win32-api', '>= 1.4.4')
25
+ gem.add_dependency('win32-api', '>= 1.4.5')
26
26
 
27
27
  gem.description = <<-EOF
28
28
  The windows-pr library is a collection of Windows functions and constants
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: 1.0.7
4
+ version: 1.0.8
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: 2009-08-20 00:00:00 -06:00
13
+ date: 2009-08-24 00:00:00 -06:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -31,7 +31,7 @@ dependencies:
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 1.4.4
34
+ version: 1.4.5
35
35
  version:
36
36
  description: " The windows-pr library is a collection of Windows functions and constants\n pre-defined for you using the windows-api library. It also autogenerates\n explicit ANSI and Wide character versions of those functions, as well as\n constants that can be used as methods, e.g. CloseHandle() instead of\n CloseHandle.call().\n"
37
37
  email: djberg96@gmail.com