windows-pr 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGES CHANGED
@@ -1,3 +1,7 @@
1
+ = 1.1.1 - 6-Nov-2010
2
+ * Added some security flags for Job objects to the Windows::Process module.
3
+ * Added namespace functions to the Windows::Synchronize module.
4
+
1
5
  = 1.1.0 - 5-Nov-2010
2
6
  * Added the get_volume_type method to the Windows::Volume module.
3
7
  * Added more tests for the Windows::Volume module.
data/Rakefile CHANGED
@@ -30,6 +30,12 @@ namespace 'test' do
30
30
  t.test_files = FileList['test/tc_clipboard.rb']
31
31
  end
32
32
 
33
+ Rake::TestTask.new('synchronize') do |t|
34
+ t.warning = true
35
+ t.verbose = true
36
+ t.test_files = FileList['test/tc_synchronize.rb']
37
+ end
38
+
33
39
  Rake::TestTask.new('unicode') do |t|
34
40
  t.warning = true
35
41
  t.verbose = true
@@ -96,6 +96,15 @@ module Windows
96
96
  JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK = 0x00001000
97
97
  JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 0x00002000
98
98
 
99
+ # Job Access Rights
100
+
101
+ JOB_OBJECT_ASSIGN_PROCESS = 0x0001
102
+ JOB_OBJECT_SET_ATTRIBUTES = 0x0002
103
+ JOB_OBJECT_OBJECT_QUERY = 0x0004
104
+ JOB_OBJECT_TERMINATE = 0x0008
105
+ JOB_OBJECT_SET_SECURITY_ATTRIBUTES = 0x0010
106
+ JOB_OBJECT_ALL_ACCESS = 0x1F001F
107
+
99
108
  # Functions
100
109
 
101
110
  API.new('AssignProcessToJobObject', 'LL', 'B')
@@ -1,100 +1,131 @@
1
1
  require 'windows/api'
2
2
 
3
3
  module Windows
4
- module Synchronize
5
- API.auto_namespace = 'Windows::Synchronize'
6
- API.auto_constant = true
7
- API.auto_method = true
8
- API.auto_unicode = true
4
+ module Synchronize
5
+ API.auto_namespace = 'Windows::Synchronize'
6
+ API.auto_constant = true
7
+ API.auto_method = true
8
+ API.auto_unicode = true
9
9
 
10
- INFINITE = 0xFFFFFFFF
11
- WAIT_OBJECT_0 = 0
12
- WAIT_TIMEOUT = 0x102
13
- WAIT_ABANDONED = 128
14
- WAIT_ABANDONED_0 = WAIT_ABANDONED
15
- WAIT_FAILED = 0xFFFFFFFF
16
-
17
- STATUS_WAIT_0 = 0
18
- STATUS_ABANDONED_WAIT_0 = 128
19
- STATUS_USER_APC = 192
20
- STATUS_TIMEOUT = 258
21
- STATUS_PENDING = 259
22
-
23
- # Wake mask constants
24
- QS_ALLEVENTS = 0x04BF
25
- QS_ALLINPUT = 0x04FF
26
- QS_ALLPOSTMESSAGE = 0x0100
27
- QS_HOTKEY = 0x0080
28
- QS_INPUT = 0x407
29
- QS_KEY = 0x0001
30
- QS_MOUSE = 0x0006
31
- QS_MOUSEBUTTON = 0x0004
32
- QS_MOUSEMOVE = 0x0002
33
- QS_PAINT = 0x0020
34
- QS_POSTMESSAGE = 0x0008
35
- QS_RAWINPUT = 0x0400
36
- QS_SENDMESSAGE = 0x0040
37
- QS_TIMER = 0x0010
38
-
39
- # Wait type constants
40
- MWMO_ALERTABLE = 0x0002
41
- MWMO_INPUTAVAILABLE = 0x0004
42
- MWMO_WAITALL = 0x0001
43
-
44
- # Access rights
45
- EVENT_ALL_ACCESS = 0x1F0003
46
- EVENT_MODIFY_STATE = 0x0002
47
- MUTEX_ALL_ACCESS = 0x1F0001
48
- MUTEX_MODIFY_STATE = 0x0001
49
- SEMAPHORE_ALL_ACCESS = 0x1F0003
50
- SEMAPHORE_MODIFY_STATE = 0x0002
10
+ INFINITE = 0xFFFFFFFF
11
+ WAIT_OBJECT_0 = 0
12
+ WAIT_TIMEOUT = 0x102
13
+ WAIT_ABANDONED = 128
14
+ WAIT_ABANDONED_0 = WAIT_ABANDONED
15
+ WAIT_FAILED = 0xFFFFFFFF
16
+
17
+ STATUS_WAIT_0 = 0
18
+ STATUS_ABANDONED_WAIT_0 = 128
19
+ STATUS_USER_APC = 192
20
+ STATUS_TIMEOUT = 258
21
+ STATUS_PENDING = 259
22
+
23
+ # Wake mask constants
51
24
 
