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.
Files changed (115) hide show
  1. data/CHANGES +408 -404
  2. data/MANIFEST +65 -65
  3. data/README +149 -149
  4. data/Rakefile +52 -52
  5. data/doc/conversion_guide.txt +37 -37
  6. data/lib/windows/clipboard.rb +59 -59
  7. data/lib/windows/com.rb +190 -189
  8. data/lib/windows/com/automation.rb +147 -147
  9. data/lib/windows/com/variant.rb +22 -22
  10. data/lib/windows/console.rb +112 -112
  11. data/lib/windows/debug.rb +33 -33
  12. data/lib/windows/device_io.rb +246 -246
  13. data/lib/windows/directory.rb +25 -25
  14. data/lib/windows/error.rb +482 -482
  15. data/lib/windows/eventlog.rb +78 -78
  16. data/lib/windows/file.rb +262 -262
  17. data/lib/windows/file_mapping.rb +23 -23
  18. data/lib/windows/filesystem.rb +13 -13
  19. data/lib/windows/gdi/bitmap.rb +63 -63
  20. data/lib/windows/gdi/device_context.rb +44 -44
  21. data/lib/windows/gdi/metafile.rb +38 -38
  22. data/lib/windows/gdi/painting_drawing.rb +113 -113
  23. data/lib/windows/handle.rb +21 -21
  24. data/lib/windows/library.rb +42 -42
  25. data/lib/windows/limits.rb +31 -31
  26. data/lib/windows/mailslot.rb +22 -22
  27. data/lib/windows/memory.rb +126 -126
  28. data/lib/windows/msvcrt/buffer.rb +73 -73
  29. data/lib/windows/msvcrt/directory.rb +29 -29
  30. data/lib/windows/msvcrt/file.rb +45 -45
  31. data/lib/windows/msvcrt/io.rb +71 -71
  32. data/lib/windows/msvcrt/time.rb +167 -167
  33. data/lib/windows/national.rb +578 -578
  34. data/lib/windows/network/management.rb +523 -523
  35. data/lib/windows/network/snmp.rb +90 -90
  36. data/lib/windows/network/winsock.rb +126 -126
  37. data/lib/windows/nio.rb +48 -47
  38. data/lib/windows/ntfs/winternl.rb +96 -96
  39. data/lib/windows/path.rb +141 -141
  40. data/lib/windows/pipe.rb +40 -40
  41. data/lib/windows/process.rb +174 -174
  42. data/lib/windows/registry.rb +126 -126
  43. data/lib/windows/security.rb +477 -477
  44. data/lib/windows/security/authentication.rb +30 -30
  45. data/lib/windows/service.rb +140 -140
  46. data/lib/windows/shell.rb +169 -169
  47. data/lib/windows/sound.rb +37 -37
  48. data/lib/windows/synchronize.rb +131 -131
  49. data/lib/windows/system_info.rb +227 -222
  50. data/lib/windows/thread.rb +62 -62
  51. data/lib/windows/time.rb +46 -46
  52. data/lib/windows/tool_helper.rb +34 -34
  53. data/lib/windows/volume.rb +59 -59
  54. data/lib/windows/window.rb +79 -79
  55. data/lib/windows/window/classes.rb +57 -57
  56. data/lib/windows/window/dialog.rb +89 -89
  57. data/lib/windows/window/menu.rb +100 -100
  58. data/lib/windows/window/message.rb +295 -295
  59. data/lib/windows/window/properties.rb +18 -18
  60. data/lib/windows/window/timer.rb +17 -17
  61. data/test/tc_clipboard.rb +41 -41
  62. data/test/tc_com.rb +32 -32
  63. data/test/tc_com_automation.rb +15 -15
  64. data/test/tc_console.rb +108 -108
  65. data/test/tc_debug.rb +48 -48
  66. data/test/tc_device_io.rb +29 -29
  67. data/test/tc_directory.rb +25 -25
  68. data/test/tc_error.rb +49 -49
  69. data/test/tc_eventlog.rb +58 -58
  70. data/test/tc_file.rb +67 -67
  71. data/test/tc_file_mapping.rb +38 -38
  72. data/test/tc_filesystem.rb +27 -27
  73. data/test/tc_gdi_bitmap.rb +25 -25
  74. data/test/tc_gdi_metafile.rb +23 -23
  75. data/test/tc_handle.rb +36 -36
  76. data/test/tc_library.rb +37 -37
  77. data/test/tc_limits.rb +34 -34
  78. data/test/tc_mailslot.rb +22 -22
  79. data/test/tc_memory.rb +44 -44
  80. data/test/tc_msvcrt_buffer.rb +68 -68
  81. data/test/tc_msvcrt_directory.rb +98 -98
  82. data/test/tc_msvcrt_file.rb +80 -80
  83. data/test/tc_msvcrt_io.rb +48 -48
  84. data/test/tc_msvcrt_string.rb +93 -93
  85. data/test/tc_msvcrt_time.rb +29 -29
  86. data/test/tc_national.rb +38 -38
  87. data/test/tc_network_management.rb +32 -32
  88. data/test/tc_network_snmp.rb +31 -31
  89. data/test/tc_network_winsock.rb +34 -34
  90. data/test/tc_nio.rb +32 -32
  91. data/test/tc_ntfs_winternl.rb +29 -29
  92. data/test/tc_path.rb +90 -90
  93. data/test/tc_pipe.rb +53 -53
  94. data/test/tc_process.rb +24 -24
  95. data/test/tc_registry.rb +29 -29
  96. data/test/tc_security.rb +104 -104
  97. data/test/tc_security_authentication.rb +34 -34
  98. data/test/tc_service.rb +57 -57
  99. data/test/tc_shell.rb +34 -34
  100. data/test/tc_sound.rb +37 -37
  101. data/test/tc_synchronize.rb +75 -75
  102. data/test/tc_system_info.rb +43 -43
  103. data/test/tc_thread.rb +29 -29
  104. data/test/tc_time.rb +32 -32
  105. data/test/tc_tool_helper.rb +29 -29
  106. data/test/tc_volume.rb +47 -47
  107. data/test/tc_window.rb +45 -45
  108. data/test/tc_window_classes.rb +33 -33
  109. data/test/tc_window_dialog.rb +33 -33
  110. data/test/tc_window_menu.rb +29 -29
  111. data/test/tc_window_message.rb +33 -33
  112. data/test/tc_window_properties.rb +29 -29
  113. data/test/tc_window_timer.rb +29 -29
  114. data/windows-pr.gemspec +34 -34
  115. metadata +4 -4
