windows-pr 1.1.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. data/CHANGES +15 -0
  2. data/MANIFEST +65 -65
  3. data/README +149 -149
  4. data/Rakefile +37 -52
  5. data/doc/conversion_guide.txt +37 -37
  6. data/lib/windows/clipboard.rb +2 -0
  7. data/lib/windows/com.rb +2 -0
  8. data/lib/windows/com/accessibility.rb +12 -10
  9. data/lib/windows/com/automation.rb +149 -147
  10. data/lib/windows/com/variant.rb +24 -22
  11. data/lib/windows/console.rb +114 -112
  12. data/lib/windows/debug.rb +35 -33
  13. data/lib/windows/device_io.rb +248 -246
  14. data/lib/windows/directory.rb +2 -0
  15. data/lib/windows/error.rb +2 -0
  16. data/lib/windows/eventlog.rb +2 -0
  17. data/lib/windows/file.rb +264 -262
  18. data/lib/windows/file_mapping.rb +25 -23
  19. data/lib/windows/filesystem.rb +2 -0
  20. data/lib/windows/gdi/bitmap.rb +65 -63
  21. data/lib/windows/gdi/device_context.rb +46 -44
  22. data/lib/windows/gdi/metafile.rb +40 -38
  23. data/lib/windows/gdi/painting_drawing.rb +115 -113
  24. data/lib/windows/handle.rb +2 -0
  25. data/lib/windows/library.rb +2 -0
  26. data/lib/windows/limits.rb +34 -31
  27. data/lib/windows/mailslot.rb +2 -0
  28. data/lib/windows/memory.rb +2 -0
  29. data/lib/windows/msvcrt/buffer.rb +75 -73
  30. data/lib/windows/msvcrt/directory.rb +31 -29
  31. data/lib/windows/msvcrt/file.rb +47 -45
  32. data/lib/windows/msvcrt/io.rb +62 -60
  33. data/lib/windows/msvcrt/string.rb +2 -0
  34. data/lib/windows/msvcrt/time.rb +169 -167
  35. data/lib/windows/national.rb +580 -578
  36. data/lib/windows/network/management.rb +525 -523
  37. data/lib/windows/network/snmp.rb +92 -90
  38. data/lib/windows/network/winsock.rb +128 -126
  39. data/lib/windows/nio.rb +2 -0
  40. data/lib/windows/ntfs/winternl.rb +96 -82
  41. data/lib/windows/path.rb +143 -141
  42. data/lib/windows/pipe.rb +42 -40
  43. data/lib/windows/process.rb +2 -0
  44. data/lib/windows/registry.rb +171 -126
  45. data/lib/windows/security.rb +479 -477
  46. data/lib/windows/security/authentication.rb +32 -30
  47. data/lib/windows/service.rb +142 -140
  48. data/lib/windows/shell.rb +171 -169
  49. data/lib/windows/socket.rb +86 -0
  50. data/lib/windows/sound.rb +39 -37
  51. data/lib/windows/synchronize.rb +133 -131
  52. data/lib/windows/system_info.rb +4 -2
  53. data/lib/windows/thread.rb +2 -0
  54. data/lib/windows/time.rb +48 -46
  55. data/lib/windows/tool_helper.rb +36 -34
  56. data/lib/windows/unicode.rb +2 -0
  57. data/lib/windows/volume.rb +61 -59
  58. data/lib/windows/window.rb +81 -79
  59. data/lib/windows/window/classes.rb +59 -57
  60. data/lib/windows/window/dialog.rb +91 -89
  61. data/lib/windows/window/menu.rb +102 -100
  62. data/lib/windows/window/message.rb +297 -295
  63. data/lib/windows/window/properties.rb +20 -18
  64. data/lib/windows/window/timer.rb +19 -17
  65. data/lib/windows/wsa.rb +102 -0
  66. data/test/tc_clipboard.rb +41 -41
  67. data/test/tc_com.rb +32 -32
  68. data/test/tc_com_automation.rb +15 -15
  69. data/test/tc_console.rb +108 -108
  70. data/test/tc_debug.rb +48 -48
  71. data/test/tc_device_io.rb +29 -29
  72. data/test/tc_directory.rb +25 -25
  73. data/test/tc_error.rb +38 -50
  74. data/test/tc_eventlog.rb +58 -58
  75. data/test/tc_file.rb +67 -67
  76. data/test/tc_file_mapping.rb +38 -38
  77. data/test/tc_filesystem.rb +27 -27
  78. data/test/tc_gdi_bitmap.rb +25 -25
  79. data/test/tc_gdi_metafile.rb +23 -23
  80. data/test/tc_handle.rb +36 -36
  81. data/test/tc_library.rb +37 -37
  82. data/test/tc_limits.rb +34 -34
  83. data/test/tc_mailslot.rb +22 -22
  84. data/test/tc_memory.rb +44 -44
  85. data/test/tc_msvcrt_buffer.rb +59 -68
  86. data/test/tc_msvcrt_directory.rb +96 -98
  87. data/test/tc_msvcrt_file.rb +80 -80
  88. data/test/tc_msvcrt_io.rb +48 -48
  89. data/test/tc_msvcrt_string.rb +94 -93
  90. data/test/tc_msvcrt_time.rb +19 -29
  91. data/test/tc_national.rb +38 -38
  92. data/test/tc_network_management.rb +32 -32
  93. data/test/tc_network_snmp.rb +31 -31
  94. data/test/tc_network_winsock.rb +34 -34
  95. data/test/tc_nio.rb +32 -32
  96. data/test/tc_ntfs_winternl.rb +33 -18
  97. data/test/tc_path.rb +90 -90
  98. data/test/tc_pipe.rb +53 -53
  99. data/test/tc_process.rb +24 -24
  100. data/test/tc_registry.rb +29 -29
  101. data/test/tc_security.rb +104 -104
  102. data/test/tc_security_authentication.rb +34 -34
  103. data/test/tc_service.rb +57 -57
  104. data/test/tc_shell.rb +34 -34
  105. data/test/tc_socket.rb +20 -0
  106. data/test/tc_sound.rb +37 -37
  107. data/test/tc_synchronize.rb +75 -75
  108. data/test/tc_system_info.rb +33 -43
  109. data/test/tc_thread.rb +29 -29
  110. data/test/tc_time.rb +32 -32
  111. data/test/tc_tool_helper.rb +29 -29
  112. data/test/tc_unicode.rb +62 -62
  113. data/test/tc_volume.rb +47 -47
  114. data/test/tc_window.rb +45 -45
  115. data/test/tc_window_classes.rb +33 -33
  116. data/test/tc_window_dialog.rb +33 -33
  117. data/test/tc_window_menu.rb +29 -29
  118. data/test/tc_window_message.rb +33 -33
  119. data/test/tc_window_properties.rb +29 -29
  120. data/test/tc_window_timer.rb +29 -29
  121. data/test/tc_wsa.rb +19 -0
  122. data/windows-pr.gemspec +1 -1
  123. metadata +13 -7