52
- API.new('CancelWaitableTimer', 'L', 'B')
53
- API.new('CreateEvent', 'PIIP', 'L')
54
- API.new('CreateMutex', 'PIP', 'L')
55
- API.new('CreateSemaphore', 'PLLP', 'L')
56
- API.new('CreateWaitableTimer', 'PIP', 'L')
57
- API.new('DeleteCriticalSection', 'P', 'V')
58
- API.new('EnterCriticalSection', 'P', 'V')
59
- API.new('GetOverlappedResult', 'LPPI', 'I')
60
- API.new('InitializeCriticalSection', 'P', 'V')
61
- API.new('InitializeCriticalSectionAndSpinCount', 'PL', 'B')
62
- API.new('LeaveCriticalSection', 'P', 'V')
63
- API.new('MsgWaitForMultipleObjects', 'LPILL', 'L', 'user32')
64
- API.new('MsgWaitForMultipleObjectsEx', 'LPLLL', 'L', 'user32')
65
- API.new('OpenEvent', 'LIP', 'L')
66
- API.new('OpenMutex', 'LIP', 'L')
67
- API.new('OpenSemaphore', 'LIP', 'L')
68
- API.new('OpenWaitableTimer', 'LIP', 'L')
69
- API.new('ReleaseMutex', 'L', 'B')
70
- API.new('ReleaseSemaphore', 'LLP', 'B')
71
- API.new('ResetEvent', 'L', 'B')
72
- API.new('SetCriticalSectionSpinCount', 'PL', 'V')
73
- API.new('SetWaitableTimer', 'LPLKPI', 'B')
74
- API.new('SetEvent', 'L', 'B')
75
- API.new('TryEnterCriticalSection', 'P', 'B')
76
- API.new('WaitForMultipleObjects', 'LPIL', 'L')
77
- API.new('WaitForMultipleObjectsEx', 'LPILI', 'L')
78
- API.new('WaitForSingleObject', 'LL', 'L')
79
- API.new('WaitForSingleObjectEx', 'LLI', 'L')
80
-
81
- # Macros
82
-
83
- def HasOverlappedIoCompleted(overlapped)
84
- overlapped[0,4].unpack('L')[0] != STATUS_PENDING
25
+ QS_ALLEVENTS = 0x04BF
26
+ QS_ALLINPUT = 0x04FF
27
+ QS_ALLPOSTMESSAGE = 0x0100
28
+ QS_HOTKEY = 0x0080
29
+ QS_INPUT = 0x407
30
+ QS_KEY = 0x0001
31
+ QS_MOUSE = 0x0006
32
+ QS_MOUSEBUTTON = 0x0004
33
+ QS_MOUSEMOVE = 0x0002
34
+ QS_PAINT = 0x0020
35
+ QS_POSTMESSAGE = 0x0008
36
+ QS_RAWINPUT = 0x0400
37
+ QS_SENDMESSAGE = 0x0040
38
+ QS_TIMER = 0x0010
39
+
40
+ # Wait type constants
41
+
42
+ MWMO_ALERTABLE = 0x0002
43
+ MWMO_INPUTAVAILABLE = 0x0004
44
+ MWMO_WAITALL = 0x0001
45
+
46
+ # Access rights
47
+
48
+ EVENT_ALL_ACCESS = 0x1F0003
49
+ EVENT_MODIFY_STATE = 0x0002
50
+ MUTEX_ALL_ACCESS = 0x1F0001
51
+ MUTEX_MODIFY_STATE = 0x0001
52
+ SEMAPHORE_ALL_ACCESS = 0x1F0003
53
+ SEMAPHORE_MODIFY_STATE = 0x0002
54
+
55
+ # Namespace flags
56
+
57
+ PRIVATE_NAMESPACE_FLAG_DESTROY = 0x00000001
58
+
59
+ # Functions
60
+
61
+ API.new('CancelWaitableTimer', 'L', 'B')
62
+ API.new('CreateEvent', 'PIIP', 'L')
63
+ API.new('CreateMutex', 'PIP', 'L')
64
+ API.new('CreateSemaphore', 'PLLP', 'L')
65
+ API.new('CreateWaitableTimer', 'PIP', 'L')
66
+ API.new('DeleteCriticalSection', 'P', 'V')
67
+ API.new('EnterCriticalSection', 'P', 'V')
68
+ API.new('GetOverlappedResult', 'LPPI', 'I')
69
+ API.new('InitializeCriticalSection', 'P', 'V')
70
+ API.new('InitializeCriticalSectionAndSpinCount', 'PL', 'B')
71
+ API.new('LeaveCriticalSection', 'P', 'V')
72
+ API.new('MsgWaitForMultipleObjects', 'LPILL', 'L', 'user32')
73
+ API.new('MsgWaitForMultipleObjectsEx', 'LPLLL', 'L', 'user32')
74
+ API.new('OpenEvent', 'LIP', 'L')
75
+ API.new('OpenMutex', 'LIP', 'L')
76
+ API.new('OpenSemaphore', 'LIP', 'L')
77
+ API.new('OpenWaitableTimer', 'LIP', 'L')
78
+ API.new('ReleaseMutex', 'L', 'B')
79
+ API.new('ReleaseSemaphore', 'LLP', 'B')
80
+ API.new('ResetEvent', 'L', 'B')
81
+ API.new('SetCriticalSectionSpinCount', 'PL', 'V')
82
+ API.new('SetWaitableTimer', 'LPLKPI', 'B')
83
+ API.new('SetEvent', 'L', 'B')
84
+ API.new('TryEnterCriticalSection', 'P', 'B')
85
+ API.new('WaitForMultipleObjects', 'LPIL', 'L')
86
+ API.new('WaitForMultipleObjectsEx', 'LPILI', 'L')
87
+ API.new('WaitForSingleObject', 'LL', 'L')
88
+ API.new('WaitForSingleObjectEx', 'LLI', 'L')
89
+
90
+ # Macros
91
+
92
+ def HasOverlappedIoCompleted(overlapped)
93
+ overlapped[0,4].unpack('L')[0] != STATUS_PENDING
94
+ end
95
+
96
+ # This simulates the RUBY_CRITICAL macro from rubysig.h, although I've
97
+ # added the begin/ensure wrapper to boot.
98
+ #
99
+ def RUBY_CRITICAL(&block)
100
+ critical_section = [0].pack('L')
101
+ begin
102
+ InitializeCriticalSection(critical_section)
103
+ EnterCriticalSection(critical_section)
104
+ block.call
105
+ ensure
106
+ LeaveCriticalSection(critical_section)
85
107
  end
