windows-pr 0.6.6 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,13 @@
1
- require 'Win32API'
1
+ require 'windows/api'
2
+ include Windows
2
3
 
3
4
  module Windows
4
5
  module Volume
6
+ API.auto_namespace = 'Windows::Volume'
7
+ API.auto_constant = true
8
+ API.auto_method = true
9
+ API.auto_unicode = true
10
+
5
11
  DRIVE_UNKNOWN = 0
6
12
  DRIVE_NO_ROOT_DIR = 1
7
13
  DRIVE_REMOVABLE = 2
@@ -10,93 +16,27 @@ module Windows
10
16
  DRIVE_CDROM = 5
11
17
  DRIVE_RAMDISK = 6
12
18
 
13
- FindFirstVolume = Win32API.new('kernel32', 'FindFirstVolume', 'PL', 'L')
14
- FindFirstVolumeMountPoint = Win32API.new('kernel32', 'FindFirstVolumeMountPoint', 'PPL', 'L')
15
- FindNextVolume = Win32API.new('kernel32', 'FindNextVolume', 'LPL', 'I')
16
- FindNextVolumeMountPoint = Win32API.new('kernel32', 'FindNextVolumeMountPoint', 'LPL', 'I')
17
- FindVolumeClose = Win32API.new('kernel32', 'FindVolumeClose', 'L', 'I')
18
- FindVolumeMountPointClose = Win32API.new('kernel32', 'FindVolumeMountPointClose', 'L', 'I')
19
-
20
- GetDriveType = Win32API.new('kernel32', 'GetDriveType', 'P', 'I')
21
- GetLogicalDrives = Win32API.new('kernel32', 'GetLogicalDrives', 'V', 'L')
22
- GetLogicalDriveStrings = Win32API.new('kernel32', 'GetLogicalDriveStrings', 'LP', 'L')
23
- GetVolumeInformation = Win32API.new('kernel32', 'GetVolumeInformation', 'PPLPPPPL', 'I')
24
- GetVolumeNameForVolumeMountPoint = Win32API.new('kernel32', 'GetVolumeNameForVolumeMountPoint', 'PPL', 'I')
25
- GetVolumePathName = Win32API.new('kernel32', 'GetVolumePathName', 'PPL', 'I')
26
-
27
- SetVolumeLabel = Win32API.new('kernel32', 'SetVolumeLabel', 'PP', 'I')
28
- SetVolumeMountPoint = Win32API.new('kernel32', 'SetVolumeMountPoint', 'PP', 'I')
19
+ API.new('FindFirstVolume', 'PL', 'L')
20
+ API.new('FindFirstVolumeMountPoint', 'PPL', 'L')
21
+ API.new('FindNextVolume', 'LPL', 'B')
22
+ API.new('FindNextVolumeMountPoint', 'LPL', 'B')
23
+ API.new('FindVolumeClose', 'L', 'B')
24
+ API.new('FindVolumeMountPointClose', 'L', 'B')
25
+ API.new('GetDriveType', 'P', 'I')
26
+ API.new('GetLogicalDrives', 'V', 'L')
27
+ API.new('GetLogicalDriveStrings', 'LP', 'L')
28
+ API.new('GetVolumeInformation', 'PPLPPPPL', 'B')
29
+ API.new('GetVolumeNameForVolumeMountPoint', 'PPL', 'B')
30
+ API.new('GetVolumePathName', 'PPL', 'B')
31
+ API.new('SetVolumeLabel', 'PP', 'B')
32
+ API.new('SetVolumeMountPoint', 'PP', 'B')
29
33
 
30
34
  # Windows XP or later
31
35
  begin
32
- GetVolumePathNamesForVolumeName = Win32API.new('kernel32', 'GetVolumePathNamesForVolumeName', 'PPLL', 'I')
36
+ API.new('GetVolumePathNamesForVolumeName', 'PPLL', 'B')
33
37
  rescue
34
38
  # Do nothing - not supported on current platform. It's up to you to
35
39
  # check for the existence of the constant in your code.
36
40
  end
37
-
38
- def FindFirstVolume(name, length=name.size)
39
- FindFirstVolume.call(name, length)
40
- end
41
-
42
- def FindFirstVolumeMountPoint(name, volume, length=volume.size)
43
- FindFirstVolumeMountPoint.call(name, volume, length)
44
- end
45
-
46
- def FindNextVolume(handle, name, length=name.size)
47
- FindNextVolume.call(handle, name, length) != 0
48
- end
49
-
50
- def FindNextVolumeMountPoint(handle, name, length=name.size)
51
- FindNextVolumeMountPoint.call(handle, name, length) != 0
52
- end
53
-
54
- def FindVolumeClose(handle)
55
- FindVolumeClose.call(handle) != 0
56
- end
57
-
58
- def FindVolumeMountPointClose(handle)
59
- FindVolumeMountPointClose.call(handle) != 0
60
- end
61
-
62
- def GetDriveType(path)
63
- GetDriveType.call(path)
64
- end
65
-
66
- def GetLogicalDrives()
67
- GetLogicalDrives.call()
68
- end
69
-
70
- def GetLogicalDriveStrings(length, buffer)
71
- GetLogicalDriveStrings.call(length, buffer)
72
- end
73
-
74
- def GetVolumeInformation(path, v_buf, v_size, serial, length, flags, fs_buf, fs_size)
75
- GetVolumeInformation.call(path, v_buf, v_size, serial, length, flags, fs_buf, fs_size) != 0
76
- end
77
-
78
- def GetVolumeNameForVolumeMountPoint(mount, name, length=name.size)
79
- GetVolumeNameForVolumeMountPoint.call(mount, name, length) != 0
80
- end
81
-
82
- def GetVolumePathName(file, name, length = name.size)
83
- GetVolumePathName.call(file, name, length) != 0
84
- end
85
-
86
- def SetVolumeLabel(label, volume)
87
- SetVolumeLabel.call(label, volume) != 0
88
- end
89
-
90
- def SetVolumeMountPoint(mount, name)
91
- SetVolumeMountPoint.call(mount, name) != 0
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
101
41
  end