@@ -7,6 +7,8 @@ module Windows
7
7
  API.auto_method = true
8
8
  API.auto_unicode = false
9
9
 
10
+ private
11
+
10
12
  INVALID_HANDLE_VALUE = 0xFFFFFFFF
11
13
  HANDLE_FLAG_INHERIT = 0x00000001
12
14
  HANDLE_FLAG_PROTECT_FROM_CLOSE = 0x00000002
@@ -7,6 +7,8 @@ module Windows
7
7
  API.auto_method = true
8
8
  API.auto_unicode = true
9
9
 
10
+ private
11
+
10
12
  DLL_PROCESS_DETACH = 0
11
13
  DLL_PROCESS_ATTACH = 1
12
14
  DLL_THREAD_ATTACH = 2
@@ -1,31 +1,34 @@
1
- module Windows
2
- module Limits
3
- MINCHAR = 0x80
4
- MAXCHAR = 0x7f
5
- MINSHORT = 0x8000
6
- MAXSHORT = 0x7fff
7
- MINLONG = 0x80000000
8
- MAXLONG = 0x7fffffff
9
- MAXBYTE = 0xff
10
- MAXWORD = 0xffff
11
- MAXDWORD = 0xffffffff
12
-
13
- # For wide character functions the actual path limit is actually 32k
14
- # for most functions that deal with paths, but in the interests of not
15
- # wasting huge chunks of memory on buffers I limit it to 1k, which
16
- # should be more than enough in practice.
17
- if RUBY_VERSION.to_f >= 1.9
18
- if __ENCODING__.name == 'UTF-8'
19
- MAXPATH = 1024
20
- else
21
- MAXPATH = 256
22
- end
23
- else
24
- if $KCODE == 'UTF8'
25
- MAXPATH = 1024
26
- else
27
- MAXPATH = 256
28
- end
29
- end
30
- end
31
- end
1
+ module Windows
2
+ module Limits
3
+ private
4
+
5
+ MINCHAR = 0x80
6
+ MAXCHAR = 0x7f
7
+ MINSHORT = 0x8000
8
+ MAXSHORT = 0x7fff
9
+ MINLONG = 0x80000000
10
+ MAXLONG = 0x7fffffff
11
+ MAXBYTE = 0xff
12
+ MAXWORD = 0xffff
13
+ MAXDWORD = 0xffffffff
14
+
15
+ # For wide character functions the actual path limit is actually 32k
16
+ # for most functions that deal with paths, but in the interests of not
17
+ # wasting huge chunks of memory on buffers I limit it to 1k, which
18
+ # should be more than enough in practice.
19
+ #
20
+ if RUBY_VERSION.to_f >= 1.9
21
+ if __ENCODING__.name == 'UTF-8'
22
+ MAXPATH = 1024
23
+ else
24
+ MAXPATH = 256
25
+ end
26
+ else
27
+ if $KCODE == 'UTF8'
28
+ MAXPATH = 1024
29
+ else
30
+ MAXPATH = 256
31
+ end
32
+ end
33
+ end
34
+ end
@@ -10,6 +10,8 @@ module Windows
10
10
  API.auto_method = true