86
-
87
- # This simulates the RUBY_CRITICAL macro from rubysig.h, although I've
88
- # added the begin/ensure wrapper to boot.
89
- def RUBY_CRITICAL(&block)
90
- critical_section = [0].pack('L')
91
- begin
92
- InitializeCriticalSection(critical_section)
93
- EnterCriticalSection(critical_section)
94
- block.call
95
- ensure
96
- LeaveCriticalSection(critical_section)
97
- end
98
- end
99
- end
108
+ end
109
+
110
+ # Vista or later
111
+
112
+ begin
113
+ API.new('AddSIDToBoundaryDescriptor', 'PP', 'B')
114
+ API.new('ClosePrivateNamespace', 'LL', 'B')
115
+ API.new('CreateBoundaryDescriptor', 'SL', 'L')
116
+ API.new('DeleteBoundaryDescriptor', 'L', 'V')
117
+ API.new('CreatePrivateNamespace', 'PLS', 'L')
118
+ API.new('OpenPrivateNamespace', 'PS', 'L')
119
+ rescue Win32::API::LoadLibraryError
120
+ # Windows Vista or later
121
+ end
122
+
123
+ # Windows 7 or later
124
+
125
+ begin
126
+ API.new('AddIntegrityLabelToBoundaryDescriptor', 'PP', 'B')
127
+ rescue Win32::API::LoadLibraryError
128
+ # Windows 7 or later
129
+ end
130
+ end
100
131
  end
@@ -6,74 +6,70 @@
6
6
  require "windows/synchronize"
