windows-pr 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +9 -0
- data/MANIFEST +3 -1
- data/doc/conversion_guide.txt +5 -1
- data/lib/windows/error.rb +4 -0
- data/lib/windows/file.rb +28 -8
- data/lib/windows/file_mapping.rb +0 -18
- data/lib/windows/memory.rb +33 -8
- data/lib/windows/msvcrt/directory.rb +93 -0
- data/lib/windows/msvcrt/file.rb +20 -0
- data/lib/windows/msvcrt/time.rb +168 -0
- data/lib/windows/nio.rb +0 -4
- data/lib/windows/security.rb +8 -0
- data/lib/windows/synchronize.rb +11 -0
- data/lib/windows/time.rb +1 -1
- data/windows-pr.gemspec +1 -1
- metadata +18 -9
data/CHANGES
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
= 0.7.2 - 15-Oct-2007
|
2
|
+
* Added the Windows::MSVCRT::Time module.
|
3
|
+
* Added the Windows::MSVCRT::Directory module.
|
4
|
+
* Added some SID related security constants to the Windows::Security module.
|
5
|
+
* Added more constants and the HasOverlappedIoCompleted macro to the
|
6
|
+
Windows::Synchronize module.
|
7
|
+
* Added some 'find' methods to the Windows::File module.
|
8
|
+
* Some prototype fixes for the 'Virtual' functions in Windows::Memory.
|
9
|
+
|
1
10
|
= 0.7.1 - 21-Sep-2007
|
2
11
|
* Added USN (changejournal) macros to Windows::DeviceIO.
|
3
12
|
* Added the Heap functions to Windows::Memory.
|
data/MANIFEST
CHANGED
@@ -42,6 +42,8 @@ lib/windows/gdi/device_context.rb
|
|
42
42
|
lib/windows/gdi/painting_drawing.rb
|
43
43
|
|
44
44
|
lib/windows/msvcrt/buffer.rb
|
45
|
+
lib/windows/msvcrt/directory.rb
|
45
46
|
lib/windows/msvcrt/file.rb
|
46
47
|
lib/windows/msvcrt/io.rb
|
47
|
-
lib/windows/msvcrt/string.rb
|
48
|
+
lib/windows/msvcrt/string.rb
|
49
|
+
lib/windows/msvcrt/time.rb
|
data/doc/conversion_guide.txt
CHANGED
@@ -13,6 +13,7 @@ LPTSTR => 'P'
|
|
13
13
|
UINT => 'I'
|
14
14
|
VOID => 'V'
|
15
15
|
WORD => 'I'
|
16
|
+
LPVOID => 'L' (or 'P')
|
16
17
|
|
17
18
|
= C Data Types
|
18
19
|
void => 'V'
|
@@ -22,4 +23,7 @@ const char* => 'L'
|
|
22
23
|
int => 'I'
|
23
24
|
long => 'L'
|
24
25
|
struct => 'P'
|
25
|
-
struct* => 'P'
|
26
|
+
struct* => 'P'
|
27
|
+
|
28
|
+
In practice most LPVOID types should be designated as 'L' because this
|
29
|
+
usually means the function is looking for an address.
|
data/lib/windows/error.rb
CHANGED
@@ -204,6 +204,10 @@ module Windows
|
|
204
204
|
ERROR_TOO_MANY_MODULES = 214
|
205
205
|
ERROR_NESTING_NOT_ALLOWED = 215
|
206
206
|
ERROR_MORE_DATA = 234
|
207
|
+
|
208
|
+
ERROR_OPERATION_ABORTED = 995
|
209
|
+
ERROR_IO_INCOMPLETE = 996
|
210
|
+
ERROR_IO_PENDING = 997
|
207
211
|
|
208
212
|
ERROR_USER_DEFINED_BASE = 0xF000
|
209
213
|
|
data/lib/windows/file.rb
CHANGED
@@ -10,6 +10,10 @@ module Windows
|
|
10
10
|
API.auto_method = true
|
11
11
|
API.auto_unicode = true
|
12
12
|
|
13
|
+
FILE_BEGIN = 0
|
14
|
+
FILE_CURRENT = 1
|
15
|
+
FILE_END = 2
|
16
|
+
|
13
17
|
# File Attributes
|
14
18
|
FILE_ATTRIBUTE_READONLY = 0x00000001
|
15
19
|
FILE_ATTRIBUTE_HIDDEN = 0x00000002
|
@@ -173,21 +177,32 @@ module Windows
|
|
173
177
|
SECTION_EXTEND_SIZE
|
174
178
|
|
175
179
|
# Errors
|
176
|
-
INVALID_FILE_ATTRIBUTES
|
177
|
-
INVALID_HANDLE_VALUE
|
178
|
-
|
180
|
+
INVALID_FILE_ATTRIBUTES = -1
|
181
|
+
INVALID_HANDLE_VALUE = -1
|
182
|
+
INVALID_SET_FILE_POINTER = -1
|
183
|
+
INVALID_FILE_SIZE = 0xFFFFFFFF
|
179
184
|
|
180
185
|
# Misc
|
181
|
-
LOCKFILE_EXCLUSIVE_LOCK
|
182
|
-
LOCKFILE_FAIL_IMMEDIATELY
|
186
|
+
LOCKFILE_EXCLUSIVE_LOCK = 0x00000001
|
187
|
+
LOCKFILE_FAIL_IMMEDIATELY = 0x00000002
|
188
|
+
MOVEFILE_REPLACE_EXISTING = 0x00000001
|
189
|
+
MOVEFILE_COPY_ALLOWED = 0x00000002
|
190
|
+
MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004
|
191
|
+
MOVEFILE_WRITE_THROUGH = 0x00000008
|
192
|
+
MOVEFILE_CREATE_HARDLINK = 0x00000010
|
193
|
+
MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x00000020
|
183
194
|
|
184
195
|
API.new('CopyFile', 'PPI', 'B')
|
185
|
-
API.new('CopyFileEx', '
|
196
|
+
API.new('CopyFileEx', 'PPKPPL', 'B')
|
186
197
|
API.new('CreateFile', 'PLLPLLL', 'L')
|
187
198
|
API.new('CreateHardLink', 'PPP', 'B')
|
188
199
|
API.new('DecryptFile', 'PL', 'B', 'advapi32')
|
189
200
|
API.new('DeleteFile', 'P', 'B')
|
190
201
|
API.new('EncryptFile', 'P', 'B', 'advapi32')
|
202
|
+
API.new('FindClose', 'L', 'B')
|
203
|
+
API.new('FindFirstFile', 'PP', 'L')
|
204
|
+
API.new('FindFirstFileEx', 'PIPIII', 'L')
|
205
|
+
API.new('FindNextFile', 'LP', 'B')
|
191
206
|
API.new('GetBinaryType', 'PP', 'B')
|
192
207
|
API.new('GetFileAttributes', 'P', 'L')
|
193
208
|
API.new('GetFileAttributesEx', 'PPP', 'I')
|
@@ -199,12 +214,17 @@ module Windows
|
|
199
214
|
API.new('GetShortPathName', 'PPL', 'L')
|
200
215
|
API.new('LockFile', 'LLLLL', 'B')
|
201
216
|
API.new('LockFileEx', 'LLLLLL', 'B')
|
217
|
+
API.new('MoveFile', 'PP', 'B')
|
218
|
+
API.new('MoveFileEx', 'PPL', 'B')
|
202
219
|
API.new('ReadFile', 'LPLPP', 'B')
|
203
|
-
API.new('ReadFileEx', '
|
220
|
+
API.new('ReadFileEx', 'LPLPK', 'B')
|
221
|
+
API.new('SetEndOfFile', 'L', 'B')
|
204
222
|
API.new('SetFileAttributes', 'PL', 'B')
|
223
|
+
API.new('SetFilePointer', 'LLPL', 'L')
|
224
|
+
API.new('SetFilePointerEx', 'LLPL', 'B')
|
205
225
|
API.new('UnlockFile', 'LLLLL', 'B')
|
206
226
|
API.new('UnlockFileEx', 'LLLLL', 'B')
|
207
227
|
API.new('WriteFile', 'LPLPP', 'B')
|
208
|
-
API.new('WriteFileEx', '
|
228
|
+
API.new('WriteFileEx', 'LPLPK', 'B')
|
209
229
|
end
|
210
230
|
end
|
data/lib/windows/file_mapping.rb
CHANGED
@@ -13,24 +13,6 @@ module Windows
|
|
13
13
|
FILE_MAP_READ = 0x0004
|
14
14
|
FILE_MAP_ALL_ACCESS = 983071
|
15
15
|
|
16
|
-
PAGE_NOACCESS = 0x01
|
17
|
-
PAGE_READONLY = 0x02
|
18
|
-
PAGE_READWRITE = 0x04
|
19
|
-
PAGE_WRITECOPY = 0x08
|
20
|
-
PAGE_EXECUTE = 0x10
|
21
|
-
PAGE_EXECUTE_READ = 0x20
|
22
|
-
PAGE_EXECUTE_READWRITE = 0x40
|
23
|
-
PAGE_EXECUTE_WRITECOPY = 0x80
|
24
|
-
PAGE_GUARD = 0x100
|
25
|
-
PAGE_NOCACHE = 0x200
|
26
|
-
PAGE_WRITECOMBINE = 0x400
|
27
|
-
SEC_FILE = 0x800000
|
28
|
-
SEC_IMAGE = 0x1000000
|
29
|
-
SEC_VLM = 0x2000000
|
30
|
-
SEC_RESERVE = 0x4000000
|
31
|
-
SEC_COMMIT = 0x8000000
|
32
|
-
SEC_NOCACHE = 0x10000000
|
33
|
-
|
34
16
|
API.new('CreateFileMapping', 'LPLLLP', 'L')
|
35
17
|
API.new('FlushViewOfFile', 'PL', 'B')
|
36
18
|
API.new('MapViewOfFile', 'LLLLL', 'L')
|
data/lib/windows/memory.rb
CHANGED
@@ -22,11 +22,36 @@ module Windows
|
|
22
22
|
|
23
23
|
MEM_COMMIT = 0x1000
|
24
24
|
MEM_RESERVE = 0x2000
|
25
|
+
MEM_DECOMMIT = 0x4000
|
26
|
+
MEM_RELEASE = 0x8000
|
27
|
+
MEM_FREE = 0x10000
|
28
|
+
MEM_PRIVATE = 0x20000
|
29
|
+
MEM_MAPPED = 0x40000
|
25
30
|
MEM_RESET = 0x80000
|
26
|
-
MEM_LARGE_PAGES = 0x20000000
|
27
|
-
MEM_PHYSICAL = 0x400000
|
28
31
|
MEM_TOP_DOWN = 0x100000
|
29
32
|
MEM_WRITE_WATCH = 0x200000
|
33
|
+
MEM_PHYSICAL = 0x400000
|
34
|
+
MEM_LARGE_PAGES = 0x20000000
|
35
|
+
MEM_4MB_PAGES = 0x80000000200000
|
36
|
+
|
37
|
+
PAGE_NOACCESS = 0x01
|
38
|
+
PAGE_READONLY = 0x02
|
39
|
+
PAGE_READWRITE = 0x04
|
40
|
+
PAGE_WRITECOPY = 0x08
|
41
|
+
PAGE_EXECUTE = 0x10
|
42
|
+
PAGE_EXECUTE_READ = 0x20
|
43
|
+
PAGE_EXECUTE_READWRITE = 0x40
|
44
|
+
PAGE_EXECUTE_WRITECOPY = 0x80
|
45
|
+
PAGE_GUARD = 0x100
|
46
|
+
PAGE_NOCACHE = 0x200
|
47
|
+
PAGE_WRITECOMBINE = 0x400
|
48
|
+
|
49
|
+
SEC_FILE = 0x800000
|
50
|
+
SEC_IMAGE = 0x1000000
|
51
|
+
SEC_VLM = 0x2000000
|
52
|
+
SEC_RESERVE = 0x4000000
|
53
|
+
SEC_COMMIT = 0x8000000
|
54
|
+
SEC_NOCACHE = 0x10000000
|
30
55
|
|
31
56
|
API.new('GlobalAlloc', 'II', 'I')
|
32
57
|
API.new('GlobalFlags', 'I', 'I')
|
@@ -53,16 +78,16 @@ module Windows
|
|
53
78
|
API.new('HeapValidate', 'LLL', 'B')
|
54
79
|
API.new('HeapWalk', 'LP', 'B')
|
55
80
|
|
56
|
-
API.new('VirtualAlloc', 'LLLL', '
|
57
|
-
API.new('VirtualAllocEx', 'LLLLL', '
|
81
|
+
API.new('VirtualAlloc', 'LLLL', 'L')
|
82
|
+
API.new('VirtualAllocEx', 'LLLLL', 'L')
|
58
83
|
API.new('VirtualFree', 'LLL', 'B')
|
59
84
|
API.new('VirtualFreeEx', 'LLLL', 'B')
|
60
|
-
API.new('VirtualLock', '
|
61
|
-
API.new('VirtualProtect', '
|
62
|
-
API.new('VirtualProtectEx', '
|
85
|
+
API.new('VirtualLock', 'LL', 'B')
|
86
|
+
API.new('VirtualProtect', 'LLLP', 'B')
|
87
|
+
API.new('VirtualProtectEx', 'LLLLP', 'B')
|
63
88
|
API.new('VirtualQuery', 'LPL', 'L')
|
64
89
|
API.new('VirtualQueryEx', 'LLPL', 'L')
|
65
|
-
API.new('VirtualUnlock', '
|
90
|
+
API.new('VirtualUnlock', 'LL', 'B')
|
66
91
|
API.new('RtlZeroMemory', 'PL', 'L')
|
67
92
|
|
68
93
|
# Windows XP or later
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'windows/api'
|
2
|
+
include Windows
|
3
|
+
|
4
|
+
module Windows
|
5
|
+
module MSVCRT
|
6
|
+
module Directory
|
7
|
+
API.auto_method = false
|
8
|
+
API.auto_constant = false
|
9
|
+
API.auto_unicode = false
|
10
|
+
|
11
|
+
Chdir = API.new('_chdir', 'P', 'I', 'msvcrt')
|
12
|
+
Wchdir = API.new('_wchdir', 'P', 'I', 'msvcrt')
|
13
|
+
Chdrive = API.new('_chdrive', 'I', 'I', 'msvcrt')
|
14
|
+
Getcwd = API.new('_getcwd', 'PI', 'P', 'msvcrt')
|
15
|
+
Wgetcwd = API.new('_wgetcwd', 'PI', 'P', 'msvcrt')
|
16
|
+
Getdcwd = API.new('_getdcwd', 'IPI', 'P', 'msvcrt')
|
17
|
+
Wgetdcwd = API.new('_wgetdcwd', 'IPI', 'P', 'msvcrt')
|
18
|
+
Getdiskfree = API.new('_getdiskfree', 'IP', 'I', 'msvcrt')
|
19
|
+
Getdrive = API.new('_getdrive', 'V', 'I', 'msvcrt')
|
20
|
+
Getdrives = API.new('_getdrives', 'V', 'L', 'msvcrt')
|
21
|
+
Mkdir = API.new('_mkdir', 'P', 'I', 'msvcrt')
|
22
|
+
Wmkdir = API.new('_wmkdir', 'P', 'I', 'msvcrt')
|
23
|
+
Rmdir = API.new('_rmdir', 'P', 'I', 'msvcrt')
|
24
|
+
Wrmdir = API.new('_wrmdir', 'P', 'I', 'msvcrt')
|
25
|
+
Searchenv = API.new('_searchenv', 'PPP', 'V', 'msvcrt')
|
26
|
+
Wsearchenv = API.new('_wsearchenv', 'PPP', 'V', 'msvcrt')
|
27
|
+
|
28
|
+
def chdir(dirname)
|
29
|
+
Chdir.call(dirname)
|
30
|
+
end
|
31
|
+
|
32
|
+
def wchdir(dirname)
|
33
|
+
Wchdir.call(dirname)
|
34
|
+
end
|
35
|
+
|
36
|
+
def chdrive(drive_number)
|
37
|
+
Chdrive.call(drive_number)
|
38
|
+
end
|
39
|
+
|
40
|
+
def getcwd(buffer, maxlen)
|
41
|
+
Getcwd.call(buffer, maxlen)
|
42
|
+
end
|
43
|
+
|
44
|
+
def wgetcwd(buffer, maxlen)
|
45
|
+
Wgetcwd.call(buffer, maxlen)
|
46
|
+
end
|
47
|
+
|
48
|
+
def getdcwd(drive, buffer, maxlen)
|
49
|
+
Getdcwd.call(drive, buffer, maxlen)
|
50
|
+
end
|
51
|
+
|
52
|
+
def wgetdcwd(drive, buffer, maxlen)
|
53
|
+
Wgetdcwd.call(drive, buffer, maxlen)
|
54
|
+
end
|
55
|
+
|
56
|
+
def getdiskfree(drive, struct_ptr)
|
57
|
+
Getdiskfree.call(drive, struct_ptr)
|
58
|
+
end
|
59
|
+
|
60
|
+
def getdrive
|
61
|
+
Getdrive.call
|
62
|
+
end
|
63
|
+
|
64
|
+
def getdrives
|
65
|
+
Getdrives.call
|
66
|
+
end
|
67
|
+
|
68
|
+
def mkdir(dirname)
|
69
|
+
Mkdir.call(dirname)
|
70
|
+
end
|
71
|
+
|
72
|
+
def wmkdir(dirname)
|
73
|
+
Wmkdir.call(dirname)
|
74
|
+
end
|
75
|
+
|
76
|
+
def rmdir(dirname)
|
77
|
+
Rmdir.call(dirname)
|
78
|
+
end
|
79
|
+
|
80
|
+
def wrmdir(dirname)
|
81
|
+
Wrmdir.call(dirname)
|
82
|
+
end
|
83
|
+
|
84
|
+
def searchenv(filename, varname, pathname)
|
85
|
+
Searchenv.call(filename, varname, pathname)
|
86
|
+
end
|
87
|
+
|
88
|
+
def wsearchenv(filename, varname, pathname)
|
89
|
+
Wsearchenv.call(filename, varname, pathname)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
data/lib/windows/msvcrt/file.rb
CHANGED
@@ -17,20 +17,36 @@ module Windows
|
|
17
17
|
S_IWRITE = 0000200 # write permission, owner
|
18
18
|
S_IEXEC = 0000100 # execute/search permission, owner
|
19
19
|
|
20
|
+
Chmod = API.new('_chmod', 'PI', 'I', 'msvcrt')
|
21
|
+
Chsize = API.new('_chsize', 'IL', 'I', 'msvcrt')
|
20
22
|
Mktemp = API.new('_mktemp', 'P', 'P', 'msvcrt')
|
21
23
|
Stat = API.new('_stat', 'PP', 'I', 'msvcrt')
|
22
24
|
Stat64 = API.new('_stat64', 'PP', 'I', 'msvcrt')
|
25
|
+
Wchmod = API.new('_wchmod', 'PI', 'I', 'msvcrt')
|
23
26
|
Wmktemp = API.new('_wmktemp', 'P', 'P', 'msvcrt')
|
24
27
|
Wstat = API.new('_wstat', 'PP', 'I', 'msvcrt')
|
25
28
|
Wstat64 = API.new('_wstat64', 'PP', 'I', 'msvcrt')
|
26
29
|
|
27
30
|
# VC++ 8.0 or later
|
28
31
|
begin
|
32
|
+
Chsize_s = API.new('_chsize_s', 'IL', 'I', 'msvcrt')
|
29
33
|
Mktemp_s = API.new('_mktemp_s', 'PL', 'L', 'msvcrt')
|
30
34
|
Wmktemp_s = API.new('_wmktemp_s', 'PL', 'L', 'msvcrt')
|
31
35
|
rescue RuntimeError
|
32
36
|
# Ignore - you must check for it via 'defined?'
|
33
37
|
end
|
38
|
+
|
39
|
+
def chmod(file, mode)
|
40
|
+
Chmod.call(file, mode)
|
41
|
+
end
|
42
|
+
|
43
|
+
def chsize(fd, size)
|
44
|
+
Chsize.call(fd, size)
|
45
|
+
end
|
46
|
+
|
47
|
+
def chsize_s(fd, size)
|
48
|
+
Chsize_s.call(fd, size)
|
49
|
+
end
|
34
50
|
|
35
51
|
def mktemp(template)
|
36
52
|
Mktemp.call(template)
|
@@ -47,6 +63,10 @@ module Windows
|
|
47
63
|
def stat64(path, buffer)
|
48
64
|
Stat64.call(path, buffer)
|
49
65
|
end
|
66
|
+
|
67
|
+
def wchmod(file, mode)
|
68
|
+
Wchmod.call(file, mode)
|
69
|
+
end
|
50
70
|
|
51
71
|
def wmktemp(template)
|
52
72
|
Wmktemp.call(template)
|
@@ -0,0 +1,168 @@
|
|
1
|
+
require 'windows/api'
|
2
|
+
include Windows
|
3
|
+
|
4
|
+
module Windows
|
5
|
+
module MSVCRT
|
6
|
+
module Time
|
7
|
+
API.auto_constant = false
|
8
|
+
API.auto_method = false
|
9
|
+
API.auto_unicode = false
|
10
|
+
|
11
|
+
Asctime = API.new('asctime', 'P', 'P', 'msvcrt')
|
12
|
+
Clock = API.new('clock', 'V', 'L', 'msvcrt')
|
13
|
+
Ctime = API.new('ctime', 'P', 'P', 'msvcrt')
|
14
|
+
Ctime64 = API.new('_ctime64', 'P', 'P', 'msvcrt')
|
15
|
+
Difftime = API.new('difftime', 'LL', 'L', 'msvcrt')
|
16
|
+
Ftime = API.new('_ftime', 'P', 'L', 'msvcrt')
|
17
|
+
Ftime64 = API.new('_ftime64', 'P', 'L', 'msvcrt')
|
18
|
+
Futime = API.new('_futime', 'IP', 'I', 'msvcrt')
|
19
|
+
Futime64 = API.new('_futime64', 'IP', 'I', 'msvcrt')
|
20
|
+
Gmtime = API.new('gmtime', 'P', 'P', 'msvcrt')
|
21
|
+
Gmtime64 = API.new('_gmtime64', 'P', 'P', 'msvcrt')
|
22
|
+
Localtime = API.new('localtime', 'P', 'P', 'msvcrt')
|
23
|
+
Localtime64 = API.new('_localtime64', 'P', 'P', 'msvcrt')
|
24
|
+
Mktime = API.new('mktime', 'P', 'L', 'msvcrt')
|
25
|
+
Mktime64 = API.new('_mktime64', 'P', 'L', 'msvcrt')
|
26
|
+
Strdate = API.new('_strdate', 'P', 'P', 'msvcrt')
|
27
|
+
Strftime = API.new('strftime', 'PLPP', 'L', 'msvcrt')
|
28
|
+
Strtime = API.new('_strtime', 'P', 'P', 'msvcrt')
|
29
|
+
WinTime = API.new('time', 'P', 'L', 'msvcrt') # Avoid conflict
|
30
|
+
WinTime64 = API.new('_time64', 'P', 'L', 'msvcrt') # Avoid conflict
|
31
|
+
Tzset = API.new('_tzset', 'V', 'V', 'msvcrt')
|
32
|
+
Utime = API.new('_utime', 'PP', 'I', 'msvcrt')
|
33
|
+
Utime64 = API.new('_utime64', 'PP', 'I', 'msvcrt')
|
34
|
+
Wasctime = API.new('_wasctime', 'P', 'P', 'msvcrt')
|
35
|
+
Wctime = API.new('_wctime', 'P', 'P', 'msvcrt')
|
36
|
+
Wctime64 = API.new('_wctime64', 'P', 'P', 'msvcrt')
|
37
|
+
Wstrdate = API.new('_wstrdate', 'P', 'L', 'msvcrt')
|
38
|
+
Wcsftime = API.new('wcsftime', 'PLPP', 'L', 'msvcrt')
|
39
|
+
Wstrtime = API.new('_wstrtime', 'P', 'P', 'msvcrt')
|
40
|
+
Wutime = API.new('_wutime', 'PP', 'I', 'msvcrt')
|
41
|
+
Wutime64 = API.new('_wutime64', 'PP', 'I', 'msvcrt')
|
42
|
+
|
43
|
+
def asctime(timeptr)
|
44
|
+
Asctime.call(timeptr)
|
45
|
+
end
|
46
|
+
|
47
|
+
def clock
|
48
|
+
Clock.call
|
49
|
+
end
|
50
|
+
|
51
|
+
def ctime(timer)
|
52
|
+
Ctime.call(timer)
|
53
|
+
end
|
54
|
+
|
55
|
+
def ctime64(timer)
|
56
|
+
Ctime64.call(timer)
|
57
|
+
end
|
58
|
+
|
59
|
+
def difftime(timer1, timer0)
|
60
|
+
Difftime.call(timer1, timer0)
|
61
|
+
end
|
62
|
+
|
63
|
+
def ftime(timeptr)
|
64
|
+
Ftime.call(timeptr)
|
65
|
+
end
|
66
|
+
|
67
|
+
def ftime64(timeptr)
|
68
|
+
Ftime64.call(timeptr)
|
69
|
+
end
|
70
|
+
|
71
|
+
def futime(fd, filetime)
|
72
|
+
Futime.call(fd, filetime)
|
73
|
+
end
|
74
|
+
|
75
|
+
def futime64(fd, filetime)
|
76
|
+
Futime64.call(fd, filetime)
|
77
|
+
end
|
78
|
+
|
79
|
+
def gmtime(timer)
|
80
|
+
Gmtime.call(timer)
|
81
|
+
end
|
82
|
+
|
83
|
+
def gmtime64(timer)
|
84
|
+
Gmtime64.call(timer)
|
85
|
+
end
|
86
|
+
|
87
|
+
def localtime(timer)
|
88
|
+
Localtime.call(timer)
|
89
|
+
end
|
90
|
+
|
91
|
+
def localtime64(timer)
|
92
|
+
Localtime64.call(timer)
|
93
|
+
end
|
94
|
+
|
95
|
+
def mktime(timeptr)
|
96
|
+
Mktime.call(timeptr)
|
97
|
+
end
|
98
|
+
|
99
|
+
def mktime64(timeptr)
|
100
|
+
Mktime64.call(timeptr)
|
101
|
+
end
|
102
|
+
|
103
|
+
def strdate(datestr)
|
104
|
+
Strdate.call(datestr)
|
105
|
+
end
|
106
|
+
|
107
|
+
def strftime(dest, maxsize, format, timeptr)
|
108
|
+
Strftime.call(dest, maxsize, format, timeptr)
|
109
|
+
end
|
110
|
+
|
111
|
+
def strtime(timestr)
|
112
|
+
Strtime.call(timestr)
|
113
|
+
end
|
114
|
+
|
115
|
+
def time(timer)
|
116
|
+
WinTime.call(timer)
|
117
|
+
end
|
118
|
+
|
119
|
+
def time64(timer)
|
120
|
+
WinTime64.call(timer)
|
121
|
+
end
|
122
|
+
|
123
|
+
def tzset
|
124
|
+
Tzset.call
|
125
|
+
end
|
126
|
+
|
127
|
+
def utime(filename, times)
|
128
|
+
Utime.call(filename, times)
|
129
|
+
end
|
130
|
+
|
131
|
+
def utime64(filename, times)
|
132
|
+
Utime64.call(filename, times)
|
133
|
+
end
|
134
|
+
|
135
|
+
def wasctime(timeptr)
|
136
|
+
Wasctime.call(timeptr)
|
137
|
+
end
|
138
|
+
|
139
|
+
def wcsftime(dest, maxsize, format, timeptr)
|
140
|
+
Wcsftime.call(dest, maxsize, format, timeptr)
|
141
|
+
end
|
142
|
+
|
143
|
+
def wctime(timer)
|
144
|
+
Wctime.call(timer)
|
145
|
+
end
|
146
|
+
|
147
|
+
def wctime64(timer)
|
148
|
+
Wctime64.call(timer)
|
149
|
+
end
|
150
|
+
|
151
|
+
def wstrdate(datestr)
|
152
|
+
Wstrdate.call(datestr)
|
153
|
+
end
|
154
|
+
|
155
|
+
def wstrtime(timestr)
|
156
|
+
Wstrtime.call(timestr)
|
157
|
+
end
|
158
|
+
|
159
|
+
def wutime(filename, times)
|
160
|
+
Wutime.call(filename, times)
|
161
|
+
end
|
162
|
+
|
163
|
+
def wutime64(filename, times)
|
164
|
+
Wutime64.call(filename, times)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
data/lib/windows/nio.rb
CHANGED
@@ -32,14 +32,10 @@ module Windows
|
|
32
32
|
API.new('GetQueuedCompletionStatus', 'LPPPL', 'B')
|
33
33
|
API.new('OpenFile', 'PPI', 'L')
|
34
34
|
API.new('PostQueuedCompletionStatus', 'LLPP', 'B')
|
35
|
-
API.new('ReadFile', 'LPLPP', 'B')
|
36
|
-
API.new('ReadFileEx', 'LPLPP', 'B')
|
37
35
|
API.new('ReadFileScatter', 'LPLPP', 'B')
|
38
36
|
API.new('SetEndOfFile', 'L', 'B')
|
39
37
|
API.new('SetFilePointer', 'LLPL', 'L')
|
40
38
|
API.new('SetFilePointerEx', 'LLPL', 'L')
|
41
|
-
API.new('WriteFile', 'LPLPP', 'B')
|
42
|
-
API.new('WriteFileEx', 'LPLPP', 'B')
|
43
39
|
API.new('WriteFileGather', 'LPLPP', 'B')
|
44
40
|
end
|
45
41
|
end
|
data/lib/windows/security.rb
CHANGED
@@ -18,6 +18,14 @@ module Windows
|
|
18
18
|
SECURITY_DESCRIPTOR_MIN_LENGTH = 20
|
19
19
|
SECURITY_DESCRIPTOR_REVISION = 1
|
20
20
|
|
21
|
+
SECURITY_NULL_SID_AUTHORITY = 0
|
22
|
+
SECURITY_WORLD_SID_AUTHORITY = 1
|
23
|
+
SECURITY_LOCAL_SID_AUTHORITY = 2
|
24
|
+
SECURITY_CREATOR_SID_AUTHORITY = 3
|
25
|
+
SECURITY_NON_UNIQUE_AUTHORITY = 4
|
26
|
+
SECURITY_NT_AUTHORITY = 5
|
27
|
+
SECURITY_RESOURCE_MANAGER_AUTHORITY = 9
|
28
|
+
|
21
29
|
GENERIC_RIGHTS_MASK = 4026597376
|
22
30
|
GENERIC_RIGHTS_CHK = 4026531840
|
23
31
|
REST_RIGHTS_MASK = 2097151
|
data/lib/windows/synchronize.rb
CHANGED
@@ -14,6 +14,12 @@ module Windows
|
|
14
14
|
WAIT_ABANDONED = 128
|
15
15
|
WAIT_FAILED = 0xFFFFFFFF
|
16
16
|
|
17
|
+
STATUS_WAIT_0 = 0
|
18
|
+
STATUS_ABANDONED_WAIT_0 = 128
|
19
|
+
STATUS_USER_APC = 192
|
20
|
+
STATUS_TIMEOUT = 258
|
21
|
+
STATUS_PENDING = 259
|
22
|
+
|
17
23
|
# Wake mask constants
|
18
24
|
QS_ALLEVENTS = 0x04BF
|
19
25
|
QS_ALLINPUT = 0x04FF
|
@@ -60,5 +66,10 @@ module Windows
|
|
60
66
|
API.new('WaitForMultipleObjectsEx', 'LPILI', 'L')
|
61
67
|
API.new('WaitForSingleObject', 'LL', 'L')
|
62
68
|
API.new('WaitForSingleObjectEx', 'LLI', 'L')
|
69
|
+
|
70
|
+
# Macros
|
71
|
+
def HasOverlappedIoCompleted(overlapped)
|
72
|
+
overlapped[0,4].unpack('L')[0] != STATUS_PENDING
|
73
|
+
end
|
63
74
|
end
|
64
75
|
end
|
data/lib/windows/time.rb
CHANGED
@@ -36,11 +36,11 @@ module Windows
|
|
36
36
|
API.new('SetSystemTimeAdjustment', 'LI', 'B')
|
37
37
|
API.new('SystemTimeToFileTime', 'PP', 'B')
|
38
38
|
API.new('SystemTimeToTzSpecificLocalTime', 'PPP', 'B')
|
39
|
-
API.new('TzSpecificLocalTimeToSystemTime', 'PPP', 'B')
|
40
39
|
|
41
40
|
# Windows XP or later
|
42
41
|
begin
|
43
42
|
API.new('GetSystemTimes', 'PPP', 'B')
|
43
|
+
API.new('TzSpecificLocalTimeToSystemTime', 'PPP', 'B')
|
44
44
|
rescue RuntimeError
|
45
45
|
# Do nothing. It's up to you to check your platform.
|
46
46
|
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.7.
|
5
|
+
gem.version = "0.7.2"
|
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.4
|
3
|
-
specification_version:
|
2
|
+
rubygems_version: 0.9.4.5
|
3
|
+
specification_version: 2
|
4
4
|
name: windows-pr
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.7.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.7.2
|
7
|
+
date: 2007-10-15 00:00:00 -06:00
|
8
8
|
summary: Windows functions and constants bundled via Win32::API
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -16,15 +16,22 @@ autorequire:
|
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|
18
18
|
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::
|
19
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
|
-
- - "
|
21
|
+
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: "0"
|
24
30
|
version:
|
25
31
|
platform: ruby
|
26
32
|
signing_key:
|
27
|
-
cert_chain:
|
33
|
+
cert_chain: []
|
34
|
+
|
28
35
|
post_install_message:
|
29
36
|
authors:
|
30
37
|
- Daniel J. Berger
|
@@ -82,9 +89,11 @@ files:
|
|
82
89
|
- test/tc_volume.rb
|
83
90
|
- test/tc_window.rb
|
84
91
|
- lib/windows/msvcrt/buffer.rb
|
92
|
+
- lib/windows/msvcrt/directory.rb
|
85
93
|
- lib/windows/msvcrt/file.rb
|
86
94
|
- lib/windows/msvcrt/io.rb
|
87
95
|
- lib/windows/msvcrt/string.rb
|
96
|
+
- lib/windows/msvcrt/time.rb
|
88
97
|
- lib/windows/gdi/bitmap.rb
|
89
98
|
- lib/windows/gdi/device_context.rb
|
90
99
|
- lib/windows/gdi/painting_drawing.rb
|
@@ -134,7 +143,7 @@ dependencies:
|
|
134
143
|
- !ruby/object:Gem::Dependency
|
135
144
|
name: windows-api
|
136
145
|
version_requirement:
|
137
|
-
version_requirements: !ruby/object:Gem::
|
146
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
147
|
requirements:
|
139
148
|
- - ">="
|
140
149
|
- !ruby/object:Gem::Version
|