11
11
  API.auto_unicode = true
12
12
 
13
+ private
14
+
13
15
  # Constants
14
16
 
15
17
  MAILSLOT_WAIT_FOREVER = 0xFFFFFFFF
@@ -7,6 +7,8 @@ module Windows
7
7
  API.auto_method = true
8
8
  API.auto_unicode = false
9
9
 
10
+ private
11
+
10
12
  GHND = 0x0042
11
13
  GMEM_FIXED = 0x0000
12
14
  GMEM_MOVABLE = 0002
@@ -1,73 +1,75 @@
1
- require 'windows/api'
2
-
3
- module Windows
4
- module MSVCRT
5
- module Buffer
6
- API.auto_constant = false # We want multiple versions
7
- API.auto_method = false
8
- API.auto_unicode = false
9
-
10
- Memcpy = API.new('memcpy', 'PLL', 'P', MSVCRT_DLL)
11
- Memccpy = API.new('_memccpy', 'PPIL', 'P', MSVCRT_DLL)
12
- Memchr = API.new('memchr', 'PIL', 'P', MSVCRT_DLL)
13
- Memcmp = API.new('memcmp', 'PPL', 'I', MSVCRT_DLL)
14
- Memicmp = API.new('_memicmp', 'PPL', 'I', MSVCRT_DLL)
15
- Memmove = API.new('memmove', 'PPL', 'P', MSVCRT_DLL)
16
- Memset = API.new('memset', 'PLL', 'L', MSVCRT_DLL)
17
- Swab = API.new('_swab', 'PPI', 'V', MSVCRT_DLL)
18
-
19
- MemcpyPLL = API.new('memcpy', 'PLL', 'P', MSVCRT_DLL)
20
- MemcpyLPL = API.new('memcpy', 'LPL', 'P', MSVCRT_DLL)
21
- MemcpyLLL = API.new('memcpy', 'LLL', 'P', MSVCRT_DLL)
22
- MemcpyPPL = API.new('memcpy', 'PPL', 'P', MSVCRT_DLL)
23
-
24
- # Wrapper for the memcpy() function. Both the +dest+ and +src+ can
25
- # be either a string or a memory address. If +size+ is omitted, it
26
- # defaults to the length of +src+.
27
- #
28
- def memcpy(dest, src, size = src.length)
29
- if dest.is_a?(::Integer)
30
- if src.is_a?(::String)
31
- MemcpyLPL.call(dest, src, size)
32
- else
33
- MemcpyLLL.call(dest, src, size)
34
- end
35
- else
36
- if src.is_a?(::String)
37
- MemcpyPPL.call(dest, src, size)
38
- else
39
- MemcpyPLL.call(dest, src, size)
40
- end
41
- end
42
- end
43
-
44
- def memccpy(dest, src, char, count)
45
- Memccpy.call(dest, src, char, count)
46
- end
47
-
48
- def memchr(buf, char, count)
49
- Memchr.call(buf, char, count)
50
- end
51
-
52
- def memcmp(buf1, buf2, count)
53
- Memcmp.call(buf1, buf2, count)
54
- end
55
-
56
- def memicmp(buf1, buf2, count)
57
- Memicmp.call(buf1, buf2, count)
58
- end
59
-
60
- def memmove(dest, src, count)
61
- Memmove.call(dest, src, count)
62
- end
63
-
64
- def memset(dest, char, count)
65
- Memset.call(dest, char, count)
66
- end
67
-
68
- def swab(src, dest, count)
69
- Swab.call(src, dest, count)
70
- end
71
- end
72
- end
73
- end
1
+ require 'windows/api'
2
+
3
+ module Windows
4
+ module MSVCRT
5
+ module Buffer
6
+ API.auto_constant = false # We want multiple versions
7
+ API.auto_method = false
8
+ API.auto_unicode = false
9
+
10
+ private
11
+
12
+ Memcpy = API.new('memcpy', 'PLL', 'P', MSVCRT_DLL)
13
+ Memccpy = API.new('_memccpy', 'PPIL', 'P', MSVCRT_DLL)
14
+ Memchr = API.new('memchr', 'PIL', 'P', MSVCRT_DLL)
15
+ Memcmp = API.new('memcmp', 'PPL', 'I', MSVCRT_DLL)
16
+ Memicmp = API.new('_memicmp', 'PPL', 'I', MSVCRT_DLL)
17
+ Memmove = API.new('memmove', 'PPL', 'P', MSVCRT_DLL)
18
+ Memset = API.new('memset', 'PLL', 'L', MSVCRT_DLL)
19
+ Swab = API.new('_swab', 'PPI', 'V', MSVCRT_DLL)
20
+
21
+ MemcpyPLL = API.new('memcpy', 'PLL', 'P', MSVCRT_DLL)
22
+ MemcpyLPL = API.new('memcpy', 'LPL', 'P', MSVCRT_DLL)
23
+ MemcpyLLL = API.new('memcpy', 'LLL', 'P', MSVCRT_DLL)
24
+ MemcpyPPL = API.new('memcpy', 'PPL', 'P', MSVCRT_DLL)
25
+
26
+ # Wrapper for the memcpy() function. Both the +dest+ and +src+ can
27
+ # be either a string or a memory address. If +size+ is omitted, it
28
+ # defaults to the length of +src+.
29
+ #
30
+ def memcpy(dest, src, size = src.length)
31
+ if dest.is_a?(::Integer)
32
+ if src.is_a?(::String)
33
+ MemcpyLPL.call(dest, src, size)
34
+ else
35
+ MemcpyLLL.call(dest, src, size)
36
+ end
37
+ else
38
+ if src.is_a?(::String)
39
+ MemcpyPPL.call(dest, src, size)
40
+ else
41
+ MemcpyPLL.call(dest, src, size)
42
+ end
43
+ end
44
+ end
45
+
46
+ def memccpy(dest, src, char, count)
47
+ Memccpy.call(dest, src, char, count)
48
+ end
49
+
50
+ def memchr(buf, char, count)
51
+ Memchr.call(buf, char, count)
52
+ end
53
+
54
+ def memcmp(buf1, buf2, count)
55
+ Memcmp.call(buf1, buf2, count)
56
+ end
57
+
58
+ def memicmp(buf1, buf2, count)
59
+ Memicmp.call(buf1, buf2, count)
60
+ end
61
+
62
+ def memmove(dest, src, count)
63
+ Memmove.call(dest, src, count)
64
+ end
65
+
66
+ def memset(dest, char, count)
67
+ Memset.call(dest, char, count)
68
+ end
69
+
70
+ def swab(src, dest, count)
71
+ Swab.call(src, dest, count)
72
+ end
73
+ end
74
+ end
75
+ end
@@ -1,29 +1,31 @@
1
- require 'windows/api'
2
-
3
- module Windows
4
- module MSVCRT
5
- module Directory
6
- API.auto_namespace = 'Windows::MSVCRT::Directory'
7
- API.auto_method = true
8
- API.auto_constant = true
9
- API.auto_unicode = false
10
-
11
- API.new('_chdir', 'S', 'I', MSVCRT_DLL)
12
- API.new('_wchdir', 'S', 'I', MSVCRT_DLL)
13
- API.new('_chdrive', 'I', 'I', MSVCRT_DLL)
14
- API.new('_getcwd', 'PI', 'P', MSVCRT_DLL)
15
- API.new('_wgetcwd', 'PI', 'P', MSVCRT_DLL)
16
- API.new('_getdcwd', 'IPI', 'P', MSVCRT_DLL)
17
- API.new('_wgetdcwd', 'IPI', 'P', MSVCRT_DLL)
18
- API.new('_getdiskfree', 'IP', 'I', MSVCRT_DLL)
19
- API.new('_getdrive', 'V', 'I', MSVCRT_DLL)
20
- API.new('_getdrives', 'V', 'L', MSVCRT_DLL)
21
- API.new('_mkdir', 'S', 'I', MSVCRT_DLL)
22
- API.new('_wmkdir', 'S', 'I', MSVCRT_DLL)
23
- API.new('_rmdir', 'S', 'I', MSVCRT_DLL)
24
- API.new('_wrmdir', 'S', 'I', MSVCRT_DLL)
25
- API.new('_searchenv', 'SSP', 'V', MSVCRT_DLL)
26
- API.new('_wsearchenv', 'SSP', 'V', MSVCRT_DLL)
27
- end
28
- end
29
- end
1
+ require 'windows/api'
2
+
3
+ module Windows
4
+ module MSVCRT
5
+ module Directory
6
+ API.auto_namespace = 'Windows::MSVCRT::Directory'
7
+ API.auto_method = true
8
+ API.auto_constant = true
9
+ API.auto_unicode = false
10
+
11
+ private
12
+
13
+ API.new('_chdir', 'S', 'I', MSVCRT_DLL)
14
+ API.new('_wchdir', 'S', 'I', MSVCRT_DLL)
15
+ API.new('_chdrive', 'I', 'I', MSVCRT_DLL)
16
+ API.new('_getcwd', 'PI', 'P', MSVCRT_DLL)
17
+ API.new('_wgetcwd', 'PI', 'P', MSVCRT_DLL)
18
+ API.new('_getdcwd', 'IPI', 'P', MSVCRT_DLL)
19
+ API.new('_wgetdcwd', 'IPI', 'P', MSVCRT_DLL)
20
+ API.new('_getdiskfree', 'IP', 'I', MSVCRT_DLL)
21
+ API.new('_getdrive', 'V', 'I', MSVCRT_DLL)
22
+ API.new('_getdrives', 'V', 'L', MSVCRT_DLL)
23
+ API.new('_mkdir', 'S', 'I', MSVCRT_DLL)
24
+ API.new('_wmkdir', 'S', 'I', MSVCRT_DLL)
25
+ API.new('_rmdir', 'S', 'I', MSVCRT_DLL)
26
+ API.new('_wrmdir', 'S', 'I', MSVCRT_DLL)
27
+ API.new('_searchenv', 'SSP', 'V', MSVCRT_DLL)
28
+ API.new('_wsearchenv', 'SSP', 'V', MSVCRT_DLL)
29
+ end
30
+ end
31
+ end
@@ -1,45 +1,47 @@
1
- require 'windows/api'
2
-
3
- module Windows
4
- module MSVCRT
5
- module File
6
- API.auto_namespace = 'Windows::MSVCRT::File'
7
- API.auto_method = true
8
- API.auto_constant = true
9
- API.auto_unicode = false
10
-
11
- S_IFMT = 0170000 # file type mask
12
- S_IFDIR = 0040000 # directory
13
- S_IFCHR = 0020000 # character special
14
- S_IFIFO = 0010000 # pipe
15
- S_IFREG = 0100000 # regular
16
- S_IREAD = 0000400 # read permission, owner
17
- S_IWRITE = 0000200 # write permission, owner
18
- S_IEXEC = 0000100 # execute/search permission, owner
19
-
20
- API.new('_chmod', 'PI', 'I', MSVCRT_DLL)
21
- API.new('_chsize', 'IL', 'I', MSVCRT_DLL)
22
- API.new('_mktemp', 'P', 'P', MSVCRT_DLL)
23
- API.new('_stat', 'PP', 'I', 'msvcrt')
24
- API.new('_stat64', 'PP', 'I', MSVCRT_DLL)
25
- API.new('_umask', 'I', 'I', MSVCRT_DLL)
26
-
27
- # Wide character variants
28
-
29
- API.new('_wchmod', 'PI', 'I', MSVCRT_DLL)
30
- API.new('_wmktemp', 'P', 'P', MSVCRT_DLL)
31
- API.new('_wstat', 'PP', 'I', 'msvcrt')
32
- API.new('_wstat64', 'PP', 'I', MSVCRT_DLL)
33
-
34
- # VC++ 8.0 or later
35
- begin
36
- API.new('_chsize_s', 'IL', 'I', MSVCRT_DLL)
37
- API.new('_mktemp_s', 'PL', 'L', MSVCRT_DLL)
38
- API.new('_umask_s', 'IP', 'L', MSVCRT_DLL)
39
- API.new('_wmktemp_s', 'PL', 'L', MSVCRT_DLL)
40
- rescue Win32::API::LoadLibraryError
41
- # Ignore - you must check for it via 'defined?'
42
- end
43
- end
44
- end
45
- end
1
+ require 'windows/api'
2
+
3
+ module Windows
4
+ module MSVCRT
5
+ module File
6
+ API.auto_namespace = 'Windows::MSVCRT::File'
7
+ API.auto_method = true
8
+ API.auto_constant = true
9
+ API.auto_unicode = false
10
+
11
+ private
12
+
13
+ S_IFMT = 0170000 # file type mask
14
+ S_IFDIR = 0040000 # directory
15
+ S_IFCHR = 0020000 # character special
16
+ S_IFIFO = 0010000 # pipe
17
+ S_IFREG = 0100000 # regular
18
+ S_IREAD = 0000400 # read permission, owner
19
+ S_IWRITE = 0000200 # write permission, owner
20
+ S_IEXEC = 0000100 # execute/search permission, owner
21
+
22
+ API.new('_chmod', 'PI', 'I', MSVCRT_DLL)
23
+ API.new('_chsize', 'IL', 'I', MSVCRT_DLL)
24
+ API.new('_mktemp', 'P', 'P', MSVCRT_DLL)
25
+ API.new('_stat', 'PP', 'I', 'msvcrt')
26
+ API.new('_stat64', 'PP', 'I', MSVCRT_DLL)
27
+ API.new('_umask', 'I', 'I', MSVCRT_DLL)
28
+
29
+ # Wide character variants
30
+
31
+ API.new('_wchmod', 'PI', 'I', MSVCRT_DLL)
32
+ API.new('_wmktemp', 'P', 'P', MSVCRT_DLL)
33
+ API.new('_wstat', 'PP', 'I', 'msvcrt')
34
+ API.new('_wstat64', 'PP', 'I', MSVCRT_DLL)
35
+
36
+ # VC++ 8.0 or later
37
+ begin
38
+ API.new('_chsize_s', 'IL', 'I', MSVCRT_DLL)
39
+ API.new('_mktemp_s', 'PL', 'L', MSVCRT_DLL)
40
+ API.new('_umask_s', 'IP', 'L', MSVCRT_DLL)
41
+ API.new('_wmktemp_s', 'PL', 'L', MSVCRT_DLL)
42
+ rescue Win32::API::LoadLibraryError
43
+ # Ignore - you must check for it via 'defined?'
44
+ end
45
+ end
46
+ end
47
+ end
@@ -2,70 +2,72 @@ require 'windows/api'
2
2
 