7
7
  require "test/unit"
8
8
 
9
- class SynchFoo
10
- include Windows::Synchronize
11
- end
12
-
13
9
  class TC_Windows_Synchronize < Test::Unit::TestCase
14
- def setup
15
- @handle = (0.chr * 16).unpack('LLLL')
16
- @foo = SynchFoo.new
17
- end
10
+ include Windows::Synchronize
11
+
12
+ def setup
13
+ @handle = (0.chr * 16).unpack('LLLL')
14
+ end
18
15
 
19
- def test_numeric_constants
20
- assert_not_nil(SynchFoo::INFINITE)
21
- assert_not_nil(SynchFoo::WAIT_OBJECT_0)
22
- assert_not_nil(SynchFoo::WAIT_TIMEOUT)
23
- assert_not_nil(SynchFoo::WAIT_ABANDONED)
24
- assert_not_nil(SynchFoo::WAIT_FAILED)
25
- assert_not_nil(SynchFoo::QS_ALLEVENTS)
26
- assert_not_nil(SynchFoo::QS_ALLINPUT)
27
- assert_not_nil(SynchFoo::QS_ALLPOSTMESSAGE)
28
- assert_not_nil(SynchFoo::QS_HOTKEY)
29
- assert_not_nil(SynchFoo::QS_INPUT)
30
- assert_not_nil(SynchFoo::QS_KEY)
31
- assert_not_nil(SynchFoo::QS_MOUSE)
32
- assert_not_nil(SynchFoo::QS_MOUSEBUTTON)
33
- assert_not_nil(SynchFoo::QS_MOUSEMOVE)
34
- assert_not_nil(SynchFoo::QS_PAINT)
35
- assert_not_nil(SynchFoo::QS_POSTMESSAGE)
36
- assert_not_nil(SynchFoo::QS_RAWINPUT)
37
- assert_not_nil(SynchFoo::QS_SENDMESSAGE)
38
- assert_not_nil(SynchFoo::QS_TIMER)
39
- assert_not_nil(SynchFoo::MWMO_ALERTABLE)
40
- assert_not_nil(SynchFoo::MWMO_INPUTAVAILABLE)
41
- assert_not_nil(SynchFoo::MWMO_WAITALL)
42
- assert_not_nil(SynchFoo::EVENT_ALL_ACCESS)
43
- assert_not_nil(SynchFoo::EVENT_MODIFY_STATE)
44
- assert_not_nil(SynchFoo::MUTEX_ALL_ACCESS)
45
- assert_not_nil(SynchFoo::MUTEX_MODIFY_STATE)
46
- assert_not_nil(SynchFoo::SEMAPHORE_ALL_ACCESS)
47
- assert_not_nil(SynchFoo::SEMAPHORE_MODIFY_STATE)
48
- end
16
+ def test_numeric_constants
17
+ assert_not_nil(INFINITE)
18
+ assert_not_nil(WAIT_OBJECT_0)
19
+ assert_not_nil(WAIT_TIMEOUT)
20
+ assert_not_nil(WAIT_ABANDONED)
21
+ assert_not_nil(WAIT_FAILED)
22
+ assert_not_nil(QS_ALLEVENTS)
23
+ assert_not_nil(QS_ALLINPUT)
24
+ assert_not_nil(QS_ALLPOSTMESSAGE)
25
+ assert_not_nil(QS_HOTKEY)
26
+ assert_not_nil(QS_INPUT)
27
+ assert_not_nil(QS_KEY)
28
+ assert_not_nil(QS_MOUSE)
29
+ assert_not_nil(QS_MOUSEBUTTON)
30
+ assert_not_nil(QS_MOUSEMOVE)
31
+ assert_not_nil(QS_PAINT)
32
+ assert_not_nil(QS_POSTMESSAGE)
33
+ assert_not_nil(QS_RAWINPUT)
34
+ assert_not_nil(QS_SENDMESSAGE)
35
+ assert_not_nil(QS_TIMER)
36
+ assert_not_nil(MWMO_ALERTABLE)
37
+ assert_not_nil(MWMO_INPUTAVAILABLE)
38
+ assert_not_nil(MWMO_WAITALL)
39
+ assert_not_nil(EVENT_ALL_ACCESS)
40
+ assert_not_nil(EVENT_MODIFY_STATE)
41
+ assert_not_nil(MUTEX_ALL_ACCESS)
42
+ assert_not_nil(MUTEX_MODIFY_STATE)
43
+ assert_not_nil(SEMAPHORE_ALL_ACCESS)
44
+ assert_not_nil(SEMAPHORE_MODIFY_STATE)
45
+ end
49
46
 
