windows-pr 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +444 -438
  3. data/MANIFEST +68 -65
  4. data/README +154 -153
  5. data/Rakefile +42 -37
  6. data/doc/conversion_guide.txt +37 -37
  7. data/lib/windows/clipboard.rb +61 -61
  8. data/lib/windows/com.rb +192 -192
  9. data/lib/windows/com/accessibility.rb +16 -16
  10. data/lib/windows/com/automation.rb +149 -149
  11. data/lib/windows/com/variant.rb +24 -24
  12. data/lib/windows/console.rb +114 -114
  13. data/lib/windows/debug.rb +35 -35
  14. data/lib/windows/device_io.rb +248 -248
  15. data/lib/windows/directory.rb +27 -27
  16. data/lib/windows/error.rb +504 -498
  17. data/lib/windows/eventlog.rb +80 -80
  18. data/lib/windows/file.rb +264 -264
  19. data/lib/windows/file_mapping.rb +25 -25
  20. data/lib/windows/filesystem.rb +15 -15
  21. data/lib/windows/gdi/bitmap.rb +65 -65
  22. data/lib/windows/gdi/device_context.rb +46 -46
  23. data/lib/windows/gdi/metafile.rb +40 -40
  24. data/lib/windows/gdi/painting_drawing.rb +115 -115
  25. data/lib/windows/handle.rb +23 -23
  26. data/lib/windows/library.rb +44 -44
  27. data/lib/windows/limits.rb +34 -34
  28. data/lib/windows/mailslot.rb +24 -24
  29. data/lib/windows/memory.rb +128 -128
  30. data/lib/windows/msvcrt/buffer.rb +75 -75
  31. data/lib/windows/msvcrt/directory.rb +31 -31
  32. data/lib/windows/msvcrt/file.rb +47 -47
  33. data/lib/windows/msvcrt/io.rb +73 -73
  34. data/lib/windows/msvcrt/string.rb +182 -182
  35. data/lib/windows/msvcrt/time.rb +169 -169
  36. data/lib/windows/national.rb +580 -580
  37. data/lib/windows/network/management.rb +525 -525
  38. data/lib/windows/network/snmp.rb +92 -92
  39. data/lib/windows/network/winsock.rb +128 -128
  40. data/lib/windows/nio.rb +50 -50
  41. data/lib/windows/ntfs/winternl.rb +117 -117
  42. data/lib/windows/path.rb +143 -143
  43. data/lib/windows/pipe.rb +42 -42
  44. data/lib/windows/process.rb +176 -176
  45. data/lib/windows/registry.rb +171 -171
  46. data/lib/windows/security.rb +479 -479
  47. data/lib/windows/security/authentication.rb +32 -32
  48. data/lib/windows/security/sspi.rb +153 -0
  49. data/lib/windows/service.rb +142 -142
  50. data/lib/windows/shell.rb +171 -171
  51. data/lib/windows/socket.rb +86 -86
  52. data/lib/windows/sound.rb +39 -39
  53. data/lib/windows/synchronize.rb +133 -133
  54. data/lib/windows/system_info.rb +229 -229
  55. data/lib/windows/thread.rb +64 -64
  56. data/lib/windows/time.rb +48 -48
  57. data/lib/windows/tool_helper.rb +36 -36
  58. data/lib/windows/unicode.rb +155 -155
  59. data/lib/windows/volume.rb +61 -61
  60. data/lib/windows/window.rb +81 -81
  61. data/lib/windows/window/classes.rb +59 -59
  62. data/lib/windows/window/dialog.rb +91 -91
  63. data/lib/windows/window/menu.rb +102 -102
  64. data/lib/windows/window/message.rb +297 -297
  65. data/lib/windows/window/properties.rb +20 -20
  66. data/lib/windows/window/timer.rb +19 -19
  67. data/lib/windows/wsa.rb +102 -102
  68. data/test/tc_clipboard.rb +41 -41
  69. data/test/tc_com.rb +32 -32
  70. data/test/tc_com_automation.rb +15 -15
  71. data/test/tc_console.rb +108 -108
  72. data/test/tc_debug.rb +48 -48
  73. data/test/tc_device_io.rb +29 -29
  74. data/test/tc_directory.rb +25 -25
  75. data/test/tc_error.rb +38 -38
  76. data/test/tc_eventlog.rb +58 -58
  77. data/test/tc_file.rb +67 -67
  78. data/test/tc_file_mapping.rb +38 -38
  79. data/test/tc_filesystem.rb +27 -27
  80. data/test/tc_gdi_bitmap.rb +25 -25
  81. data/test/tc_gdi_metafile.rb +23 -23
  82. data/test/tc_handle.rb +36 -36
  83. data/test/tc_library.rb +37 -37
  84. data/test/tc_limits.rb +34 -34
  85. data/test/tc_mailslot.rb +22 -22
  86. data/test/tc_memory.rb +44 -44
  87. data/test/tc_msvcrt_buffer.rb +63 -63
  88. data/test/tc_msvcrt_directory.rb +96 -96
  89. data/test/tc_msvcrt_file.rb +80 -80
  90. data/test/tc_msvcrt_io.rb +48 -48
  91. data/test/tc_msvcrt_string.rb +94 -94
  92. data/test/tc_msvcrt_time.rb +19 -19
  93. data/test/tc_national.rb +38 -38
  94. data/test/tc_network_management.rb +32 -32
  95. data/test/tc_network_snmp.rb +31 -31
  96. data/test/tc_network_winsock.rb +34 -34
  97. data/test/tc_nio.rb +32 -32
  98. data/test/tc_ntfs_winternl.rb +48 -48
  99. data/test/tc_path.rb +90 -90
  100. data/test/tc_pipe.rb +53 -53
  101. data/test/tc_process.rb +24 -24
  102. data/test/tc_registry.rb +29 -29
  103. data/test/tc_security.rb +104 -104
  104. data/test/tc_security_authentication.rb +34 -34
  105. data/test/tc_security_sspi.rb +23 -0
  106. data/test/tc_service.rb +57 -57
  107. data/test/tc_shell.rb +34 -34
  108. data/test/tc_socket.rb +20 -20
  109. data/test/tc_sound.rb +37 -37
  110. data/test/tc_synchronize.rb +75 -75
  111. data/test/tc_system_info.rb +33 -33
  112. data/test/tc_thread.rb +29 -29
  113. data/test/tc_time.rb +32 -32
  114. data/test/tc_tool_helper.rb +29 -29
  115. data/test/tc_unicode.rb +83 -83
  116. data/test/tc_volume.rb +47 -47
  117. data/test/tc_window.rb +45 -45
  118. data/test/tc_window_classes.rb +33 -33
  119. data/test/tc_window_dialog.rb +33 -33
  120. data/test/tc_window_menu.rb +29 -29
  121. data/test/tc_window_message.rb +33 -33
  122. data/test/tc_window_properties.rb +29 -29
  123. data/test/tc_window_timer.rb +29 -29
  124. data/test/tc_wsa.rb +19 -19
  125. data/windows-pr.gemspec +33 -34
  126. metadata +31 -32
@@ -1,75 +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
- 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
+ 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,31 +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
- 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
+ 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,47 +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
- 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
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
@@ -1,73 +1,73 @@
1
- require 'windows/api'
2
-
3
- # This module includes stream I/O, low level I/O, etc.
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
11
-
12
- private
13
-
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
25
-
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
-
54
- # Wide character versions
55
-
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?'
70
- end
71
- end
72
- end
73
- end
1
+ require 'windows/api'
2
+
3
+ # This module includes stream I/O, low level I/O, etc.
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
11
+
12
+ private
13
+
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
25
+
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
+
54
+ # Wide character versions
55
+
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?'
70
+ end
71
+ end
72
+ end
73
+ end