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.
- checksums.yaml +7 -0
- data/CHANGES +444 -438
- data/MANIFEST +68 -65
- data/README +154 -153
- data/Rakefile +42 -37
- data/doc/conversion_guide.txt +37 -37
- data/lib/windows/clipboard.rb +61 -61
- data/lib/windows/com.rb +192 -192
- data/lib/windows/com/accessibility.rb +16 -16
- data/lib/windows/com/automation.rb +149 -149
- data/lib/windows/com/variant.rb +24 -24
- data/lib/windows/console.rb +114 -114
- data/lib/windows/debug.rb +35 -35
- data/lib/windows/device_io.rb +248 -248
- data/lib/windows/directory.rb +27 -27
- data/lib/windows/error.rb +504 -498
- data/lib/windows/eventlog.rb +80 -80
- data/lib/windows/file.rb +264 -264
- data/lib/windows/file_mapping.rb +25 -25
- data/lib/windows/filesystem.rb +15 -15
- data/lib/windows/gdi/bitmap.rb +65 -65
- data/lib/windows/gdi/device_context.rb +46 -46
- data/lib/windows/gdi/metafile.rb +40 -40
- data/lib/windows/gdi/painting_drawing.rb +115 -115
- data/lib/windows/handle.rb +23 -23
- data/lib/windows/library.rb +44 -44
- data/lib/windows/limits.rb +34 -34
- data/lib/windows/mailslot.rb +24 -24
- data/lib/windows/memory.rb +128 -128
- data/lib/windows/msvcrt/buffer.rb +75 -75
- data/lib/windows/msvcrt/directory.rb +31 -31
- data/lib/windows/msvcrt/file.rb +47 -47
- data/lib/windows/msvcrt/io.rb +73 -73
- data/lib/windows/msvcrt/string.rb +182 -182
- data/lib/windows/msvcrt/time.rb +169 -169
- data/lib/windows/national.rb +580 -580
- data/lib/windows/network/management.rb +525 -525
- data/lib/windows/network/snmp.rb +92 -92
- data/lib/windows/network/winsock.rb +128 -128
- data/lib/windows/nio.rb +50 -50
- data/lib/windows/ntfs/winternl.rb +117 -117
- data/lib/windows/path.rb +143 -143
- data/lib/windows/pipe.rb +42 -42
- data/lib/windows/process.rb +176 -176
- data/lib/windows/registry.rb +171 -171
- data/lib/windows/security.rb +479 -479
- data/lib/windows/security/authentication.rb +32 -32
- data/lib/windows/security/sspi.rb +153 -0
- data/lib/windows/service.rb +142 -142
- data/lib/windows/shell.rb +171 -171
- data/lib/windows/socket.rb +86 -86
- data/lib/windows/sound.rb +39 -39
- data/lib/windows/synchronize.rb +133 -133
- data/lib/windows/system_info.rb +229 -229
- data/lib/windows/thread.rb +64 -64
- data/lib/windows/time.rb +48 -48
- data/lib/windows/tool_helper.rb +36 -36
- data/lib/windows/unicode.rb +155 -155
- data/lib/windows/volume.rb +61 -61
- data/lib/windows/window.rb +81 -81
- data/lib/windows/window/classes.rb +59 -59
- data/lib/windows/window/dialog.rb +91 -91
- data/lib/windows/window/menu.rb +102 -102
- data/lib/windows/window/message.rb +297 -297
- data/lib/windows/window/properties.rb +20 -20
- data/lib/windows/window/timer.rb +19 -19
- data/lib/windows/wsa.rb +102 -102
- 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 -38
- 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 +63 -63
- data/test/tc_msvcrt_directory.rb +96 -96
- data/test/tc_msvcrt_file.rb +80 -80
- data/test/tc_msvcrt_io.rb +48 -48
- data/test/tc_msvcrt_string.rb +94 -94
- data/test/tc_msvcrt_time.rb +19 -19
- 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 +48 -48
- 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_security_sspi.rb +23 -0
- data/test/tc_service.rb +57 -57
- data/test/tc_shell.rb +34 -34
- data/test/tc_socket.rb +20 -20
- data/test/tc_sound.rb +37 -37
- data/test/tc_synchronize.rb +75 -75
- data/test/tc_system_info.rb +33 -33
- 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 +83 -83
- 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 -19
- data/windows-pr.gemspec +33 -34
- metadata +31 -32
@@ -1,117 +1,117 @@
|
|
1
|
-
require 'windows/api'
|
2
|
-
|
3
|
-
# This library exposes functions from ntdll, which are typically undocumented.
|
4
|
-
# The name is derived from winternl.h which contains only function prototypes.
|
5
|
-
|
6
|
-
module Windows
|
7
|
-
module NTFS
|
8
|
-
module Winternl
|
9
|
-
API.auto_namespace = 'Windows::NTFS::Winternl'
|
10
|
-
API.auto_constant = true
|
11
|
-
API.auto_method = true
|
12
|
-
API.auto_unicode = false
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
FileAccessInformation = 8
|
17
|
-
FileAlignmentInformation = 17
|
18
|
-
FileAllInformation = 18
|
19
|
-
FileAllocationInformation = 19
|
20
|
-
FileAlternateNameInformation = 21
|
21
|
-
FileAttributeTagInformation = 35
|
22
|
-
FileBasicInformation = 4
|
23
|
-
FileBothDirectoryInformation = 3
|
24
|
-
FileCompletionInformation = 30
|
25
|
-
FileCompressionInformation = 28
|
26
|
-
FileDirectoryInformation = 1
|
27
|
-
FileDispositionInformation = 13
|
28
|
-
FileEaInformation = 7
|
29
|
-
FileEndOfFileInformation = 20
|
30
|
-
FileFullDirectoryInformation = 2
|
31
|
-
FileFullEaInformation = 15
|
32
|
-
FileHardLinkInformation = 46
|
33
|
-
FileIdBothDirectoryInformation = 37
|
34
|
-
FileIdFullDirectoryInformation = 38
|
35
|
-
FileInternalInformation = 6
|
36
|
-
FileLinkInformation = 11
|
37
|
-
FileMailslotQueryInformation = 26
|
38
|
-
FileMailslotSetInformation = 27
|
39
|
-
FileModeInformation = 16
|
40
|
-
FileMoveClusterInformation = 31
|
41
|
-
FileNameInformation = 9
|
42
|
-
FileNamesInformation = 12
|
43
|
-
FileNetworkOpenInformation = 34
|
44
|
-
FileObjectIdInformation = 29
|
45
|
-
FilePipeInformation = 23
|
46
|
-
FilePipeLocalInformation = 24
|
47
|
-
FilePipeRemoteInformation = 25
|
48
|
-
FilePositionInformation = 14
|
49
|
-
FileQuotaInformation = 32
|
50
|
-
FileRenameInformation = 10
|
51
|
-
FileReparsePointInformation = 33
|
52
|
-
FileShortNameInformation = 40
|
53
|
-
FileStandardInformation = 5
|
54
|
-
FileStreamInformation = 22
|
55
|
-
FileTrackingInformation = 36
|
56
|
-
FileValidDataLengthInformation = 39
|
57
|
-
|
58
|
-
ObjectNameInformation = 1
|
59
|
-
|
60
|
-
STATUS_SUCCESS = 0
|
61
|
-
|
62
|
-
API.new('NtQueryInformationFile', 'LPPLL', 'L', 'ntdll')
|
63
|
-
API.new('NtQueryObject', 'LLPLP', 'L', 'ntdll')
|
64
|
-
API.new('NtQuerySystemInformation', 'LPLP', 'L', 'ntdll')
|
65
|
-
API.new('RtlAdjustPrivilege', 'LIIP', 'L', 'ntdll')
|
66
|
-
|
67
|
-
begin
|
68
|
-
API.new('RtlSetProcessIsCritical', 'IPI', 'L', 'ntdll')
|
69
|
-
rescue Win32::API::LoadLibraryError
|
70
|
-
# XP or later
|
71
|
-
end
|
72
|
-
|
73
|
-
# Should work for Windows XP/2000
|
74
|
-
unless defined? GetFinalPathNameByHandle
|
75
|
-
begin
|
76
|
-
API.new('GetFinalPathNameByHandle', 'LPLL', 'L')
|
77
|
-
rescue Win32::API::LoadLibraryError
|
78
|
-
require 'windows/error'
|
79
|
-
require 'windows/unicode'
|
80
|
-
require 'windows/volume'
|
81
|
-
|
82
|
-
include Windows::Error
|
83
|
-
include Windows::Unicode
|
84
|
-
include Windows::Volume
|
85
|
-
|
86
|
-
# Simulates the GetFinalPathNameByHandle method. Note that the +size+
|
87
|
-
# and +flags+ arguments are ignored, but are required for interface
|
88
|
-
# compatibility. The buffer is an in/out parameter.
|
89
|
-
#
|
90
|
-
# The +size+ argument simply isn't used internally and the +flags+
|
91
|
-
# argument is currently assumed to always be VOLUME_NAME_NT.
|
92
|
-
#
|
93
|
-
def GetFinalPathNameByHandle(handle, buffer, size, flags)
|
94
|
-
mpath = 1024
|
95
|
-
|
96
|
-
object_name_information = 0.chr * (8 + (mpath * 2))
|
97
|
-
|
98
|
-
status = NtQueryObject(
|
99
|
-
handle,
|
100
|
-
ObjectNameInformation,
|
101
|
-
object_name_information,
|
102
|
-
object_name_information.size,
|
103
|
-
0
|
104
|
-
)
|
105
|
-
|
106
|
-
if status > 0
|
107
|
-
raise 'NtQueryObject function failed: ' + get_last_error
|
108
|
-
end
|
109
|
-
|
110
|
-
buffer.replace(wide_to_multi(object_name_information[8..-1]))
|
111
|
-
buffer.size
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
1
|
+
require 'windows/api'
|
2
|
+
|
3
|
+
# This library exposes functions from ntdll, which are typically undocumented.
|
4
|
+
# The name is derived from winternl.h which contains only function prototypes.
|
5
|
+
|
6
|
+
module Windows
|
7
|
+
module NTFS
|
8
|
+
module Winternl
|
9
|
+
API.auto_namespace = 'Windows::NTFS::Winternl'
|
10
|
+
API.auto_constant = true
|
11
|
+
API.auto_method = true
|
12
|
+
API.auto_unicode = false
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
FileAccessInformation = 8
|
17
|
+
FileAlignmentInformation = 17
|
18
|
+
FileAllInformation = 18
|
19
|
+
FileAllocationInformation = 19
|
20
|
+
FileAlternateNameInformation = 21
|
21
|
+
FileAttributeTagInformation = 35
|
22
|
+
FileBasicInformation = 4
|
23
|
+
FileBothDirectoryInformation = 3
|
24
|
+
FileCompletionInformation = 30
|
25
|
+
FileCompressionInformation = 28
|
26
|
+
FileDirectoryInformation = 1
|
27
|
+
FileDispositionInformation = 13
|
28
|
+
FileEaInformation = 7
|
29
|
+
FileEndOfFileInformation = 20
|
30
|
+
FileFullDirectoryInformation = 2
|
31
|
+
FileFullEaInformation = 15
|
32
|
+
FileHardLinkInformation = 46
|
33
|
+
FileIdBothDirectoryInformation = 37
|
34
|
+
FileIdFullDirectoryInformation = 38
|
35
|
+
FileInternalInformation = 6
|
36
|
+
FileLinkInformation = 11
|
37
|
+
FileMailslotQueryInformation = 26
|
38
|
+
FileMailslotSetInformation = 27
|
39
|
+
FileModeInformation = 16
|
40
|
+
FileMoveClusterInformation = 31
|
41
|
+
FileNameInformation = 9
|
42
|
+
FileNamesInformation = 12
|
43
|
+
FileNetworkOpenInformation = 34
|
44
|
+
FileObjectIdInformation = 29
|
45
|
+
FilePipeInformation = 23
|
46
|
+
FilePipeLocalInformation = 24
|
47
|
+
FilePipeRemoteInformation = 25
|
48
|
+
FilePositionInformation = 14
|
49
|
+
FileQuotaInformation = 32
|
50
|
+
FileRenameInformation = 10
|
51
|
+
FileReparsePointInformation = 33
|
52
|
+
FileShortNameInformation = 40
|
53
|
+
FileStandardInformation = 5
|
54
|
+
FileStreamInformation = 22
|
55
|
+
FileTrackingInformation = 36
|
56
|
+
FileValidDataLengthInformation = 39
|
57
|
+
|
58
|
+
ObjectNameInformation = 1
|
59
|
+
|
60
|
+
STATUS_SUCCESS = 0
|
61
|
+
|
62
|
+
API.new('NtQueryInformationFile', 'LPPLL', 'L', 'ntdll')
|
63
|
+
API.new('NtQueryObject', 'LLPLP', 'L', 'ntdll')
|
64
|
+
API.new('NtQuerySystemInformation', 'LPLP', 'L', 'ntdll')
|
65
|
+
API.new('RtlAdjustPrivilege', 'LIIP', 'L', 'ntdll')
|
66
|
+
|
67
|
+
begin
|
68
|
+
API.new('RtlSetProcessIsCritical', 'IPI', 'L', 'ntdll')
|
69
|
+
rescue Win32::API::LoadLibraryError
|
70
|
+
# XP or later
|
71
|
+
end
|
72
|
+
|
73
|
+
# Should work for Windows XP/2000
|
74
|
+
unless defined? GetFinalPathNameByHandle
|
75
|
+
begin
|
76
|
+
API.new('GetFinalPathNameByHandle', 'LPLL', 'L')
|
77
|
+
rescue Win32::API::LoadLibraryError
|
78
|
+
require 'windows/error'
|
79
|
+
require 'windows/unicode'
|
80
|
+
require 'windows/volume'
|
81
|
+
|
82
|
+
include Windows::Error
|
83
|
+
include Windows::Unicode
|
84
|
+
include Windows::Volume
|
85
|
+
|
86
|
+
# Simulates the GetFinalPathNameByHandle method. Note that the +size+
|
87
|
+
# and +flags+ arguments are ignored, but are required for interface
|
88
|
+
# compatibility. The buffer is an in/out parameter.
|
89
|
+
#
|
90
|
+
# The +size+ argument simply isn't used internally and the +flags+
|
91
|
+
# argument is currently assumed to always be VOLUME_NAME_NT.
|
92
|
+
#
|
93
|
+
def GetFinalPathNameByHandle(handle, buffer, size, flags)
|
94
|
+
mpath = 1024
|
95
|
+
|
96
|
+
object_name_information = 0.chr * (8 + (mpath * 2))
|
97
|
+
|
98
|
+
status = NtQueryObject(
|
99
|
+
handle,
|
100
|
+
ObjectNameInformation,
|
101
|
+
object_name_information,
|
102
|
+
object_name_information.size,
|
103
|
+
0
|
104
|
+
)
|
105
|
+
|
106
|
+
if status > 0
|
107
|
+
raise 'NtQueryObject function failed: ' + get_last_error
|
108
|
+
end
|
109
|
+
|
110
|
+
buffer.replace(wide_to_multi(object_name_information[8..-1]))
|
111
|
+
buffer.size
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
data/lib/windows/path.rb
CHANGED
@@ -1,143 +1,143 @@
|
|
1
|
-
require 'windows/api'
|
2
|
-
|
3
|
-
module Windows
|
4
|
-
module Path
|
5
|
-
API.auto_namespace = 'Windows::Path'
|
6
|
-
API.auto_constant = true
|
7
|
-
API.auto_method = true
|
8
|
-
API.auto_unicode = true
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
# These constants are for use by the PathGetCharType() function.
|
13
|
-
|
14
|
-
GCT_INVALID = 0x0000 # Character is not valid in a path.
|
15
|
-
GCT_LFNCHAR = 0x0001 # Character is valid in a long file name.
|
16
|
-
GCT_SHORTCHAR = 0x0002 # Character is valid in a short (8.3) file name.
|
17
|
-
GCT_WILD = 0x0004 # Character is a wildcard character.
|
18
|
-
GCT_SEPARATOR = 0x0008 # Character is a path separator.
|
19
|
-
|
20
|
-
URL_UNESCAPE = 0x10000000
|
21
|
-
URL_ESCAPE_UNSAFE = 0x20000000
|
22
|
-
URL_PLUGGABLE_PROTOCOL = 0x40000000
|
23
|
-
URL_WININET_COMPATIBILITY = 0x80000000
|
24
|
-
URL_DONT_ESCAPE_EXTRA_INFO = 0x02000000
|
25
|
-
URL_DONT_UNESCAPE_EXTRA_INFO = URL_DONT_ESCAPE_EXTRA_INFO
|
26
|
-
URL_BROWSER_MODE = URL_DONT_ESCAPE_EXTRA_INFO
|
27
|
-
URL_ESCAPE_SPACES_ONLY = 0x04000000
|
28
|
-
URL_DONT_SIMPLIFY = 0x08000000
|
29
|
-
URL_NO_META = URL_DONT_SIMPLIFY
|
30
|
-
URL_UNESCAPE_INPLACE = 0x00100000
|
31
|
-
URL_CONVERT_IF_DOSPATH = 0x00200000
|
32
|
-
URL_UNESCAPE_HIGH_ANSI_ONLY = 0x00400000
|
33
|
-
URL_INTERNAL_PATH = 0x00800000
|
34
|
-
URL_FILE_USE_PATHURL = 0x00010000
|
35
|
-
URL_DONT_UNESCAPE = 0x00020000
|
36
|
-
URL_ESCAPE_PERCENT = 0x00001000
|
37
|
-
URL_ESCAPE_SEGMENT_ONLY = 0x00002000
|
38
|
-
URL_PARTFLAG_KEEPSCHEME = 0x00000001
|
39
|
-
URL_APPLY_DEFAULT = 0x00000001
|
40
|
-
URL_APPLY_GUESSSCHEME = 0x00000002
|
41
|
-
URL_APPLY_GUESSFILE = 0x00000004
|
42
|
-
URL_APPLY_FORCEAPPLY = 0x00000008
|
43
|
-
|
44
|
-
# URLIS enum
|
45
|
-
|
46
|
-
URLIS_URL = 1
|
47
|
-
URLIS_OPAQUE = 2
|
48
|
-
URLIS_NOHISTORY = 3
|
49
|
-
URLIS_FILEURL = 4
|
50
|
-
URLIS_APPLIABLE = 5
|
51
|
-
URLIS_DIRECTORY = 6
|
52
|
-
URLIS_HASQUERY = 7
|
53
|
-
|
54
|
-
API.new('PathAddBackslash', 'P', 'P', 'shlwapi')
|
55
|
-
API.new('PathAddExtension', 'PS', 'B', 'shlwapi')
|
56
|
-
API.new('PathAppend', 'PS', 'B', 'shlwapi')
|
57
|
-
API.new('PathBuildRoot', 'PI', 'P', 'shlwapi')
|
58
|
-
API.new('PathCanonicalize', 'PS', 'B', 'shlwapi')
|
59
|
-
API.new('PathCombine', 'PSS', 'P', 'shlwapi')
|
60
|
-
API.new('PathCommonPrefix', 'SSP', 'I', 'shlwapi')
|
61
|
-
API.new('PathCompactPath', 'PPI', 'B', 'shlwapi')
|
62
|
-
API.new('PathCompactPathEx', 'PPIL', 'B', 'shlwapi')
|
63
|
-
API.new('PathCreateFromUrl', 'SPPL', 'L', 'shlwapi')
|
64
|
-
API.new('PathFileExists', 'S', 'B', 'shlwapi')
|
65
|
-
API.new('PathFindExtension', 'S', 'P', 'shlwapi')
|
66
|
-
API.new('PathFindFileName', 'S', 'P', 'shlwapi')
|
67
|
-
API.new('PathFindNextComponent', 'S', 'P', 'shlwapi')
|
68
|
-
API.new('PathFindOnPath', 'PS', 'B', 'shlwapi')
|
69
|
-
API.new('PathFindSuffixArray', 'SSI', 'P', 'shlwapi')
|
70
|
-
API.new('PathGetArgs', 'S', 'P', 'shlwapi')
|
71
|
-
API.new('PathGetCharType', 'P', 'I', 'shlwapi')
|
72
|
-
API.new('PathGetDriveNumber', 'S', 'I', 'shlwapi')
|
73
|
-
API.new('PathIsContentType', 'SS', 'B', 'shlwapi')
|
74
|
-
API.new('PathIsDirectory', 'S', 'B', 'shlwapi')
|
75
|
-
API.new('PathIsDirectoryEmpty', 'S', 'B', 'shlwapi')
|
76
|
-
API.new('PathIsFileSpec', 'S', 'B', 'shlwapi')
|
77
|
-
API.new('PathIsLFNFileSpec', 'S', 'B', 'shlwapi')
|
78
|
-
API.new('PathIsNetworkPath', 'S', 'B', 'shlwapi')
|
79
|
-
API.new('PathIsPrefix', 'SS', 'B', 'shlwapi')
|
80
|
-
API.new('PathIsRelative', 'S', 'B', 'shlwapi')
|
81
|
-
API.new('PathIsRoot', 'S', 'B', 'shlwapi')
|
82
|
-
API.new('PathIsSameRoot', 'SS', 'B', 'shlwapi')
|
83
|
-
API.new('PathIsSystemFolder', 'SL', 'B', 'shlwapi')
|
84
|
-
API.new('PathIsUNC', 'S', 'B', 'shlwapi')
|
85
|
-
API.new('PathIsUNCServer', 'S', 'B', 'shlwapi')
|
86
|
-
API.new('PathIsUNCServerShare', 'S', 'B', 'shlwapi')
|
87
|
-
API.new('PathIsURL', 'S', 'B', 'shlwapi')
|
88
|
-
API.new('PathMakePretty', 'P', 'B', 'shlwapi')
|
89
|
-
API.new('PathMakeSystemFolder', 'S', 'B', 'shlwapi')
|
90
|
-
API.new('PathMatchSpec', 'SS', 'B', 'shlwapi')
|
91
|
-
API.new('PathParseIconLocation', 'P', 'I', 'shlwapi')
|
92
|
-
API.new('PathQuoteSpaces', 'P', 'V', 'shlwapi')
|
93
|
-
API.new('PathRelativePathTo', 'PPLPL', 'B', 'shlwapi')
|
94
|
-
API.new('PathRemoveArgs', 'P', 'V', 'shlwapi')
|
95
|
-
API.new('PathRemoveBackslash', 'P', 'P', 'shlwapi')
|
96
|
-
API.new('PathRemoveBlanks', 'P', 'V', 'shlwapi')
|
97
|
-
API.new('PathRemoveExtension', 'P','V', 'shlwapi')
|
98
|
-
API.new('PathRemoveFileSpec', 'P', 'B', 'shlwapi')
|
99
|
-
API.new('PathRenameExtension', 'PS', 'B', 'shlwapi')
|
100
|
-
API.new('PathSearchAndQualify', 'SPI', 'B', 'shlwapi')
|
101
|
-
API.new('PathSetDlgItemPath', 'LIS', 'V', 'shlwapi')
|
102
|
-
API.new('PathSkipRoot', 'S', 'P', 'shlwapi')
|
103
|
-
API.new('PathStripPath', 'P', 'V', 'shlwapi')
|
104
|
-
API.new('PathStripToRoot', 'P', 'B', 'shlwapi')
|
105
|
-
API.new('PathUndecorate', 'P', 'V', 'shlwapi')
|
106
|
-
API.new('PathUnExpandEnvStrings', 'SPI', 'B', 'shlwapi')
|
107
|
-
API.new('PathUnmakeSystemFolder', 'S', 'B', 'shlwapi')
|
108
|
-
API.new('PathUnquoteSpaces', 'P', 'V', 'shlwapi')
|
109
|
-
|
110
|
-
API.new('UrlApplyScheme', 'SPPL', 'L', 'shlwapi')
|
111
|
-
API.new('UrlCanonicalize', 'SPPL', 'L', 'shlwapi')
|
112
|
-
API.new('UrlCombine', 'SSPPL', 'L', 'shlwapi')
|
113
|
-
API.new('UrlCompare', 'SSI', 'I', 'shlwapi')
|
114
|
-
API.new('UrlCreateFromPath', 'SPPL', 'L', 'shlwapi')
|
115
|
-
API.new('UrlEscape', 'SPPL', 'L', 'shlwapi')
|
116
|
-
API.new('UrlGetLocation', 'S', 'P', 'shlwapi')
|
117
|
-
API.new('UrlGetPart', 'SPPLL', 'L', 'shlwapi')
|
118
|
-
API.new('UrlHash', 'SPL', 'L', 'shlwapi')
|
119
|
-
API.new('UrlIs', 'SL', 'B', 'shlwapi')
|
120
|
-
API.new('UrlIsNoHistory', 'S', 'B', 'shlwapi')
|
121
|
-
API.new('UrlIsOpaque', 'S', 'B', 'shlwapi')
|
122
|
-
API.new('UrlUnescape', 'PPPL', 'L', 'shlwapi')
|
123
|
-
|
124
|
-
# Macros
|
125
|
-
|
126
|
-
def UrlEscapeSpaces(pszUrl, pszEscaped, pcchEscaped)
|
127
|
-
UrlCanonicalize.call(
|
128
|
-
pszUrl,
|
129
|
-
pszEscaped,
|
130
|
-
pcchEscaped,
|
131
|
-
URL_ESCAPE_SPACES_ONLY | URL_DONT_ESCAPE_EXTRA_INFO
|
132
|
-
)
|
133
|
-
end
|
134
|
-
|
135
|
-
def UrlIsFileUrl(pszUrl)
|
136
|
-
UrlIsA.call(pszUrl, URLIS_FILEURL)
|
137
|
-
end
|
138
|
-
|
139
|
-
def UrlUnescapeInPlace(pszUrl, dwFlags)
|
140
|
-
UrlUnescape.call(pszUrl, nil, nil, dwFlags | URL_UNESCAPE_INPLACE)
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
1
|
+
require 'windows/api'
|
2
|
+
|
3
|
+
module Windows
|
4
|
+
module Path
|
5
|
+
API.auto_namespace = 'Windows::Path'
|
6
|
+
API.auto_constant = true
|
7
|
+
API.auto_method = true
|
8
|
+
API.auto_unicode = true
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
# These constants are for use by the PathGetCharType() function.
|
13
|
+
|
14
|
+
GCT_INVALID = 0x0000 # Character is not valid in a path.
|
15
|
+
GCT_LFNCHAR = 0x0001 # Character is valid in a long file name.
|
16
|
+
GCT_SHORTCHAR = 0x0002 # Character is valid in a short (8.3) file name.
|
17
|
+
GCT_WILD = 0x0004 # Character is a wildcard character.
|
18
|
+
GCT_SEPARATOR = 0x0008 # Character is a path separator.
|
19
|
+
|
20
|
+
URL_UNESCAPE = 0x10000000
|
21
|
+
URL_ESCAPE_UNSAFE = 0x20000000
|
22
|
+
URL_PLUGGABLE_PROTOCOL = 0x40000000
|
23
|
+
URL_WININET_COMPATIBILITY = 0x80000000
|
24
|
+
URL_DONT_ESCAPE_EXTRA_INFO = 0x02000000
|
25
|
+
URL_DONT_UNESCAPE_EXTRA_INFO = URL_DONT_ESCAPE_EXTRA_INFO
|
26
|
+
URL_BROWSER_MODE = URL_DONT_ESCAPE_EXTRA_INFO
|
27
|
+
URL_ESCAPE_SPACES_ONLY = 0x04000000
|
28
|
+
URL_DONT_SIMPLIFY = 0x08000000
|
29
|
+
URL_NO_META = URL_DONT_SIMPLIFY
|
30
|
+
URL_UNESCAPE_INPLACE = 0x00100000
|
31
|
+
URL_CONVERT_IF_DOSPATH = 0x00200000
|
32
|
+
URL_UNESCAPE_HIGH_ANSI_ONLY = 0x00400000
|
33
|
+
URL_INTERNAL_PATH = 0x00800000
|
34
|
+
URL_FILE_USE_PATHURL = 0x00010000
|
35
|
+
URL_DONT_UNESCAPE = 0x00020000
|
36
|
+
URL_ESCAPE_PERCENT = 0x00001000
|
37
|
+
URL_ESCAPE_SEGMENT_ONLY = 0x00002000
|
38
|
+
URL_PARTFLAG_KEEPSCHEME = 0x00000001
|
39
|
+
URL_APPLY_DEFAULT = 0x00000001
|
40
|
+
URL_APPLY_GUESSSCHEME = 0x00000002
|
41
|
+
URL_APPLY_GUESSFILE = 0x00000004
|
42
|
+
URL_APPLY_FORCEAPPLY = 0x00000008
|
43
|
+
|
44
|
+
# URLIS enum
|
45
|
+
|
46
|
+
URLIS_URL = 1
|
47
|
+
URLIS_OPAQUE = 2
|
48
|
+
URLIS_NOHISTORY = 3
|
49
|
+
URLIS_FILEURL = 4
|
50
|
+
URLIS_APPLIABLE = 5
|
51
|
+
URLIS_DIRECTORY = 6
|
52
|
+
URLIS_HASQUERY = 7
|
53
|
+
|
54
|
+
API.new('PathAddBackslash', 'P', 'P', 'shlwapi')
|
55
|
+
API.new('PathAddExtension', 'PS', 'B', 'shlwapi')
|
56
|
+
API.new('PathAppend', 'PS', 'B', 'shlwapi')
|
57
|
+
API.new('PathBuildRoot', 'PI', 'P', 'shlwapi')
|
58
|
+
API.new('PathCanonicalize', 'PS', 'B', 'shlwapi')
|
59
|
+
API.new('PathCombine', 'PSS', 'P', 'shlwapi')
|
60
|
+
API.new('PathCommonPrefix', 'SSP', 'I', 'shlwapi')
|
61
|
+
API.new('PathCompactPath', 'PPI', 'B', 'shlwapi')
|
62
|
+
API.new('PathCompactPathEx', 'PPIL', 'B', 'shlwapi')
|
63
|
+
API.new('PathCreateFromUrl', 'SPPL', 'L', 'shlwapi')
|
64
|
+
API.new('PathFileExists', 'S', 'B', 'shlwapi')
|
65
|
+
API.new('PathFindExtension', 'S', 'P', 'shlwapi')
|
66
|
+
API.new('PathFindFileName', 'S', 'P', 'shlwapi')
|
67
|
+
API.new('PathFindNextComponent', 'S', 'P', 'shlwapi')
|
68
|
+
API.new('PathFindOnPath', 'PS', 'B', 'shlwapi')
|
69
|
+
API.new('PathFindSuffixArray', 'SSI', 'P', 'shlwapi')
|
70
|
+
API.new('PathGetArgs', 'S', 'P', 'shlwapi')
|
71
|
+
API.new('PathGetCharType', 'P', 'I', 'shlwapi')
|
72
|
+
API.new('PathGetDriveNumber', 'S', 'I', 'shlwapi')
|
73
|
+
API.new('PathIsContentType', 'SS', 'B', 'shlwapi')
|
74
|
+
API.new('PathIsDirectory', 'S', 'B', 'shlwapi')
|
75
|
+
API.new('PathIsDirectoryEmpty', 'S', 'B', 'shlwapi')
|
76
|
+
API.new('PathIsFileSpec', 'S', 'B', 'shlwapi')
|
77
|
+
API.new('PathIsLFNFileSpec', 'S', 'B', 'shlwapi')
|
78
|
+
API.new('PathIsNetworkPath', 'S', 'B', 'shlwapi')
|
79
|
+
API.new('PathIsPrefix', 'SS', 'B', 'shlwapi')
|
80
|
+
API.new('PathIsRelative', 'S', 'B', 'shlwapi')
|
81
|
+
API.new('PathIsRoot', 'S', 'B', 'shlwapi')
|
82
|
+
API.new('PathIsSameRoot', 'SS', 'B', 'shlwapi')
|
83
|
+
API.new('PathIsSystemFolder', 'SL', 'B', 'shlwapi')
|
84
|
+
API.new('PathIsUNC', 'S', 'B', 'shlwapi')
|
85
|
+
API.new('PathIsUNCServer', 'S', 'B', 'shlwapi')
|
86
|
+
API.new('PathIsUNCServerShare', 'S', 'B', 'shlwapi')
|
87
|
+
API.new('PathIsURL', 'S', 'B', 'shlwapi')
|
88
|
+
API.new('PathMakePretty', 'P', 'B', 'shlwapi')
|
89
|
+
API.new('PathMakeSystemFolder', 'S', 'B', 'shlwapi')
|
90
|
+
API.new('PathMatchSpec', 'SS', 'B', 'shlwapi')
|
91
|
+
API.new('PathParseIconLocation', 'P', 'I', 'shlwapi')
|
92
|
+
API.new('PathQuoteSpaces', 'P', 'V', 'shlwapi')
|
93
|
+
API.new('PathRelativePathTo', 'PPLPL', 'B', 'shlwapi')
|
94
|
+
API.new('PathRemoveArgs', 'P', 'V', 'shlwapi')
|
95
|
+
API.new('PathRemoveBackslash', 'P', 'P', 'shlwapi')
|
96
|
+
API.new('PathRemoveBlanks', 'P', 'V', 'shlwapi')
|
97
|
+
API.new('PathRemoveExtension', 'P','V', 'shlwapi')
|
98
|
+
API.new('PathRemoveFileSpec', 'P', 'B', 'shlwapi')
|
99
|
+
API.new('PathRenameExtension', 'PS', 'B', 'shlwapi')
|
100
|
+
API.new('PathSearchAndQualify', 'SPI', 'B', 'shlwapi')
|
101
|
+
API.new('PathSetDlgItemPath', 'LIS', 'V', 'shlwapi')
|
102
|
+
API.new('PathSkipRoot', 'S', 'P', 'shlwapi')
|
103
|
+
API.new('PathStripPath', 'P', 'V', 'shlwapi')
|
104
|
+
API.new('PathStripToRoot', 'P', 'B', 'shlwapi')
|
105
|
+
API.new('PathUndecorate', 'P', 'V', 'shlwapi')
|
106
|
+
API.new('PathUnExpandEnvStrings', 'SPI', 'B', 'shlwapi')
|
107
|
+
API.new('PathUnmakeSystemFolder', 'S', 'B', 'shlwapi')
|
108
|
+
API.new('PathUnquoteSpaces', 'P', 'V', 'shlwapi')
|
109
|
+
|
110
|
+
API.new('UrlApplyScheme', 'SPPL', 'L', 'shlwapi')
|
111
|
+
API.new('UrlCanonicalize', 'SPPL', 'L', 'shlwapi')
|
112
|
+
API.new('UrlCombine', 'SSPPL', 'L', 'shlwapi')
|
113
|
+
API.new('UrlCompare', 'SSI', 'I', 'shlwapi')
|
114
|
+
API.new('UrlCreateFromPath', 'SPPL', 'L', 'shlwapi')
|
115
|
+
API.new('UrlEscape', 'SPPL', 'L', 'shlwapi')
|
116
|
+
API.new('UrlGetLocation', 'S', 'P', 'shlwapi')
|
117
|
+
API.new('UrlGetPart', 'SPPLL', 'L', 'shlwapi')
|
118
|
+
API.new('UrlHash', 'SPL', 'L', 'shlwapi')
|
119
|
+
API.new('UrlIs', 'SL', 'B', 'shlwapi')
|
120
|
+
API.new('UrlIsNoHistory', 'S', 'B', 'shlwapi')
|
121
|
+
API.new('UrlIsOpaque', 'S', 'B', 'shlwapi')
|
122
|
+
API.new('UrlUnescape', 'PPPL', 'L', 'shlwapi')
|
123
|
+
|
124
|
+
# Macros
|
125
|
+
|
126
|
+
def UrlEscapeSpaces(pszUrl, pszEscaped, pcchEscaped)
|
127
|
+
UrlCanonicalize.call(
|
128
|
+
pszUrl,
|
129
|
+
pszEscaped,
|
130
|
+
pcchEscaped,
|
131
|
+
URL_ESCAPE_SPACES_ONLY | URL_DONT_ESCAPE_EXTRA_INFO
|
132
|
+
)
|
133
|
+
end
|
134
|
+
|
135
|
+
def UrlIsFileUrl(pszUrl)
|
136
|
+
UrlIsA.call(pszUrl, URLIS_FILEURL)
|
137
|
+
end
|
138
|
+
|
139
|
+
def UrlUnescapeInPlace(pszUrl, dwFlags)
|
140
|
+
UrlUnescape.call(pszUrl, nil, nil, dwFlags | URL_UNESCAPE_INPLACE)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|