50
- def test_method_constants
51
- assert_not_nil(SynchFoo::CreateEvent)
52
- assert_not_nil(SynchFoo::CreateMutex)
53
- assert_not_nil(SynchFoo::CreateSemaphore)
54
- assert_not_nil(SynchFoo::DeleteCriticalSection)
55
- assert_not_nil(SynchFoo::EnterCriticalSection)
56
- assert_not_nil(SynchFoo::GetOverlappedResult)
57
- assert_not_nil(SynchFoo::InitializeCriticalSection)
58
- assert_not_nil(SynchFoo::InitializeCriticalSectionAndSpinCount)
59
- assert_not_nil(SynchFoo::LeaveCriticalSection)
60
- assert_not_nil(SynchFoo::MsgWaitForMultipleObjects)
61
- assert_not_nil(SynchFoo::MsgWaitForMultipleObjectsEx)
62
- assert_not_nil(SynchFoo::OpenEvent)
63
- assert_not_nil(SynchFoo::OpenMutex)
64
- assert_not_nil(SynchFoo::OpenSemaphore)
65
- assert_not_nil(SynchFoo::ReleaseMutex)
66
- assert_not_nil(SynchFoo::ReleaseSemaphore)
67
- assert_not_nil(SynchFoo::ResetEvent)
68
- assert_not_nil(SynchFoo::SetEvent)
69
- assert_not_nil(SynchFoo::WaitForMultipleObjects)
70
- assert_not_nil(SynchFoo::WaitForMultipleObjectsEx)
71
- assert_not_nil(SynchFoo::WaitForSingleObject)
72
- assert_not_nil(SynchFoo::WaitForSingleObjectEx)
73
- end
47
+ def test_method_constants
48
+ assert_not_nil(CreateEvent)
49
+ assert_not_nil(CreateMutex)
50
+ assert_not_nil(CreateSemaphore)
51
+ assert_not_nil(DeleteCriticalSection)
52
+ assert_not_nil(EnterCriticalSection)
53
+ assert_not_nil(GetOverlappedResult)
54
+ assert_not_nil(InitializeCriticalSection)
55
+ assert_not_nil(InitializeCriticalSectionAndSpinCount)
56
+ assert_not_nil(LeaveCriticalSection)
57
+ assert_not_nil(MsgWaitForMultipleObjects)
58
+ assert_not_nil(MsgWaitForMultipleObjectsEx)
59
+ assert_not_nil(OpenEvent)
60
+ assert_not_nil(OpenMutex)
61
+ assert_not_nil(OpenSemaphore)
62
+ assert_not_nil(ReleaseMutex)
63
+ assert_not_nil(ReleaseSemaphore)
64
+ assert_not_nil(ResetEvent)
65
+ assert_not_nil(SetEvent)
66
+ assert_not_nil(WaitForMultipleObjects)
67
+ assert_not_nil(WaitForMultipleObjectsEx)
68
+ assert_not_nil(WaitForSingleObject)
69
+ assert_not_nil(WaitForSingleObjectEx)
70
+ end
74
71
 
75
- def teardown
76
- @foo = nil
77
- @handle = nil
78
- end
72
+ def teardown
73
+ @handle = nil
74
+ end
79
75
  end
data/windows-pr.gemspec CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'windows-pr'
5
- spec.version = '1.1.0'
5
+ spec.version = '1.1.1'
6
6
  spec.license = 'Artistic 2.0'
7
7
  spec.authors = ['Daniel J. Berger', 'Park Heesob']
8
8
  spec.email = 'djberg96@gmail.com'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: windows-pr
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 0
10
- version: 1.1.0
9
+ - 1
10
+ version: 1.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel J. Berger
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-05 00:00:00 -06:00
19
+ date: 2010-11-06 00:00:00 -06:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -180,7 +180,6 @@ files:
180
180
  - test/tc_window_message.rb
181
181
  - test/tc_window_properties.rb
182
182
  - test/tc_window_timer.rb
183
- - windows-pr-1.1.0.gem
184
183
  - windows-pr.gemspec
185
184
  has_rdoc: true
186
185
  homepage: http://www.rubyforge.org/projects/win32utils