3
3
  # This module includes stream I/O, low level I/O, etc.
4
4
  module Windows
5
- module MSVCRT
6
- module IO
7
- API.auto_namespace = 'Windows::MSVCRT::IO'
8
- API.auto_constant = true
9
- API.auto_method = true
10
- API.auto_unicode = false
5
+ module MSVCRT
6
+ module IO
7
+ API.auto_namespace = 'Windows::MSVCRT::IO'
8
+ API.auto_constant = true
9
+ API.auto_method = true
10
+ API.auto_unicode = false
11
11
 
12
- S_IFMT = 0170000 # file type mask
13
- S_IFDIR = 0040000 # directory
14
- S_IFCHR = 0020000 # character special
15
- S_IFIFO = 0010000 # pipe
16
- S_IFREG = 0100000 # regular
17
- S_IREAD = 0000400 # read permission, owner
18
- S_IWRITE = 0000200 # write permission, owner
19
- S_IEXEC = 0000100 # execute/search permission, owner
20
-
21
- SH_DENYNO = 0x40 # deny none mode
22
- SHORT_LIVED = 0x1000 # temporary file storage
12
+ private
23
13
 
24
- API.new('clearerr', 'I', 'V', MSVCRT_DLL)
25
- API.new('_close', 'I', 'V', MSVCRT_DLL)
26
- API.new('fclose', 'I', 'I', MSVCRT_DLL)
27
- API.new('_fcloseall', 'V', 'I', MSVCRT_DLL)
28
- API.new('_fdopen', 'IP', 'I', MSVCRT_DLL)
29
- API.new('feof', 'I', 'I', MSVCRT_DLL)
30
- API.new('ferror', 'L', 'I', MSVCRT_DLL)
31
- API.new('fflush', 'I', 'I', MSVCRT_DLL)
32
- API.new('fgetc', 'L', 'I', MSVCRT_DLL)
33
- API.new('fgetpos', 'LP', 'I', MSVCRT_DLL)
34
- API.new('fgetwc', 'L', 'I', MSVCRT_DLL)
35
- API.new('fgets', 'PIL', 'P', MSVCRT_DLL)
36
- API.new('fgetws', 'PIL', 'P', MSVCRT_DLL)
37
- API.new('_fileno', 'I', 'I', MSVCRT_DLL)
38
- API.new('_flushall', 'V', 'I', MSVCRT_DLL)
39
- API.new('fopen', 'PP', 'I', MSVCRT_DLL)
40
- API.new('fputs', 'PL', 'I', MSVCRT_DLL)
41
- API.new('fputws', 'PL', 'I', MSVCRT_DLL)
42
- API.new('getc', 'L', 'I', MSVCRT_DLL)
43
- API.new('getwc', 'L', 'L', MSVCRT_DLL)
44
- API.new('_open', 'PII', 'I', MSVCRT_DLL)
45
- API.new('_rmtmp', 'V', 'I', MSVCRT_DLL)
46
- API.new('_setmode', 'II', 'I', MSVCRT_DLL)
47
- API.new('_sopen', 'PIII', 'I', MSVCRT_DLL)
48
- API.new('_tempnam', 'PP', 'P', MSVCRT_DLL)
49
- API.new('tmpfile', 'V', 'L', MSVCRT_DLL)
50
- API.new('tmpnam', 'P', 'P', MSVCRT_DLL)
14
+ S_IFMT = 0170000 # file type mask
15
+ S_IFDIR = 0040000 # directory
16
+ S_IFCHR = 0020000 # character special
17
+ S_IFIFO = 0010000 # pipe
18
+ S_IFREG = 0100000 # regular
19
+ S_IREAD = 0000400 # read permission, owner
20
+ S_IWRITE = 0000200 # write permission, owner
21
+ S_IEXEC = 0000100 # execute/search permission, owner
22
+
23
+ SH_DENYNO = 0x40 # deny none mode
24
+ SHORT_LIVED = 0x1000 # temporary file storage
51
25
 
