windows-pr 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +7 -0
- data/MANIFEST +3 -1
- data/README +21 -20
- data/Rakefile +42 -0
- data/lib/windows/com.rb +1 -1
- data/lib/windows/debug.rb +1 -1
- data/lib/windows/device_io.rb +35 -4
- data/lib/windows/gdi/bitmap.rb +37 -0
- data/lib/windows/gdi/device_context.rb +45 -0
- data/lib/windows/gdi/painting_drawing.rb +114 -0
- data/lib/windows/memory.rb +34 -5
- data/lib/windows/nio.rb +45 -26
- data/lib/windows/registry.rb +5 -0
- data/lib/windows/time.rb +48 -0
- data/lib/windows/window.rb +2 -0
- data/test/tc_clipboard.rb +26 -33
- data/test/tc_com.rb +34 -0
- data/test/tc_console.rb +87 -80
- data/test/tc_debug.rb +48 -0
- data/test/tc_error.rb +18 -25
- data/test/tc_eventlog.rb +33 -40
- data/test/tc_file.rb +42 -49
- data/test/tc_library.rb +13 -20
- data/test/tc_memory.rb +18 -25
- data/test/tc_msvcrt_buffer.rb +10 -17
- data/test/tc_path.rb +63 -70
- data/test/tc_pipe.rb +27 -34
- data/test/tc_process.rb +4 -11
- data/test/tc_registry.rb +4 -11
- data/test/tc_security.rb +28 -35
- data/test/tc_synchronize.rb +47 -54
- data/test/tc_unicode.rb +28 -35
- data/test/tc_volume.rb +4 -11
- data/test/tc_window.rb +45 -0
- data/windows-pr.gemspec +7 -6
- metadata +38 -14
- data/install.rb +0 -18
- data/test/ts_all.rb +0 -19
data/test/tc_library.rb
CHANGED
@@ -3,42 +3,35 @@
|
|
3
3
|
#
|
4
4
|
# Test case for the Windows::Library module.
|
5
5
|
#####################################################################
|
6
|
-
base = File.basename(Dir.pwd)
|
7
|
-
if base == 'test' || base =~ /windows-pr/
|
8
|
-
Dir.chdir '..' if base == 'test'
|
9
|
-
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
-
Dir.chdir 'test' rescue nil
|
11
|
-
end
|
12
|
-
|
13
6
|
require 'windows/library'
|
14
7
|
require 'test/unit'
|
15
8
|
|
16
|
-
class
|
9
|
+
class LibraryFoo
|
17
10
|
include Windows::Library
|
18
11
|
end
|
19
12
|
|
20
13
|
class TC_Windows_Library < Test::Unit::TestCase
|
21
14
|
def setup
|
22
|
-
@
|
15
|
+
@LibraryFoo = LibraryFoo.new
|
23
16
|
end
|
24
17
|
|
25
18
|
def test_numeric_constants
|
26
|
-
assert_equal(0,
|
27
|
-
assert_equal(1,
|
28
|
-
assert_equal(2,
|
29
|
-
assert_equal(3,
|
19
|
+
assert_equal(0, LibraryFoo::DLL_PROCESS_DETACH)
|
20
|
+
assert_equal(1, LibraryFoo::DLL_PROCESS_ATTACH)
|
21
|
+
assert_equal(2, LibraryFoo::DLL_THREAD_ATTACH)
|
22
|
+
assert_equal(3, LibraryFoo::DLL_THREAD_DETACH)
|
30
23
|
end
|
31
24
|
|
32
25
|
def test_method_constants
|
33
|
-
assert_not_nil(
|
34
|
-
assert_not_nil(
|
35
|
-
assert_not_nil(
|
36
|
-
assert_not_nil(
|
37
|
-
assert_not_nil(
|
38
|
-
assert_not_nil(
|
26
|
+
assert_not_nil(LibraryFoo::FreeLibrary)
|
27
|
+
assert_not_nil(LibraryFoo::GetModuleFileName)
|
28
|
+
assert_not_nil(LibraryFoo::GetModuleHandle)
|
29
|
+
assert_not_nil(LibraryFoo::LoadLibrary)
|
30
|
+
assert_not_nil(LibraryFoo::LoadLibraryEx)
|
31
|
+
assert_not_nil(LibraryFoo::LoadModule)
|
39
32
|
end
|
40
33
|
|
41
34
|
def teardown
|
42
|
-
@
|
35
|
+
@LibraryFoo = nil
|
43
36
|
end
|
44
37
|
end
|
data/test/tc_memory.rb
CHANGED
@@ -3,45 +3,38 @@
|
|
3
3
|
#
|
4
4
|
# Test case for the Windows::Memory module.
|
5
5
|
#####################################################################
|
6
|
-
base = File.basename(Dir.pwd)
|
7
|
-
if base == 'test' || base =~ /windows-pr/
|
8
|
-
Dir.chdir '..' if base == 'test'
|
9
|
-
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
-
Dir.chdir 'test' rescue nil
|
11
|
-
end
|
12
|
-
|
13
6
|
require 'windows/memory'
|
14
7
|
require 'test/unit'
|
15
8
|
|
16
|
-
class
|
9
|
+
class MemoryFoo
|
17
10
|
include Windows::Memory
|
18
11
|
end
|
19
12
|
|
20
|
-
class
|
13
|
+
class TC_Windows_Memory < Test::Unit::TestCase
|
21
14
|
def setup
|
22
|
-
@foo =
|
15
|
+
@foo = MemoryFoo.new
|
23
16
|
@path = "C:\\"
|
24
17
|
end
|
25
18
|
|
26
19
|
def test_numeric_constants
|
27
|
-
assert_not_nil(
|
28
|
-
assert_not_nil(
|
29
|
-
assert_not_nil(
|
30
|
-
assert_not_nil(
|
31
|
-
assert_not_nil(
|
20
|
+
assert_not_nil(MemoryFoo::GHND)
|
21
|
+
assert_not_nil(MemoryFoo::GMEM_FIXED)
|
22
|
+
assert_not_nil(MemoryFoo::GMEM_MOVABLE)
|
23
|
+
assert_not_nil(MemoryFoo::GMEM_ZEROINIT)
|
24
|
+
assert_not_nil(MemoryFoo::GPTR)
|
32
25
|
end
|
33
26
|
|
34
27
|
def test_method_constants
|
35
|
-
assert_not_nil(
|
36
|
-
assert_not_nil(
|
37
|
-
assert_not_nil(
|
38
|
-
assert_not_nil(
|
39
|
-
assert_not_nil(
|
40
|
-
assert_not_nil(
|
41
|
-
assert_not_nil(
|
42
|
-
assert_not_nil(
|
43
|
-
assert_not_nil(
|
44
|
-
assert_not_nil(
|
28
|
+
assert_not_nil(MemoryFoo::GlobalAlloc)
|
29
|
+
assert_not_nil(MemoryFoo::GlobalFlags)
|
30
|
+
assert_not_nil(MemoryFoo::GlobalFree)
|
31
|
+
assert_not_nil(MemoryFoo::GlobalHandle)
|
32
|
+
assert_not_nil(MemoryFoo::GlobalLock)
|
33
|
+
assert_not_nil(MemoryFoo::GlobalMemoryStatus)
|
34
|
+
assert_not_nil(MemoryFoo::GlobalMemoryStatusEx)
|
35
|
+
assert_not_nil(MemoryFoo::GlobalReAlloc)
|
36
|
+
assert_not_nil(MemoryFoo::GlobalSize)
|
37
|
+
assert_not_nil(MemoryFoo::GlobalUnlock)
|
45
38
|
end
|
46
39
|
|
47
40
|
def teardown
|
data/test/tc_msvcrt_buffer.rb
CHANGED
@@ -3,34 +3,27 @@
|
|
3
3
|
#
|
4
4
|
# Test case for the Windows::MSVCRT::Buffer module.
|
5
5
|
#####################################################################
|
6
|
-
base = File.basename(Dir.pwd)
|
7
|
-
if base == 'test' || base =~ /windows-pr/
|
8
|
-
Dir.chdir '..' if base == 'test'
|
9
|
-
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
-
Dir.chdir 'test' rescue nil
|
11
|
-
end
|
12
|
-
|
13
6
|
require "windows/msvcrt/buffer"
|
14
7
|
require "test/unit"
|
15
8
|
|
16
|
-
class
|
9
|
+
class BufferFoo
|
17
10
|
include Windows::MSVCRT::Buffer
|
18
11
|
end
|
19
12
|
|
20
13
|
class TC_Windows_MSVCRT_Buffer < Test::Unit::TestCase
|
21
14
|
def setup
|
22
|
-
@foo =
|
15
|
+
@foo = BufferFoo.new
|
23
16
|
end
|
24
17
|
|
25
18
|
def test_method_constants
|
26
|
-
assert_not_nil(
|
27
|
-
assert_not_nil(
|
28
|
-
assert_not_nil(
|
29
|
-
assert_not_nil(
|
30
|
-
assert_not_nil(
|
31
|
-
assert_not_nil(
|
32
|
-
assert_not_nil(
|
33
|
-
assert_not_nil(
|
19
|
+
assert_not_nil(BufferFoo::Memcpy)
|
20
|
+
assert_not_nil(BufferFoo::Memccpy)
|
21
|
+
assert_not_nil(BufferFoo::Memchr)
|
22
|
+
assert_not_nil(BufferFoo::Memcmp)
|
23
|
+
assert_not_nil(BufferFoo::Memicmp)
|
24
|
+
assert_not_nil(BufferFoo::Memmove)
|
25
|
+
assert_not_nil(BufferFoo::Memset)
|
26
|
+
assert_not_nil(BufferFoo::Swab)
|
34
27
|
end
|
35
28
|
|
36
29
|
def test_memcpy
|
data/test/tc_path.rb
CHANGED
@@ -3,91 +3,84 @@
|
|
3
3
|
#
|
4
4
|
# Test case for the Windows::Path module.
|
5
5
|
#####################################################################
|
6
|
-
base = File.basename(Dir.pwd)
|
7
|
-
if base == 'test' || base =~ /windows-pr/
|
8
|
-
Dir.chdir '..' if base == 'test'
|
9
|
-
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
-
Dir.chdir 'test' rescue nil
|
11
|
-
end
|
12
|
-
|
13
6
|
require "windows/path"
|
14
7
|
require "test/unit"
|
15
8
|
|
16
|
-
class
|
9
|
+
class PathFoo
|
17
10
|
include Windows::Path
|
18
11
|
end
|
19
12
|
|
20
13
|
class TC_Windows_Path < Test::Unit::TestCase
|
21
14
|
def setup
|
22
|
-
@foo =
|
15
|
+
@foo = PathFoo.new
|
23
16
|
@path = "C:\\"
|
24
17
|
end
|
25
18
|
|
26
19
|
def test_numeric_constants
|
27
|
-
assert_equal(0x0000,
|
28
|
-
assert_equal(0x0001,
|
29
|
-
assert_equal(0x0002,
|
30
|
-
assert_equal(0x0004,
|
31
|
-
assert_equal(0x0008,
|
20
|
+
assert_equal(0x0000, PathFoo::GCT_INVALID)
|
21
|
+
assert_equal(0x0001, PathFoo::GCT_LFNCHAR)
|
22
|
+
assert_equal(0x0002, PathFoo::GCT_SHORTCHAR)
|
23
|
+
assert_equal(0x0004, PathFoo::GCT_WILD)
|
24
|
+
assert_equal(0x0008, PathFoo::GCT_SEPARATOR)
|
32
25
|
end
|
33
26
|
|
34
27
|
def test_method_constants
|
35
|
-
assert_not_nil(
|
36
|
-
assert_not_nil(
|
37
|
-
assert_not_nil(
|
38
|
-
assert_not_nil(
|
39
|
-
assert_not_nil(
|
40
|
-
assert_not_nil(
|
41
|
-
assert_not_nil(
|
42
|
-
assert_not_nil(
|
43
|
-
assert_not_nil(
|
44
|
-
assert_not_nil(
|
45
|
-
assert_not_nil(
|
46
|
-
assert_not_nil(
|
47
|
-
assert_not_nil(
|
48
|
-
assert_not_nil(
|
49
|
-
assert_not_nil(
|
50
|
-
assert_not_nil(
|
51
|
-
assert_not_nil(
|
52
|
-
assert_not_nil(
|
53
|
-
assert_not_nil(
|
54
|
-
assert_not_nil(
|
55
|
-
assert_not_nil(
|
56
|
-
assert_not_nil(
|
57
|
-
assert_not_nil(
|
58
|
-
#assert_not_nil(
|
59
|
-
assert_not_nil(
|
60
|
-
assert_not_nil(
|
61
|
-
assert_not_nil(
|
62
|
-
assert_not_nil(
|
63
|
-
assert_not_nil(
|
64
|
-
assert_not_nil(
|
65
|
-
assert_not_nil(
|
66
|
-
assert_not_nil(
|
67
|
-
assert_not_nil(
|
68
|
-
assert_not_nil(
|
69
|
-
assert_not_nil(
|
70
|
-
assert_not_nil(
|
71
|
-
assert_not_nil(
|
72
|
-
assert_not_nil(
|
73
|
-
assert_not_nil(
|
74
|
-
assert_not_nil(
|
75
|
-
assert_not_nil(
|
76
|
-
assert_not_nil(
|
77
|
-
assert_not_nil(
|
78
|
-
assert_not_nil(
|
79
|
-
assert_not_nil(
|
80
|
-
assert_not_nil(
|
81
|
-
assert_not_nil(
|
82
|
-
assert_not_nil(
|
83
|
-
assert_not_nil(
|
84
|
-
assert_not_nil(
|
85
|
-
assert_not_nil(
|
86
|
-
assert_not_nil(
|
87
|
-
assert_not_nil(
|
88
|
-
assert_not_nil(
|
89
|
-
assert_not_nil(
|
90
|
-
assert_not_nil(
|
28
|
+
assert_not_nil(PathFoo::PathAddBackslash)
|
29
|
+
assert_not_nil(PathFoo::PathAddExtension)
|
30
|
+
assert_not_nil(PathFoo::PathAppend)
|
31
|
+
assert_not_nil(PathFoo::PathBuildRoot)
|
32
|
+
assert_not_nil(PathFoo::PathCanonicalize)
|
33
|
+
assert_not_nil(PathFoo::PathCombine)
|
34
|
+
assert_not_nil(PathFoo::PathCommonPrefix)
|
35
|
+
assert_not_nil(PathFoo::PathCompactPath)
|
36
|
+
assert_not_nil(PathFoo::PathCompactPathEx)
|
37
|
+
assert_not_nil(PathFoo::PathCreateFromUrl)
|
38
|
+
assert_not_nil(PathFoo::PathFileExists)
|
39
|
+
assert_not_nil(PathFoo::PathFindExtension)
|
40
|
+
assert_not_nil(PathFoo::PathFindFileName)
|
41
|
+
assert_not_nil(PathFoo::PathFindNextComponent)
|
42
|
+
assert_not_nil(PathFoo::PathFindOnPath)
|
43
|
+
assert_not_nil(PathFoo::PathFindSuffixArray)
|
44
|
+
assert_not_nil(PathFoo::PathGetArgs)
|
45
|
+
assert_not_nil(PathFoo::PathGetCharType)
|
46
|
+
assert_not_nil(PathFoo::PathGetDriveNumber)
|
47
|
+
assert_not_nil(PathFoo::PathIsContentType)
|
48
|
+
assert_not_nil(PathFoo::PathIsDirectory)
|
49
|
+
assert_not_nil(PathFoo::PathIsDirectoryEmpty)
|
50
|
+
assert_not_nil(PathFoo::PathIsFileSpec)
|
51
|
+
#assert_not_nil(PathFoo::PathIsHTMLFile)
|
52
|
+
assert_not_nil(PathFoo::PathIsLFNFileSpec)
|
53
|
+
assert_not_nil(PathFoo::PathIsNetworkPath)
|
54
|
+
assert_not_nil(PathFoo::PathIsPrefix)
|
55
|
+
assert_not_nil(PathFoo::PathIsRelative)
|
56
|
+
assert_not_nil(PathFoo::PathIsRoot)
|
57
|
+
assert_not_nil(PathFoo::PathIsSameRoot)
|
58
|
+
assert_not_nil(PathFoo::PathIsSystemFolder)
|
59
|
+
assert_not_nil(PathFoo::PathIsUNC)
|
60
|
+
assert_not_nil(PathFoo::PathIsUNCServer)
|
61
|
+
assert_not_nil(PathFoo::PathIsUNCServerShare)
|
62
|
+
assert_not_nil(PathFoo::PathIsURL)
|
63
|
+
assert_not_nil(PathFoo::PathMakePretty)
|
64
|
+
assert_not_nil(PathFoo::PathMakeSystemFolder)
|
65
|
+
assert_not_nil(PathFoo::PathMatchSpec)
|
66
|
+
assert_not_nil(PathFoo::PathParseIconLocation)
|
67
|
+
assert_not_nil(PathFoo::PathQuoteSpaces)
|
68
|
+
assert_not_nil(PathFoo::PathRelativePathTo)
|
69
|
+
assert_not_nil(PathFoo::PathRemoveArgs)
|
70
|
+
assert_not_nil(PathFoo::PathRemoveBackslash)
|
71
|
+
assert_not_nil(PathFoo::PathRemoveBlanks)
|
72
|
+
assert_not_nil(PathFoo::PathRemoveExtension)
|
73
|
+
assert_not_nil(PathFoo::PathRemoveFileSpec)
|
74
|
+
assert_not_nil(PathFoo::PathRenameExtension)
|
75
|
+
assert_not_nil(PathFoo::PathSearchAndQualify)
|
76
|
+
assert_not_nil(PathFoo::PathSetDlgItemPath)
|
77
|
+
assert_not_nil(PathFoo::PathSkipRoot)
|
78
|
+
assert_not_nil(PathFoo::PathStripPath)
|
79
|
+
assert_not_nil(PathFoo::PathStripToRoot)
|
80
|
+
assert_not_nil(PathFoo::PathUndecorate)
|
81
|
+
assert_not_nil(PathFoo::PathUnExpandEnvStrings)
|
82
|
+
assert_not_nil(PathFoo::PathUnmakeSystemFolder)
|
83
|
+
assert_not_nil(PathFoo::PathUnquoteSpaces)
|
91
84
|
end
|
92
85
|
|
93
86
|
def teardown
|
data/test/tc_pipe.rb
CHANGED
@@ -3,55 +3,48 @@
|
|
3
3
|
#
|
4
4
|
# Test case for the Windows::Pipe module.
|
5
5
|
#####################################################################
|
6
|
-
base = File.basename(Dir.pwd)
|
7
|
-
if base == 'test' || base =~ /windows-pr/
|
8
|
-
Dir.chdir '..' if base == 'test'
|
9
|
-
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
-
Dir.chdir 'test' rescue nil
|
11
|
-
end
|
12
|
-
|
13
6
|
require 'windows/pipe'
|
14
7
|
require 'test/unit'
|
15
8
|
|
16
|
-
class
|
9
|
+
class PipeFoo
|
17
10
|
include Windows::Pipe
|
18
11
|
end
|
19
12
|
|
20
13
|
class TC_Windows_Pipe < Test::Unit::TestCase
|
21
14
|
|
22
15
|
def setup
|
23
|
-
@foo =
|
16
|
+
@foo = PipeFoo.new
|
24
17
|
end
|
25
18
|
|
26
19
|
def test_numeric_constants
|
27
|
-
assert_equal(0x00000001,
|
28
|
-
assert_equal(0xffffffff,
|
29
|
-
assert_equal(0x00000000,
|
30
|
-
assert_equal(0x00000000,
|
31
|
-
assert_equal(0x00000001,
|
32
|
-
assert_equal(0x00000001,
|
33
|
-
assert_equal(0x00000002,
|
34
|
-
assert_equal(0x00000003,
|
35
|
-
assert_equal(0x00000000,
|
36
|
-
assert_equal(0x00000004,
|
37
|
-
assert_equal(0x00000000,
|
38
|
-
assert_equal(0x00000002,
|
39
|
-
assert_equal(0x00000000,
|
40
|
-
assert_equal(0x00000001,
|
20
|
+
assert_equal(0x00000001, PipeFoo::NMPWAIT_NOWAIT)
|
21
|
+
assert_equal(0xffffffff, PipeFoo::NMPWAIT_WAIT_FOREVER)
|
22
|
+
assert_equal(0x00000000, PipeFoo::NMPWAIT_USE_DEFAULT_WAIT)
|
23
|
+
assert_equal(0x00000000, PipeFoo::PIPE_WAIT)
|
24
|
+
assert_equal(0x00000001, PipeFoo::PIPE_NOWAIT)
|
25
|
+
assert_equal(0x00000001, PipeFoo::PIPE_ACCESS_INBOUND)
|
26
|
+
assert_equal(0x00000002, PipeFoo::PIPE_ACCESS_OUTBOUND)
|
27
|
+
assert_equal(0x00000003, PipeFoo::PIPE_ACCESS_DUPLEX)
|
28
|
+
assert_equal(0x00000000, PipeFoo::PIPE_TYPE_BYTE)
|
29
|
+
assert_equal(0x00000004, PipeFoo::PIPE_TYPE_MESSAGE)
|
30
|
+
assert_equal(0x00000000, PipeFoo::PIPE_READMODE_BYTE)
|
31
|
+
assert_equal(0x00000002, PipeFoo::PIPE_READMODE_MESSAGE)
|
32
|
+
assert_equal(0x00000000, PipeFoo::PIPE_CLIENT_END)
|
33
|
+
assert_equal(0x00000001, PipeFoo::PIPE_SERVER_END)
|
41
34
|
end
|
42
35
|
|
43
36
|
def test_method_constants
|
44
|
-
assert_not_nil(
|
45
|
-
assert_not_nil(
|
46
|
-
assert_not_nil(
|
47
|
-
assert_not_nil(
|
48
|
-
assert_not_nil(
|
49
|
-
assert_not_nil(
|
50
|
-
assert_not_nil(
|
51
|
-
assert_not_nil(
|
52
|
-
assert_not_nil(
|
53
|
-
assert_not_nil(
|
54
|
-
assert_not_nil(
|
37
|
+
assert_not_nil(PipeFoo::CallNamedPipe)
|
38
|
+
assert_not_nil(PipeFoo::ConnectNamedPipe)
|
39
|
+
assert_not_nil(PipeFoo::CreateNamedPipe)
|
40
|
+
assert_not_nil(PipeFoo::CreatePipe)
|
41
|
+
assert_not_nil(PipeFoo::DisconnectNamedPipe)
|
42
|
+
assert_not_nil(PipeFoo::GetNamedPipeHandleState)
|
43
|
+
assert_not_nil(PipeFoo::GetNamedPipeInfo)
|
44
|
+
assert_not_nil(PipeFoo::PeekNamedPipe)
|
45
|
+
assert_not_nil(PipeFoo::SetNamedPipeHandleState)
|
46
|
+
assert_not_nil(PipeFoo::TransactNamedPipe)
|
47
|
+
assert_not_nil(PipeFoo::WaitNamedPipe)
|
55
48
|
end
|
56
49
|
|
57
50
|
def teardown
|
data/test/tc_process.rb
CHANGED
@@ -3,31 +3,24 @@
|
|
3
3
|
#
|
4
4
|
# Test case for the Windows::Process module.
|
5
5
|
#####################################################################
|
6
|
-
base = File.basename(Dir.pwd)
|
7
|
-
if base == 'test' || base =~ /windows-pr/
|
8
|
-
Dir.chdir '..' if base == 'test'
|
9
|
-
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
-
Dir.chdir 'test' rescue nil
|
11
|
-
end
|
12
|
-
|
13
6
|
require 'windows/process'
|
14
7
|
require 'test/unit'
|
15
8
|
|
16
|
-
class
|
9
|
+
class ProcessFoo
|
17
10
|
include Windows::Process
|
18
11
|
end
|
19
12
|
|
20
13
|
class TC_Windows_Process < Test::Unit::TestCase
|
21
14
|
def setup
|
22
|
-
@foo =
|
15
|
+
@foo = ProcessFoo.new
|
23
16
|
end
|
24
17
|
|
25
18
|
def test_numeric_constants
|
26
|
-
assert_equal(0x1F0FFF,
|
19
|
+
assert_equal(0x1F0FFF, ProcessFoo::PROCESS_ALL_ACCESS)
|
27
20
|
end
|
28
21
|
|
29
22
|
def test_method_constants
|
30
|
-
assert_not_nil(
|
23
|
+
assert_not_nil(ProcessFoo::CreateProcess)
|
31
24
|
end
|
32
25
|
|
33
26
|
def teardown
|
data/test/tc_registry.rb
CHANGED
@@ -3,31 +3,24 @@
|
|
3
3
|
#
|
4
4
|
# Test case for the Windows::Registry module.
|
5
5
|
#####################################################################
|
6
|
-
base = File.basename(Dir.pwd)
|
7
|
-
if base == 'test' || base =~ /windows-pr/
|
8
|
-
Dir.chdir '..' if base == 'test'
|
9
|
-
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
-
Dir.chdir 'test' rescue nil
|
11
|
-
end
|
12
|
-
|
13
6
|
require 'windows/registry'
|
14
7
|
require 'test/unit'
|
15
8
|
|
16
|
-
class
|
9
|
+
class RegistryFoo
|
17
10
|
include Windows::Registry
|
18
11
|
end
|
19
12
|
|
20
13
|
class TC_Windows_Registry < Test::Unit::TestCase
|
21
14
|
def setup
|
22
|
-
@foo =
|
15
|
+
@foo = RegistryFoo.new
|
23
16
|
end
|
24
17
|
|
25
18
|
def test_numeric_constants
|
26
|
-
assert_equal(0x80000000,
|
19
|
+
assert_equal(0x80000000, RegistryFoo::HKEY_CLASSES_ROOT)
|
27
20
|
end
|
28
21
|
|
29
22
|
def test_method_constants
|
30
|
-
assert_not_nil(
|
23
|
+
assert_not_nil(RegistryFoo::RegCloseKey)
|
31
24
|
end
|
32
25
|
|
33
26
|
def teardown
|
data/test/tc_security.rb
CHANGED
@@ -3,54 +3,47 @@
|
|
3
3
|
#
|
4
4
|
# Test case for the Windows::Security module.
|
5
5
|
#####################################################################
|
6
|
-
base = File.basename(Dir.pwd)
|
7
|
-
if base == 'test' || base =~ /windows-pr/
|
8
|
-
Dir.chdir '..' if base == 'test'
|
9
|
-
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
10
|
-
Dir.chdir 'test' rescue nil
|
11
|
-
end
|
12
|
-
|
13
6
|
require "windows/security"
|
14
7
|
require "test/unit"
|
15
8
|
|
16
|
-
class
|
9
|
+
class SecurityFoo
|
17
10
|
include Windows::Security
|
18
11
|
end
|
19
12
|
|
20
|
-
class
|
13
|
+
class TC_Windows_Security < Test::Unit::TestCase
|
21
14
|
def setup
|
22
|
-
@foo =
|
15
|
+
@foo = SecurityFoo.new
|
23
16
|
end
|
24
17
|
|
25
18
|
def test_numeric_constants
|
26
|
-
assert_equal(2,
|
27
|
-
assert_equal(2,
|
28
|
-
assert_equal(3,
|
29
|
-
assert_equal(4,
|
30
|
-
assert_equal(62,
|
31
|
-
assert_equal(4,
|
32
|
-
assert_equal(4,
|
33
|
-
assert_equal(20,
|
34
|
-
assert_equal(1,
|
35
|
-
assert_equal(4026597376,
|
36
|
-
assert_equal(4026531840,
|
37
|
-
assert_equal(2097151,
|
19
|
+
assert_equal(2, SecurityFoo::ACL_REVISION)
|
20
|
+
assert_equal(2, SecurityFoo::ACL_REVISION2)
|
21
|
+
assert_equal(3, SecurityFoo::ACL_REVISION3)
|
22
|
+
assert_equal(4, SecurityFoo::ACL_REVISION4)
|
23
|
+
assert_equal(62, SecurityFoo::ALLOW_ACE_LENGTH)
|
24
|
+
assert_equal(4, SecurityFoo::DACL_SECURITY_INFORMATION)
|
25
|
+
assert_equal(4, SecurityFoo::SE_DACL_PRESENT)
|
26
|
+
assert_equal(20, SecurityFoo::SECURITY_DESCRIPTOR_MIN_LENGTH)
|
27
|
+
assert_equal(1, SecurityFoo::SECURITY_DESCRIPTOR_REVISION)
|
28
|
+
assert_equal(4026597376, SecurityFoo::GENERIC_RIGHTS_MASK)
|
29
|
+
assert_equal(4026531840, SecurityFoo::GENERIC_RIGHTS_CHK)
|
30
|
+
assert_equal(2097151, SecurityFoo::REST_RIGHTS_MASK)
|
38
31
|
end
|
39
32
|
|
40
33
|
def test_method_constants
|
41
|
-
assert_not_nil(
|
42
|
-
assert_not_nil(
|
43
|
-
assert_not_nil(
|
44
|
-
assert_not_nil(
|
45
|
-
assert_not_nil(
|
46
|
-
assert_not_nil(
|
47
|
-
assert_not_nil(
|
48
|
-
assert_not_nil(
|
49
|
-
assert_not_nil(
|
50
|
-
assert_not_nil(
|
51
|
-
assert_not_nil(
|
52
|
-
assert_not_nil(
|
53
|
-
assert_not_nil(
|
34
|
+
assert_not_nil(SecurityFoo::AddAce)
|
35
|
+
assert_not_nil(SecurityFoo::CopySid)
|
36
|
+
assert_not_nil(SecurityFoo::GetAce)
|
37
|
+
assert_not_nil(SecurityFoo::GetFileSecurity)
|
38
|
+
assert_not_nil(SecurityFoo::GetLengthSid)
|
39
|
+
assert_not_nil(SecurityFoo::GetSecurityDescriptorControl)
|
40
|
+
assert_not_nil(SecurityFoo::GetSecurityDescriptorDacl)
|
41
|
+
assert_not_nil(SecurityFoo::InitializeAcl)
|
42
|
+
assert_not_nil(SecurityFoo::InitializeSecurityDescriptor)
|
43
|
+
assert_not_nil(SecurityFoo::LookupAccountName)
|
44
|
+
assert_not_nil(SecurityFoo::LookupAccountSid)
|
45
|
+
assert_not_nil(SecurityFoo::SetFileSecurity)
|
46
|
+
assert_not_nil(SecurityFoo::SetSecurityDescriptorDacl)
|
54
47
|
end
|
55
48
|
|
56
49
|
def test_add_ace
|