windows-pr 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +408 -404
- data/MANIFEST +65 -65
- data/README +149 -149
- data/Rakefile +52 -52
- data/doc/conversion_guide.txt +37 -37
- data/lib/windows/clipboard.rb +59 -59
- data/lib/windows/com.rb +190 -189
- data/lib/windows/com/automation.rb +147 -147
- data/lib/windows/com/variant.rb +22 -22
- data/lib/windows/console.rb +112 -112
- data/lib/windows/debug.rb +33 -33
- data/lib/windows/device_io.rb +246 -246
- data/lib/windows/directory.rb +25 -25
- data/lib/windows/error.rb +482 -482
- data/lib/windows/eventlog.rb +78 -78
- data/lib/windows/file.rb +262 -262
- data/lib/windows/file_mapping.rb +23 -23
- data/lib/windows/filesystem.rb +13 -13
- data/lib/windows/gdi/bitmap.rb +63 -63
- data/lib/windows/gdi/device_context.rb +44 -44
- data/lib/windows/gdi/metafile.rb +38 -38
- data/lib/windows/gdi/painting_drawing.rb +113 -113
- data/lib/windows/handle.rb +21 -21
- data/lib/windows/library.rb +42 -42
- data/lib/windows/limits.rb +31 -31
- data/lib/windows/mailslot.rb +22 -22
- data/lib/windows/memory.rb +126 -126
- data/lib/windows/msvcrt/buffer.rb +73 -73
- data/lib/windows/msvcrt/directory.rb +29 -29
- data/lib/windows/msvcrt/file.rb +45 -45
- data/lib/windows/msvcrt/io.rb +71 -71
- data/lib/windows/msvcrt/time.rb +167 -167
- data/lib/windows/national.rb +578 -578
- data/lib/windows/network/management.rb +523 -523
- data/lib/windows/network/snmp.rb +90 -90
- data/lib/windows/network/winsock.rb +126 -126
- data/lib/windows/nio.rb +48 -47
- data/lib/windows/ntfs/winternl.rb +96 -96
- data/lib/windows/path.rb +141 -141
- data/lib/windows/pipe.rb +40 -40
- data/lib/windows/process.rb +174 -174
- data/lib/windows/registry.rb +126 -126
- data/lib/windows/security.rb +477 -477
- data/lib/windows/security/authentication.rb +30 -30
- data/lib/windows/service.rb +140 -140
- data/lib/windows/shell.rb +169 -169
- data/lib/windows/sound.rb +37 -37
- data/lib/windows/synchronize.rb +131 -131
- data/lib/windows/system_info.rb +227 -222
- data/lib/windows/thread.rb +62 -62
- data/lib/windows/time.rb +46 -46
- data/lib/windows/tool_helper.rb +34 -34
- data/lib/windows/volume.rb +59 -59
- data/lib/windows/window.rb +79 -79
- data/lib/windows/window/classes.rb +57 -57
- data/lib/windows/window/dialog.rb +89 -89
- data/lib/windows/window/menu.rb +100 -100
- data/lib/windows/window/message.rb +295 -295
- data/lib/windows/window/properties.rb +18 -18
- data/lib/windows/window/timer.rb +17 -17
- data/test/tc_clipboard.rb +41 -41
- data/test/tc_com.rb +32 -32
- data/test/tc_com_automation.rb +15 -15
- data/test/tc_console.rb +108 -108
- data/test/tc_debug.rb +48 -48
- data/test/tc_device_io.rb +29 -29
- data/test/tc_directory.rb +25 -25
- data/test/tc_error.rb +49 -49
- data/test/tc_eventlog.rb +58 -58
- data/test/tc_file.rb +67 -67
- data/test/tc_file_mapping.rb +38 -38
- data/test/tc_filesystem.rb +27 -27
- data/test/tc_gdi_bitmap.rb +25 -25
- data/test/tc_gdi_metafile.rb +23 -23
- data/test/tc_handle.rb +36 -36
- data/test/tc_library.rb +37 -37
- data/test/tc_limits.rb +34 -34
- data/test/tc_mailslot.rb +22 -22
- data/test/tc_memory.rb +44 -44
- data/test/tc_msvcrt_buffer.rb +68 -68
- data/test/tc_msvcrt_directory.rb +98 -98
- data/test/tc_msvcrt_file.rb +80 -80
- data/test/tc_msvcrt_io.rb +48 -48
- data/test/tc_msvcrt_string.rb +93 -93
- data/test/tc_msvcrt_time.rb +29 -29
- data/test/tc_national.rb +38 -38
- data/test/tc_network_management.rb +32 -32
- data/test/tc_network_snmp.rb +31 -31
- data/test/tc_network_winsock.rb +34 -34
- data/test/tc_nio.rb +32 -32
- data/test/tc_ntfs_winternl.rb +29 -29
- data/test/tc_path.rb +90 -90
- data/test/tc_pipe.rb +53 -53
- data/test/tc_process.rb +24 -24
- data/test/tc_registry.rb +29 -29
- data/test/tc_security.rb +104 -104
- data/test/tc_security_authentication.rb +34 -34
- data/test/tc_service.rb +57 -57
- data/test/tc_shell.rb +34 -34
- data/test/tc_sound.rb +37 -37
- data/test/tc_synchronize.rb +75 -75
- data/test/tc_system_info.rb +43 -43
- data/test/tc_thread.rb +29 -29
- data/test/tc_time.rb +32 -32
- data/test/tc_tool_helper.rb +29 -29
- data/test/tc_volume.rb +47 -47
- data/test/tc_window.rb +45 -45
- data/test/tc_window_classes.rb +33 -33
- data/test/tc_window_dialog.rb +33 -33
- data/test/tc_window_menu.rb +29 -29
- data/test/tc_window_message.rb +33 -33
- data/test/tc_window_properties.rb +29 -29
- data/test/tc_window_timer.rb +29 -29
- data/windows-pr.gemspec +34 -34
- metadata +4 -4
@@ -1,73 +1,73 @@
|
|
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
|
+
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,29 +1,29 @@
|
|
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
|
+
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
|
data/lib/windows/msvcrt/file.rb
CHANGED
@@ -1,45 +1,45 @@
|
|
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
|
+
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
|
data/lib/windows/msvcrt/io.rb
CHANGED
@@ -1,71 +1,71 @@
|
|
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
|
-
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
|
23
|
-
|
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)
|
51
|
-
|
52
|
-
# Wide character versions
|
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)
|
60
|
-
|
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
|
69
|
-
end
|
70
|
-
end
|
71
|
-
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
|
+
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
|
23
|
+
|
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)
|
51
|
+
|
52
|
+
# Wide character versions
|
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)
|
60
|
+
|
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
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/windows/msvcrt/time.rb
CHANGED
@@ -1,167 +1,167 @@
|
|
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
|
-
Asctime = API.new('asctime', 'P', 'P', MSVCRT_DLL)
|
11
|
-
Clock = API.new('clock', 'V', 'L', MSVCRT_DLL)
|
12
|
-
Ctime = API.new('ctime', 'P', 'P', 'msvcrt')
|
13
|
-
Ctime64 = API.new('_ctime64', 'P', 'P', MSVCRT_DLL)
|
14
|
-
Difftime = API.new('difftime', 'LL', 'L', 'msvcrt')
|
15
|
-
Ftime = API.new('_ftime', 'P', 'L', 'msvcrt')
|
16
|
-
Ftime64 = API.new('_ftime64', 'P', 'L', MSVCRT_DLL)
|
17
|
-
Futime = API.new('_futime', 'IP', 'I', 'msvcrt')
|
18
|
-
Futime64 = API.new('_futime64', 'IP', 'I', MSVCRT_DLL)
|
19
|
-
Gmtime = API.new('gmtime', 'P', 'P', 'msvcrt')
|
20
|
-
Gmtime64 = API.new('_gmtime64', 'P', 'P', MSVCRT_DLL)
|
21
|
-
Localtime = API.new('localtime', 'P', 'P', 'msvcrt')
|
22
|
-
Localtime64 = API.new('_localtime64', 'P', 'P', MSVCRT_DLL)
|
23
|
-
Mktime = API.new('mktime', 'P', 'L', 'msvcrt')
|
24
|
-
Mktime64 = API.new('_mktime64', 'P', 'L', MSVCRT_DLL)
|
25
|
-
Strdate = API.new('_strdate', 'P', 'P', MSVCRT_DLL)
|
26
|
-
Strftime = API.new('strftime', 'PLPP', 'L', MSVCRT_DLL)
|
27
|
-
Strtime = API.new('_strtime', 'P', 'P', MSVCRT_DLL)
|
28
|
-
WinTime = API.new('time', 'P', 'L', 'msvcrt') # Avoid conflict
|
29
|
-
WinTime64 = API.new('_time64', 'P', 'L', MSVCRT_DLL) # Avoid conflict
|
30
|
-
Tzset = API.new('_tzset', 'V', 'V', MSVCRT_DLL)
|
31
|
-
Utime = API.new('_utime', 'PP', 'I', 'msvcrt')
|
32
|
-
Utime64 = API.new('_utime64', 'PP', 'I', MSVCRT_DLL)
|
33
|
-
Wasctime = API.new('_wasctime', 'P', 'P', MSVCRT_DLL)
|
34
|
-
Wctime = API.new('_wctime', 'P', 'P', 'msvcrt')
|
35
|
-
Wctime64 = API.new('_wctime64', 'P', 'P', MSVCRT_DLL)
|
36
|
-
Wstrdate = API.new('_wstrdate', 'P', 'L', MSVCRT_DLL)
|
37
|
-
Wcsftime = API.new('wcsftime', 'PLPP', 'L', MSVCRT_DLL)
|
38
|
-
Wstrtime = API.new('_wstrtime', 'P', 'P', MSVCRT_DLL)
|
39
|
-
Wutime = API.new('_wutime', 'PP', 'I', 'msvcrt')
|
40
|
-
Wutime64 = API.new('_wutime64', 'PP', 'I', MSVCRT_DLL)
|
41
|
-
|
42
|
-
def asctime(timeptr)
|
43
|
-
Asctime.call(timeptr)
|
44
|
-
end
|
45
|
-
|
46
|
-
def clock
|
47
|
-
Clock.call
|
48
|
-
end
|
49
|
-
|
50
|
-
def ctime(timer)
|
51
|
-
Ctime.call(timer)
|
52
|
-
end
|
53
|
-
|
54
|
-
def ctime64(timer)
|
55
|
-
Ctime64.call(timer)
|
56
|
-
end
|
57
|
-
|
58
|
-
def difftime(timer1, timer0)
|
59
|
-
Difftime.call(timer1, timer0)
|
60
|
-
end
|
61
|
-
|
62
|
-
def ftime(timeptr)
|
63
|
-
Ftime.call(timeptr)
|
64
|
-
end
|
65
|
-
|
66
|
-
def ftime64(timeptr)
|
67
|
-
Ftime64.call(timeptr)
|
68
|
-
end
|
69
|
-
|
70
|
-
def futime(fd, filetime)
|
71
|
-
Futime.call(fd, filetime)
|
72
|
-
end
|
73
|
-
|
74
|
-
def futime64(fd, filetime)
|
75
|
-
Futime64.call(fd, filetime)
|
76
|
-
end
|
77
|
-
|
78
|
-
def gmtime(timer)
|
79
|
-
Gmtime.call(timer)
|
80
|
-
end
|
81
|
-
|
82
|
-
def gmtime64(timer)
|
83
|
-
Gmtime64.call(timer)
|
84
|
-
end
|
85
|
-
|
86
|
-
def localtime(timer)
|
87
|
-
Localtime.call(timer)
|
88
|
-
end
|
89
|
-
|
90
|
-
def localtime64(timer)
|
91
|
-
Localtime64.call(timer)
|
92
|
-
end
|
93
|
-
|
94
|
-
def mktime(timeptr)
|
95
|
-
Mktime.call(timeptr)
|
96
|
-
end
|
97
|
-
|
98
|
-
def mktime64(timeptr)
|
99
|
-
Mktime64.call(timeptr)
|
100
|
-
end
|
101
|
-
|
102
|
-
def strdate(datestr)
|
103
|
-
Strdate.call(datestr)
|
104
|
-
end
|
105
|
-
|
106
|
-
def strftime(dest, maxsize, format, timeptr)
|
107
|
-
Strftime.call(dest, maxsize, format, timeptr)
|
108
|
-
end
|
109
|
-
|
110
|
-
def strtime(timestr)
|
111
|
-
Strtime.call(timestr)
|
112
|
-
end
|
113
|
-
|
114
|
-
def time(timer)
|
115
|
-
WinTime.call(timer)
|
116
|
-
end
|
117
|
-
|
118
|
-
def time64(timer)
|
119
|
-
WinTime64.call(timer)
|
120
|
-
end
|
121
|
-
|
122
|
-
def tzset
|
123
|
-
Tzset.call
|
124
|
-
end
|
125
|
-
|
126
|
-
def utime(filename, times)
|
127
|
-
Utime.call(filename, times)
|
128
|
-
end
|
129
|
-
|
130
|
-
def utime64(filename, times)
|
131
|
-
Utime64.call(filename, times)
|
132
|
-
end
|
133
|
-
|
134
|
-
def wasctime(timeptr)
|
135
|
-
Wasctime.call(timeptr)
|
136
|
-
end
|
137
|
-
|
138
|
-
def wcsftime(dest, maxsize, format, timeptr)
|
139
|
-
Wcsftime.call(dest, maxsize, format, timeptr)
|
140
|
-
end
|
141
|
-
|
142
|
-
def wctime(timer)
|
143
|
-
Wctime.call(timer)
|
144
|
-
end
|
145
|
-
|
146
|
-
def wctime64(timer)
|
147
|
-
Wctime64.call(timer)
|
148
|
-
end
|
149
|
-
|
150
|
-
def wstrdate(datestr)
|
151
|
-
Wstrdate.call(datestr)
|
152
|
-
end
|
153
|
-
|
154
|
-
def wstrtime(timestr)
|
155
|
-
Wstrtime.call(timestr)
|
156
|
-
end
|
157
|
-
|
158
|
-
def wutime(filename, times)
|
159
|
-
Wutime.call(filename, times)
|
160
|
-
end
|
161
|
-
|
162
|
-
def wutime64(filename, times)
|
163
|
-
Wutime64.call(filename, times)
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
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
|
+
Asctime = API.new('asctime', 'P', 'P', MSVCRT_DLL)
|
11
|
+
Clock = API.new('clock', 'V', 'L', MSVCRT_DLL)
|
12
|
+
Ctime = API.new('ctime', 'P', 'P', 'msvcrt')
|
13
|
+
Ctime64 = API.new('_ctime64', 'P', 'P', MSVCRT_DLL)
|
14
|
+
Difftime = API.new('difftime', 'LL', 'L', 'msvcrt')
|
15
|
+
Ftime = API.new('_ftime', 'P', 'L', 'msvcrt')
|
16
|
+
Ftime64 = API.new('_ftime64', 'P', 'L', MSVCRT_DLL)
|
17
|
+
Futime = API.new('_futime', 'IP', 'I', 'msvcrt')
|
18
|
+
Futime64 = API.new('_futime64', 'IP', 'I', MSVCRT_DLL)
|
19
|
+
Gmtime = API.new('gmtime', 'P', 'P', 'msvcrt')
|
20
|
+
Gmtime64 = API.new('_gmtime64', 'P', 'P', MSVCRT_DLL)
|
21
|
+
Localtime = API.new('localtime', 'P', 'P', 'msvcrt')
|
22
|
+
Localtime64 = API.new('_localtime64', 'P', 'P', MSVCRT_DLL)
|
23
|
+
Mktime = API.new('mktime', 'P', 'L', 'msvcrt')
|
24
|
+
Mktime64 = API.new('_mktime64', 'P', 'L', MSVCRT_DLL)
|
25
|
+
Strdate = API.new('_strdate', 'P', 'P', MSVCRT_DLL)
|
26
|
+
Strftime = API.new('strftime', 'PLPP', 'L', MSVCRT_DLL)
|
27
|
+
Strtime = API.new('_strtime', 'P', 'P', MSVCRT_DLL)
|
28
|
+
WinTime = API.new('time', 'P', 'L', 'msvcrt') # Avoid conflict
|
29
|
+
WinTime64 = API.new('_time64', 'P', 'L', MSVCRT_DLL) # Avoid conflict
|
30
|
+
Tzset = API.new('_tzset', 'V', 'V', MSVCRT_DLL)
|
31
|
+
Utime = API.new('_utime', 'PP', 'I', 'msvcrt')
|
32
|
+
Utime64 = API.new('_utime64', 'PP', 'I', MSVCRT_DLL)
|
33
|
+
Wasctime = API.new('_wasctime', 'P', 'P', MSVCRT_DLL)
|
34
|
+
Wctime = API.new('_wctime', 'P', 'P', 'msvcrt')
|
35
|
+
Wctime64 = API.new('_wctime64', 'P', 'P', MSVCRT_DLL)
|
36
|
+
Wstrdate = API.new('_wstrdate', 'P', 'L', MSVCRT_DLL)
|
37
|
+
Wcsftime = API.new('wcsftime', 'PLPP', 'L', MSVCRT_DLL)
|
38
|
+
Wstrtime = API.new('_wstrtime', 'P', 'P', MSVCRT_DLL)
|
39
|
+
Wutime = API.new('_wutime', 'PP', 'I', 'msvcrt')
|
40
|
+
Wutime64 = API.new('_wutime64', 'PP', 'I', MSVCRT_DLL)
|
41
|
+
|
42
|
+
def asctime(timeptr)
|
43
|
+
Asctime.call(timeptr)
|
44
|
+
end
|
45
|
+
|
46
|
+
def clock
|
47
|
+
Clock.call
|
48
|
+
end
|
49
|
+
|
50
|
+
def ctime(timer)
|
51
|
+
Ctime.call(timer)
|
52
|
+
end
|
53
|
+
|
54
|
+
def ctime64(timer)
|
55
|
+
Ctime64.call(timer)
|
56
|
+
end
|
57
|
+
|
58
|
+
def difftime(timer1, timer0)
|
59
|
+
Difftime.call(timer1, timer0)
|
60
|
+
end
|
61
|
+
|
62
|
+
def ftime(timeptr)
|
63
|
+
Ftime.call(timeptr)
|
64
|
+
end
|
65
|
+
|
66
|
+
def ftime64(timeptr)
|
67
|
+
Ftime64.call(timeptr)
|
68
|
+
end
|
69
|
+
|
70
|
+
def futime(fd, filetime)
|
71
|
+
Futime.call(fd, filetime)
|
72
|
+
end
|
73
|
+
|
74
|
+
def futime64(fd, filetime)
|
75
|
+
Futime64.call(fd, filetime)
|
76
|
+
end
|
77
|
+
|
78
|
+
def gmtime(timer)
|
79
|
+
Gmtime.call(timer)
|
80
|
+
end
|
81
|
+
|
82
|
+
def gmtime64(timer)
|
83
|
+
Gmtime64.call(timer)
|
84
|
+
end
|
85
|
+
|
86
|
+
def localtime(timer)
|
87
|
+
Localtime.call(timer)
|
88
|
+
end
|
89
|
+
|
90
|
+
def localtime64(timer)
|
91
|
+
Localtime64.call(timer)
|
92
|
+
end
|
93
|
+
|
94
|
+
def mktime(timeptr)
|
95
|
+
Mktime.call(timeptr)
|
96
|
+
end
|
97
|
+
|
98
|
+
def mktime64(timeptr)
|
99
|
+
Mktime64.call(timeptr)
|
100
|
+
end
|
101
|
+
|
102
|
+
def strdate(datestr)
|
103
|
+
Strdate.call(datestr)
|
104
|
+
end
|
105
|
+
|
106
|
+
def strftime(dest, maxsize, format, timeptr)
|
107
|
+
Strftime.call(dest, maxsize, format, timeptr)
|
108
|
+
end
|
109
|
+
|
110
|
+
def strtime(timestr)
|
111
|
+
Strtime.call(timestr)
|
112
|
+
end
|
113
|
+
|
114
|
+
def time(timer)
|
115
|
+
WinTime.call(timer)
|
116
|
+
end
|
117
|
+
|
118
|
+
def time64(timer)
|
119
|
+
WinTime64.call(timer)
|
120
|
+
end
|
121
|
+
|
122
|
+
def tzset
|
123
|
+
Tzset.call
|
124
|
+
end
|
125
|
+
|
126
|
+
def utime(filename, times)
|
127
|
+
Utime.call(filename, times)
|
128
|
+
end
|
129
|
+
|
130
|
+
def utime64(filename, times)
|
131
|
+
Utime64.call(filename, times)
|
132
|
+
end
|
133
|
+
|
134
|
+
def wasctime(timeptr)
|
135
|
+
Wasctime.call(timeptr)
|
136
|
+
end
|
137
|
+
|
138
|
+
def wcsftime(dest, maxsize, format, timeptr)
|
139
|
+
Wcsftime.call(dest, maxsize, format, timeptr)
|
140
|
+
end
|
141
|
+
|
142
|
+
def wctime(timer)
|
143
|
+
Wctime.call(timer)
|
144
|
+
end
|
145
|
+
|
146
|
+
def wctime64(timer)
|
147
|
+
Wctime64.call(timer)
|
148
|
+
end
|
149
|
+
|
150
|
+
def wstrdate(datestr)
|
151
|
+
Wstrdate.call(datestr)
|
152
|
+
end
|
153
|
+
|
154
|
+
def wstrtime(timestr)
|
155
|
+
Wstrtime.call(timestr)
|
156
|
+
end
|
157
|
+
|
158
|
+
def wutime(filename, times)
|
159
|
+
Wutime.call(filename, times)
|
160
|
+
end
|
161
|
+
|
162
|
+
def wutime64(filename, times)
|
163
|
+
Wutime64.call(filename, times)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|