102
- end
42
+ end
@@ -1,7 +1,13 @@
1
- require 'Win32API'
1
+ require 'windows/api'
2
+ include Windows
2
3
 
3
4
  module Windows
4
5
  module Window
6
+ API.auto_namespace = 'Windows::Window'
7
+ API.auto_constant = true
8
+ API.auto_method = true
9
+ API.auto_unicode = false
10
+
5
11
  # ShowWindow() constants
6
12
  SW_HIDE = 0
7
13
  SW_SHOWNORMAL = 1
@@ -19,20 +25,8 @@ module Windows
19
25
  SW_FORCEMINIMIZE = 11
20
26
  SW_MAX = 11
21
27
 
22
- GetClientRect = Win32API.new('user32', 'GetClientRect', 'LP', 'I')
23
- GetForegroundWindow = Win32API.new('user32', 'GetForegroundWindow', 'V', 'L')
24
- GetWindowRect = Win32API.new('user32', 'GetWindowRect', 'LP', 'I')
25
-
26
- def GetClientRect(hwnd, rect)
27
- GetClientRect.call(hwnd, rect) != 0
28
- end
29
-
30
- def GetForegroundWindow
31
- GetForegroundWindow.call
32
- end
33
-
34
- def GetWindowRect(hwnd, rect)
35
- GetWindowRect.call(hwnd, rect) != 0
36
- end
28
+ API.new('GetClientRect', 'LP', 'B', 'user32')
29
+ API.new('GetForegroundWindow', 'V', 'L', 'user32')
30
+ API.new('GetWindowRect', 'LP', 'B', 'user32')
37
31
  end
38
- end
32
+ 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.6"
5
+ gem.version = "0.7.0"
6
6
  gem.author = "Daniel J. Berger"
7
7
  gem.email = "djberg96@gmail.com"
8
8
  gem.homepage = "http://www.rubyforge.org/projects/win32utils"
@@ -16,7 +16,8 @@ spec = Gem::Specification.new do |gem|
16
16
  gem.files += Dir["test/*"] + Dir["[A-Z]*"]
17
17
  gem.files.reject! { |fn| fn.include? "CVS" }
18
18
  gem.require_path = "lib"
19
- gem.extra_rdoc_files = ["README", "CHANGES"]
19
+ gem.extra_rdoc_files = ["MANIFEST", "README", "CHANGES"]
20
+ gem.add_dependency("windows-api", ">= 0.1.1")
20
21
  end
21
22
 
22
23
  if $0 == __FILE__
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0.8
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.6
7
- date: 2007-05-03 00:00:00 -06:00
6
+ version: 0.7.0
7
+ date: 2007-08-09 00:00:00 -06:00
8
8
  summary: Windows functions and constants predefined via Win32API
9
9
  require_paths:
10
10
  - lib
@@ -31,7 +31,9 @@ authors:
31
31
  files:
32
32
  - doc/conversion_guide.txt
33
33
  - lib/windows/clipboard.rb
34
+ - lib/windows/com.rb
34
35
  - lib/windows/console.rb
36
+ - lib/windows/debug.rb
35
37
  - lib/windows/device_io.rb
36
38
  - lib/windows/directory.rb
37
39
  - lib/windows/error.rb
@@ -45,6 +47,7 @@ files:
45
47
  - lib/windows/memory.rb
46
48
  - lib/windows/national.rb
47
49
  - lib/windows/network_management.rb
50
+ - lib/windows/nio.rb
48
51
  - lib/windows/path.rb
49
52
  - lib/windows/pipe.rb
50
53
  - lib/windows/process.rb
@@ -94,6 +97,7 @@ test_files:
94
97
  rdoc_options: []
95
98
 
96
99
  extra_rdoc_files:
100
+ - MANIFEST
97
101
  - README
98
102
  - CHANGES
99
103
  executables: []
@@ -102,5 +106,13 @@ extensions: []
102
106
 
103
107
  requirements: []
104
108
 
105
- dependencies: []
106
-
109
+ dependencies:
110
+ - !ruby/object:Gem::Dependency
111
+ name: windows-api
112
+ version_requirement:
113
+ version_requirements: !ruby/object:Gem::Version::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: 0.1.1
118
+ version: