windows-pr 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,2 +1,6 @@
1
+ = 0.2.0 - 13-Apr-2006
2
+ * Added the filesystem module.
3
+ * Fixed signature and dll mistakes in the file module.
4
+
1
5
  = 0.1.0 - 4-Apr-2006
2
6
  * Initial release
data/MANIFEST CHANGED
@@ -10,6 +10,7 @@ lib/windows/clipboard.rb
10
10
  lib/windows/device_io.rb
11
11
  lib/windows/error.rb
12
12
  lib/windows/file.rb
13
+ lib/windows/filesystem.rb
13
14
  lib/windows/handle.rb
14
15
  lib/windows/memory.rb
15
16
  lib/windows/path.rb
data/lib/windows/file.rb CHANGED
@@ -163,21 +163,29 @@ module Windows
163
163
  FILE_FLAG_OPEN_NO_RECALL = 0x00100000
164
164
  FILE_FLAG_FIRST_PIPE_INSTANCE = 0x00080000
165
165
 
166
+ # File creation disposition
167
+ CREATE_NEW = 1
168
+ CREATE_ALWAYS = 2
169
+ OPEN_EXISTING = 3
170
+ OPEN_ALWAYS = 4
171
+ TRUNCATE_EXISTING = 5
172
+
166
173
  # Errors
167
174
  INVALID_FILE_ATTRIBUTES = -1
175
+ INVALID_HANDLE_VALUE = -1
168
176
  INVALID_FILE_SIZE = 0xFFFFFFFF
169
177
 
170
178
  CopyFile = Win32API.new('kernel32', 'CopyFile', 'PPI', 'I')
171
179
  CopyFileEx = Win32API.new('kernel32', 'CopyFileEx', 'PPPPPL', 'I')
172
180
  CreateFile = Win32API.new('kernel32', 'CreateFile', 'PLLPLLL', 'L')
173
181
  CreateHardLink = Win32API.new('kernel32', 'CreateHardLink', 'PPP', 'I')
174
- DecryptFile = Win32API.new('kernel32', 'DecryptFile', 'PL', 'I')
182
+ DecryptFile = Win32API.new('advapi32', 'DecryptFile', 'PL', 'I')
175
183
  DeleteFile = Win32API.new('kernel32', 'DeleteFile', 'P', 'I')
176
- EncryptFile = Win32API.new('kernel32', 'EncryptFile', 'P', 'I')
184
+ EncryptFile = Win32API.new('advapi32', 'EncryptFile', 'P', 'I')
177
185
 
178
- GetBinaryType = Win32API.new('kernel32', 'GetBinaryType', 'PL', 'I')
186
+ GetBinaryType = Win32API.new('kernel32', 'GetBinaryType', 'PP', 'I')
179
187
  GetFileAttributes = Win32API.new('kernel32', 'GetFileAttributes', 'P', 'L')
180
- GetFileAttributesEx = Win32API.new('kernel32', 'GetFileAttributes', 'PPP', 'I')
188
+ GetFileAttributesEx = Win32API.new('kernel32', 'GetFileAttributesEx', 'PPP', 'I')
181
189
  GetFileSize = Win32API.new('kernel32', 'GetFileSize', 'LP', 'L')
182
190
  GetFileSizeEx = Win32API.new('kernel32', 'GetFileSizeEx', 'LP', 'L')
183
191
  GetFileType = Win32API.new('kernel32', 'GetFileType', 'L', 'L')
@@ -186,7 +194,6 @@ module Windows
186
194
  LockFileEx = Win32API.new('kernel32', 'LockFileEx', 'LLLLLL', 'I')
187
195
  ReadFile = Win32API.new('kernel32', 'ReadFile', 'LPLPP', 'I')
188
196
  ReadFileEx = Win32API.new('kernel32', 'ReadFileEx', 'LPLPP', 'I')
189
- ReOpenFile = Win32API.new('kernel32', 'ReOpenFile', 'LLLL', 'L')
190
197
 
191
198
  SetFileAttributes = Win32API.new('kernel32', 'SetFileAttributes', 'PL', 'I')
192
199
 
@@ -263,10 +270,6 @@ module Windows
263
270
  ReadFileEx.call(file, buf, bytes, overlapped, routine) > 0
264
271
  end
265
272
 
266
- def ReOpenFile(handle, access, mode, flags)
267
- ReOpenFile.call(handle, access, mode, flags)
268
- end
269
-
270
273
  def SetFileAttributes(file, attributes)
271
274
  SetFileAttributes.call(file, attributes) > 0
272
275
  end
@@ -0,0 +1,16 @@
1
+ require 'Win32API'
2
+
3
+ module Windows
4
+ module FileSystem
5
+ GetDiskFreeSpace = Win32API.new('kernel32', 'GetDiskFreeSpace', 'PPPPP', 'I')
6
+ GetDiskFreeSpaceEx = Win32API.new('kernel32', 'GetDiskFreeSpaceEx', 'PPPP', 'I')
7
+
8
+ def GetDiskFreeSpace(path, sectors, bytes, free, total)
9
+ GetDiskFreeSpace.call(path, sectors, bytes, free, total) > 0
10
+ end
11
+
12
+ def GetDiskFreeSpaceEx(path, free_bytes, total_bytes, total_free)
13
+ GetDiskFreeSpaceEx.call(path, free_bytes, total_bytes, total_free) > 0
14
+ end
15
+ end
16
+ end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: windows-pr
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.0
7
- date: 2006-04-05 00:00:00 -06:00
6
+ version: 0.2.0
7
+ date: 2006-04-13 00:00:00 -06:00
8
8
  summary: Windows functions predefined via Win32API
9
9
  require_paths:
10
10
  - lib
@@ -33,6 +33,7 @@ files:
33
33
  - lib/windows/device_io.rb
34
34
  - lib/windows/error.rb
35
35
  - lib/windows/file.rb
36
+ - lib/windows/filesystem.rb
36
37
  - lib/windows/handle.rb
37
38
  - lib/windows/memory.rb
38
39
  - lib/windows/path.rb
@@ -41,13 +42,11 @@ files:
41
42
  - test/ts_all.rb
42
43
  - lib/windows/msvcrt/buffer.rb
43
44
  - lib/windows/msvcrt/file.rb
44
- - test/CVS
45
45
  - test/tc_error.rb
46
46
  - test/tc_msvcrt_buffer.rb
47
47
  - test/tc_path.rb
48
48
  - test/tc_synchronize.rb
49
49
  - CHANGES
50
- - CVS
51
50
  - MANIFEST
52
51
  - README
53
52
  test_files: