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
data/lib/windows/shell.rb
CHANGED
@@ -1,171 +1,171 @@
|
|
1
|
-
require 'windows/api'
|
2
|
-
|
3
|
-
module Windows
|
4
|
-
module Shell
|
5
|
-
API.auto_namespace = 'Windows::Shell'
|
6
|
-
API.auto_constant = true
|
7
|
-
API.auto_method = true
|
8
|
-
API.auto_unicode = true
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
# CSIDL constants
|
13
|
-
CSIDL_DESKTOP = 0x0000
|
14
|
-
CSIDL_INTERNET = 0x0001
|
15
|
-
CSIDL_PROGRAMS = 0x0002
|
16
|
-
CSIDL_CONTROLS = 0x0003
|
17
|
-
CSIDL_PRINTERS = 0x0004
|
18
|
-
CSIDL_PERSONAL = 0x0005
|
19
|
-
CSIDL_FAVORITES = 0x0006
|
20
|
-
CSIDL_STARTUP = 0x0007
|
21
|
-
CSIDL_RECENT = 0x0008
|
22
|
-
CSIDL_SENDTO = 0x0009
|
23
|
-
CSIDL_BITBUCKET = 0x000a
|
24
|
-
CSIDL_STARTMENU = 0x000b
|
25
|
-
CSIDL_MYDOCUMENTS = 0x000c
|
26
|
-
CSIDL_MYMUSIC = 0x000d
|
27
|
-
CSIDL_MYVIDEO = 0x000e
|
28
|
-
CSIDL_DESKTOPDIRECTORY = 0x0010
|
29
|
-
CSIDL_DRIVES = 0x0011
|
30
|
-
CSIDL_NETWORK = 0x0012
|
31
|
-
CSIDL_NETHOOD = 0x0013
|
32
|
-
CSIDL_FONTS = 0x0014
|
33
|
-
CSIDL_TEMPLATES = 0x0015
|
34
|
-
CSIDL_COMMON_STARTMENU = 0x0016
|
35
|
-
CSIDL_COMMON_PROGRAMS = 0X0017
|
36
|
-
CSIDL_COMMON_STARTUP = 0x0018
|
37
|
-
CSIDL_COMMON_FAVORITES = 0x001f
|
38
|
-
CSIDL_COMMON_DESKTOPDIRECTORY = 0x0019
|
39
|
-
CSIDL_APPDATA = 0x001a
|
40
|
-
CSIDL_PRINTHOOD = 0x001b
|
41
|
-
CSIDL_LOCAL_APPDATA = 0x001c
|
42
|
-
CSIDL_ALTSTARTUP = 0x001d
|
43
|
-
CSIDL_COMMON_ALTSTARTUP = 0x001e
|
44
|
-
CSIDL_INTERNET_CACHE = 0x0020
|
45
|
-
CSIDL_COOKIES = 0x0021
|
46
|
-
CSIDL_HISTORY = 0x0022
|
47
|
-
CSIDL_COMMON_APPDATA = 0x0023
|
48
|
-
CSIDL_WINDOWS = 0x0024
|
49
|
-
CSIDL_SYSTEM = 0x0025
|
50
|
-
CSIDL_PROGRAM_FILES = 0x0026
|
51
|
-
CSIDL_MYPICTURES = 0x0027
|
52
|
-
CSIDL_PROFILE = 0x0028
|
53
|
-
CSIDL_SYSTEMX86 = 0x0029
|
54
|
-
CSIDL_PROGRAM_FILESX86 = 0x002a
|
55
|
-
CSIDL_PROGRAM_FILES_COMMON = 0x002b
|
56
|
-
CSIDL_PROGRAM_FILES_COMMONX86 = 0x002c
|
57
|
-
CSIDL_COMMON_TEMPLATES = 0x002d
|
58
|
-
CSIDL_COMMON_DOCUMENTS = 0x002e
|
59
|
-
CSIDL_CONNECTIONS = 0x0031
|
60
|
-
CSIDL_COMMON_MUSIC = 0x0035
|
61
|
-
CSIDL_COMMON_PICTURES = 0x0036
|
62
|
-
CSIDL_COMMON_VIDEO = 0x0037
|
63
|
-
CSIDL_RESOURCES = 0x0038
|
64
|
-
CSIDL_RESOURCES_LOCALIZED = 0x0039
|
65
|
-
CSIDL_COMMON_OEM_LINKS = 0x003a
|
66
|
-
CSIDL_CDBURN_AREA = 0x003b
|
67
|
-
CSIDL_COMMON_ADMINTOOLS = 0x002f
|
68
|
-
CSIDL_ADMINTOOLS = 0x0030
|
69
|
-
|
70
|
-
# Return codes
|
71
|
-
S_FALSE = 1
|
72
|
-
E_FAIL = 2147500037
|
73
|
-
E_INVALIDARG = 2147483651
|
74
|
-
|
75
|
-
# Flags
|
76
|
-
SHGFP_TYPE_CURRENT = 0
|
77
|
-
SHGFP_TYPE_DEFAULT = 1
|
78
|
-
|
79
|
-
# Shell file operations
|
80
|
-
FO_MOVE = 0x0001
|
81
|
-
FO_COPY = 0x0002
|
82
|
-
FO_DELETE = 0x0003
|
83
|
-
FO_RENAME = 0x0004
|
84
|
-
|
85
|
-
FOF_MULTIDESTFILES = 0x0001
|
86
|
-
FOF_CONFIRMMOUSE = 0x0002
|
87
|
-
FOF_SILENT = 0x0004 # Don't create progress/report
|
88
|
-
FOF_RENAMEONCOLLISION = 0x0008
|
89
|
-
FOF_NOCONFIRMATION = 0x0010 # Don't prompt the user.
|
90
|
-
FOF_WANTMAPPINGHANDLE = 0x0020 # Fill in SHFILEOPSTRUCT.hNameMappings
|
91
|
-
FOF_ALLOWUNDO = 0x0040
|
92
|
-
FOF_FILESONLY = 0x0080 # On *.*, do only files
|
93
|
-
FOF_SIMPLEPROGRESS = 0x0100 # Means don't show names of files
|
94
|
-
FOF_NOCONFIRMMKDIR = 0x0200 # Don't confirm making any needed dirs
|
95
|
-
FOF_NOERRORUI = 0x0400 # Don't put up error UI
|
96
|
-
FOF_NOCOPYSECURITYATTRIBS = 0x0800 # Don't copy NT file Sec. Attributes
|
97
|
-
FOF_NORECURSION = 0x1000 # Don't recurse into directories.
|
98
|
-
FOF_NO_CONNECTED_ELEMENTS = 0x2000 # Don't operate on connected elements
|
99
|
-
FOF_WANTNUKEWARNING = 0x4000 # During delete op, warn if nuking
|
100
|
-
FOF_NORECURSEREPARSE = 0x8000 # Treat reparse points as objects
|
101
|
-
|
102
|
-
# Shell execute error codes
|
103
|
-
SE_ERR_FNF = 2 # file not found
|
104
|
-
SE_ERR_PNF = 3 # path not found
|
105
|
-
SE_ERR_ACCESSDENIED = 5 # access denied
|
106
|
-
SE_ERR_OOM = 8 # out of memory
|
107
|
-
SE_ERR_DLLNOTFOUND = 32
|
108
|
-
SE_ERR_SHARE = 26
|
109
|
-
SE_ERR_ASSOCINCOMPLETE = 27
|
110
|
-
SE_ERR_DDETIMEOUT = 28
|
111
|
-
SE_ERR_DDEFAIL = 29
|
112
|
-
SE_ERR_DDEBUSY = 30
|
113
|
-
SE_ERR_NOASSOC = 31
|
114
|
-
|
115
|
-
# Shell link constants
|
116
|
-
SHGNLI_PIDL = 0x000000001 # pszLinkTo is a pidl
|
117
|
-
SHGNLI_PREFIXNAME = 0x000000002 # Make name "Shortcut to xxx"
|
118
|
-
SHGNLI_NOUNIQUE = 0x000000004 # don't do the unique name generation
|
119
|
-
SHGNLI_NOLNK = 0x000000008 # don't add ".lnk" extension
|
120
|
-
|
121
|
-
# File information constants
|
122
|
-
SHGFI_ICON = 0x000000100 # get icon
|
123
|
-
SHGFI_DISPLAYNAME = 0x000000200 # get display name
|
124
|
-
SHGFI_TYPENAME = 0x000000400 # get type name
|
125
|
-
SHGFI_ATTRIBUTES = 0x000000800 # get attributes
|
126
|
-
SHGFI_ICONLOCATION = 0x000001000 # get icon location
|
127
|
-
SHGFI_EXETYPE = 0x000002000 # return exe type
|
128
|
-
SHGFI_SYSICONINDEX = 0x000004000 # get system icon index
|
129
|
-
SHGFI_LINKOVERLAY = 0x000008000 # put a link overlay on icon
|
130
|
-
SHGFI_SELECTED = 0x000010000 # show icon in selected state
|
131
|
-
SHGFI_ATTR_SPECIFIED = 0x000020000 # get only specified attributes
|
132
|
-
SHGFI_LARGEICON = 0x000000000 # get large icon
|
133
|
-
SHGFI_SMALLICON = 0x000000001 # get small icon
|
134
|
-
SHGFI_OPENICON = 0x000000002 # get open icon
|
135
|
-
SHGFI_SHELLICONSIZE = 0x000000004 # get shell size icon
|
136
|
-
SHGFI_PIDL = 0x000000008 # pszPath is a pidl
|
137
|
-
SHGFI_USEFILEATTRIBUTES = 0x000000010 # use passed dwFileAttribute
|
138
|
-
SHGFI_ADDOVERLAYS = 0x000000020 # apply the appropriate overlays
|
139
|
-
SHGFI_OVERLAYINDEX = 0x000000040 # Get the index of the overlay
|
140
|
-
|
141
|
-
API.new('DragQueryFile', 'LLPL', 'I', 'shell32')
|
142
|
-
API.new('ExtractIcon', 'LSI', 'L', 'shell32')
|
143
|
-
API.new('ExtractIconEx', 'SIPPI', 'I', 'shell32')
|
144
|
-
API.new('FindExecutable', 'SSP', 'L', 'shell32')
|
145
|
-
API.new('GetAllUsersProfileDirectory', 'PP', 'B', 'userenv')
|
146
|
-
API.new('GetDefaultUserProfileDirectory', 'PP', 'B', 'userenv')
|
147
|
-
API.new('GetProfilesDirectory', 'PP', 'B', 'userenv')
|
148
|
-
API.new('GetUserProfileDirectory', 'LPP', 'B', 'userenv')
|
149
|
-
API.new('ShellAbout', 'LSSL', 'I', 'shell32')
|
150
|
-
API.new('SHBrowseForFolder', 'P', 'P', 'shell32')
|
151
|
-
API.new('SHChangeNotify', 'LILL', 'V', 'shell32')
|
152
|
-
API.new('ShellExecute', 'LSSSSI', 'L', 'shell32')
|
153
|
-
API.new('ShellExecuteEx', 'P', 'B', 'shell32')
|
154
|
-
API.new('SHFileOperation', 'P', 'I', 'shell32')
|
155
|
-
API.new('SHGetFileInfo', 'PLPII', 'L', 'shell32')
|
156
|
-
API.new('SHGetFolderLocation', 'LILLP', 'L', 'shell32')
|
157
|
-
API.new('SHGetFolderPath', 'LLLLP', 'L', 'shell32')
|
158
|
-
API.new('SHGetNewLinkInfo', 'SSPPI', 'B', 'shell32')
|
159
|
-
API.new('SHGetPathFromIDList', 'LL', 'B', 'shell32')
|
160
|
-
API.new('SHGetSpecialFolderLocation', 'LIP', 'L', 'shell32')
|
161
|
-
API.new('SHGetSpecialFolderPath', 'LPLL','L', 'shell32')
|
162
|
-
|
163
|
-
begin
|
164
|
-
API.new('SHGetKnownFolderPath', 'LLLP', 'L', 'shell32')
|
165
|
-
API.new('SHGetKnownFolderIDList', 'LLLP', 'L', 'shell32')
|
166
|
-
API.new('SHGetNameFromIDList', 'PLP', 'L', 'shell32')
|
167
|
-
rescue Win32::API::LoadLibraryError
|
168
|
-
# Windows Vista or later
|
169
|
-
end
|
170
|
-
end
|
171
|
-
end
|
1
|
+
require 'windows/api'
|
2
|
+
|
3
|
+
module Windows
|
4
|
+
module Shell
|
5
|
+
API.auto_namespace = 'Windows::Shell'
|
6
|
+
API.auto_constant = true
|
7
|
+
API.auto_method = true
|
8
|
+
API.auto_unicode = true
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
# CSIDL constants
|
13
|
+
CSIDL_DESKTOP = 0x0000
|
14
|
+
CSIDL_INTERNET = 0x0001
|
15
|
+
CSIDL_PROGRAMS = 0x0002
|
16
|
+
CSIDL_CONTROLS = 0x0003
|
17
|
+
CSIDL_PRINTERS = 0x0004
|
18
|
+
CSIDL_PERSONAL = 0x0005
|
19
|
+
CSIDL_FAVORITES = 0x0006
|
20
|
+
CSIDL_STARTUP = 0x0007
|
21
|
+
CSIDL_RECENT = 0x0008
|
22
|
+
CSIDL_SENDTO = 0x0009
|
23
|
+
CSIDL_BITBUCKET = 0x000a
|
24
|
+
CSIDL_STARTMENU = 0x000b
|
25
|
+
CSIDL_MYDOCUMENTS = 0x000c
|
26
|
+
CSIDL_MYMUSIC = 0x000d
|
27
|
+
CSIDL_MYVIDEO = 0x000e
|
28
|
+
CSIDL_DESKTOPDIRECTORY = 0x0010
|
29
|
+
CSIDL_DRIVES = 0x0011
|
30
|
+
CSIDL_NETWORK = 0x0012
|
31
|
+
CSIDL_NETHOOD = 0x0013
|
32
|
+
CSIDL_FONTS = 0x0014
|
33
|
+
CSIDL_TEMPLATES = 0x0015
|
34
|
+
CSIDL_COMMON_STARTMENU = 0x0016
|
35
|
+
CSIDL_COMMON_PROGRAMS = 0X0017
|
36
|
+
CSIDL_COMMON_STARTUP = 0x0018
|
37
|
+
CSIDL_COMMON_FAVORITES = 0x001f
|
38
|
+
CSIDL_COMMON_DESKTOPDIRECTORY = 0x0019
|
39
|
+
CSIDL_APPDATA = 0x001a
|
40
|
+
CSIDL_PRINTHOOD = 0x001b
|
41
|
+
CSIDL_LOCAL_APPDATA = 0x001c
|
42
|
+
CSIDL_ALTSTARTUP = 0x001d
|
43
|
+
CSIDL_COMMON_ALTSTARTUP = 0x001e
|
44
|
+
CSIDL_INTERNET_CACHE = 0x0020
|
45
|
+
CSIDL_COOKIES = 0x0021
|
46
|
+
CSIDL_HISTORY = 0x0022
|
47
|
+
CSIDL_COMMON_APPDATA = 0x0023
|
48
|
+
CSIDL_WINDOWS = 0x0024
|
49
|
+
CSIDL_SYSTEM = 0x0025
|
50
|
+
CSIDL_PROGRAM_FILES = 0x0026
|
51
|
+
CSIDL_MYPICTURES = 0x0027
|
52
|
+
CSIDL_PROFILE = 0x0028
|
53
|
+
CSIDL_SYSTEMX86 = 0x0029
|
54
|
+
CSIDL_PROGRAM_FILESX86 = 0x002a
|
55
|
+
CSIDL_PROGRAM_FILES_COMMON = 0x002b
|
56
|
+
CSIDL_PROGRAM_FILES_COMMONX86 = 0x002c
|
57
|
+
CSIDL_COMMON_TEMPLATES = 0x002d
|
58
|
+
CSIDL_COMMON_DOCUMENTS = 0x002e
|
59
|
+
CSIDL_CONNECTIONS = 0x0031
|
60
|
+
CSIDL_COMMON_MUSIC = 0x0035
|
61
|
+
CSIDL_COMMON_PICTURES = 0x0036
|
62
|
+
CSIDL_COMMON_VIDEO = 0x0037
|
63
|
+
CSIDL_RESOURCES = 0x0038
|
64
|
+
CSIDL_RESOURCES_LOCALIZED = 0x0039
|
65
|
+
CSIDL_COMMON_OEM_LINKS = 0x003a
|
66
|
+
CSIDL_CDBURN_AREA = 0x003b
|
67
|
+
CSIDL_COMMON_ADMINTOOLS = 0x002f
|
68
|
+
CSIDL_ADMINTOOLS = 0x0030
|
69
|
+
|
70
|
+
# Return codes
|
71
|
+
S_FALSE = 1
|
72
|
+
E_FAIL = 2147500037
|
73
|
+
E_INVALIDARG = 2147483651
|
74
|
+
|
75
|
+
# Flags
|
76
|
+
SHGFP_TYPE_CURRENT = 0
|
77
|
+
SHGFP_TYPE_DEFAULT = 1
|
78
|
+
|
79
|
+
# Shell file operations
|
80
|
+
FO_MOVE = 0x0001
|
81
|
+
FO_COPY = 0x0002
|
82
|
+
FO_DELETE = 0x0003
|
83
|
+
FO_RENAME = 0x0004
|
84
|
+
|
85
|
+
FOF_MULTIDESTFILES = 0x0001
|
86
|
+
FOF_CONFIRMMOUSE = 0x0002
|
87
|
+
FOF_SILENT = 0x0004 # Don't create progress/report
|
88
|
+
FOF_RENAMEONCOLLISION = 0x0008
|
89
|
+
FOF_NOCONFIRMATION = 0x0010 # Don't prompt the user.
|
90
|
+
FOF_WANTMAPPINGHANDLE = 0x0020 # Fill in SHFILEOPSTRUCT.hNameMappings
|
91
|
+
FOF_ALLOWUNDO = 0x0040
|
92
|
+
FOF_FILESONLY = 0x0080 # On *.*, do only files
|
93
|
+
FOF_SIMPLEPROGRESS = 0x0100 # Means don't show names of files
|
94
|
+
FOF_NOCONFIRMMKDIR = 0x0200 # Don't confirm making any needed dirs
|
95
|
+
FOF_NOERRORUI = 0x0400 # Don't put up error UI
|
96
|
+
FOF_NOCOPYSECURITYATTRIBS = 0x0800 # Don't copy NT file Sec. Attributes
|
97
|
+
FOF_NORECURSION = 0x1000 # Don't recurse into directories.
|
98
|
+
FOF_NO_CONNECTED_ELEMENTS = 0x2000 # Don't operate on connected elements
|
99
|
+
FOF_WANTNUKEWARNING = 0x4000 # During delete op, warn if nuking
|
100
|
+
FOF_NORECURSEREPARSE = 0x8000 # Treat reparse points as objects
|
101
|
+
|
102
|
+
# Shell execute error codes
|
103
|
+
SE_ERR_FNF = 2 # file not found
|
104
|
+
SE_ERR_PNF = 3 # path not found
|
105
|
+
SE_ERR_ACCESSDENIED = 5 # access denied
|
106
|
+
SE_ERR_OOM = 8 # out of memory
|
107
|
+
SE_ERR_DLLNOTFOUND = 32
|
108
|
+
SE_ERR_SHARE = 26
|
109
|
+
SE_ERR_ASSOCINCOMPLETE = 27
|
110
|
+
SE_ERR_DDETIMEOUT = 28
|
111
|
+
SE_ERR_DDEFAIL = 29
|
112
|
+
SE_ERR_DDEBUSY = 30
|
113
|
+
SE_ERR_NOASSOC = 31
|
114
|
+
|
115
|
+
# Shell link constants
|
116
|
+
SHGNLI_PIDL = 0x000000001 # pszLinkTo is a pidl
|
117
|
+
SHGNLI_PREFIXNAME = 0x000000002 # Make name "Shortcut to xxx"
|
118
|
+
SHGNLI_NOUNIQUE = 0x000000004 # don't do the unique name generation
|
119
|
+
SHGNLI_NOLNK = 0x000000008 # don't add ".lnk" extension
|
120
|
+
|
121
|
+
# File information constants
|
122
|
+
SHGFI_ICON = 0x000000100 # get icon
|
123
|
+
SHGFI_DISPLAYNAME = 0x000000200 # get display name
|
124
|
+
SHGFI_TYPENAME = 0x000000400 # get type name
|
125
|
+
SHGFI_ATTRIBUTES = 0x000000800 # get attributes
|
126
|
+
SHGFI_ICONLOCATION = 0x000001000 # get icon location
|
127
|
+
SHGFI_EXETYPE = 0x000002000 # return exe type
|
128
|
+
SHGFI_SYSICONINDEX = 0x000004000 # get system icon index
|
129
|
+
SHGFI_LINKOVERLAY = 0x000008000 # put a link overlay on icon
|
130
|
+
SHGFI_SELECTED = 0x000010000 # show icon in selected state
|
131
|
+
SHGFI_ATTR_SPECIFIED = 0x000020000 # get only specified attributes
|
132
|
+
SHGFI_LARGEICON = 0x000000000 # get large icon
|
133
|
+
SHGFI_SMALLICON = 0x000000001 # get small icon
|
134
|
+
SHGFI_OPENICON = 0x000000002 # get open icon
|
135
|
+
SHGFI_SHELLICONSIZE = 0x000000004 # get shell size icon
|
136
|
+
SHGFI_PIDL = 0x000000008 # pszPath is a pidl
|
137
|
+
SHGFI_USEFILEATTRIBUTES = 0x000000010 # use passed dwFileAttribute
|
138
|
+
SHGFI_ADDOVERLAYS = 0x000000020 # apply the appropriate overlays
|
139
|
+
SHGFI_OVERLAYINDEX = 0x000000040 # Get the index of the overlay
|
140
|
+
|
141
|
+
API.new('DragQueryFile', 'LLPL', 'I', 'shell32')
|
142
|
+
API.new('ExtractIcon', 'LSI', 'L', 'shell32')
|
143
|
+
API.new('ExtractIconEx', 'SIPPI', 'I', 'shell32')
|
144
|
+
API.new('FindExecutable', 'SSP', 'L', 'shell32')
|
145
|
+
API.new('GetAllUsersProfileDirectory', 'PP', 'B', 'userenv')
|
146
|
+
API.new('GetDefaultUserProfileDirectory', 'PP', 'B', 'userenv')
|
147
|
+
API.new('GetProfilesDirectory', 'PP', 'B', 'userenv')
|
148
|
+
API.new('GetUserProfileDirectory', 'LPP', 'B', 'userenv')
|
149
|
+
API.new('ShellAbout', 'LSSL', 'I', 'shell32')
|
150
|
+
API.new('SHBrowseForFolder', 'P', 'P', 'shell32')
|
151
|
+
API.new('SHChangeNotify', 'LILL', 'V', 'shell32')
|
152
|
+
API.new('ShellExecute', 'LSSSSI', 'L', 'shell32')
|
153
|
+
API.new('ShellExecuteEx', 'P', 'B', 'shell32')
|
154
|
+
API.new('SHFileOperation', 'P', 'I', 'shell32')
|
155
|
+
API.new('SHGetFileInfo', 'PLPII', 'L', 'shell32')
|
156
|
+
API.new('SHGetFolderLocation', 'LILLP', 'L', 'shell32')
|
157
|
+
API.new('SHGetFolderPath', 'LLLLP', 'L', 'shell32')
|
158
|
+
API.new('SHGetNewLinkInfo', 'SSPPI', 'B', 'shell32')
|
159
|
+
API.new('SHGetPathFromIDList', 'LL', 'B', 'shell32')
|
160
|
+
API.new('SHGetSpecialFolderLocation', 'LIP', 'L', 'shell32')
|
161
|
+
API.new('SHGetSpecialFolderPath', 'LPLL','L', 'shell32')
|
162
|
+
|
163
|
+
begin
|
164
|
+
API.new('SHGetKnownFolderPath', 'LLLP', 'L', 'shell32')
|
165
|
+
API.new('SHGetKnownFolderIDList', 'LLLP', 'L', 'shell32')
|
166
|
+
API.new('SHGetNameFromIDList', 'PLP', 'L', 'shell32')
|
167
|
+
rescue Win32::API::LoadLibraryError
|
168
|
+
# Windows Vista or later
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
data/lib/windows/socket.rb
CHANGED
@@ -1,86 +1,86 @@
|
|
1
|
-
require 'windows/api'
|
2
|
-
|
3
|
-
module Windows
|
4
|
-
module Socket
|
5
|
-
API.auto_namespace = 'Windows::Socket'
|
6
|
-
API.auto_constant = true
|
7
|
-
API.auto_method = true
|
8
|
-
API.auto_unicode = true
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
# Constants
|
13
|
-
|
14
|
-
IPPROTO_IP = 0 # dummy for IP
|
15
|
-
IPPROTO_ICMP = 1 # control message protocol
|
16
|
-
IPPROTO_IGMP = 2 # group management protocol
|
17
|
-
IPPROTO_GGP = 3 # gateway^2 (deprecated)
|
18
|
-
IPPROTO_TCP = 6 # tcp
|
19
|
-
IPPROTO_PUP = 12 # pup
|
20
|
-
IPPROTO_UDP = 17 # user datagram protocol
|
21
|
-
IPPROTO_IDP = 22 # xns idp
|
22
|
-
IPPROTO_ND = 77 # UNOFFICIAL net disk proto
|
23
|
-
IPPROTO_RAW = 255 # raw IP packet
|
24
|
-
IPPROTO_MAX = 256
|
25
|
-
|
26
|
-
NSPROTO_IPX = 1000
|
27
|
-
NSPROTO_SPX = 1256
|
28
|
-
NSPROTO_SPXII = 1257
|
29
|
-
|
30
|
-
# Functions
|
31
|
-
|
32
|
-
API.new('accept', 'LPP', 'L', 'ws2_32')
|
33
|
-
API.new('AcceptEx', 'LLPLLLPP', 'B', 'mswsock')
|
34
|
-
API.new('bind', 'LPI', 'I', 'ws2_32')
|
35
|
-
API.new('closesocket', 'L', 'I', 'ws2_32')
|
36
|
-
API.new('connect', 'LPI', 'I', 'ws2_32')
|
37
|
-
API.new('EnumProtocols', 'PPP', 'I', 'mswsock')
|
38
|
-
API.new('GetAcceptExSockaddrs', 'PLLLPPPP', 'V', 'mswsock')
|
39
|
-
API.new('GetAddressByName', 'LPPPLPPPPP', 'I', 'mswsock')
|
40
|
-
API.new('gethostbyaddr', 'SII', 'P', 'ws2_32')
|
41
|
-
API.new('gethostbyname', 'S', 'P', 'ws2_32')
|
42
|
-
API.new('gethostname', 'PI', 'I', 'ws2_32')
|
43
|
-
API.new('GetNameByType', 'PPL', 'I', 'mswsock')
|
44
|
-
API.new('getpeername', 'LPP', 'I', 'ws2_32')
|
45
|
-
API.new('getprotobyname', 'S', 'P', 'ws2_32')
|
46
|
-
API.new('getprotobynumber', 'I', 'P', 'ws2_32')
|
47
|
-
API.new('getservbyport', 'IS', 'P', 'ws2_32')
|
48
|
-
API.new('GetService', 'LPSLPPP', 'I', 'mswsock')
|
49
|
-
API.new('getsockname', 'LPP', 'I', 'ws2_32')
|
50
|
-
API.new('getsockopt', 'LIIPP', 'I', 'ws2_32')
|
51
|
-
API.new('GetTypeByName', 'LIIPP', 'I', 'mswsock')
|
52
|
-
API.new('htonl', 'L', 'L', 'ws2_32')
|
53
|
-
API.new('htons', 'S', 'S', 'ws2_32')
|
54
|
-
API.new('inet_addr', 'S', 'L', 'ws2_32')
|
55
|
-
API.new('inet_ntoa', 'P', 'S', 'ws2_32')
|
56
|
-
API.new('ioctlsocket', 'LLP', 'I', 'ws2_32')
|
57
|
-
API.new('listen', 'LI', 'I', 'ws2_32')
|
58
|
-
API.new('ntohl', 'L', 'L', 'ws2_32')
|
59
|
-
API.new('ntohs', 'S', 'S', 'ws2_32')
|
60
|
-
API.new('recv', 'LPII', 'I', 'ws2_32')
|
61
|
-
API.new('recvfrom', 'LPIIPP', 'I', 'ws2_32')
|
62
|
-
API.new('send', 'LSII', 'I', 'ws2_32')
|
63
|
-
API.new('sendto', 'LSIIPI', 'I', 'ws2_32')
|
64
|
-
API.new('SetService', 'LLLPPP', 'I', 'mswsock')
|
65
|
-
API.new('setsockopt', 'LIISI', 'I', 'ws2_32')
|
66
|
-
API.new('shutdown', 'LI', 'I', 'ws2_32')
|
67
|
-
API.new('socket', 'III', 'L', 'ws2_32')
|
68
|
-
API.new('TransmitFile', 'LLLLPPL', 'B', 'mswsock')
|
69
|
-
|
70
|
-
begin
|
71
|
-
API.new('freeaddrinfo', 'P', 'V', 'ws2_32')
|
72
|
-
API.new('FreeAddrInfoEx', 'P', 'V', 'ws2_32')
|
73
|
-
API.new('FreeAddrInfoW', 'P', 'V', 'ws2_32')
|
74
|
-
API.new('getaddrinfo', 'PPPP', 'I', 'ws2_32')
|
75
|
-
API.new('GetAddrInfoEx', 'PPLPPPPPPP', 'I', 'ws2_32')
|
76
|
-
API.new('GetAddrInfoW', 'PPPP', 'I', 'ws2_32')
|
77
|
-
API.new('getnameinfo', 'PLPLPLI', 'I', 'ws2_32')
|
78
|
-
API.new('GetNameInfoW', 'PLPLPLI', 'I', 'ws2_32')
|
79
|
-
API.new('InetNtop', 'IPPL', 'P', 'ws2_32')
|
80
|
-
API.new('inet_pton', 'IPP', 'I', 'ws2_32')
|
81
|
-
API.new('SetAddrInfoEx', 'SSPLPLLPPPPP', 'I', 'ws2_32')
|
82
|
-
rescue Win32::API::LoadLibraryError
|
83
|
-
# XP or later
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
1
|
+
require 'windows/api'
|
2
|
+
|
3
|
+
module Windows
|
4
|
+
module Socket
|
5
|
+
API.auto_namespace = 'Windows::Socket'
|
6
|
+
API.auto_constant = true
|
7
|
+
API.auto_method = true
|
8
|
+
API.auto_unicode = true
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
# Constants
|
13
|
+
|
14
|
+
IPPROTO_IP = 0 # dummy for IP
|
15
|
+
IPPROTO_ICMP = 1 # control message protocol
|
16
|
+
IPPROTO_IGMP = 2 # group management protocol
|
17
|
+
IPPROTO_GGP = 3 # gateway^2 (deprecated)
|
18
|
+
IPPROTO_TCP = 6 # tcp
|
19
|
+
IPPROTO_PUP = 12 # pup
|
20
|
+
IPPROTO_UDP = 17 # user datagram protocol
|
21
|
+
IPPROTO_IDP = 22 # xns idp
|
22
|
+
IPPROTO_ND = 77 # UNOFFICIAL net disk proto
|
23
|
+
IPPROTO_RAW = 255 # raw IP packet
|
24
|
+
IPPROTO_MAX = 256
|
25
|
+
|
26
|
+
NSPROTO_IPX = 1000
|
27
|
+
NSPROTO_SPX = 1256
|
28
|
+
NSPROTO_SPXII = 1257
|
29
|
+
|
30
|
+
# Functions
|
31
|
+
|
32
|
+
API.new('accept', 'LPP', 'L', 'ws2_32')
|
33
|
+
API.new('AcceptEx', 'LLPLLLPP', 'B', 'mswsock')
|
34
|
+
API.new('bind', 'LPI', 'I', 'ws2_32')
|
35
|
+
API.new('closesocket', 'L', 'I', 'ws2_32')
|
36
|
+
API.new('connect', 'LPI', 'I', 'ws2_32')
|
37
|
+
API.new('EnumProtocols', 'PPP', 'I', 'mswsock')
|
38
|
+
API.new('GetAcceptExSockaddrs', 'PLLLPPPP', 'V', 'mswsock')
|
39
|
+
API.new('GetAddressByName', 'LPPPLPPPPP', 'I', 'mswsock')
|
40
|
+
API.new('gethostbyaddr', 'SII', 'P', 'ws2_32')
|
41
|
+
API.new('gethostbyname', 'S', 'P', 'ws2_32')
|
42
|
+
API.new('gethostname', 'PI', 'I', 'ws2_32')
|
43
|
+
API.new('GetNameByType', 'PPL', 'I', 'mswsock')
|
44
|
+
API.new('getpeername', 'LPP', 'I', 'ws2_32')
|
45
|
+
API.new('getprotobyname', 'S', 'P', 'ws2_32')
|
46
|
+
API.new('getprotobynumber', 'I', 'P', 'ws2_32')
|
47
|
+
API.new('getservbyport', 'IS', 'P', 'ws2_32')
|
48
|
+
API.new('GetService', 'LPSLPPP', 'I', 'mswsock')
|
49
|
+
API.new('getsockname', 'LPP', 'I', 'ws2_32')
|
50
|
+
API.new('getsockopt', 'LIIPP', 'I', 'ws2_32')
|
51
|
+
API.new('GetTypeByName', 'LIIPP', 'I', 'mswsock')
|
52
|
+
API.new('htonl', 'L', 'L', 'ws2_32')
|
53
|
+
API.new('htons', 'S', 'S', 'ws2_32')
|
54
|
+
API.new('inet_addr', 'S', 'L', 'ws2_32')
|
55
|
+
API.new('inet_ntoa', 'P', 'S', 'ws2_32')
|
56
|
+
API.new('ioctlsocket', 'LLP', 'I', 'ws2_32')
|
57
|
+
API.new('listen', 'LI', 'I', 'ws2_32')
|
58
|
+
API.new('ntohl', 'L', 'L', 'ws2_32')
|
59
|
+
API.new('ntohs', 'S', 'S', 'ws2_32')
|
60
|
+
API.new('recv', 'LPII', 'I', 'ws2_32')
|
61
|
+
API.new('recvfrom', 'LPIIPP', 'I', 'ws2_32')
|
62
|
+
API.new('send', 'LSII', 'I', 'ws2_32')
|
63
|
+
API.new('sendto', 'LSIIPI', 'I', 'ws2_32')
|
64
|
+
API.new('SetService', 'LLLPPP', 'I', 'mswsock')
|
65
|
+
API.new('setsockopt', 'LIISI', 'I', 'ws2_32')
|
66
|
+
API.new('shutdown', 'LI', 'I', 'ws2_32')
|
67
|
+
API.new('socket', 'III', 'L', 'ws2_32')
|
68
|
+
API.new('TransmitFile', 'LLLLPPL', 'B', 'mswsock')
|
69
|
+
|
70
|
+
begin
|
71
|
+
API.new('freeaddrinfo', 'P', 'V', 'ws2_32')
|
72
|
+
API.new('FreeAddrInfoEx', 'P', 'V', 'ws2_32')
|
73
|
+
API.new('FreeAddrInfoW', 'P', 'V', 'ws2_32')
|
74
|
+
API.new('getaddrinfo', 'PPPP', 'I', 'ws2_32')
|
75
|
+
API.new('GetAddrInfoEx', 'PPLPPPPPPP', 'I', 'ws2_32')
|
76
|
+
API.new('GetAddrInfoW', 'PPPP', 'I', 'ws2_32')
|
77
|
+
API.new('getnameinfo', 'PLPLPLI', 'I', 'ws2_32')
|
78
|
+
API.new('GetNameInfoW', 'PLPLPLI', 'I', 'ws2_32')
|
79
|
+
API.new('InetNtop', 'IPPL', 'P', 'ws2_32')
|
80
|
+
API.new('inet_pton', 'IPP', 'I', 'ws2_32')
|
81
|
+
API.new('SetAddrInfoEx', 'SSPLPLLPPPPP', 'I', 'ws2_32')
|
82
|
+
rescue Win32::API::LoadLibraryError
|
83
|
+
# XP or later
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|