52
- # Wide character versions
26
+ API.new('clearerr', 'I', 'V', MSVCRT_DLL)
27
+ API.new('_close', 'I', 'V', MSVCRT_DLL)
28
+ API.new('fclose', 'I', 'I', MSVCRT_DLL)
29
+ API.new('_fcloseall', 'V', 'I', MSVCRT_DLL)
30
+ API.new('_fdopen', 'IP', 'I', MSVCRT_DLL)
31
+ API.new('feof', 'I', 'I', MSVCRT_DLL)
32
+ API.new('ferror', 'L', 'I', MSVCRT_DLL)
33
+ API.new('fflush', 'I', 'I', MSVCRT_DLL)
34
+ API.new('fgetc', 'L', 'I', MSVCRT_DLL)
35
+ API.new('fgetpos', 'LP', 'I', MSVCRT_DLL)
36
+ API.new('fgetwc', 'L', 'I', MSVCRT_DLL)
37
+ API.new('fgets', 'PIL', 'P', MSVCRT_DLL)
38
+ API.new('fgetws', 'PIL', 'P', MSVCRT_DLL)
39
+ API.new('_fileno', 'I', 'I', MSVCRT_DLL)
40
+ API.new('_flushall', 'V', 'I', MSVCRT_DLL)
41
+ API.new('fopen', 'PP', 'I', MSVCRT_DLL)
42
+ API.new('fputs', 'PL', 'I', MSVCRT_DLL)
43
+ API.new('fputws', 'PL', 'I', MSVCRT_DLL)
44
+ API.new('getc', 'L', 'I', MSVCRT_DLL)
45
+ API.new('getwc', 'L', 'L', MSVCRT_DLL)
46
+ API.new('_open', 'PII', 'I', MSVCRT_DLL)
47
+ API.new('_rmtmp', 'V', 'I', MSVCRT_DLL)
48
+ API.new('_setmode', 'II', 'I', MSVCRT_DLL)
49
+ API.new('_sopen', 'PIII', 'I', MSVCRT_DLL)
50
+ API.new('_tempnam', 'PP', 'P', MSVCRT_DLL)
51
+ API.new('tmpfile', 'V', 'L', MSVCRT_DLL)
52
+ API.new('tmpnam', 'P', 'P', MSVCRT_DLL)
53
53
 
