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.
- data/CHANGES +15 -0
- data/MANIFEST +65 -65
- data/README +149 -149
- data/Rakefile +37 -52
- data/doc/conversion_guide.txt +37 -37
- data/lib/windows/clipboard.rb +2 -0
- data/lib/windows/com.rb +2 -0
- data/lib/windows/com/accessibility.rb +12 -10
- data/lib/windows/com/automation.rb +149 -147
- data/lib/windows/com/variant.rb +24 -22
- data/lib/windows/console.rb +114 -112
- data/lib/windows/debug.rb +35 -33
- data/lib/windows/device_io.rb +248 -246
- data/lib/windows/directory.rb +2 -0
- data/lib/windows/error.rb +2 -0
- data/lib/windows/eventlog.rb +2 -0
- data/lib/windows/file.rb +264 -262
- data/lib/windows/file_mapping.rb +25 -23
- data/lib/windows/filesystem.rb +2 -0
- data/lib/windows/gdi/bitmap.rb +65 -63
- data/lib/windows/gdi/device_context.rb +46 -44
- data/lib/windows/gdi/metafile.rb +40 -38
- data/lib/windows/gdi/painting_drawing.rb +115 -113
- data/lib/windows/handle.rb +2 -0
- data/lib/windows/library.rb +2 -0
- data/lib/windows/limits.rb +34 -31
- data/lib/windows/mailslot.rb +2 -0
- data/lib/windows/memory.rb +2 -0
- data/lib/windows/msvcrt/buffer.rb +75 -73
- data/lib/windows/msvcrt/directory.rb +31 -29
- data/lib/windows/msvcrt/file.rb +47 -45
- data/lib/windows/msvcrt/io.rb +62 -60
- data/lib/windows/msvcrt/string.rb +2 -0
- data/lib/windows/msvcrt/time.rb +169 -167
- data/lib/windows/national.rb +580 -578
- data/lib/windows/network/management.rb +525 -523
- data/lib/windows/network/snmp.rb +92 -90
- data/lib/windows/network/winsock.rb +128 -126
- data/lib/windows/nio.rb +2 -0
- data/lib/windows/ntfs/winternl.rb +96 -82
- data/lib/windows/path.rb +143 -141
- data/lib/windows/pipe.rb +42 -40
- data/lib/windows/process.rb +2 -0
- data/lib/windows/registry.rb +171 -126
- data/lib/windows/security.rb +479 -477
- data/lib/windows/security/authentication.rb +32 -30
- data/lib/windows/service.rb +142 -140
- data/lib/windows/shell.rb +171 -169
- data/lib/windows/socket.rb +86 -0
- data/lib/windows/sound.rb +39 -37
- data/lib/windows/synchronize.rb +133 -131
- data/lib/windows/system_info.rb +4 -2
- data/lib/windows/thread.rb +2 -0
- data/lib/windows/time.rb +48 -46
- data/lib/windows/tool_helper.rb +36 -34
- data/lib/windows/unicode.rb +2 -0
- data/lib/windows/volume.rb +61 -59
- data/lib/windows/window.rb +81 -79
- data/lib/windows/window/classes.rb +59 -57
- data/lib/windows/window/dialog.rb +91 -89
- data/lib/windows/window/menu.rb +102 -100
- data/lib/windows/window/message.rb +297 -295
- data/lib/windows/window/properties.rb +20 -18
- data/lib/windows/window/timer.rb +19 -17
- data/lib/windows/wsa.rb +102 -0
- 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 +38 -50
- 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 +59 -68
- data/test/tc_msvcrt_directory.rb +96 -98
- data/test/tc_msvcrt_file.rb +80 -80
- data/test/tc_msvcrt_io.rb +48 -48
- data/test/tc_msvcrt_string.rb +94 -93
- data/test/tc_msvcrt_time.rb +19 -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 +33 -18
- 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_socket.rb +20 -0
- data/test/tc_sound.rb +37 -37
- data/test/tc_synchronize.rb +75 -75
- data/test/tc_system_info.rb +33 -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_unicode.rb +62 -62
- 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/test/tc_wsa.rb +19 -0
- data/windows-pr.gemspec +1 -1
- metadata +13 -7
data/CHANGES
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
= 1.2.0 - 24-Mar-2011
|
2
|
+
* All methods and constants are now private. These methods were never meant
|
3
|
+
to be used by individual objects, but are only meant to be used internally.
|
4
|
+
Note that, because of an issue currently in the windows-api library, some
|
5
|
+
methods may still be currently public, but users of this library should not
|
6
|
+
count on that for long.
|
7
|
+
* Added the Windows::WSA and Windows::Socket modules.
|
8
|
+
* Fixed the MAKEWORD and MAKELONG macro methods in the SystemInfo module.
|
9
|
+
* Added many more functions and some constants to the Windows::Registry module.
|
10
|
+
Thanks go to Dan Rathbun for the suggestion.
|
11
|
+
* Fixed the HKEY_CURRENT_USER constant in the Windows::Registry module.
|
12
|
+
* The custom GetFinalPathNameByHandle method for Windows XP and 2000 has been
|
13
|
+
fixed and reworked. It is limited to a defacto VOLUME_NAME_NT flag value,
|
14
|
+
however. See the comments for details.
|
15
|
+
|
1
16
|
= 1.1.3 - 20-Jan-2011
|
2
17
|
* Added the windows_7? method to the Windows::SystemInfo module.
|
3
18
|
* Some minor cosmetic updates to other files.
|
data/MANIFEST
CHANGED
@@ -1,65 +1,65 @@
|
|
1
|
-
* CHANGES
|
2
|
-
* MANIFEST
|
3
|
-
* README
|
4
|
-
* Rakefile
|
5
|
-
* windows-pr.gemspec
|
6
|
-
|
7
|
-
* doc/conversion_guide.txt
|
8
|
-
|
9
|
-
* lib/windows/clipboard.rb
|
10
|
-
* lib/windows/console.rb
|
11
|
-
* lib/windows/device_io.rb
|
12
|
-
* lib/windows/directory.rb
|
13
|
-
* lib/windows/error.rb
|
14
|
-
* lib/windows/eventlog.rb
|
15
|
-
* lib/windows/file_mapping.rb
|
16
|
-
* lib/windows/file.rb
|
17
|
-
* lib/windows/filesystem.rb
|
18
|
-
* lib/windows/handle.rb
|
19
|
-
* lib/windows/library.rb
|
20
|
-
* lib/windows/limits.rb
|
21
|
-
* lib/windows/mailslot.rb
|
22
|
-
* lib/windows/memory.rb
|
23
|
-
* lib/windows/national.rb
|
24
|
-
* lib/windows/nio.rb
|
25
|
-
* lib/windows/network_management.rb
|
26
|
-
* lib/windows/path.rb
|
27
|
-
* lib/windows/pipe.rb
|
28
|
-
* lib/windows/process.rb
|
29
|
-
* lib/windows/registry.rb
|
30
|
-
* lib/windows/security.rb
|
31
|
-
* lib/windows/service.rb
|
32
|
-
* lib/windows/shell.rb
|
33
|
-
* lib/windows/sound.rb
|
34
|
-
* lib/windows/synchronize.rb
|
35
|
-
* lib/windows/system_info.rb
|
36
|
-
* lib/windows/time.rb
|
37
|
-
* lib/windows/unicode.rb
|
38
|
-
* lib/windows/volume.rb
|
39
|
-
* lib/windows/window.rb
|
40
|
-
|
41
|
-
* lib/windows/com/automation.rb
|
42
|
-
|
43
|
-
* lib/windows/gdi/bitmap.rb
|
44
|
-
* lib/windows/gdi/device_context.rb
|
45
|
-
* lib/windows/gdi/painting_drawing.rb
|
46
|
-
|
47
|
-
* lib/windows/msvcrt/buffer.rb
|
48
|
-
* lib/windows/msvcrt/directory.rb
|
49
|
-
* lib/windows/msvcrt/file.rb
|
50
|
-
* lib/windows/msvcrt/io.rb
|
51
|
-
* lib/windows/msvcrt/string.rb
|
52
|
-
* lib/windows/msvcrt/time.rb
|
53
|
-
|
54
|
-
* lib/windows/network/management.rb
|
55
|
-
* lib/windows/network/snmp.rb
|
56
|
-
* lib/windows/network/winsock.rb
|
57
|
-
|
58
|
-
* lib/windows/ntfs/winternl.rb
|
59
|
-
|
60
|
-
* lib/windows/window/classes.rb
|
61
|
-
* lib/windows/window/dialog.rb
|
62
|
-
* lib/windows/window/menu.rb
|
63
|
-
* lib/windows/window/message.rb
|
64
|
-
* lib/windows/window/properties.rb
|
65
|
-
* lib/windows/window/timer.rb
|
1
|
+
* CHANGES
|
2
|
+
* MANIFEST
|
3
|
+
* README
|
4
|
+
* Rakefile
|
5
|
+
* windows-pr.gemspec
|
6
|
+
|
7
|
+
* doc/conversion_guide.txt
|
8
|
+
|
9
|
+
* lib/windows/clipboard.rb
|
10
|
+
* lib/windows/console.rb
|
11
|
+
* lib/windows/device_io.rb
|
12
|
+
* lib/windows/directory.rb
|
13
|
+
* lib/windows/error.rb
|
14
|
+
* lib/windows/eventlog.rb
|
15
|
+
* lib/windows/file_mapping.rb
|
16
|
+
* lib/windows/file.rb
|
17
|
+
* lib/windows/filesystem.rb
|
18
|
+
* lib/windows/handle.rb
|
19
|
+
* lib/windows/library.rb
|
20
|
+
* lib/windows/limits.rb
|
21
|
+
* lib/windows/mailslot.rb
|
22
|
+
* lib/windows/memory.rb
|
23
|
+
* lib/windows/national.rb
|
24
|
+
* lib/windows/nio.rb
|
25
|
+
* lib/windows/network_management.rb
|
26
|
+
* lib/windows/path.rb
|
27
|
+
* lib/windows/pipe.rb
|
28
|
+
* lib/windows/process.rb
|
29
|
+
* lib/windows/registry.rb
|
30
|
+
* lib/windows/security.rb
|
31
|
+
* lib/windows/service.rb
|
32
|
+
* lib/windows/shell.rb
|
33
|
+
* lib/windows/sound.rb
|
34
|
+
* lib/windows/synchronize.rb
|
35
|
+
* lib/windows/system_info.rb
|
36
|
+
* lib/windows/time.rb
|
37
|
+
* lib/windows/unicode.rb
|
38
|
+
* lib/windows/volume.rb
|
39
|
+
* lib/windows/window.rb
|
40
|
+
|
41
|
+
* lib/windows/com/automation.rb
|
42
|
+
|
43
|
+
* lib/windows/gdi/bitmap.rb
|
44
|
+
* lib/windows/gdi/device_context.rb
|
45
|
+
* lib/windows/gdi/painting_drawing.rb
|
46
|
+
|
47
|
+
* lib/windows/msvcrt/buffer.rb
|
48
|
+
* lib/windows/msvcrt/directory.rb
|
49
|
+
* lib/windows/msvcrt/file.rb
|
50
|
+
* lib/windows/msvcrt/io.rb
|
51
|
+
* lib/windows/msvcrt/string.rb
|
52
|
+
* lib/windows/msvcrt/time.rb
|
53
|
+
|
54
|
+
* lib/windows/network/management.rb
|
55
|
+
* lib/windows/network/snmp.rb
|
56
|
+
* lib/windows/network/winsock.rb
|
57
|
+
|
58
|
+
* lib/windows/ntfs/winternl.rb
|
59
|
+
|
60
|
+
* lib/windows/window/classes.rb
|
61
|
+
* lib/windows/window/dialog.rb
|
62
|
+
* lib/windows/window/menu.rb
|
63
|
+
* lib/windows/window/message.rb
|
64
|
+
* lib/windows/window/properties.rb
|
65
|
+
* lib/windows/window/timer.rb
|
data/README
CHANGED
@@ -1,149 +1,149 @@
|
|
1
|
-
== Description
|
2
|
-
A collection of Windows functions predefined for you via Win32::API.
|
3
|
-
Hence the 'pr', for 'Pure Ruby'.
|
4
|
-
|
5
|
-
== Synopsis
|
6
|
-
require 'windows/path'
|
7
|
-
|
8
|
-
class Foo
|
9
|
-
include Windows::Path
|
10
|
-
|
11
|
-
if PathIsRoot.call("C:\\") > 0
|
12
|
-
...
|
13
|
-
end
|
14
|
-
|
15
|
-
# or
|
16
|
-
|
17
|
-
if PathIsRoot("C:\\")
|
18
|
-
...
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
== Installation
|
23
|
-
gem install windows-pr
|
24
|
-
|
25
|
-
== Methods
|
26
|
-
Each of the various files included as part of this package provide a series
|
27
|
-
of constants corresponding to the equivalent Windows API function and
|
28
|
-
related numeric constants. For example, if you require 'windows/path',
|
29
|
-
you now have PathIsRoot, PathIsUNC, etc, available to you as Win32::API
|
30
|
-
objects in the form of constants.
|
31
|
-
|
32
|
-
A wrapper has been provided for each method in order to avoid the
|
33
|
-
Win32::API#call method. So, instead of PathIsRoot.call(path) you can
|
34
|
-
invoke it as PathIsRoot(path). If the original function is lower case
|
35
|
-
then the wrapper method is lower case as well. For example, instead of
|
36
|
-
doing 'Memcpy.call(dest, src, size)' you can do 'memcpy(dest, src, size)'.
|
37
|
-
|
38
|
-
Remember boys and girls, if you write 'PathIsRoot', you're referring to
|
39
|
-
the constant. If you write 'PathIsRoot()', you're calling the wrapper
|
40
|
-
method.
|
41
|
-
|
42
|
-
Boolean methods automatically perform a check for success or failure. So,
|
43
|
-
instead of having to do something like 'if PathIsRoot(path) > 0' you can
|
44
|
-
just do 'if PathIsRoot(path)'. However, I do not add this nicety for the
|
45
|
-
MSVCRT functions that return int's because some functions have multiple
|
46
|
-
return values which you may want to inspect. So, rather than making you
|
47
|
-
guess, I have simply declared that you must inspect return values manually
|
48
|
-
for any MSVCRT module.
|
49
|
-
|
50
|
-
Source files contain related functions, by topic. For example, the
|
51
|
-
clipboard.rb file contains clipboard related functions, such as
|
52
|
-
CloseClipboard(), as well as constants such as CF_TEXT, CF_BITMAP, etc.
|
53
|
-
|
54
|
-
== Wide character functions
|
55
|
-
I decided that the $KCODE handling was a bad idea, so most of the $KCODE
|
56
|
-
handling has been removed. The only methods that change their behavior
|
57
|
-
based on $KCODE are the multi_to_wide and wide_to_multi helper methods
|
58
|
-
in the Windows::Unicode module. If $KCODE is set to UTF8, then the code
|
59
|
-
point used is CP_UTF8. Otherwise, CP_ACP is used.
|
60
|
-
|
61
|
-
The modules all come with explicit ANSI and Wide (Unicode) functions,
|
62
|
-
when available from MS Windows. By default, a function without an explicit
|
63
|
-
'A' at the end of the function name uses the ANSI version. It is up to you
|
64
|
-
to use the wide ('W') functions explicitly if you wish.
|
65
|
-
|
66
|
-
== Platform specific functions
|
67
|
-
Not all functions are defined on all platforms. For example, the
|
68
|
-
AttachConsole() function is only defined on Windows XP and later. If you
|
69
|
-
eed to conditionally test for its existence, simply use the 'defined?'
|
70
|
-
method:
|
71
|
-
|
72
|
-
if defined? AttachConsole
|
73
|
-
# Do something
|
74
|
-
else
|
75
|
-
# Do something else
|
76
|
-
end
|
77
|
-
|
78
|
-
== Where are the tests, dude?
|
79
|
-
While I've made some effort to test these functions, there are simply too
|
80
|
-
many for me to effectively test them all. We're ultimately talking about
|
81
|
-
hundreds, if not thousands, of functions, and I don't know what all of them
|
82
|
-
actually do. That being said, I will add tests where and when I can.
|
83
|
-
|
84
|
-
If you find that I've declared the function prototype wrong for a given
|
85
|
-
function, please let me know ASAP and I'll fix it. An example program
|
86
|
-
demonstrating the problem would be helpful, too. Or, if you'd just like
|
87
|
-
to contribute some test cases, that's fine as well.
|
88
|
-
|
89
|
-
== What's the point?
|
90
|
-
I became tired of redefining Windows functions over and over whenever I
|
91
|
-
wanted to use the Win32API library. I thought it would be very handy to
|
92
|
-
have them predefined for me in a library with convenient wrapper methods
|
93
|
-
to boot.
|
94
|
-
|
95
|
-
While it's true that Moonwolf has a library on the RAA that includes many
|
96
|
-
of these functions defined already, there are a few issues with it. First,
|
97
|
-
it puts *every* function and constant in one or two files. That's a waste
|
98
|
-
of memory, hard to organize & maintain, and impossible to test. Second,
|
99
|
-
some of his function declarations are wrong. Third, some of the functions
|
100
|
-
I needed for my own projects are missing. Fourth, there's no gem. Lastly,
|
101
|
-
I haven't seen an update in over 6 years, which leads me to believe it is
|
102
|
-
no longer maintained.
|
103
|
-
|
104
|
-
== Hey, I'm missing function X!
|
105
|
-
I have only defined a small subset of the overall Windows API. It would
|
106
|
-
take me years to define them *all*. I defined the ones I needed first,
|
107
|
-
plus some that I thought would be useful to others. I will continue to
|
108
|
-
add functions in my spare time, or (especially) by request.
|
109
|
-
|
110
|
-
== Bugs
|
111
|
-
None that I'm aware of. Please report any bugs on the project page at
|
112
|
-
http://www.rubyforge.org/projects/win32utils.
|
113
|
-
|
114
|
-
The only real bugs you could find are either bad prototype declarations
|
115
|
-
or bad constant values. Sometimes I forget to wrap functions properly
|
116
|
-
that may not be defined on older Windows platforms. But, please report
|
117
|
-
any of these issues on the project page should you stumble into them.
|
118
|
-
|
119
|
-
== Known Issues
|
120
|
-
In some cases the MSDN docs are wrong, and we have to learn it the hard
|
121
|
-
way. If you should happen to find a documentation bug on their site,
|
122
|
-
please contact them and let them know. They're generally good about fixing
|
123
|
-
them.
|
124
|
-
|
125
|
-
In other cases library functions are not exported by the dll. For example,
|
126
|
-
my version of shlwapi.dll does not export the PathIsHTMLFile() function,
|
127
|
-
despite being well past the minimum version for that DLL. There is nothing
|
128
|
-
you or I can do about it short of rebuilding the DLL file from scratch
|
129
|
-
and/or reporting the issue to Microsoft.
|
130
|
-
|
131
|
-
== Supported Platforms
|
132
|
-
I only support the Windows NT family of Windows, and then only Windows
|
133
|
-
2000 and later.
|
134
|
-
|
135
|
-
== License
|
136
|
-
Artistic 2.0
|
137
|
-
|
138
|
-
== Warranty
|
139
|
-
This package is provided "as is" and without any express or
|
140
|
-
implied warranties, including, without limitation, the implied
|
141
|
-
warranties of merchantability and fitness for a particular purpose.
|
142
|
-
|
143
|
-
== Copyright
|
144
|
-
(C) 2006-2010, Daniel J. Berger
|
145
|
-
All Rights Reserved
|
146
|
-
|
147
|
-
== Author(s)
|
148
|
-
Daniel Berger
|
149
|
-
Park Heesob
|
1
|
+
== Description
|
2
|
+
A collection of Windows functions predefined for you via Win32::API.
|
3
|
+
Hence the 'pr', for 'Pure Ruby'.
|
4
|
+
|
5
|
+
== Synopsis
|
6
|
+
require 'windows/path'
|
7
|
+
|
8
|
+
class Foo
|
9
|
+
include Windows::Path
|
10
|
+
|
11
|
+
if PathIsRoot.call("C:\\") > 0
|
12
|
+
...
|
13
|
+
end
|
14
|
+
|
15
|
+
# or
|
16
|
+
|
17
|
+
if PathIsRoot("C:\\")
|
18
|
+
...
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
== Installation
|
23
|
+
gem install windows-pr
|
24
|
+
|
25
|
+
== Methods
|
26
|
+
Each of the various files included as part of this package provide a series
|
27
|
+
of constants corresponding to the equivalent Windows API function and
|
28
|
+
related numeric constants. For example, if you require 'windows/path',
|
29
|
+
you now have PathIsRoot, PathIsUNC, etc, available to you as Win32::API
|
30
|
+
objects in the form of constants.
|
31
|
+
|
32
|
+
A wrapper has been provided for each method in order to avoid the
|
33
|
+
Win32::API#call method. So, instead of PathIsRoot.call(path) you can
|
34
|
+
invoke it as PathIsRoot(path). If the original function is lower case
|
35
|
+
then the wrapper method is lower case as well. For example, instead of
|
36
|
+
doing 'Memcpy.call(dest, src, size)' you can do 'memcpy(dest, src, size)'.
|
37
|
+
|
38
|
+
Remember boys and girls, if you write 'PathIsRoot', you're referring to
|
39
|
+
the constant. If you write 'PathIsRoot()', you're calling the wrapper
|
40
|
+
method.
|
41
|
+
|
42
|
+
Boolean methods automatically perform a check for success or failure. So,
|
43
|
+
instead of having to do something like 'if PathIsRoot(path) > 0' you can
|
44
|
+
just do 'if PathIsRoot(path)'. However, I do not add this nicety for the
|
45
|
+
MSVCRT functions that return int's because some functions have multiple
|
46
|
+
return values which you may want to inspect. So, rather than making you
|
47
|
+
guess, I have simply declared that you must inspect return values manually
|
48
|
+
for any MSVCRT module.
|
49
|
+
|
50
|
+
Source files contain related functions, by topic. For example, the
|
51
|
+
clipboard.rb file contains clipboard related functions, such as
|
52
|
+
CloseClipboard(), as well as constants such as CF_TEXT, CF_BITMAP, etc.
|
53
|
+
|
54
|
+
== Wide character functions
|
55
|
+
I decided that the $KCODE handling was a bad idea, so most of the $KCODE
|
56
|
+
handling has been removed. The only methods that change their behavior
|
57
|
+
based on $KCODE are the multi_to_wide and wide_to_multi helper methods
|
58
|
+
in the Windows::Unicode module. If $KCODE is set to UTF8, then the code
|
59
|
+
point used is CP_UTF8. Otherwise, CP_ACP is used.
|
60
|
+
|
61
|
+
The modules all come with explicit ANSI and Wide (Unicode) functions,
|
62
|
+
when available from MS Windows. By default, a function without an explicit
|
63
|
+
'A' at the end of the function name uses the ANSI version. It is up to you
|
64
|
+
to use the wide ('W') functions explicitly if you wish.
|
65
|
+
|
66
|
+
== Platform specific functions
|
67
|
+
Not all functions are defined on all platforms. For example, the
|
68
|
+
AttachConsole() function is only defined on Windows XP and later. If you
|
69
|
+
eed to conditionally test for its existence, simply use the 'defined?'
|
70
|
+
method:
|
71
|
+
|
72
|
+
if defined? AttachConsole
|
73
|
+
# Do something
|
74
|
+
else
|
75
|
+
# Do something else
|
76
|
+
end
|
77
|
+
|
78
|
+
== Where are the tests, dude?
|
79
|
+
While I've made some effort to test these functions, there are simply too
|
80
|
+
many for me to effectively test them all. We're ultimately talking about
|
81
|
+
hundreds, if not thousands, of functions, and I don't know what all of them
|
82
|
+
actually do. That being said, I will add tests where and when I can.
|
83
|
+
|
84
|
+
If you find that I've declared the function prototype wrong for a given
|
85
|
+
function, please let me know ASAP and I'll fix it. An example program
|
86
|
+
demonstrating the problem would be helpful, too. Or, if you'd just like
|
87
|
+
to contribute some test cases, that's fine as well.
|
88
|
+
|
89
|
+
== What's the point?
|
90
|
+
I became tired of redefining Windows functions over and over whenever I
|
91
|
+
wanted to use the Win32API library. I thought it would be very handy to
|
92
|
+
have them predefined for me in a library with convenient wrapper methods
|
93
|
+
to boot.
|
94
|
+
|
95
|
+
While it's true that Moonwolf has a library on the RAA that includes many
|
96
|
+
of these functions defined already, there are a few issues with it. First,
|
97
|
+
it puts *every* function and constant in one or two files. That's a waste
|
98
|
+
of memory, hard to organize & maintain, and impossible to test. Second,
|
99
|
+
some of his function declarations are wrong. Third, some of the functions
|
100
|
+
I needed for my own projects are missing. Fourth, there's no gem. Lastly,
|
101
|
+
I haven't seen an update in over 6 years, which leads me to believe it is
|
102
|
+
no longer maintained.
|
103
|
+
|
104
|
+
== Hey, I'm missing function X!
|
105
|
+
I have only defined a small subset of the overall Windows API. It would
|
106
|
+
take me years to define them *all*. I defined the ones I needed first,
|
107
|
+
plus some that I thought would be useful to others. I will continue to
|
108
|
+
add functions in my spare time, or (especially) by request.
|
109
|
+
|
110
|
+
== Bugs
|
111
|
+
None that I'm aware of. Please report any bugs on the project page at
|
112
|
+
http://www.rubyforge.org/projects/win32utils.
|
113
|
+
|
114
|
+
The only real bugs you could find are either bad prototype declarations
|
115
|
+
or bad constant values. Sometimes I forget to wrap functions properly
|
116
|
+
that may not be defined on older Windows platforms. But, please report
|
117
|
+
any of these issues on the project page should you stumble into them.
|
118
|
+
|
119
|
+
== Known Issues
|
120
|
+
In some cases the MSDN docs are wrong, and we have to learn it the hard
|
121
|
+
way. If you should happen to find a documentation bug on their site,
|
122
|
+
please contact them and let them know. They're generally good about fixing
|
123
|
+
them.
|
124
|
+
|
125
|
+
In other cases library functions are not exported by the dll. For example,
|
126
|
+
my version of shlwapi.dll does not export the PathIsHTMLFile() function,
|
127
|
+
despite being well past the minimum version for that DLL. There is nothing
|
128
|
+
you or I can do about it short of rebuilding the DLL file from scratch
|
129
|
+
and/or reporting the issue to Microsoft.
|
130
|
+
|
131
|
+
== Supported Platforms
|
132
|
+
I only support the Windows NT family of Windows, and then only Windows
|
133
|
+
2000 and later.
|
134
|
+
|
135
|
+
== License
|
136
|
+
Artistic 2.0
|
137
|
+
|
138
|
+
== Warranty
|
139
|
+
This package is provided "as is" and without any express or
|
140
|
+
implied warranties, including, without limitation, the implied
|
141
|
+
warranties of merchantability and fitness for a particular purpose.
|
142
|
+
|
143
|
+
== Copyright
|
144
|
+
(C) 2006-2010, Daniel J. Berger
|
145
|
+
All Rights Reserved
|
146
|
+
|
147
|
+
== Author(s)
|
148
|
+
Daniel Berger
|
149
|
+
Park Heesob
|
data/Rakefile
CHANGED
@@ -1,52 +1,37 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/clean'
|
3
|
-
require 'rake/testtask'
|
4
|
-
|
5
|
-
CLEAN
|
6
|
-
|
7
|
-
namespace 'gem' do
|
8
|
-
desc 'Build the windows-pr gem'
|
9
|
-
task :create do
|
10
|
-
spec = eval(IO.read('windows-pr.gemspec'))
|
11
|
-
Gem::Builder.new(spec).build
|
12
|
-
end
|
13
|
-
|
14
|
-
desc 'Install the windows-pr gem'
|
15
|
-
task :install => [:create] do
|
16
|
-
file = Dir["*.gem"].first
|
17
|
-
sh "gem install #{file}"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
namespace 'test' do
|
22
|
-
Rake::TestTask.new('all') do |t|
|
23
|
-
t.warning = true
|
24
|
-
t.test_files = FileList['test/tc*']
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
Rake::TestTask.new('unicode') do |t|
|
40
|
-
t.warning = true
|
41
|
-
t.verbose = true
|
42
|
-
t.test_files = FileList['test/tc_unicode.rb']
|
43
|
-
end
|
44
|
-
|
45
|
-
Rake::TestTask.new('volume') do |t|
|
46
|
-
t.warning = true
|
47
|
-
t.verbose = true
|
48
|
-
t.test_files = FileList['test/tc_volume.rb']
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
task :default => 'test:all'
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
5
|
+
CLEAN.include("**/*.gem", "**/*.rbc")
|
6
|
+
|
7
|
+
namespace 'gem' do
|
8
|
+
desc 'Build the windows-pr gem'
|
9
|
+
task :create do
|
10
|
+
spec = eval(IO.read('windows-pr.gemspec'))
|
11
|
+
Gem::Builder.new(spec).build
|
12
|
+
end
|
13
|
+
|
14
|
+
desc 'Install the windows-pr gem'
|
15
|
+
task :install => [:create] do
|
16
|
+
file = Dir["*.gem"].first
|
17
|
+
sh "gem install #{file}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
namespace 'test' do
|
22
|
+
Rake::TestTask.new('all') do |t|
|
23
|
+
t.warning = true
|
24
|
+
t.test_files = FileList['test/tc*']
|
25
|
+
end
|
26
|
+
|
27
|
+
# Dynamically generate individual test tasks.
|
28
|
+
Dir['test/*.rb'].each{ |file|
|
29
|
+
name = File.basename(file.split('tc_').last, '.rb')
|
30
|
+
Rake::TestTask.new(name) do |t|
|
31
|
+
t.warning = true
|
32
|
+
t.test_files = FileList[file]
|
33
|
+
end
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
task :default => 'test:all'
|