@@ -1,96 +1,96 @@
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
- FileAccessInformation = 8
15
- FileAlignmentInformation = 17
16
- FileAllInformation = 18
17
- FileAllocationInformation = 19
18
- FileAlternateNameInformation = 21
19
- FileAttributeTagInformation = 35
20
- FileBasicInformation = 4
21
- FileBothDirectoryInformation = 3
22
- FileCompletionInformation = 30
23
- FileCompressionInformation = 28
24
- FileDirectoryInformation = 1
25
- FileDispositionInformation = 13
26
- FileEaInformation = 7
27
- FileEndOfFileInformation = 20
28
- FileFullDirectoryInformation = 2
29
- FileFullEaInformation = 15
30
- FileHardLinkInformation = 46
31
- FileIdBothDirectoryInformation = 37
32
- FileIdFullDirectoryInformation = 38
33
- FileInternalInformation = 6
34
- FileLinkInformation = 11
35
- FileMailslotQueryInformation = 26
36
- FileMailslotSetInformation = 27
37
- FileModeInformation = 16
38
- FileMoveClusterInformation = 31
39
- FileNameInformation = 9
40
- FileNamesInformation = 12
41
- FileNetworkOpenInformation = 34
42
- FileObjectIdInformation = 29
43
- FilePipeInformation = 23
44
- FilePipeLocalInformation = 24
45
- FilePipeRemoteInformation = 25
46
- FilePositionInformation = 14
47
- FileQuotaInformation = 32
48
- FileRenameInformation = 10
49
- FileReparsePointInformation = 33
50
- FileShortNameInformation = 40
51
- FileStandardInformation = 5
52
- FileStreamInformation = 22
53
- FileTrackingInformation = 36
54
- FileValidDataLengthInformation = 39
55
-
56
- ObjectNameInformation = 1
57
-
58
- STATUS_SUCCESS = 0
59
-
60
- API.new('NtQueryInformationFile', 'LPPLL', 'L', 'ntdll')
61
- API.new('NtQueryObject', 'LLPLP', 'L', 'ntdll')
62
- API.new('NtQuerySystemInformation', 'LPLP', 'L', 'ntdll')
63
- API.new('RtlAdjustPrivilege', 'LIIP', 'L', 'ntdll')
64
- API.new('RtlSetProcessIsCritical', 'IPI', 'L', 'ntdll')
65
-
66
- # Should work for Windows XP/2000
67
- unless defined? GetFinalPathNameByHandle
68
- require 'windows/handle'
69
- require 'windows/error'
70
- require 'windows/unicode'
71
-
72
- def GetFinalPathNameByHandle(file)
73
- begin
74
- max_path = 256
75
- fh = File.open(file, 'r')
76
- handle = get_osfhandle(fh.fileno)
77
- object_name_information = 0.chr * (8 + (max_path*2))
78
-
79
- status = NtQueryObject(
80
- handle,
81
- ObjectNameInformation,
82
- object_name_information,
83
- object_name_information.size,
84
- 0
85
- )
86
-
87
- name = wide_to_multi(object_name_information[8..-1])
88
- ensure
89
- fh.close
90
- end
91
- name
92
- end
93
- end
94
- end
95
- end
96
- 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
+ FileAccessInformation = 8
15
+ FileAlignmentInformation = 17
16
+ FileAllInformation = 18
17
+ FileAllocationInformation = 19
18
+ FileAlternateNameInformation = 21
19
+ FileAttributeTagInformation = 35
20
+ FileBasicInformation = 4
21
+ FileBothDirectoryInformation = 3
22
+ FileCompletionInformation = 30
23
+ FileCompressionInformation = 28
24
+ FileDirectoryInformation = 1
25
+ FileDispositionInformation = 13
26
+ FileEaInformation = 7
27
+ FileEndOfFileInformation = 20
28
+ FileFullDirectoryInformation = 2
29
+ FileFullEaInformation = 15
30
+ FileHardLinkInformation = 46
31
+ FileIdBothDirectoryInformation = 37
32
+ FileIdFullDirectoryInformation = 38
33
+ FileInternalInformation = 6
34
+ FileLinkInformation = 11
35
+ FileMailslotQueryInformation = 26
36
+ FileMailslotSetInformation = 27
37
+ FileModeInformation = 16
38
+ FileMoveClusterInformation = 31
39
+ FileNameInformation = 9
40
+ FileNamesInformation = 12
41
+ FileNetworkOpenInformation = 34
42
+ FileObjectIdInformation = 29
43
+ FilePipeInformation = 23
44
+ FilePipeLocalInformation = 24
45
+ FilePipeRemoteInformation = 25
46
+ FilePositionInformation = 14
47
+ FileQuotaInformation = 32
48
+ FileRenameInformation = 10
49
+ FileReparsePointInformation = 33
50
+ FileShortNameInformation = 40
51
+ FileStandardInformation = 5
52
+ FileStreamInformation = 22
53
+ FileTrackingInformation = 36
54
+ FileValidDataLengthInformation = 39
55
+
56
+ ObjectNameInformation = 1
57
+
58
+ STATUS_SUCCESS = 0
59
+
60
+ API.new('NtQueryInformationFile', 'LPPLL', 'L', 'ntdll')
61
+ API.new('NtQueryObject', 'LLPLP', 'L', 'ntdll')
62
+ API.new('NtQuerySystemInformation', 'LPLP', 'L', 'ntdll')
63
+ API.new('RtlAdjustPrivilege', 'LIIP', 'L', 'ntdll')
64
+ API.new('RtlSetProcessIsCritical', 'IPI', 'L', 'ntdll')
65
+
66
+ # Should work for Windows XP/2000
67
+ unless defined? GetFinalPathNameByHandle
68
+ require 'windows/handle'
69
+ require 'windows/error'
70
+ require 'windows/unicode'
71
+
72
+ def GetFinalPathNameByHandle(file)
73
+ begin
74
+ max_path = 256
75
+ fh = File.open(file, 'r')
76
+ handle = get_osfhandle(fh.fileno)
77
+ object_name_information = 0.chr * (8 + (max_path*2))
78
+
79
+ status = NtQueryObject(
80
+ handle,
81
+ ObjectNameInformation,
82
+ object_name_information,
83
+ object_name_information.size,
84
+ 0
85
+ )
86
+
87
+ name = wide_to_multi(object_name_information[8..-1])
88
+ ensure
89
+ fh.close
90
+ end
91
+ name
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
data/lib/windows/path.rb CHANGED
@@ -1,141 +1,141 @@
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
- # These constants are for use by the PathGetCharType() function.
11
-
12
- GCT_INVALID = 0x0000 # Character is not valid in a path.
13
- GCT_LFNCHAR = 0x0001 # Character is valid in a long file name.
14
- GCT_SHORTCHAR = 0x0002 # Character is valid in a short (8.3) file name.
15
- GCT_WILD = 0x0004 # Character is a wildcard character.
16
- GCT_SEPARATOR = 0x0008 # Character is a path separator.
17
-
18
- URL_UNESCAPE = 0x10000000
19
- URL_ESCAPE_UNSAFE = 0x20000000
20
- URL_PLUGGABLE_PROTOCOL = 0x40000000
21
- URL_WININET_COMPATIBILITY = 0x80000000
22
- URL_DONT_ESCAPE_EXTRA_INFO = 0x02000000
23
- URL_DONT_UNESCAPE_EXTRA_INFO = URL_DONT_ESCAPE_EXTRA_INFO
24
- URL_BROWSER_MODE = URL_DONT_ESCAPE_EXTRA_INFO
25
- URL_ESCAPE_SPACES_ONLY = 0x04000000
26
- URL_DONT_SIMPLIFY = 0x08000000
27
- URL_NO_META = URL_DONT_SIMPLIFY
28
- URL_UNESCAPE_INPLACE = 0x00100000
29
- URL_CONVERT_IF_DOSPATH = 0x00200000
30
- URL_UNESCAPE_HIGH_ANSI_ONLY = 0x00400000
31
- URL_INTERNAL_PATH = 0x00800000
32
- URL_FILE_USE_PATHURL = 0x00010000
33
- URL_DONT_UNESCAPE = 0x00020000
34
- URL_ESCAPE_PERCENT = 0x00001000
35
- URL_ESCAPE_SEGMENT_ONLY = 0x00002000
36
- URL_PARTFLAG_KEEPSCHEME = 0x00000001
37
- URL_APPLY_DEFAULT = 0x00000001
38
- URL_APPLY_GUESSSCHEME = 0x00000002
39
- URL_APPLY_GUESSFILE = 0x00000004
40
- URL_APPLY_FORCEAPPLY = 0x00000008
41
-
42
- # URLIS enum
43
-
44
- URLIS_URL = 1
45
- URLIS_OPAQUE = 2
46
- URLIS_NOHISTORY = 3
47
- URLIS_FILEURL = 4
48
- URLIS_APPLIABLE = 5
49
- URLIS_DIRECTORY = 6
50
- URLIS_HASQUERY = 7
51
-
52
- API.new('PathAddBackslash', 'P', 'P', 'shlwapi')
53
- API.new('PathAddExtension', 'PS', 'B', 'shlwapi')
54
- API.new('PathAppend', 'PS', 'B', 'shlwapi')
55
- API.new('PathBuildRoot', 'PI', 'P', 'shlwapi')
56
- API.new('PathCanonicalize', 'PS', 'B', 'shlwapi')
57
- API.new('PathCombine', 'PSS', 'P', 'shlwapi')
58
- API.new('PathCommonPrefix', 'SSP', 'I', 'shlwapi')
59
- API.new('PathCompactPath', 'PPI', 'B', 'shlwapi')
60
- API.new('PathCompactPathEx', 'PPIL', 'B', 'shlwapi')
61
- API.new('PathCreateFromUrl', 'SPPL', 'L', 'shlwapi')
62
- API.new('PathFileExists', 'S', 'B', 'shlwapi')
63
- API.new('PathFindExtension', 'S', 'P', 'shlwapi')
64
- API.new('PathFindFileName', 'S', 'P', 'shlwapi')
65
- API.new('PathFindNextComponent', 'S', 'P', 'shlwapi')
66
- API.new('PathFindOnPath', 'PS', 'B', 'shlwapi')
67
- API.new('PathFindSuffixArray', 'SSI', 'P', 'shlwapi')
68
- API.new('PathGetArgs', 'S', 'P', 'shlwapi')
69
- API.new('PathGetCharType', 'P', 'I', 'shlwapi')
70
- API.new('PathGetDriveNumber', 'S', 'I', 'shlwapi')
71
- API.new('PathIsContentType', 'SS', 'B', 'shlwapi')
72
- API.new('PathIsDirectory', 'S', 'B', 'shlwapi')
73
- API.new('PathIsDirectoryEmpty', 'S', 'B', 'shlwapi')
74
- API.new('PathIsFileSpec', 'S', 'B', 'shlwapi')
75
- API.new('PathIsLFNFileSpec', 'S', 'B', 'shlwapi')
76
- API.new('PathIsNetworkPath', 'S', 'B', 'shlwapi')
77
- API.new('PathIsPrefix', 'SS', 'B', 'shlwapi')
78
- API.new('PathIsRelative', 'S', 'B', 'shlwapi')
79
- API.new('PathIsRoot', 'S', 'B', 'shlwapi')
80
- API.new('PathIsSameRoot', 'SS', 'B', 'shlwapi')
81
- API.new('PathIsSystemFolder', 'SL', 'B', 'shlwapi')
82
- API.new('PathIsUNC', 'S', 'B', 'shlwapi')
83
- API.new('PathIsUNCServer', 'S', 'B', 'shlwapi')
84
- API.new('PathIsUNCServerShare', 'S', 'B', 'shlwapi')
85
- API.new('PathIsURL', 'S', 'B', 'shlwapi')
86
- API.new('PathMakePretty', 'P', 'B', 'shlwapi')
87
- API.new('PathMakeSystemFolder', 'S', 'B', 'shlwapi')
88
- API.new('PathMatchSpec', 'SS', 'B', 'shlwapi')
89
- API.new('PathParseIconLocation', 'P', 'I', 'shlwapi')
90
- API.new('PathQuoteSpaces', 'P', 'V', 'shlwapi')
91
- API.new('PathRelativePathTo', 'PPLPL', 'B', 'shlwapi')
92
- API.new('PathRemoveArgs', 'P', 'V', 'shlwapi')
93
- API.new('PathRemoveBackslash', 'P', 'P', 'shlwapi')
94
- API.new('PathRemoveBlanks', 'P', 'V', 'shlwapi')
95
- API.new('PathRemoveExtension', 'P','V', 'shlwapi')
96
- API.new('PathRemoveFileSpec', 'P', 'B', 'shlwapi')
97
- API.new('PathRenameExtension', 'PS', 'B', 'shlwapi')
98
- API.new('PathSearchAndQualify', 'SPI', 'B', 'shlwapi')
99
- API.new('PathSetDlgItemPath', 'LIS', 'V', 'shlwapi')
100
- API.new('PathSkipRoot', 'S', 'P', 'shlwapi')
101
- API.new('PathStripPath', 'P', 'V', 'shlwapi')
102
- API.new('PathStripToRoot', 'P', 'B', 'shlwapi')
103
- API.new('PathUndecorate', 'P', 'V', 'shlwapi')
104
- API.new('PathUnExpandEnvStrings', 'SPI', 'B', 'shlwapi')
105
- API.new('PathUnmakeSystemFolder', 'S', 'B', 'shlwapi')
106
- API.new('PathUnquoteSpaces', 'P', 'V', 'shlwapi')
107
-
108
- API.new('UrlApplyScheme', 'SPPL', 'L', 'shlwapi')
109
- API.new('UrlCanonicalize', 'SPPL', 'L', 'shlwapi')
110
- API.new('UrlCombine', 'SSPPL', 'L', 'shlwapi')
111
- API.new('UrlCompare', 'SSI', 'I', 'shlwapi')
112
- API.new('UrlCreateFromPath', 'SPPL', 'L', 'shlwapi')
113
- API.new('UrlEscape', 'SPPL', 'L', 'shlwapi')
114
- API.new('UrlGetLocation', 'S', 'P', 'shlwapi')
115
- API.new('UrlGetPart', 'SPPLL', 'L', 'shlwapi')
116
- API.new('UrlHash', 'SPL', 'L', 'shlwapi')
117
- API.new('UrlIs', 'SL', 'B', 'shlwapi')
118
- API.new('UrlIsNoHistory', 'S', 'B', 'shlwapi')
119
- API.new('UrlIsOpaque', 'S', 'B', 'shlwapi')
120
- API.new('UrlUnescape', 'PPPL', 'L', 'shlwapi')
121
-
122
- # Macros
123
-
124
- def UrlEscapeSpaces(pszUrl, pszEscaped, pcchEscaped)
125
- UrlCanonicalize.call(
126
- pszUrl,
127
- pszEscaped,
128
- pcchEscaped,
129
- URL_ESCAPE_SPACES_ONLY | URL_DONT_ESCAPE_EXTRA_INFO
130
- )
131
- end
132
-
133
- def UrlIsFileUrl(pszUrl)
134
- UrlIsA.call(pszUrl, URLIS_FILEURL)
135
- end
136
-
137
- def UrlUnescapeInPlace(pszUrl, dwFlags)
138
- UrlUnescape.call(pszUrl, nil, nil, dwFlags | URL_UNESCAPE_INPLACE)
139
- end
140
- end
141
- 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
+ # These constants are for use by the PathGetCharType() function.
11
+
12
+ GCT_INVALID = 0x0000 # Character is not valid in a path.
13
+ GCT_LFNCHAR = 0x0001 # Character is valid in a long file name.
14
+ GCT_SHORTCHAR = 0x0002 # Character is valid in a short (8.3) file name.
15
+ GCT_WILD = 0x0004 # Character is a wildcard character.
16
+ GCT_SEPARATOR = 0x0008 # Character is a path separator.
17
+
18
+ URL_UNESCAPE = 0x10000000
19
+ URL_ESCAPE_UNSAFE = 0x20000000
20
+ URL_PLUGGABLE_PROTOCOL = 0x40000000
21
+ URL_WININET_COMPATIBILITY = 0x80000000
22
+ URL_DONT_ESCAPE_EXTRA_INFO = 0x02000000
23
+ URL_DONT_UNESCAPE_EXTRA_INFO = URL_DONT_ESCAPE_EXTRA_INFO
24
+ URL_BROWSER_MODE = URL_DONT_ESCAPE_EXTRA_INFO
25
+ URL_ESCAPE_SPACES_ONLY = 0x04000000
26
+ URL_DONT_SIMPLIFY = 0x08000000
27
+ URL_NO_META = URL_DONT_SIMPLIFY
28
+ URL_UNESCAPE_INPLACE = 0x00100000
29
+ URL_CONVERT_IF_DOSPATH = 0x00200000
30
+ URL_UNESCAPE_HIGH_ANSI_ONLY = 0x00400000
31
+ URL_INTERNAL_PATH = 0x00800000
32
+ URL_FILE_USE_PATHURL = 0x00010000
33
+ URL_DONT_UNESCAPE = 0x00020000
34
+ URL_ESCAPE_PERCENT = 0x00001000
35
+ URL_ESCAPE_SEGMENT_ONLY = 0x00002000
36
+ URL_PARTFLAG_KEEPSCHEME = 0x00000001
37
+ URL_APPLY_DEFAULT = 0x00000001
38
+ URL_APPLY_GUESSSCHEME = 0x00000002
39
+ URL_APPLY_GUESSFILE = 0x00000004
40
+ URL_APPLY_FORCEAPPLY = 0x00000008
41
+
42
+ # URLIS enum
43
+
44
+ URLIS_URL = 1
45
+ URLIS_OPAQUE = 2
46
+ URLIS_NOHISTORY = 3
47
+ URLIS_FILEURL = 4
48
+ URLIS_APPLIABLE = 5
49
+ URLIS_DIRECTORY = 6
50
+ URLIS_HASQUERY = 7
51
+
52
+ API.new('PathAddBackslash', 'P', 'P', 'shlwapi')
53
+ API.new('PathAddExtension', 'PS', 'B', 'shlwapi')
54
+ API.new('PathAppend', 'PS', 'B', 'shlwapi')
55
+ API.new('PathBuildRoot', 'PI', 'P', 'shlwapi')
56
+ API.new('PathCanonicalize', 'PS', 'B', 'shlwapi')
57
+ API.new('PathCombine', 'PSS', 'P', 'shlwapi')
58
+ API.new('PathCommonPrefix', 'SSP', 'I', 'shlwapi')
59
+ API.new('PathCompactPath', 'PPI', 'B', 'shlwapi')
60
+ API.new('PathCompactPathEx', 'PPIL', 'B', 'shlwapi')
61
+ API.new('PathCreateFromUrl', 'SPPL', 'L', 'shlwapi')
62
+ API.new('PathFileExists', 'S', 'B', 'shlwapi')
63
+ API.new('PathFindExtension', 'S', 'P', 'shlwapi')
64
+ API.new('PathFindFileName', 'S', 'P', 'shlwapi')
65
+ API.new('PathFindNextComponent', 'S', 'P', 'shlwapi')
66
+ API.new('PathFindOnPath', 'PS', 'B', 'shlwapi')
67
+ API.new('PathFindSuffixArray', 'SSI', 'P', 'shlwapi')
68
+ API.new('PathGetArgs', 'S', 'P', 'shlwapi')
69
+ API.new('PathGetCharType', 'P', 'I', 'shlwapi')
70
+ API.new('PathGetDriveNumber', 'S', 'I', 'shlwapi')
71
+ API.new('PathIsContentType', 'SS', 'B', 'shlwapi')
72
+ API.new('PathIsDirectory', 'S', 'B', 'shlwapi')
73
+ API.new('PathIsDirectoryEmpty', 'S', 'B', 'shlwapi')
74
+ API.new('PathIsFileSpec', 'S', 'B', 'shlwapi')
75
+ API.new('PathIsLFNFileSpec', 'S', 'B', 'shlwapi')
76
+ API.new('PathIsNetworkPath', 'S', 'B', 'shlwapi')
77
+ API.new('PathIsPrefix', 'SS', 'B', 'shlwapi')
78
+ API.new('PathIsRelative', 'S', 'B', 'shlwapi')
79
+ API.new('PathIsRoot', 'S', 'B', 'shlwapi')
80
+ API.new('PathIsSameRoot', 'SS', 'B', 'shlwapi')
81
+ API.new('PathIsSystemFolder', 'SL', 'B', 'shlwapi')
82
+ API.new('PathIsUNC', 'S', 'B', 'shlwapi')
83
+ API.new('PathIsUNCServer', 'S', 'B', 'shlwapi')
84
+ API.new('PathIsUNCServerShare', 'S', 'B', 'shlwapi')
85
+ API.new('PathIsURL', 'S', 'B', 'shlwapi')
86
+ API.new('PathMakePretty', 'P', 'B', 'shlwapi')
87
+ API.new('PathMakeSystemFolder', 'S', 'B', 'shlwapi')
88
+ API.new('PathMatchSpec', 'SS', 'B', 'shlwapi')
89
+ API.new('PathParseIconLocation', 'P', 'I', 'shlwapi')
90
+ API.new('PathQuoteSpaces', 'P', 'V', 'shlwapi')
91
+ API.new('PathRelativePathTo', 'PPLPL', 'B', 'shlwapi')
92
+ API.new('PathRemoveArgs', 'P', 'V', 'shlwapi')
93
+ API.new('PathRemoveBackslash', 'P', 'P', 'shlwapi')
94
+ API.new('PathRemoveBlanks', 'P', 'V', 'shlwapi')
95
+ API.new('PathRemoveExtension', 'P','V', 'shlwapi')
96
+ API.new('PathRemoveFileSpec', 'P', 'B', 'shlwapi')
97
+ API.new('PathRenameExtension', 'PS', 'B', 'shlwapi')
98
+ API.new('PathSearchAndQualify', 'SPI', 'B', 'shlwapi')
99
+ API.new('PathSetDlgItemPath', 'LIS', 'V', 'shlwapi')
100
+ API.new('PathSkipRoot', 'S', 'P', 'shlwapi')
101
+ API.new('PathStripPath', 'P', 'V', 'shlwapi')
102
+ API.new('PathStripToRoot', 'P', 'B', 'shlwapi')
103
+ API.new('PathUndecorate', 'P', 'V', 'shlwapi')
104
+ API.new('PathUnExpandEnvStrings', 'SPI', 'B', 'shlwapi')
105
+ API.new('PathUnmakeSystemFolder', 'S', 'B', 'shlwapi')
106
+ API.new('PathUnquoteSpaces', 'P', 'V', 'shlwapi')
107
+
108
+ API.new('UrlApplyScheme', 'SPPL', 'L', 'shlwapi')
109
+ API.new('UrlCanonicalize', 'SPPL', 'L', 'shlwapi')
110
+ API.new('UrlCombine', 'SSPPL', 'L', 'shlwapi')
111
+ API.new('UrlCompare', 'SSI', 'I', 'shlwapi')
112
+ API.new('UrlCreateFromPath', 'SPPL', 'L', 'shlwapi')
113
+ API.new('UrlEscape', 'SPPL', 'L', 'shlwapi')
114
+ API.new('UrlGetLocation', 'S', 'P', 'shlwapi')
115
+ API.new('UrlGetPart', 'SPPLL', 'L', 'shlwapi')
116
+ API.new('UrlHash', 'SPL', 'L', 'shlwapi')
117
+ API.new('UrlIs', 'SL', 'B', 'shlwapi')
118
+ API.new('UrlIsNoHistory', 'S', 'B', 'shlwapi')
119
+ API.new('UrlIsOpaque', 'S', 'B', 'shlwapi')
120
+ API.new('UrlUnescape', 'PPPL', 'L', 'shlwapi')
121
+
122
+ # Macros
123
+
124
+ def UrlEscapeSpaces(pszUrl, pszEscaped, pcchEscaped)
125
+ UrlCanonicalize.call(
126
+ pszUrl,
127
+ pszEscaped,
128
+ pcchEscaped,
129
+ URL_ESCAPE_SPACES_ONLY | URL_DONT_ESCAPE_EXTRA_INFO
130
+ )
131
+ end
132
+
133
+ def UrlIsFileUrl(pszUrl)
134
+ UrlIsA.call(pszUrl, URLIS_FILEURL)
135
+ end
136
+
137
+ def UrlUnescapeInPlace(pszUrl, dwFlags)
138
+ UrlUnescape.call(pszUrl, nil, nil, dwFlags | URL_UNESCAPE_INPLACE)
139
+ end
140
+ end
141
+ end