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,182 +1,182 @@
1
- require 'windows/api'
2
-
3
- module Windows
4
- module MSVCRT
5
- module String
6
- API.auto_constant = false # We want multiple versions
7
- API.auto_method = false # We need to handle 0 & nil explicitly
8
- API.auto_unicode = false
9
-
10
- private
11
-
12
- Strchr = API.new('strchr', 'PI', 'P', MSVCRT_DLL)
13
- Strcmp = API.new('strcmp', 'PP', 'I', MSVCRT_DLL)
14
- Strcpy = API.new('strcpy', 'PL', 'L', MSVCRT_DLL)
15
- Strcspn = API.new('strcspn', 'PP', 'L', MSVCRT_DLL)
16
- Strlen = API.new('strlen', 'P', 'L', MSVCRT_DLL)
17
- Strncpy = API.new('strncpy', 'PPL', 'P', MSVCRT_DLL)
18
- Strpbrk = API.new('strpbrk', 'PP', 'P', MSVCRT_DLL)
19
- Strrchr = API.new('strrchr', 'PI', 'P', MSVCRT_DLL)
20
- Strrev = API.new('_strrev', 'P', 'P', MSVCRT_DLL)
21
- Strspn = API.new('strspn', 'PP', 'L', MSVCRT_DLL)
22
- Strstr = API.new('strstr', 'PP', 'P', MSVCRT_DLL)
23
- Strtok = API.new('strtok', 'PP', 'P', MSVCRT_DLL)
24
-
25
- StrcpyPL = API.new('strcpy', 'PL', 'L', MSVCRT_DLL)
26
- StrcpyPP = API.new('strcpy', 'PP', 'L', MSVCRT_DLL)
27
-
28
- Mbscmp = API.new('_mbscmp', 'PP', 'I', 'msvcrt')
29
- Mbscpy = API.new('_mbscpy', 'PL', 'L', 'msvcrt')
30
- Mbslen = API.new('_mbslen', 'P', 'L', 'msvcrt')
31
- Mbsrev = API.new('_mbsrev', 'P', 'P', 'msvcrt')
32
-
33
- MbscpyPL = API.new('_mbscpy', 'PL', 'L', 'msvcrt')
34
- MbscpyPP = API.new('_mbscpy', 'PP', 'L', 'msvcrt')
35
-
36
- Wcscmp = API.new('wcscmp', 'PP', 'I', MSVCRT_DLL)
37
- Wcscpy = API.new('wcscpy', 'PL', 'L', MSVCRT_DLL)
38
- Wcslen = API.new('wcslen', 'P', 'L', MSVCRT_DLL)
39
- Wcsncpy = API.new('wcsncpy', 'PPL', 'P', MSVCRT_DLL)
40
- Wcsrev = API.new('_wcsrev', 'P', 'P', MSVCRT_DLL)
41
-
42
- WcscpyPL = API.new('wcscpy', 'PL', 'L', MSVCRT_DLL)
43
- WcscpyPP = API.new('wcscpy', 'PP', 'L', MSVCRT_DLL)
44
-
45
- begin
46
- Strtok_s = API.new('strtok_s', 'PPI', 'P', MSVCRT_DLL)
47
- rescue Win32::API::LoadLibraryError
48
- # Do nothing. Not supported on your system.
49
- end
50
-
51
- def strchr(string, char)
52
- return nil if string == 0 || char == 0
53
- Strchr.call(string, char)
54
- end
55
-
56
- def strcmp(str1, str2)
57
- if str1 == 0 || str2 == 0
58
- return nil
59
- end
60
- Strcmp.call(str1, str2)
61
- end
62
-
63
- def strcpy(dest, src)
64
- if src.is_a?(Numeric)
65
- return nil if src == 0
66
- StrcpyPL.call(dest, src)
67
- else
68
- StrcpyPP.call(dest, src)
69
- end
70
- end
71
-
72
- def strlen(string)
73
- return nil if string == 0
74
- Strlen.call(string)
75
- end
76
-
77
- def strcspn(string, charset)
78
- return nil if string == 0
79
- Strcspn.call(string, charset)
80
- end
81
-
82
- def strncpy(dest, source, count)
83
- return nil if source == 0
84
- Strncpy.call(dest, source, count)
85
- end
86
-
87
- def strpbrk(string, charset)
88
- return nil if string == 0 || charset == 0
89
- Strpbrk.call(string, charset)
90
- end
91
-
92
- def strrchr(string, int)
93
- return nil if string == 0
94
- Strrchr.call(string, int)
95
- end
96
-
97
- def strrev(str)
98
- return nil if str == 0
99
- Strrev.call(str)
100
- end
101
-
102
- def strspn(string, charset)
103
- return nil if string == 0 || charset == 0
104
- Strspn.call(string, charset)
105
- end
106
-
107
- def strstr(string, search)
108
- return nil if string == 0 || search == 0
109
- Strstr.call(string, search)
110
- end
111
-
112
- def strtok(token, delimeter)
113
- return nil if token == 0 || delimeter == 0
114
- Strtok.call(token, delimeter)
115
- end
116
-
117
- if defined? Strtok_s
118
- def strtok_s(token, delimeter, context)
119
- return nil if [token, delimter, context].include?(0)
120
- Strtok_s.call(token, delimeter, context)
121
- end
122
- end
123
-
124
- def mbscmp(str1, str2)
125
- if str1 == 0 || str2 == 0
126
- return nil
127
- end
128
- Mbscmp.call(str1, str2)
129
- end
130
-
131
- def mbscpy(dest, src)
132
- if src.is_a?(Numeric)
133
- return nil if src == 0
134
- MbscpyPL.call(dest, src)
135
- else
136
- MbscpyPP.call(dest, src)
137
- end
138
- end
139
-
140
- def mbslen(string)
141
- return nil if string == 0
142
- Mbslen.call(string)
143
- end
144
-
145
- def mbsrev(str)
146
- return nil if str == 0
147
- Mbsrev.call(str)
148
- end
149
-
150
- def wcscmp(str1, str2)
151
- if str1 == 0 || str2 == 0
152
- return nil
153
- end
154
- Wcscmp.call(str1, str2)
155
- end
156
-
157
- def wcscpy(dest, src)
158
- if src.is_a?(Numeric)
159
- return nil if src == 0
160
- WcscpyPL.call(dest, src)
161
- else
162
- WcscpyPP.call(dest, src)
163
- end
164
- end
165
-
166
- def wcslen(string)
167
- return nil if string == 0
168
- Wcslen.call(string)
169
- end
170
-
171
- def wcsncpy(dest, source, count)
172
- return nil if source == 0
173
- Wcsncpy.call(dest, source, count)
174
- end
175
-
176
- def wcsrev(str)
177
- return nil if str == 0
178
- Wcsrev.call(str)
179
- end
180
- end
181
- end
182
- end
1
+ require 'windows/api'
2
+
3
+ module Windows
4
+ module MSVCRT
5
+ module String
6
+ API.auto_constant = false # We want multiple versions
7
+ API.auto_method = false # We need to handle 0 & nil explicitly
8
+ API.auto_unicode = false
9
+
10
+ private
11
+
12
+ Strchr = API.new('strchr', 'PI', 'P', MSVCRT_DLL)
13
+ Strcmp = API.new('strcmp', 'PP', 'I', MSVCRT_DLL)
14
+ Strcpy = API.new('strcpy', 'PL', 'L', MSVCRT_DLL)
15
+ Strcspn = API.new('strcspn', 'PP', 'L', MSVCRT_DLL)
16
+ Strlen = API.new('strlen', 'P', 'L', MSVCRT_DLL)
17
+ Strncpy = API.new('strncpy', 'PPL', 'P', MSVCRT_DLL)
18
+ Strpbrk = API.new('strpbrk', 'PP', 'P', MSVCRT_DLL)
19
+ Strrchr = API.new('strrchr', 'PI', 'P', MSVCRT_DLL)
20
+ Strrev = API.new('_strrev', 'P', 'P', MSVCRT_DLL)
21
+ Strspn = API.new('strspn', 'PP', 'L', MSVCRT_DLL)
22
+ Strstr = API.new('strstr', 'PP', 'P', MSVCRT_DLL)
23
+ Strtok = API.new('strtok', 'PP', 'P', MSVCRT_DLL)
24
+
25
+ StrcpyPL = API.new('strcpy', 'PL', 'L', MSVCRT_DLL)
26
+ StrcpyPP = API.new('strcpy', 'PP', 'L', MSVCRT_DLL)
27
+
28
+ Mbscmp = API.new('_mbscmp', 'PP', 'I', 'msvcrt')
29
+ Mbscpy = API.new('_mbscpy', 'PL', 'L', 'msvcrt')
30
+ Mbslen = API.new('_mbslen', 'P', 'L', 'msvcrt')
31
+ Mbsrev = API.new('_mbsrev', 'P', 'P', 'msvcrt')
32
+
33
+ MbscpyPL = API.new('_mbscpy', 'PL', 'L', 'msvcrt')
34
+ MbscpyPP = API.new('_mbscpy', 'PP', 'L', 'msvcrt')
35
+
36
+ Wcscmp = API.new('wcscmp', 'PP', 'I', MSVCRT_DLL)
37
+ Wcscpy = API.new('wcscpy', 'PL', 'L', MSVCRT_DLL)
38
+ Wcslen = API.new('wcslen', 'P', 'L', MSVCRT_DLL)
39
+ Wcsncpy = API.new('wcsncpy', 'PPL', 'P', MSVCRT_DLL)
40
+ Wcsrev = API.new('_wcsrev', 'P', 'P', MSVCRT_DLL)
41
+
42
+ WcscpyPL = API.new('wcscpy', 'PL', 'L', MSVCRT_DLL)
43
+ WcscpyPP = API.new('wcscpy', 'PP', 'L', MSVCRT_DLL)
44
+
45
+ begin
46
+ Strtok_s = API.new('strtok_s', 'PPI', 'P', MSVCRT_DLL)
47
+ rescue Win32::API::LoadLibraryError
48
+ # Do nothing. Not supported on your system.
49
+ end
50
+
51
+ def strchr(string, char)
52
+ return nil if string == 0 || char == 0
53
+ Strchr.call(string, char)
54
+ end
55
+
56
+ def strcmp(str1, str2)
57
+ if str1 == 0 || str2 == 0
58
+ return nil
59
+ end
60
+ Strcmp.call(str1, str2)
61
+ end
62
+
63
+ def strcpy(dest, src)
64
+ if src.is_a?(Numeric)
65
+ return nil if src == 0
66
+ StrcpyPL.call(dest, src)
67
+ else
68
+ StrcpyPP.call(dest, src)
69
+ end
70
+ end
71
+
72
+ def strlen(string)
73
+ return nil if string == 0
74
+ Strlen.call(string)
75
+ end
76
+
77
+ def strcspn(string, charset)
78
+ return nil if string == 0
79
+ Strcspn.call(string, charset)
80
+ end
81
+
82
+ def strncpy(dest, source, count)
83
+ return nil if source == 0
84
+ Strncpy.call(dest, source, count)
85
+ end
86
+
87
+ def strpbrk(string, charset)
88
+ return nil if string == 0 || charset == 0
89
+ Strpbrk.call(string, charset)
90
+ end
91
+
92
+ def strrchr(string, int)
93
+ return nil if string == 0
94
+ Strrchr.call(string, int)
95
+ end
96
+
97
+ def strrev(str)
98
+ return nil if str == 0
99
+ Strrev.call(str)
100
+ end
101
+
102
+ def strspn(string, charset)
103
+ return nil if string == 0 || charset == 0
104
+ Strspn.call(string, charset)
105
+ end
106
+
107
+ def strstr(string, search)
108
+ return nil if string == 0 || search == 0
109
+ Strstr.call(string, search)
110
+ end
111
+
112
+ def strtok(token, delimeter)
113
+ return nil if token == 0 || delimeter == 0
114
+ Strtok.call(token, delimeter)
115
+ end
116
+
117
+ if defined? Strtok_s
118
+ def strtok_s(token, delimeter, context)
119
+ return nil if [token, delimter, context].include?(0)
120
+ Strtok_s.call(token, delimeter, context)
121
+ end
122
+ end
123
+
124
+ def mbscmp(str1, str2)
125
+ if str1 == 0 || str2 == 0
126
+ return nil
127
+ end
128
+ Mbscmp.call(str1, str2)
129
+ end
130
+
131
+ def mbscpy(dest, src)
132
+ if src.is_a?(Numeric)
133
+ return nil if src == 0
134
+ MbscpyPL.call(dest, src)
135
+ else
136
+ MbscpyPP.call(dest, src)
137
+ end
138
+ end
139
+
140
+ def mbslen(string)
141
+ return nil if string == 0
142
+ Mbslen.call(string)
143
+ end
144
+
145
+ def mbsrev(str)
146
+ return nil if str == 0
147
+ Mbsrev.call(str)
148
+ end
149
+
150
+ def wcscmp(str1, str2)
151
+ if str1 == 0 || str2 == 0
152
+ return nil
153
+ end
154
+ Wcscmp.call(str1, str2)
155
+ end
156
+
157
+ def wcscpy(dest, src)
158
+ if src.is_a?(Numeric)
159
+ return nil if src == 0
160
+ WcscpyPL.call(dest, src)
161
+ else
162
+ WcscpyPP.call(dest, src)
163
+ end
164
+ end
165
+
166
+ def wcslen(string)
167
+ return nil if string == 0
168
+ Wcslen.call(string)
169
+ end
170
+
171
+ def wcsncpy(dest, source, count)
172
+ return nil if source == 0
173
+ Wcsncpy.call(dest, source, count)
174
+ end
175
+
176
+ def wcsrev(str)
177
+ return nil if str == 0
178
+ Wcsrev.call(str)
179
+ end
180
+ end
181
+ end
182
+ end
@@ -1,169 +1,169 @@
1
- require 'windows/api'
2
-
3
- module Windows
4
- module MSVCRT
5
- module Time
6
- API.auto_constant = false # Avoid name clash with Ruby
7
- API.auto_method = false
8
- API.auto_unicode = false
9
-
10
- private
11
-
12
- Asctime = API.new('asctime', 'P', 'P', MSVCRT_DLL)
13
- Clock = API.new('clock', 'V', 'L', MSVCRT_DLL)
14
- Ctime = API.new('ctime', 'P', 'P', 'msvcrt')
15
- Ctime64 = API.new('_ctime64', 'P', 'P', MSVCRT_DLL)
16
- Difftime = API.new('difftime', 'LL', 'L', 'msvcrt')
17
- Ftime = API.new('_ftime', 'P', 'L', 'msvcrt')
18
- Ftime64 = API.new('_ftime64', 'P', 'L', MSVCRT_DLL)
19
- Futime = API.new('_futime', 'IP', 'I', 'msvcrt')
20
- Futime64 = API.new('_futime64', 'IP', 'I', MSVCRT_DLL)
21
- Gmtime = API.new('gmtime', 'P', 'P', 'msvcrt')
22
- Gmtime64 = API.new('_gmtime64', 'P', 'P', MSVCRT_DLL)
23
- Localtime = API.new('localtime', 'P', 'P', 'msvcrt')
24
- Localtime64 = API.new('_localtime64', 'P', 'P', MSVCRT_DLL)
25
- Mktime = API.new('mktime', 'P', 'L', 'msvcrt')
26
- Mktime64 = API.new('_mktime64', 'P', 'L', MSVCRT_DLL)
27
- Strdate = API.new('_strdate', 'P', 'P', MSVCRT_DLL)
28
- Strftime = API.new('strftime', 'PLPP', 'L', MSVCRT_DLL)
29
- Strtime = API.new('_strtime', 'P', 'P', MSVCRT_DLL)
30
- WinTime = API.new('time', 'P', 'L', 'msvcrt') # Avoid conflict
31
- WinTime64 = API.new('_time64', 'P', 'L', MSVCRT_DLL) # Avoid conflict
32
- Tzset = API.new('_tzset', 'V', 'V', MSVCRT_DLL)
33
- Utime = API.new('_utime', 'PP', 'I', 'msvcrt')
34
- Utime64 = API.new('_utime64', 'PP', 'I', MSVCRT_DLL)
35
- Wasctime = API.new('_wasctime', 'P', 'P', MSVCRT_DLL)
36
- Wctime = API.new('_wctime', 'P', 'P', 'msvcrt')
37
- Wctime64 = API.new('_wctime64', 'P', 'P', MSVCRT_DLL)
38
- Wstrdate = API.new('_wstrdate', 'P', 'L', MSVCRT_DLL)
39
- Wcsftime = API.new('wcsftime', 'PLPP', 'L', MSVCRT_DLL)
40
- Wstrtime = API.new('_wstrtime', 'P', 'P', MSVCRT_DLL)
41
- Wutime = API.new('_wutime', 'PP', 'I', 'msvcrt')
42
- Wutime64 = API.new('_wutime64', 'PP', 'I', MSVCRT_DLL)
43
-
44
- def asctime(timeptr)
45
- Asctime.call(timeptr)
46
- end
47
-
48
- def clock
49
- Clock.call
50
- end
51
-
52
- def ctime(timer)
53
- Ctime.call(timer)
54
- end
55
-
56
- def ctime64(timer)
57
- Ctime64.call(timer)
58
- end
59
-
60
- def difftime(timer1, timer0)
61
- Difftime.call(timer1, timer0)
62
- end
63
-
64
- def ftime(timeptr)
65
- Ftime.call(timeptr)
66
- end
67
-
68
- def ftime64(timeptr)
69
- Ftime64.call(timeptr)
70
- end
71
-
72
- def futime(fd, filetime)
73
- Futime.call(fd, filetime)
74
- end
75
-
76
- def futime64(fd, filetime)
77
- Futime64.call(fd, filetime)
78
- end
79
-
80
- def gmtime(timer)
81
- Gmtime.call(timer)
82
- end
83
-
84
- def gmtime64(timer)
85
- Gmtime64.call(timer)
86
- end
87
-
88
- def localtime(timer)
89
- Localtime.call(timer)
90
- end
91
-
92
- def localtime64(timer)
93
- Localtime64.call(timer)
94
- end
95
-
96
- def mktime(timeptr)
97
- Mktime.call(timeptr)
98
- end
99
-
100
- def mktime64(timeptr)
101
- Mktime64.call(timeptr)
102
- end
103
-
104
- def strdate(datestr)
105
- Strdate.call(datestr)
106
- end
107
-
108
- def strftime(dest, maxsize, format, timeptr)
109
- Strftime.call(dest, maxsize, format, timeptr)
110
- end
111
-
112
- def strtime(timestr)
113
- Strtime.call(timestr)
114
- end
115
-
116
- def time(timer)
117
- WinTime.call(timer)
118
- end
119
-
120
- def time64(timer)
121
- WinTime64.call(timer)
122
- end
123
-
124
- def tzset
125
- Tzset.call
126
- end
127
-
128
- def utime(filename, times)
129
- Utime.call(filename, times)
130
- end
131
-
132
- def utime64(filename, times)
133
- Utime64.call(filename, times)
134
- end
135
-
136
- def wasctime(timeptr)
137
- Wasctime.call(timeptr)
138
- end
139
-
140
- def wcsftime(dest, maxsize, format, timeptr)
141
- Wcsftime.call(dest, maxsize, format, timeptr)
142
- end
143
-
144
- def wctime(timer)
145
- Wctime.call(timer)
146
- end
147
-
148
- def wctime64(timer)
149
- Wctime64.call(timer)
150
- end
151
-
152
- def wstrdate(datestr)
153
- Wstrdate.call(datestr)
154
- end
155
-
156
- def wstrtime(timestr)
157
- Wstrtime.call(timestr)
158
- end
159
-
160
- def wutime(filename, times)
161
- Wutime.call(filename, times)
162
- end
163
-
164
- def wutime64(filename, times)
165
- Wutime64.call(filename, times)
166
- end
167
- end
168
- end
169
- end
1
+ require 'windows/api'
2
+
3
+ module Windows
4
+ module MSVCRT
5
+ module Time
6
+ API.auto_constant = false # Avoid name clash with Ruby
7
+ API.auto_method = false
8
+ API.auto_unicode = false
9
+
10
+ private
11
+
12
+ Asctime = API.new('asctime', 'P', 'P', MSVCRT_DLL)
13
+ Clock = API.new('clock', 'V', 'L', MSVCRT_DLL)
14
+ Ctime = API.new('ctime', 'P', 'P', 'msvcrt')
15
+ Ctime64 = API.new('_ctime64', 'P', 'P', MSVCRT_DLL)
16
+ Difftime = API.new('difftime', 'LL', 'L', 'msvcrt')
17
+ Ftime = API.new('_ftime', 'P', 'L', 'msvcrt')
18
+ Ftime64 = API.new('_ftime64', 'P', 'L', MSVCRT_DLL)
19
+ Futime = API.new('_futime', 'IP', 'I', 'msvcrt')
20
+ Futime64 = API.new('_futime64', 'IP', 'I', MSVCRT_DLL)
21
+ Gmtime = API.new('gmtime', 'P', 'P', 'msvcrt')
22
+ Gmtime64 = API.new('_gmtime64', 'P', 'P', MSVCRT_DLL)
23
+ Localtime = API.new('localtime', 'P', 'P', 'msvcrt')
24
+ Localtime64 = API.new('_localtime64', 'P', 'P', MSVCRT_DLL)
25
+ Mktime = API.new('mktime', 'P', 'L', 'msvcrt')
26
+ Mktime64 = API.new('_mktime64', 'P', 'L', MSVCRT_DLL)
27
+ Strdate = API.new('_strdate', 'P', 'P', MSVCRT_DLL)
28
+ Strftime = API.new('strftime', 'PLPP', 'L', MSVCRT_DLL)
29
+ Strtime = API.new('_strtime', 'P', 'P', MSVCRT_DLL)
30
+ WinTime = API.new('time', 'P', 'L', 'msvcrt') # Avoid conflict
31
+ WinTime64 = API.new('_time64', 'P', 'L', MSVCRT_DLL) # Avoid conflict
32
+ Tzset = API.new('_tzset', 'V', 'V', MSVCRT_DLL)
33
+ Utime = API.new('_utime', 'PP', 'I', 'msvcrt')
34
+ Utime64 = API.new('_utime64', 'PP', 'I', MSVCRT_DLL)
35
+ Wasctime = API.new('_wasctime', 'P', 'P', MSVCRT_DLL)
36
+ Wctime = API.new('_wctime', 'P', 'P', 'msvcrt')
37
+ Wctime64 = API.new('_wctime64', 'P', 'P', MSVCRT_DLL)
38
+ Wstrdate = API.new('_wstrdate', 'P', 'L', MSVCRT_DLL)
39
+ Wcsftime = API.new('wcsftime', 'PLPP', 'L', MSVCRT_DLL)
40
+ Wstrtime = API.new('_wstrtime', 'P', 'P', MSVCRT_DLL)
41
+ Wutime = API.new('_wutime', 'PP', 'I', 'msvcrt')
42
+ Wutime64 = API.new('_wutime64', 'PP', 'I', MSVCRT_DLL)
43
+
44
+ def asctime(timeptr)
45
+ Asctime.call(timeptr)
46
+ end
47
+
48
+ def clock
49
+ Clock.call
50
+ end
51
+
52
+ def ctime(timer)
53
+ Ctime.call(timer)
54
+ end
55
+
56
+ def ctime64(timer)
57
+ Ctime64.call(timer)
58
+ end
59
+
60
+ def difftime(timer1, timer0)
61
+ Difftime.call(timer1, timer0)
62
+ end
63
+
64
+ def ftime(timeptr)
65
+ Ftime.call(timeptr)
66
+ end
67
+
68
+ def ftime64(timeptr)
69
+ Ftime64.call(timeptr)
70
+ end
71
+
72
+ def futime(fd, filetime)
73
+ Futime.call(fd, filetime)
74
+ end
75
+
76
+ def futime64(fd, filetime)
77
+ Futime64.call(fd, filetime)
78
+ end
79
+
80
+ def gmtime(timer)
81
+ Gmtime.call(timer)
82
+ end
83
+
84
+ def gmtime64(timer)
85
+ Gmtime64.call(timer)
86
+ end
87
+
88
+ def localtime(timer)
89
+ Localtime.call(timer)
90
+ end
91
+
92
+ def localtime64(timer)
93
+ Localtime64.call(timer)
94
+ end
95
+
96
+ def mktime(timeptr)
97
+ Mktime.call(timeptr)
98
+ end
99
+
100
+ def mktime64(timeptr)
101
+ Mktime64.call(timeptr)
102
+ end
103
+
104
+ def strdate(datestr)
105
+ Strdate.call(datestr)
106
+ end
107
+
108
+ def strftime(dest, maxsize, format, timeptr)
109
+ Strftime.call(dest, maxsize, format, timeptr)
110
+ end
111
+
112
+ def strtime(timestr)
113
+ Strtime.call(timestr)
114
+ end
115
+
116
+ def time(timer)
117
+ WinTime.call(timer)
118
+ end
119
+
120
+ def time64(timer)
121
+ WinTime64.call(timer)
122
+ end
123
+
124
+ def tzset
125
+ Tzset.call
126
+ end
127
+
128
+ def utime(filename, times)
129
+ Utime.call(filename, times)
130
+ end
131
+
132
+ def utime64(filename, times)
133
+ Utime64.call(filename, times)
134
+ end
135
+
136
+ def wasctime(timeptr)
137
+ Wasctime.call(timeptr)
138
+ end
139
+
140
+ def wcsftime(dest, maxsize, format, timeptr)
141
+ Wcsftime.call(dest, maxsize, format, timeptr)
142
+ end
143
+
144
+ def wctime(timer)
145
+ Wctime.call(timer)
146
+ end
147
+
148
+ def wctime64(timer)
149
+ Wctime64.call(timer)
150
+ end
151
+
152
+ def wstrdate(datestr)
153
+ Wstrdate.call(datestr)
154
+ end
155
+
156
+ def wstrtime(timestr)
157
+ Wstrtime.call(timestr)
158
+ end
159
+
160
+ def wutime(filename, times)
161
+ Wutime.call(filename, times)
162
+ end
163
+
164
+ def wutime64(filename, times)
165
+ Wutime64.call(filename, times)
166
+ end
167
+ end
168
+ end
169
+ end