windows-pr 0.6.3 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +9 -0
- data/lib/windows/file.rb +177 -23
- data/lib/windows/msvcrt/file.rb +12 -2
- data/lib/windows/msvcrt/string.rb +44 -2
- data/lib/windows/national.rb +125 -98
- data/lib/windows/path.rb +73 -14
- data/lib/windows/unicode.rb +44 -14
- data/lib/windows/volume.rb +16 -5
- data/windows-pr.gemspec +1 -1
- metadata +3 -3
data/CHANGES
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
= 0.6.4 - 28-Feb-2007
|
2
|
+
* Add more string functions to the Windows::MSVCRT::String module.
|
3
|
+
* Minor enhancement to the multi_to_wide and wide_to_multi helper methods in
|
4
|
+
the Windows::Unicode module. You can now pass an explicit encoding as an
|
5
|
+
optional second argument.
|
6
|
+
* Added several more methods to the Windows::National module.
|
7
|
+
* Finer grained method wrapping/checking for the Windows::Volume module.
|
8
|
+
Thanks go to Dave Rose for the spot.
|
9
|
+
|
1
10
|
= 0.6.3 - 2-Feb-2007
|
2
11
|
* Fixed the DLL for SetLastErrorEx in the Windows::Error module.
|
3
12
|
* Fixed an unitialized constant bug in the Windows::DeviceIO module.
|
data/lib/windows/file.rb
CHANGED
@@ -2,6 +2,8 @@ require 'windows/unicode'
|
|
2
2
|
|
3
3
|
module Windows
|
4
4
|
module File
|
5
|
+
include Windows::Unicode
|
6
|
+
|
5
7
|
# File Attributes
|
6
8
|
FILE_ATTRIBUTE_READONLY = 0x00000001
|
7
9
|
FILE_ATTRIBUTE_HIDDEN = 0x00000002
|
@@ -157,77 +159,197 @@ module Windows
|
|
157
159
|
LOCKFILE_EXCLUSIVE_LOCK = 0x00000001
|
158
160
|
LOCKFILE_FAIL_IMMEDIATELY = 0x00000002
|
159
161
|
|
160
|
-
CopyFile
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
162
|
+
CopyFile = Win32API.new('kernel32', 'CopyFile', 'PPI', 'I')
|
163
|
+
CopyFileA = Win32API.new('kernel32', 'CopyFileA', 'PPI', 'I')
|
164
|
+
CopyFileW = Win32API.new('kernel32', 'CopyFileW', 'PPI', 'I')
|
165
|
+
|
166
|
+
CopyFileEx = Win32API.new('kernel32', 'CopyFileEx', 'PPPPPL', 'I')
|
167
|
+
CopyFileExA = Win32API.new('kernel32', 'CopyFileExA', 'PPPPPL', 'I')
|
168
|
+
CopyFileExW = Win32API.new('kernel32', 'CopyFileExW', 'PPPPPL', 'I')
|
169
|
+
|
170
|
+
CreateFile = Win32API.new('kernel32', 'CreateFile', 'PLLPLLL', 'L')
|
171
|
+
CreateFileA = Win32API.new('kernel32', 'CreateFileA', 'PLLPLLL', 'L')
|
172
|
+
CreateFileW = Win32API.new('kernel32', 'CreateFileW', 'PLLPLLL', 'L')
|
173
|
+
|
174
|
+
CreateHardLink = Win32API.new('kernel32', 'CreateHardLink', 'PPP', 'I')
|
175
|
+
CreateHardLinkA = Win32API.new('kernel32', 'CreateHardLinkA', 'PPP', 'I')
|
176
|
+
CreateHardLinkW = Win32API.new('kernel32', 'CreateHardLinkW', 'PPP', 'I')
|
177
|
+
|
178
|
+
DecryptFile = Win32API.new('advapi32', 'DecryptFile', 'PL', 'I')
|
179
|
+
DecryptFileA = Win32API.new('advapi32', 'DecryptFileA', 'PL', 'I')
|
180
|
+
DecryptFileW = Win32API.new('advapi32', 'DecryptFileW', 'PL', 'I')
|
181
|
+
|
182
|
+
DeleteFile = Win32API.new('kernel32', 'DeleteFile', 'P', 'I')
|
183
|
+
DeleteFileA = Win32API.new('kernel32', 'DeleteFileA', 'P', 'I')
|
184
|
+
DeleteFileW = Win32API.new('kernel32', 'DeleteFileW', 'P', 'I')
|
185
|
+
|
186
|
+
EncryptFile = Win32API.new('advapi32', 'EncryptFile', 'P', 'I')
|
187
|
+
EncryptFileA = Win32API.new('advapi32', 'EncryptFileA', 'P', 'I')
|
188
|
+
EncryptFileW = Win32API.new('advapi32', 'EncryptFileW', 'P', 'I')
|
168
189
|
|
169
|
-
GetBinaryType
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
190
|
+
GetBinaryType = Win32API.new('kernel32', 'GetBinaryType', 'PP', 'I')
|
191
|
+
GetBinaryTypeA = Win32API.new('kernel32', 'GetBinaryTypeA', 'PP', 'I')
|
192
|
+
GetBinaryTypeW = Win32API.new('kernel32', 'GetBinaryTypeW', 'PP', 'I')
|
193
|
+
|
194
|
+
GetFileAttributes = Win32API.new('kernel32', 'GetFileAttributes', 'P', 'L')
|
195
|
+
GetFileAttributesA = Win32API.new('kernel32', 'GetFileAttributesA', 'P', 'L')
|
196
|
+
GetFileAttributesW = Win32API.new('kernel32', 'GetFileAttributesW', 'P', 'L')
|
197
|
+
|
198
|
+
GetFileAttributesEx = Win32API.new('kernel32', 'GetFileAttributesEx', 'PPP', 'I')
|
199
|
+
GetFileAttributesExA = Win32API.new('kernel32', 'GetFileAttributesExA', 'PPP', 'I')
|
200
|
+
GetFileAttributesExW = Win32API.new('kernel32', 'GetFileAttributesExW', 'PPP', 'I')
|
201
|
+
|
202
|
+
GetFileSize = Win32API.new('kernel32', 'GetFileSize', 'LP', 'L')
|
203
|
+
GetFileSizeEx = Win32API.new('kernel32', 'GetFileSizeEx', 'LP', 'L')
|
204
|
+
GetFileType = Win32API.new('kernel32', 'GetFileType', 'L', 'L')
|
205
|
+
|
206
|
+
GetFullPathName = Win32API.new('kernel32', 'GetFullPathName', 'PLPP', 'L')
|
207
|
+
GetFullPathNameA = Win32API.new('kernel32', 'GetFullPathNameA', 'PLPP', 'L')
|
208
|
+
GetFullPathNameW = Win32API.new('kernel32', 'GetFullPathNameW', 'PLPP', 'L')
|
209
|
+
|
210
|
+
GetLongPathName = Win32API.new('kernel32', 'GetLongPathName', 'PPL', 'L')
|
211
|
+
GetLongPathNameA = Win32API.new('kernel32', 'GetLongPathNameA', 'PPL', 'L')
|
212
|
+
GetLongPathNameW = Win32API.new('kernel32', 'GetLongPathNameW', 'PPL', 'L')
|
213
|
+
|
214
|
+
GetShortPathName = Win32API.new('kernel32', 'GetShortPathName', 'PPL', 'L')
|
215
|
+
GetShortPathNameA = Win32API.new('kernel32', 'GetShortPathNameA', 'PPL', 'L')
|
216
|
+
GetShortPathNameW = Win32API.new('kernel32', 'GetShortPathNameW', 'PPL', 'L')
|
179
217
|
|
180
218
|
LockFile = Win32API.new('kernel32', 'LockFile', 'LLLLL', 'I')
|
181
219
|
LockFileEx = Win32API.new('kernel32', 'LockFileEx', 'LLLLLL', 'I')
|
220
|
+
|
182
221
|
ReadFile = Win32API.new('kernel32', 'ReadFile', 'LPLPP', 'I')
|
183
222
|
ReadFileEx = Win32API.new('kernel32', 'ReadFileEx', 'LPLPP', 'I')
|
184
223
|
|
185
|
-
SetFileAttributes
|
224
|
+
SetFileAttributes = Win32API.new('kernel32', 'SetFileAttributes', 'PL', 'I')
|
225
|
+
SetFileAttributesA = Win32API.new('kernel32', 'SetFileAttributesA', 'PL', 'I')
|
226
|
+
SetFileAttributesW = Win32API.new('kernel32', 'SetFileAttributesW', 'PL', 'I')
|
186
227
|
|
187
228
|
UnlockFile = Win32API.new('kernel32', 'UnlockFile', 'LLLLL', 'I')
|
188
229
|
UnlockFileEx = Win32API.new('kernel32', 'UnlockFileEx', 'LLLLL', 'I')
|
189
|
-
|
190
|
-
|
230
|
+
|
231
|
+
WriteFile = Win32API.new('kernel32', 'WriteFile', 'LPLPP', 'I')
|
232
|
+
WriteFileEx = Win32API.new('kernel32', 'WriteFileEx', 'LPLPP', 'I')
|
191
233
|
|
192
234
|
def CopyFile(curr_file, new_file, bail)
|
193
235
|
CopyFile.call(curr_file, new_file, bail) > 0
|
194
236
|
end
|
237
|
+
|
238
|
+
def CopyFileA(curr_file, new_file, bail)
|
239
|
+
CopyFileA.call(curr_file, new_file, bail) > 0
|
240
|
+
end
|
241
|
+
|
242
|
+
def CopyFileW(curr_file, new_file, bail)
|
243
|
+
CopyFileW.call(curr_file, new_file, bail) > 0
|
244
|
+
end
|
195
245
|
|
196
246
|
def CopyFileEx(curr_file, new_file, routine, data, cancel, flags)
|
197
247
|
CopyFileEx.call(curr_file, new_file, routine, data, cancel, flags) > 0
|
198
248
|
end
|
199
|
-
|
249
|
+
|
250
|
+
def CopyFileExA(curr_file, new_file, routine, data, cancel, flags)
|
251
|
+
CopyFileExA.call(curr_file, new_file, routine, data, cancel, flags) > 0
|
252
|
+
end
|
253
|
+
|
254
|
+
def CopyFileExW(curr_file, new_file, routine, data, cancel, flags)
|
255
|
+
CopyFileExW.call(curr_file, new_file, routine, data, cancel, flags) > 0
|
256
|
+
end
|
257
|
+
|
200
258
|
def CreateFile(file, access, share, sec, disp, flags, template)
|
201
259
|
CreateFile.call(file, access, share, sec, disp, flags, template)
|
202
260
|
end
|
203
261
|
|
262
|
+
def CreateFileA(file, access, share, sec, disp, flags, template)
|
263
|
+
CreateFileA.call(file, access, share, sec, disp, flags, template)
|
264
|
+
end
|
265
|
+
|
266
|
+
def CreateFileW(file, access, share, sec, disp, flags, template)
|
267
|
+
CreateFileW.call(file, access, share, sec, disp, flags, template)
|
268
|
+
end
|
269
|
+
|
204
270
|
def CreateHardLink(new_file, old_file, attributes)
|
205
271
|
CreateHardLink.call(new_file, old_file, attributes) > 0
|
206
272
|
end
|
273
|
+
|
274
|
+
def CreateHardLinkA(new_file, old_file, attributes)
|
275
|
+
CreateHardLinkA.call(new_file, old_file, attributes) > 0
|
276
|
+
end
|
277
|
+
|
278
|
+
def CreateHardLinkW(new_file, old_file, attributes)
|
279
|
+
CreateHardLinkW.call(new_file, old_file, attributes) > 0
|
280
|
+
end
|
207
281
|
|
208
282
|
def DecryptFile(file, res = 0)
|
209
283
|
DecryptFile.call(file, res)
|
210
284
|
end
|
285
|
+
|
286
|
+
def DecryptFileA(file, res = 0)
|
287
|
+
DecryptFileA.call(file, res)
|
288
|
+
end
|
289
|
+
|
290
|
+
def DecryptFileW(file, res = 0)
|
291
|
+
DecryptFileW.call(file, res)
|
292
|
+
end
|
211
293
|
|
212
294
|
def DeleteFile(file)
|
213
295
|
DeleteFile.call(file) > 0
|
214
296
|
end
|
297
|
+
|
298
|
+
def DeleteFileA(file)
|
299
|
+
DeleteFileA.call(file) > 0
|
300
|
+
end
|
301
|
+
|
302
|
+
def DeleteFileW(file)
|
303
|
+
DeleteFileW.call(file) > 0
|
304
|
+
end
|
215
305
|
|
216
306
|
def EncryptFile(file)
|
217
307
|
EncryptFile.call(file) > 0
|
218
308
|
end
|
309
|
+
|
310
|
+
def EncryptFileA(file)
|
311
|
+
EncryptFileA.call(file) > 0
|
312
|
+
end
|
313
|
+
|
314
|
+
def EncryptFileW(file)
|
315
|
+
EncryptFileW.call(file) > 0
|
316
|
+
end
|
219
317
|
|
220
318
|
def GetBinaryType(file, type)
|
221
319
|
GetBinaryType.call(file, type) > 0
|
222
320
|
end
|
321
|
+
|
322
|
+
def GetBinaryTypeA(file, type)
|
323
|
+
GetBinaryTypeA.call(file, type) > 0
|
324
|
+
end
|
325
|
+
|
326
|
+
def GetBinaryTypeW(file, type)
|
327
|
+
GetBinaryTypeW.call(file, type) > 0
|
328
|
+
end
|
223
329
|
|
224
330
|
def GetFileAttributes(file)
|
225
331
|
GetFileAttributes.call(file)
|
226
332
|
end
|
333
|
+
|
334
|
+
def GetFileAttributesA(file)
|
335
|
+
GetFileAttributesA.call(file)
|
336
|
+
end
|
337
|
+
|
338
|
+
def GetFileAttributesW(file)
|
339
|
+
GetFileAttributesW.call(file)
|
340
|
+
end
|
227
341
|
|
228
342
|
def GetFileAttributesEx(file, level_id, info)
|
229
343
|
GetFileAttributesEx.call(file, level_id, info)
|
230
344
|
end
|
345
|
+
|
346
|
+
def GetFileAttributesExA(file, level_id, info)
|
347
|
+
GetFileAttributesExA.call(file, level_id, info)
|
348
|
+
end
|
349
|
+
|
350
|
+
def GetFileAttributesExW(file, level_id, info)
|
351
|
+
GetFileAttributesExW.call(file, level_id, info)
|
352
|
+
end
|
231
353
|
|
232
354
|
def GetFileSize(handle, size)
|
233
355
|
GetFileSize.call(handle, size)
|
@@ -245,13 +367,37 @@ module Windows
|
|
245
367
|
GetFullPathName.call(file, buf, buf_size, part)
|
246
368
|
end
|
247
369
|
|
370
|
+
def GetFullPathNameA(file, buf, buf_size, part)
|
371
|
+
GetFullPathNameA.call(file, buf, buf_size, part)
|
372
|
+
end
|
373
|
+
|
374
|
+
def GetFullPathNameW(file, buf, buf_size, part)
|
375
|
+
GetFullPathNameW.call(file, buf, buf_size, part)
|
376
|
+
end
|
377
|
+
|
248
378
|
def GetLongPathName(short, buf, buf_size)
|
249
379
|
GetLongPathName.call(short, buf, buf_size)
|
250
380
|
end
|
251
381
|
|
382
|
+
def GetLongPathNameA(short, buf, buf_size)
|
383
|
+
GetLongPathNameA.call(short, buf, buf_size)
|
384
|
+
end
|
385
|
+
|
386
|
+
def GetLongPathNameW(short, buf, buf_size)
|
387
|
+
GetLongPathNameW.call(short, buf, buf_size)
|
388
|
+
end
|
389
|
+
|
252
390
|
def GetShortPathName(long, buf, buf_size)
|
253
391
|
GetShortPathName.call(long, buf, buf_size)
|
254
392
|
end
|
393
|
+
|
394
|
+
def GetShortPathNameA(long, buf, buf_size)
|
395
|
+
GetShortPathNameA.call(long, buf, buf_size)
|
396
|
+
end
|
397
|
+
|
398
|
+
def GetShortPathNameW(long, buf, buf_size)
|
399
|
+
GetShortPathNameW.call(long, buf, buf_size)
|
400
|
+
end
|
255
401
|
|
256
402
|
def LockFile(handle, off_low, off_high, lock_low, lock_high)
|
257
403
|
LockFile.call(handle, off_low, off_high, lock_low, lock_high) > 0
|
@@ -272,6 +418,14 @@ module Windows
|
|
272
418
|
def SetFileAttributes(file, attributes)
|
273
419
|
SetFileAttributes.call(file, attributes) > 0
|
274
420
|
end
|
421
|
+
|
422
|
+
def SetFileAttributesA(file, attributes)
|
423
|
+
SetFileAttributesA.call(file, attributes) > 0
|
424
|
+
end
|
425
|
+
|
426
|
+
def SetFileAttributesW(file, attributes)
|
427
|
+
SetFileAttributesW.call(file, attributes) > 0
|
428
|
+
end
|
275
429
|
|
276
430
|
def UnlockFile(handle, off_low, off_high, bytes_low, bytes_high)
|
277
431
|
UnlockFile.call(handle, off_low, off_high, bytes_low, bytes_high) > 0
|
@@ -282,7 +436,7 @@ module Windows
|
|
282
436
|
end
|
283
437
|
|
284
438
|
def WriteFile(handle, buf, bytes, overlapped)
|
285
|
-
|
439
|
+
WriteFile.call(handle, buf, bytes, overlapped) > 0
|
286
440
|
end
|
287
441
|
|
288
442
|
def WriteFileEx(handle, buf, bytes, overlapped, routine)
|
data/lib/windows/msvcrt/file.rb
CHANGED
@@ -12,8 +12,10 @@ module Windows
|
|
12
12
|
S_IWRITE = 0000200 # write permission, owner
|
13
13
|
S_IEXEC = 0000100 # execute/search permission, owner
|
14
14
|
|
15
|
-
Stat
|
16
|
-
|
15
|
+
Stat = Win32API.new('msvcrt', '_stat', 'PP', 'I')
|
16
|
+
Wstat = Win32API.new('msvcrt', '_wstat', 'PP', 'I')
|
17
|
+
Stat64 = Win32API.new('msvcrt', '_stat64', 'PP', 'I')
|
18
|
+
Wstat64 = Win32API.new('msvcrt', '_wstat64', 'PP', 'I')
|
17
19
|
|
18
20
|
def stat(path, buffer)
|
19
21
|
Stat.call(path, buffer)
|
@@ -22,6 +24,14 @@ module Windows
|
|
22
24
|
def stat64(path, buffer)
|
23
25
|
Stat64.call(path, buffer)
|
24
26
|
end
|
27
|
+
|
28
|
+
def wstat(path, buffer)
|
29
|
+
Wstat.call(path, buffer)
|
30
|
+
end
|
31
|
+
|
32
|
+
def wstat64(path, buffer)
|
33
|
+
Wstat64.call(path, buffer)
|
34
|
+
end
|
25
35
|
end
|
26
36
|
end
|
27
37
|
end
|
@@ -3,40 +3,82 @@ require 'Win32API'
|
|
3
3
|
module Windows
|
4
4
|
module MSVCRT
|
5
5
|
module String
|
6
|
-
|
6
|
+
Strcmp = Win32API.new('msvcrt', 'strcmp', 'PP', 'I')
|
7
|
+
Strcpy = Win32API.new('msvcrt', 'strcpy', 'PL', 'L')
|
8
|
+
Strlen = Win32API.new('msvcrt', 'strlen', 'P', 'L')
|
7
9
|
Strrev = Win32API.new('msvcrt', '_strrev', 'P', 'P')
|
8
10
|
|
11
|
+
Mbscmp = Win32API.new('msvcrt', '_mbscmp', 'PP', 'I')
|
9
12
|
Mbscpy = Win32API.new('msvcrt', '_mbscpy', 'PL', 'L')
|
13
|
+
Mbslen = Win32API.new('msvcrt', '_mbslen', 'P', 'L')
|
10
14
|
Mbsrev = Win32API.new('msvcrt', '_mbsrev', 'P', 'P')
|
11
15
|
|
12
|
-
|
16
|
+
Wcscmp = Win32API.new('msvcrt', 'wcscmp', 'PP', 'I')
|
17
|
+
Wcscpy = Win32API.new('msvcrt', 'wcscpy', 'PL', 'L')
|
18
|
+
Wcslen = Win32API.new('msvcrt', 'wcslen', 'P', 'L')
|
13
19
|
Wcsrev = Win32API.new('msvcrt', '_wcsrev', 'P', 'P')
|
14
20
|
|
21
|
+
def strcmp(str1, str2)
|
22
|
+
if str1 == 0 || str2 == 0
|
23
|
+
return nil
|
24
|
+
end
|
25
|
+
Strcmp.call(str1, str2)
|
26
|
+
end
|
27
|
+
|
15
28
|
def strcpy(dest, src)
|
16
29
|
return nil if src == 0
|
17
30
|
Strcpy.call(dest, src)
|
18
31
|
end
|
19
32
|
|
33
|
+
def strlen(string)
|
34
|
+
return nil if string == 0
|
35
|
+
Strlen.call(string)
|
36
|
+
end
|
37
|
+
|
20
38
|
def strrev(str)
|
21
39
|
return nil if str == 0
|
22
40
|
Strrev.call(str)
|
23
41
|
end
|
24
42
|
|
43
|
+
def mbscmp(str1, str2)
|
44
|
+
if str1 == 0 || str2 == 0
|
45
|
+
return nil
|
46
|
+
end
|
47
|
+
Mbscmp.call(str1, str2)
|
48
|
+
end
|
49
|
+
|
25
50
|
def mbscpy(dest, src)
|
26
51
|
return nil if src == 0
|
27
52
|
Mbscpy.call(dest, src)
|
28
53
|
end
|
29
54
|
|
55
|
+
def mbslen(string)
|
56
|
+
return nil if string == 0
|
57
|
+
Mbslen.call(string)
|
58
|
+
end
|
59
|
+
|
30
60
|
def mbsrev(str)
|
31
61
|
return nil if str == 0
|
32
62
|
Mbsrev.call(str)
|
33
63
|
end
|
64
|
+
|
65
|
+
def wcscmp(str1, str2)
|
66
|
+
if str1 == 0 || str2 == 0
|
67
|
+
return nil
|
68
|
+
end
|
69
|
+
Wcscmp.call(str1, str2)
|
70
|
+
end
|
34
71
|
|
35
72
|
def wcscpy(dest, src)
|
36
73
|
return nil if src == 0
|
37
74
|
Wcscpy.call(dest, src)
|
38
75
|
end
|
39
76
|
|
77
|
+
def wcslen(string)
|
78
|
+
return nil if string == 0
|
79
|
+
Wcslen.call(string)
|
80
|
+
end
|
81
|
+
|
40
82
|
def wcsrev(str)
|
41
83
|
return nil if str == 0
|
42
84
|
Wcsrev.call(str)
|
data/lib/windows/national.rb
CHANGED
@@ -199,52 +199,52 @@ module Windows
|
|
199
199
|
LANG_KASHMIRI = 0x60
|
200
200
|
LANG_KAZAK = 0x3f
|
201
201
|
LANG_KONKANI = 0x57
|
202
|
-
LANG_KOREAN
|
203
|
-
LANG_KYRGYZ
|
204
|
-
LANG_LATVIAN
|
205
|
-
LANG_LITHUANIAN
|
206
|
-
LANG_MACEDONIAN
|
207
|
-
LANG_MALAY
|
208
|
-
LANG_MALAYALAM
|
209
|
-
LANG_MALTESE
|
210
|
-
LANG_MANIPURI
|
211
|
-
LANG_MAORI
|
212
|
-
LANG_MARATHI
|
213
|
-
LANG_MONGOLIAN
|
214
|
-
LANG_NEPALI
|
215
|
-
LANG_NORWEGIAN
|
216
|
-
LANG_ORIYA
|
217
|
-
LANG_POLISH
|
218
|
-
LANG_PORTUGUESE
|
219
|
-
LANG_PUNJABI
|
220
|
-
LANG_QUECHUA
|
221
|
-
LANG_ROMANIAN
|
222
|
-
LANG_RUSSIAN
|
223
|
-
LANG_SAMI
|
224
|
-
LANG_SANSKRIT
|
225
|
-
LANG_SERBIAN
|
226
|
-
LANG_SINDHI
|
227
|
-
LANG_SLOVAK
|
228
|
-
LANG_SLOVENIAN
|
229
|
-
LANG_SOTHO
|
230
|
-
LANG_SPANISH
|
231
|
-
LANG_SWAHILI
|
232
|
-
LANG_SWEDISH
|
233
|
-
LANG_SYRIAC
|
234
|
-
LANG_TAMIL
|
235
|
-
LANG_TATAR
|
236
|
-
LANG_TELUGU
|
237
|
-
LANG_THAI
|
238
|
-
LANG_TSWANA
|
239
|
-
LANG_TURKISH
|
240
|
-
LANG_UKRAINIAN
|
241
|
-
LANG_URDU
|
242
|
-
LANG_UZBEK
|
243
|
-
LANG_VIETNAMESE
|
244
|
-
LANG_WELSH
|
245
|
-
LANG_XHOSA
|
246
|
-
LANG_ZULU
|
247
|
-
|
202
|
+
LANG_KOREAN = 0x12
|
203
|
+
LANG_KYRGYZ = 0x40
|
204
|
+
LANG_LATVIAN = 0x26
|
205
|
+
LANG_LITHUANIAN = 0x27
|
206
|
+
LANG_MACEDONIAN = 0x2f
|
207
|
+
LANG_MALAY = 0x3e
|
208
|
+
LANG_MALAYALAM = 0x4c
|
209
|
+
LANG_MALTESE = 0x3a
|
210
|
+
LANG_MANIPURI = 0x58
|
211
|
+
LANG_MAORI = 0x81
|
212
|
+
LANG_MARATHI = 0x4e
|
213
|
+
LANG_MONGOLIAN = 0x50
|
214
|
+
LANG_NEPALI = 0x61
|
215
|
+
LANG_NORWEGIAN = 0x14
|
216
|
+
LANG_ORIYA = 0x48
|
217
|
+
LANG_POLISH = 0x15
|
218
|
+
LANG_PORTUGUESE = 0x16
|
219
|
+
LANG_PUNJABI = 0x46
|
220
|
+
LANG_QUECHUA = 0x6b
|
221
|
+
LANG_ROMANIAN = 0x18
|
222
|
+
LANG_RUSSIAN = 0x19
|
223
|
+
LANG_SAMI = 0x3b
|
224
|
+
LANG_SANSKRIT = 0x4f
|
225
|
+
LANG_SERBIAN = 0x1a
|
226
|
+
LANG_SINDHI = 0x59
|
227
|
+
LANG_SLOVAK = 0x1b
|
228
|
+
LANG_SLOVENIAN = 0x24
|
229
|
+
LANG_SOTHO = 0x6c
|
230
|
+
LANG_SPANISH = 0x0a
|
231
|
+
LANG_SWAHILI = 0x41
|
232
|
+
LANG_SWEDISH = 0x1d
|
233
|
+
LANG_SYRIAC = 0x5a
|
234
|
+
LANG_TAMIL = 0x49
|
235
|
+
LANG_TATAR = 0x44
|
236
|
+
LANG_TELUGU = 0x4a
|
237
|
+
LANG_THAI = 0x1e
|
238
|
+
LANG_TSWANA = 0x32
|
239
|
+
LANG_TURKISH = 0x1f
|
240
|
+
LANG_UKRAINIAN = 0x22
|
241
|
+
LANG_URDU = 0x20
|
242
|
+
LANG_UZBEK = 0x43
|
243
|
+
LANG_VIETNAMESE = 0x2a
|
244
|
+
LANG_WELSH = 0x52
|
245
|
+
LANG_XHOSA = 0x34
|
246
|
+
LANG_ZULU = 0x35
|
247
|
+
|
248
248
|
SUBLANG_NEUTRAL = 0x00 # language neutral
|
249
249
|
SUBLANG_DEFAULT = 0x01 # user default
|
250
250
|
SUBLANG_SYS_DEFAULT = 0x02 # system default
|
@@ -326,70 +326,70 @@ module Windows
|
|
326
326
|
SUBLANG_SAMI_SOUTHERN_SWEDEN = 0x07 # Southern Sami (Sweden)
|
327
327
|
SUBLANG_SAMI_SKOLT_FINLAND = 0x08 # Skolt Sami (Finland)
|
328
328
|
SUBLANG_SAMI_INARI_FINLAND = 0x09 # Inari Sami (Finland)
|
329
|
-
SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN = 0x06
|
329
|
+
SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN = 0x06 # Serbian (Bosnia and Herzegovina - Latin)
|
330
330
|
SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC = 0x07 # Serbian (Bosnia and Herzegovina - Cyrillic)
|
331
331
|
SUBLANG_SERBIAN_LATIN = 0x02 # Serbian (Latin)
|
332
332
|
SUBLANG_SERBIAN_CYRILLIC = 0x03 # Serbian (Cyrillic)
|
333
|
-
SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA = 0x01
|
334
|
-
SUBLANG_SPANISH = 0x01
|
335
|
-
SUBLANG_SPANISH_MEXICAN = 0x02
|
336
|
-
SUBLANG_SPANISH_MODERN = 0x03
|
337
|
-
SUBLANG_SPANISH_GUATEMALA = 0x04
|
338
|
-
SUBLANG_SPANISH_COSTA_RICA = 0x05
|
339
|
-
SUBLANG_SPANISH_PANAMA = 0x06
|
333
|
+
SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA = 0x01 # Northern Sotho (South Africa)
|
334
|
+
SUBLANG_SPANISH = 0x01 # Spanish (Castilian)
|
335
|
+
SUBLANG_SPANISH_MEXICAN = 0x02 # Spanish (Mexican)
|
336
|
+
SUBLANG_SPANISH_MODERN = 0x03 # Spanish (Modern)
|
337
|
+
SUBLANG_SPANISH_GUATEMALA = 0x04 # Spanish (Guatemala)
|
338
|
+
SUBLANG_SPANISH_COSTA_RICA = 0x05 # Spanish (Costa Rica)
|
339
|
+
SUBLANG_SPANISH_PANAMA = 0x06 # Spanish (Panama)
|
340
340
|
SUBLANG_SPANISH_DOMINICAN_REPUBLIC = 0x07 # Spanish (Dominican Republic)
|
341
|
-
SUBLANG_SPANISH_VENEZUELA = 0x08
|
342
|
-
SUBLANG_SPANISH_COLOMBIA = 0x09
|
343
|
-
SUBLANG_SPANISH_PERU = 0x0a
|
344
|
-
SUBLANG_SPANISH_ARGENTINA = 0x0b
|
345
|
-
SUBLANG_SPANISH_ECUADOR = 0x0c
|
346
|
-
SUBLANG_SPANISH_CHILE = 0x0d
|
347
|
-
SUBLANG_SPANISH_URUGUAY = 0x0e
|
348
|
-
SUBLANG_SPANISH_PARAGUAY = 0x0f
|
349
|
-
SUBLANG_SPANISH_BOLIVIA = 0x10
|
350
|
-
SUBLANG_SPANISH_EL_SALVADOR = 0x11
|
351
|
-
SUBLANG_SPANISH_HONDURAS = 0x12
|
352
|
-
SUBLANG_SPANISH_NICARAGUA = 0x13
|
353
|
-
SUBLANG_SPANISH_PUERTO_RICO = 0x14
|
354
|
-
SUBLANG_SWEDISH = 0x01
|
355
|
-
SUBLANG_SWEDISH_FINLAND = 0x02
|
356
|
-
SUBLANG_URDU_PAKISTAN = 0x01
|
357
|
-
SUBLANG_URDU_INDIA = 0x02
|
358
|
-
SUBLANG_UZBEK_LATIN = 0x01
|
359
|
-
SUBLANG_UZBEK_CYRILLIC = 0x02
|
341
|
+
SUBLANG_SPANISH_VENEZUELA = 0x08 # Spanish (Venezuela)
|
342
|
+
SUBLANG_SPANISH_COLOMBIA = 0x09 # Spanish (Colombia)
|
343
|
+
SUBLANG_SPANISH_PERU = 0x0a # Spanish (Peru)
|
344
|
+
SUBLANG_SPANISH_ARGENTINA = 0x0b # Spanish (Argentina)
|
345
|
+
SUBLANG_SPANISH_ECUADOR = 0x0c # Spanish (Ecuador)
|
346
|
+
SUBLANG_SPANISH_CHILE = 0x0d # Spanish (Chile)
|
347
|
+
SUBLANG_SPANISH_URUGUAY = 0x0e # Spanish (Uruguay)
|
348
|
+
SUBLANG_SPANISH_PARAGUAY = 0x0f # Spanish (Paraguay)
|
349
|
+
SUBLANG_SPANISH_BOLIVIA = 0x10 # Spanish (Bolivia)
|
350
|
+
SUBLANG_SPANISH_EL_SALVADOR = 0x11 # Spanish (El Salvador)
|
351
|
+
SUBLANG_SPANISH_HONDURAS = 0x12 # Spanish (Honduras)
|
352
|
+
SUBLANG_SPANISH_NICARAGUA = 0x13 # Spanish (Nicaragua)
|
353
|
+
SUBLANG_SPANISH_PUERTO_RICO = 0x14 # Spanish (Puerto Rico)
|
354
|
+
SUBLANG_SWEDISH = 0x01 # Swedish
|
355
|
+
SUBLANG_SWEDISH_FINLAND = 0x02 # Swedish (Finland)
|
356
|
+
SUBLANG_URDU_PAKISTAN = 0x01 # Urdu (Pakistan)
|
357
|
+
SUBLANG_URDU_INDIA = 0x02 # Urdu (India)
|
358
|
+
SUBLANG_UZBEK_LATIN = 0x01 # Uzbek (Latin)
|
359
|
+
SUBLANG_UZBEK_CYRILLIC = 0x02 # Uzbek (Cyrillic)
|
360
360
|
|
361
361
|
LOCALE_NOUSEROVERRIDE = 0x80000000
|
362
362
|
LOCALE_USE_CP_ACP = 0x40000000
|
363
363
|
LOCALE_RETURN_NUMBER = 0x20000000
|
364
364
|
|
365
|
-
LOCALE_ILANGUAGE = 0x00000001
|
366
|
-
LOCALE_SLANGUAGE = 0x00000002
|
367
|
-
LOCALE_SENGLANGUAGE = 0x00001001
|
368
|
-
LOCALE_SABBREVLANGNAME = 0x00000003
|
369
|
-
LOCALE_SNATIVELANGNAME = 0x00000004
|
365
|
+
LOCALE_ILANGUAGE = 0x00000001 # Language ID
|
366
|
+
LOCALE_SLANGUAGE = 0x00000002 # Localized name of language
|
367
|
+
LOCALE_SENGLANGUAGE = 0x00001001 # English name of language
|
368
|
+
LOCALE_SABBREVLANGNAME = 0x00000003 # Abbreviated language name
|
369
|
+
LOCALE_SNATIVELANGNAME = 0x00000004 # Native name of language
|
370
370
|
|
371
|
-
LOCALE_ICOUNTRY = 0x00000005
|
372
|
-
LOCALE_SCOUNTRY = 0x00000006
|
373
|
-
LOCALE_SENGCOUNTRY = 0x00001002
|
374
|
-
LOCALE_SABBREVCTRYNAME = 0x00000007
|
375
|
-
LOCALE_SNATIVECTRYNAME = 0x00000008
|
371
|
+
LOCALE_ICOUNTRY = 0x00000005 # Country code
|
372
|
+
LOCALE_SCOUNTRY = 0x00000006 # Localized name of country
|
373
|
+
LOCALE_SENGCOUNTRY = 0x00001002 # English name of country
|
374
|
+
LOCALE_SABBREVCTRYNAME = 0x00000007 # Abbreviated country name
|
375
|
+
LOCALE_SNATIVECTRYNAME = 0x00000008 # Native name of country
|
376
376
|
|
377
|
-
LOCALE_IDEFAULTLANGUAGE = 0x00000009
|
378
|
-
LOCALE_IDEFAULTCOUNTRY = 0x0000000A
|
379
|
-
LOCALE_IDEFAULTCODEPAGE = 0x0000000B
|
380
|
-
LOCALE_IDEFAULTANSICODEPAGE = 0x00001004
|
381
|
-
LOCALE_IDEFAULTMACCODEPAGE = 0x00001011
|
377
|
+
LOCALE_IDEFAULTLANGUAGE = 0x00000009 # default language id
|
378
|
+
LOCALE_IDEFAULTCOUNTRY = 0x0000000A # default country code
|
379
|
+
LOCALE_IDEFAULTCODEPAGE = 0x0000000B # default oem code page
|
380
|
+
LOCALE_IDEFAULTANSICODEPAGE = 0x00001004 # default ansi code page
|
381
|
+
LOCALE_IDEFAULTMACCODEPAGE = 0x00001011 # default mac code page
|
382
382
|
|
383
|
-
LOCALE_SLIST = 0x0000000C
|
384
|
-
LOCALE_IMEASURE = 0x0000000D
|
383
|
+
LOCALE_SLIST = 0x0000000C # list item separator
|
384
|
+
LOCALE_IMEASURE = 0x0000000D # 0 = metric, 1 = US
|
385
385
|
|
386
|
-
LOCALE_SDECIMAL = 0x0000000E
|
387
|
-
LOCALE_STHOUSAND = 0x0000000F
|
388
|
-
LOCALE_SGROUPING = 0x00000010
|
389
|
-
LOCALE_IDIGITS = 0x00000011
|
390
|
-
LOCALE_ILZERO = 0x00000012
|
391
|
-
LOCALE_INEGNUMBER = 0x00001010
|
392
|
-
LOCALE_SNATIVEDIGITS = 0x00000013
|
386
|
+
LOCALE_SDECIMAL = 0x0000000E # decimal separator
|
387
|
+
LOCALE_STHOUSAND = 0x0000000F # thousand separator
|
388
|
+
LOCALE_SGROUPING = 0x00000010 # digit grouping
|
389
|
+
LOCALE_IDIGITS = 0x00000011 # number of fractional digits
|
390
|
+
LOCALE_ILZERO = 0x00000012 # leading zeros for decimal
|
391
|
+
LOCALE_INEGNUMBER = 0x00001010 # negative number mode
|
392
|
+
LOCALE_SNATIVEDIGITS = 0x00000013 # native ascii 0-9
|
393
393
|
|
394
394
|
LOCALE_SCURRENCY = 0x00000014 # local monetary symbol
|
395
395
|
LOCALE_SINTLSYMBOL = 0x00000015 # intl monetary symbol
|
@@ -523,9 +523,16 @@ module Windows
|
|
523
523
|
LANG_USER_DEFAULT = 1024
|
524
524
|
LOCALE_SYSTEM_DEFAULT = 2048
|
525
525
|
LOCALE_USER_DEFAULT = 1024
|
526
|
+
LOCALE_INVARIANT = 8323072
|
526
527
|
|
527
528
|
GetACP = Win32API.new('kernel32', 'GetACP', 'V', 'I')
|
528
529
|
GetDateFormat = Win32API.new('kernel32', 'GetDateFormat', 'LLPPPI', 'I')
|
530
|
+
GetLocaleInfo = Win32API.new('kernel32', 'GetLocaleInfo', 'LLPL', 'I')
|
531
|
+
|
532
|
+
GetSystemDefaultLangID = Win32API.new('kernel32', 'GetSystemDefaultLangID', 'V', 'L')
|
533
|
+
GetSystemDefaultLCID = Win32API.new('kernel32', 'GetSystemDefaultLCID', 'V', 'L')
|
534
|
+
GetUserDefaultLangID = Win32API.new('kernel32', 'GetUserDefaultLangID', 'V', 'L')
|
535
|
+
GetUserDefaultLCID = Win32API.new('kernel32', 'GetUserDefaultLCID', 'V', 'L')
|
529
536
|
|
530
537
|
def GetACP()
|
531
538
|
GetACP.call
|
@@ -535,6 +542,26 @@ module Windows
|
|
535
542
|
GetDateFormat.call(locale, flags, date, format, datestr, size)
|
536
543
|
end
|
537
544
|
|
545
|
+
def GetLocaleInfo(locale, lctype, lcdata, size)
|
546
|
+
GetLocaleInfo.call(locale, lctype, lcdata, size)
|
547
|
+
end
|
548
|
+
|
549
|
+
def GetSystemDefaultLangID()
|
550
|
+
GetSystemDefaultLangID.call
|
551
|
+
end
|
552
|
+
|
553
|
+
def GetSystemDefaultLCID()
|
554
|
+
GetSystemDefaultLCID.call
|
555
|
+
end
|
556
|
+
|
557
|
+
def GetUserDefaultLangID()
|
558
|
+
GetUserDefaultLangID.call
|
559
|
+
end
|
560
|
+
|
561
|
+
def GetUserDefaultLCID()
|
562
|
+
GetUserDefaultLCID.call
|
563
|
+
end
|
564
|
+
|
538
565
|
# Convenience method for converting the results of the GetACP()
|
539
566
|
# function to a human readable string.
|
540
567
|
#
|
@@ -554,4 +581,4 @@ module Windows
|
|
554
581
|
s << 10 | p
|
555
582
|
end
|
556
583
|
end
|
557
|
-
end
|
584
|
+
end
|
data/lib/windows/path.rb
CHANGED
@@ -10,26 +10,85 @@ module Windows
|
|
10
10
|
GCT_SEPARATOR = 0x0008 # The character is a path separator.
|
11
11
|
|
12
12
|
PathAddBackslash = Win32API.new('shlwapi', 'PathAddBackslash', 'P', 'P')
|
13
|
+
PathAddBackslashA = Win32API.new('shlwapi', 'PathAddBackslashA', 'P', 'P')
|
14
|
+
PathAddBackslashW = Win32API.new('shlwapi', 'PathAddBackslashW', 'P', 'P')
|
15
|
+
|
13
16
|
PathAddExtension = Win32API.new('shlwapi', 'PathAddExtension', 'PP', 'I')
|
14
|
-
|
15
|
-
|
17
|
+
PathAddExtensionA = Win32API.new('shlwapi', 'PathAddExtensionA', 'PP', 'I')
|
18
|
+
PathAddExtensionW = Win32API.new('shlwapi', 'PathAddExtensionW', 'PP', 'I')
|
19
|
+
|
20
|
+
PathAppend = Win32API.new('shlwapi', 'PathAppend', 'PP', 'I')
|
21
|
+
PathAppendA = Win32API.new('shlwapi', 'PathAppendA', 'PP', 'I')
|
22
|
+
PathAppendW = Win32API.new('shlwapi', 'PathAppendW', 'PP', 'I')
|
23
|
+
|
24
|
+
PathBuildRoot = Win32API.new('shlwapi', 'PathBuildRoot', 'PI', 'P')
|
25
|
+
PathBuildRootA = Win32API.new('shlwapi', 'PathBuildRootA', 'PI', 'P')
|
26
|
+
PathBuildRootW = Win32API.new('shlwapi', 'PathBuildRootW', 'PI', 'P')
|
27
|
+
|
16
28
|
PathCanonicalize = Win32API.new('shlwapi', 'PathCanonicalize', 'PP', 'I')
|
17
|
-
|
29
|
+
PathCanonicalizeA = Win32API.new('shlwapi', 'PathCanonicalizeA', 'PP', 'I')
|
30
|
+
PathCanonicalizeW = Win32API.new('shlwapi', 'PathCanonicalizeW', 'PP', 'I')
|
31
|
+
|
32
|
+
PathCombine = Win32API.new('shlwapi', 'PathCombine', 'PPP', 'P')
|
33
|
+
PathCombineA = Win32API.new('shlwapi', 'PathCombineA', 'PPP', 'P')
|
34
|
+
PathCombineW = Win32API.new('shlwapi', 'PathCombineW', 'PPP', 'P')
|
35
|
+
|
18
36
|
PathCommonPrefix = Win32API.new('shlwapi', 'PathCommonPrefix', 'PPP', 'I')
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
37
|
+
PathCommonPrefixA = Win32API.new('shlwapi', 'PathCommonPrefixA', 'PPP', 'I')
|
38
|
+
PathCommonPrefixW = Win32API.new('shlwapi', 'PathCommonPrefixW', 'PPP', 'I')
|
39
|
+
|
40
|
+
PathCompactPath = Win32API.new('shlwapi', 'PathCompactPath', 'PPI', 'I')
|
41
|
+
PathCompactPathA = Win32API.new('shlwapi', 'PathCompactPathA', 'PPI', 'I')
|
42
|
+
PathCompactPathW = Win32API.new('shlwapi', 'PathCompactPathW', 'PPI', 'I')
|
43
|
+
|
44
|
+
PathCompactPathEx = Win32API.new('shlwapi', 'PathCompactPathEx', 'PPIL', 'I')
|
45
|
+
PathCompactPathExA = Win32API.new('shlwapi', 'PathCompactPathExA', 'PPIL', 'I')
|
46
|
+
PathCompactPathExW = Win32API.new('shlwapi', 'PathCompactPathExW', 'PPIL', 'I')
|
47
|
+
|
48
|
+
PathCreateFromUrl = Win32API.new('shlwapi', 'PathCreateFromUrl', 'PPPL', 'L')
|
49
|
+
PathCreateFromUrlA = Win32API.new('shlwapi', 'PathCreateFromUrlA', 'PPPL', 'L')
|
50
|
+
PathCreateFromUrlW = Win32API.new('shlwapi', 'PathCreateFromUrlW', 'PPPL', 'L')
|
51
|
+
|
52
|
+
PathFileExists = Win32API.new('shlwapi', 'PathFileExists', 'P', 'I')
|
53
|
+
PathFileExistsA = Win32API.new('shlwapi', 'PathFileExistsA', 'P', 'I')
|
54
|
+
PathFileExistsW = Win32API.new('shlwapi', 'PathFileExistsW', 'P', 'I')
|
55
|
+
|
56
|
+
PathFindExtension = Win32API.new('shlwapi', 'PathFindExtension', 'P', 'P')
|
57
|
+
PathFindExtensionA = Win32API.new('shlwapi', 'PathFindExtensionA', 'P', 'P')
|
58
|
+
PathFindExtensionW = Win32API.new('shlwapi', 'PathFindExtensionW', 'P', 'P')
|
59
|
+
|
24
60
|
PathFindFileName = Win32API.new('shlwapi', 'PathFindFileName', 'P', 'P')
|
61
|
+
PathFindFileNameA = Win32API.new('shlwapi', 'PathFindFileNameA', 'P', 'P')
|
62
|
+
PathFindFileNameW = Win32API.new('shlwapi', 'PathFindFileNameW', 'P', 'P')
|
25
63
|
|
26
64
|
PathFindNextComponent = Win32API.new('shlwapi', 'PathFindNextComponent', 'P', 'P')
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
65
|
+
PathFindNextComponentA = Win32API.new('shlwapi', 'PathFindNextComponentA', 'P', 'P')
|
66
|
+
PathFindNextComponentW = Win32API.new('shlwapi', 'PathFindNextComponentW', 'P', 'P')
|
67
|
+
|
68
|
+
PathFindOnPath = Win32API.new('shlwapi', 'PathFindOnPath', 'PP', 'I')
|
69
|
+
PathFindOnPathA = Win32API.new('shlwapi', 'PathFindOnPathA', 'PP', 'I')
|
70
|
+
PathFindOnPathW = Win32API.new('shlwapi', 'PathFindOnPathW', 'PP', 'I')
|
71
|
+
|
72
|
+
PathFindSuffixArray = Win32API.new('shlwapi', 'PathFindSuffixArray', 'PPI', 'P')
|
73
|
+
PathFindSuffixArrayA = Win32API.new('shlwapi', 'PathFindSuffixArrayA', 'PPI', 'P')
|
74
|
+
PathFindSuffixArrayW = Win32API.new('shlwapi', 'PathFindSuffixArrayW', 'PPI', 'P')
|
75
|
+
|
76
|
+
PathGetArgs = Win32API.new('shlwapi', 'PathGetArgs', 'P', 'P')
|
77
|
+
PathGetArgsA = Win32API.new('shlwapi', 'PathGetArgsA', 'P', 'P')
|
78
|
+
PathGetArgsW = Win32API.new('shlwapi', 'PathGetArgsW', 'P', 'P')
|
79
|
+
|
80
|
+
PathGetCharType = Win32API.new('shlwapi', 'PathGetCharType', 'P', 'I')
|
81
|
+
PathGetCharTypeA = Win32API.new('shlwapi', 'PathGetCharTypeA', 'P', 'I')
|
82
|
+
PathGetCharTypeW = Win32API.new('shlwapi', 'PathGetCharTypeW', 'P', 'I')
|
83
|
+
|
84
|
+
PathGetDriveNumber = Win32API.new('shlwapi', 'PathGetDriveNumber', 'P', 'I')
|
85
|
+
PathGetDriveNumberA = Win32API.new('shlwapi', 'PathGetDriveNumberA', 'P', 'I')
|
86
|
+
PathGetDriveNumberW = Win32API.new('shlwapi', 'PathGetDriveNumberW', 'P', 'I')
|
87
|
+
|
88
|
+
PathIsContentType = Win32API.new('shlwapi', 'PathIsContentType', 'PP', 'I')
|
89
|
+
PathIsContentTypeA = Win32API.new('shlwapi', 'PathIsContentTypeA', 'PP', 'I')
|
90
|
+
PathIsContentTypeW = Win32API.new('shlwapi', 'PathIsContentTypeW', 'PP', 'I')
|
91
|
+
|
33
92
|
PathIsDirectory = Win32API.new('shlwapi', 'PathIsDirectory', 'P', 'I')
|
34
93
|
PathIsDirectoryEmpty = Win32API.new('shlwapi', 'PathIsDirectoryEmpty', 'P', 'I')
|
35
94
|
PathIsFileSpec = Win32API.new('shlwapi', 'PathIsFileSpec', 'P', 'I')
|
data/lib/windows/unicode.rb
CHANGED
@@ -105,33 +105,63 @@ module Windows
|
|
105
105
|
|
106
106
|
# Convenient wrapper methods
|
107
107
|
|
108
|
-
# Maps a string to a wide (unicode) string using
|
109
|
-
#
|
108
|
+
# Maps a string to a wide (unicode) string using +encoding+. If no
|
109
|
+
# encoding is specified, then CP_UTF8 is used if $KCODE is set to UTF8.
|
110
|
+
# Otherwise, CP_ACP is used.
|
110
111
|
#
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
112
|
+
# If the function fails it simply returns the string as-is.
|
113
|
+
#
|
114
|
+
def multi_to_wide(string, encoding=nil)
|
115
|
+
unless encoding
|
116
|
+
encoding = ($KCODE == 'UTF8') ? CP_UTF8 : CP_ACP
|
117
|
+
end
|
118
|
+
|
119
|
+
buf = 0.chr * string.size * 2 # sizeof(WCHAR)
|
120
|
+
|
121
|
+
int = MultiByteToWideChar(
|
122
|
+
encoding,
|
123
|
+
0,
|
124
|
+
string,
|
125
|
+
string.size,
|
126
|
+
buf,
|
127
|
+
buf.size
|
128
|
+
)
|
115
129
|
|
116
130
|
if int > 0
|
117
131
|
buf[0, int*2]
|
118
132
|
else
|
119
|
-
|
133
|
+
string
|
120
134
|
end
|
121
135
|
end
|
122
136
|
|
123
|
-
# Maps a wide character string to a new character string
|
124
|
-
#
|
137
|
+
# Maps a wide character string to a new character string using the
|
138
|
+
# specified +encoding+. If no encoding is specified, then CP_UTF8
|
139
|
+
# iss used if $KCODE is set to UTF8. Otherwise, CP_ACP is used.
|
140
|
+
#
|
141
|
+
# If the function fails it simply returns the string as-is.
|
125
142
|
#
|
126
|
-
def wide_to_multi(
|
127
|
-
|
128
|
-
|
129
|
-
|
143
|
+
def wide_to_multi(string, encoding=nil)
|
144
|
+
unless encoding
|
145
|
+
encoding = ($KCODE == 'UTF8') ? CP_UTF8 : CP_ACP
|
146
|
+
end
|
147
|
+
|
148
|
+
buf = 0.chr * string.size
|
149
|
+
|
150
|
+
int = WideCharToMultiByte(
|
151
|
+
encoding,
|
152
|
+
0,
|
153
|
+
string,
|
154
|
+
string.size/2,
|
155
|
+
buf,
|
156
|
+
buf.size,
|
157
|
+
0,
|
158
|
+
0
|
159
|
+
)
|
130
160
|
|
131
161
|
if int > 0
|
132
162
|
buf[0, int]
|
133
163
|
else
|
134
|
-
|
164
|
+
string
|
135
165
|
end
|
136
166
|
end
|
137
167
|
end
|
data/lib/windows/volume.rb
CHANGED
@@ -23,10 +23,17 @@ module Windows
|
|
23
23
|
GetVolumeInformation = Win32API.new('kernel32', 'GetVolumeInformation', 'PPLPPPPL', 'I')
|
24
24
|
GetVolumeNameForVolumeMountPoint = Win32API.new('kernel32', 'GetVolumeNameForVolumeMountPoint', 'PPL', 'I')
|
25
25
|
GetVolumePathName = Win32API.new('kernel32', 'GetVolumePathName', 'PPL', 'I')
|
26
|
-
GetVolumePathNamesForVolumeName = Win32API.new('kernel32', 'GetVolumePathNamesForVolumeName', 'PPLL', 'I')
|
27
26
|
|
28
27
|
SetVolumeLabel = Win32API.new('kernel32', 'SetVolumeLabel', 'PP', 'I')
|
29
28
|
SetVolumeMountPoint = Win32API.new('kernel32', 'SetVolumeMountPoint', 'PP', 'I')
|
29
|
+
|
30
|
+
# Windows XP or later
|
31
|
+
begin
|
32
|
+
GetVolumePathNamesForVolumeName = Win32API.new('kernel32', 'GetVolumePathNamesForVolumeName', 'PPLL', 'I')
|
33
|
+
rescue
|
34
|
+
# Do nothing - not supported on current platform. It's up to you to
|
35
|
+
# check for the existence of the constant in your code.
|
36
|
+
end
|
30
37
|
|
31
38
|
def FindFirstVolume(name, length=name.size)
|
32
39
|
FindFirstVolume.call(name, length)
|
@@ -76,10 +83,6 @@ module Windows
|
|
76
83
|
GetVolumePathName.call(file, name, length) != 0
|
77
84
|
end
|
78
85
|
|
79
|
-
def GetVolumePathNamesForVolumeName(volume, paths, buf_len, return_len)
|
80
|
-
GetVolumePathNamesForVolumeName.call(volume, paths, buf_len, return_len) != 0
|
81
|
-
end
|
82
|
-
|
83
86
|
def SetVolumeLabel(label, volume)
|
84
87
|
SetVolumeLabel.call(label, volume) != 0
|
85
88
|
end
|
@@ -87,5 +90,13 @@ module Windows
|
|
87
90
|
def SetVolumeMountPoint(mount, name)
|
88
91
|
SetVolumeMountPoint.call(mount, name) != 0
|
89
92
|
end
|
93
|
+
|
94
|
+
begin
|
95
|
+
def GetVolumePathNamesForVolumeName(volume, paths, buf_len, return_len)
|
96
|
+
GetVolumePathNamesForVolumeName.call(volume, paths, buf_len, return_len) != 0
|
97
|
+
end
|
98
|
+
rescue Exception
|
99
|
+
# Windows XP or later
|
100
|
+
end
|
90
101
|
end
|
91
102
|
end
|
data/windows-pr.gemspec
CHANGED
@@ -2,7 +2,7 @@ require "rubygems"
|
|
2
2
|
|
3
3
|
spec = Gem::Specification.new do |gem|
|
4
4
|
gem.name = "windows-pr"
|
5
|
-
gem.version = "0.6.
|
5
|
+
gem.version = "0.6.4"
|
6
6
|
gem.author = "Daniel J. Berger"
|
7
7
|
gem.email = "djberg96@gmail.com"
|
8
8
|
gem.homepage = "http://www.rubyforge.org/projects/win32utils"
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.2
|
3
3
|
specification_version: 1
|
4
4
|
name: windows-pr
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.6.
|
7
|
-
date: 2007-02-
|
6
|
+
version: 0.6.4
|
7
|
+
date: 2007-02-28 00:00:00 -07:00
|
8
8
|
summary: Windows functions and constants predefined via Win32API
|
9
9
|
require_paths:
|
10
10
|
- lib
|