54
- API.new('_wopen', 'PII', 'I', MSVCRT_DLL)
55
- API.new('_wfdopen', 'IP', 'I', MSVCRT_DLL)
56
- API.new('_wfopen', 'PPI', 'I', MSVCRT_DLL)
57
- API.new('_wsopen', 'PIII', 'I', MSVCRT_DLL)
58
- API.new('_wtempnam', 'PP', 'P', MSVCRT_DLL)
59
- API.new('_wtmpnam', 'P', 'P', MSVCRT_DLL)
54
+ # Wide character versions
60
55
 
61
- # VC++ 8.0 or later
62
- begin
63
- API.new('_sopen_s', 'PPIII', 'L', MSVCRT_DLL)
64
- API.new('_tmpfile_s', 'P', 'L', MSVCRT_DLL)
65
- API.new('_wsopen_s', 'PPIII', 'L', MSVCRT_DLL)
66
- rescue Win32::API::LoadLibraryError
67
- # Ignore - you must check for it via 'defined?'
68
- end
56
+ API.new('_wopen', 'PII', 'I', MSVCRT_DLL)
57
+ API.new('_wfdopen', 'IP', 'I', MSVCRT_DLL)
58
+ API.new('_wfopen', 'PPI', 'I', MSVCRT_DLL)
59
+ API.new('_wsopen', 'PIII', 'I', MSVCRT_DLL)
60
+ API.new('_wtempnam', 'PP', 'P', MSVCRT_DLL)
61
+ API.new('_wtmpnam', 'P', 'P', MSVCRT_DLL)
62
+
63
+ # VC++ 8.0 or later
64
+ begin
65
+ API.new('_sopen_s', 'PPIII', 'L', MSVCRT_DLL)
66
+ API.new('_tmpfile_s', 'P', 'L', MSVCRT_DLL)
67
+ API.new('_wsopen_s', 'PPIII', 'L', MSVCRT_DLL)
68
+ rescue Win32::API::LoadLibraryError
69
+ # Ignore - you must check for it via 'defined?'
69
70
  end
70
- end
71
+ end
72
+ end
71
73
  end