win32-pipe 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a494308e731c0475969ecbfe838322433db1eec7
4
- data.tar.gz: 82f8cada5b940758be02ec8597320124ad690078
3
+ metadata.gz: 3efdd5d2b5a0d1c4155f89cd532f1f60f56e9efc
4
+ data.tar.gz: fb14d03d04dfb70e0425d60c38fd248b37d86382
5
5
  SHA512:
6
- metadata.gz: fa88c692a19e8a6e7bd133bfd87654f8d11297ab05b6e64656c4895cfb38b7802aea1e6aa30b8588e144967a896de5bedc59ee12bcd40119c343cdea025790fa
7
- data.tar.gz: 4c9444293aef0c48e9f2988a566900f49a9e2b14e62aa5c83f0264949a29d3b1d04bd60092d1f72459be83e4f2ad0d010157d70671567727409f32ec20b2f5f0
6
+ metadata.gz: e67c81f9a4368a9ca83463bdae86c498407478e5cfc8ed96ffc680234d8e9bcf5b4553a5be612990d908fac84ab1b6d15efcde86ea78ab43a671bf1b3f06385e
7
+ data.tar.gz: 545532d071afaef42922a643c5a835f8e01e0fab14e50ee235d8e4c169c311b7e94db26ce555464a2684232fe219affe08f82f53f660f0b144e429fa903879cc
data/CHANGES CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.3.3 - 21-Oct-2013
2
+ * Fixed INVALID_HANDLE_VALUE for 64-bit Ruby.
3
+ * Now internally uses a struct for OVERLAPPED event instead of packed string.
4
+
1
5
  == 0.3.2 - 27-Jul-2013
2
6
  * Don't raise an error if GetLastError returns ERROR_SUCCESS in server. Thanks
3
7
  to go Ben Jansen for the patch.
data/lib/win32/pipe.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require File.join(File.dirname(__FILE__), 'pipe', 'windows', 'constants')
2
2
  require File.join(File.dirname(__FILE__), 'pipe', 'windows', 'functions')
3
+ require File.join(File.dirname(__FILE__), 'pipe', 'windows', 'structs')
3
4
 
4
5
  # The Win32 module serves as a namespace only.
5
6
  module Win32
@@ -9,12 +10,13 @@ module Win32
9
10
  class Pipe
10
11
  include Windows::Constants
11
12
  include Windows::Functions
13
+ include Windows::Structs
12
14
 
13
15
  # Error raised when anything other than a SystemCallError occurs.
14
16
  class Error < StandardError; end
15
17
 
16
18
  # The version of this library
17
- VERSION = '0.3.2'
19
+ VERSION = '0.3.3'
18
20
 
19
21
  PIPE_BUFFER_SIZE = 512 #:nodoc:
20
22
  PIPE_TIMEOUT = 5000 #:nodoc:
@@ -98,7 +100,7 @@ module Win32
98
100
  @pending_io = false
99
101
  @buffer = 0.chr * PIPE_BUFFER_SIZE
100
102
  @size = 0
101
- @overlapped = 0.chr * 20 # sizeof(OVERLAPPED)
103
+ @overlapped = Overlapped.new
102
104
  @transferred = 0
103
105
  @asynchronous = false
104
106
 
@@ -108,7 +110,7 @@ module Win32
108
110
 
109
111
  if @asynchronous
110
112
  @event = CreateEvent(nil, true, true, nil)
111
- @overlapped[16, 4] = [@event].pack('L')
113
+ @overlapped[:hEvent] = @event
112
114
  end
113
115
  end
114
116
 
@@ -1,5 +1,9 @@
1
+ require 'ffi'
2
+
1
3
  module Windows
2
4
  module Constants
5
+ include FFI::Library
6
+
3
7
  PIPE_WAIT = 0x00000000
4
8
  PIPE_NOWAIT = 0x00000001
5
9
  PIPE_ACCESS_INBOUND = 0x00000001
@@ -20,7 +24,6 @@ module Windows
20
24
  FILE_ATTRIBUTE_NORMAL = 0x00000080
21
25
 
22
26
  INFINITE = 0xFFFFFFFF
23
- INVALID_HANDLE_VALUE = 0xFFFFFFFF
24
27
  NMPWAIT_WAIT_FOREVER = 0xFFFFFFFF
25
28
  ERROR_PIPE_BUSY = 231
26
29
  ERROR_IO_PENDING = 997
@@ -33,5 +36,7 @@ module Windows
33
36
  FILE_SHARE_READ = 1
34
37
  FILE_SHARE_WRITE = 2
35
38
  OPEN_EXISTING = 3
39
+
40
+ INVALID_HANDLE_VALUE = FFI::Pointer.new(-1).address
36
41
  end
37
42
  end
@@ -0,0 +1,18 @@
1
+ require 'ffi'
2
+
3
+ module Windows
4
+ module Structs
5
+ extend FFI::Library
6
+
7
+ # I'm assuming the anonymous struct for the internal union here.
8
+ class Overlapped < FFI::Struct
9
+ layout(
10
+ :Internal, :uintptr_t,
11
+ :InternalHigh, :uintptr_t,
12
+ :Offset, :ulong,
13
+ :OffsetHigh, :ulong,
14
+ :hEvent, :uintptr_t
15
+ )
16
+ end
17
+ end
18
+ end
@@ -14,7 +14,7 @@ class TC_Win32_Pipe < Test::Unit::TestCase
14
14
  end
15
15
 
16
16
  test "version is set to expected value" do
17
- assert_equal('0.3.2', Pipe::VERSION)
17
+ assert_equal('0.3.3', Pipe::VERSION)
18
18
  end
19
19
 
20
20
  test "name method basic functionality" do
data/win32-pipe.gemspec CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'win32-pipe'
5
- spec.version = '0.3.2'
5
+ spec.version = '0.3.3'
6
6
  spec.author = 'Daniel J. Berger'
7
7
  spec.license = 'Artistic 2.0'
8
8
  spec.email = 'djberg96@gmail.com'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32-pipe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-27 00:00:00.000000000 Z
11
+ date: 2013-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -58,6 +58,7 @@ files:
58
58
  - lib/win32/pipe/server.rb
59
59
  - lib/win32/pipe/windows/constants.rb
60
60
  - lib/win32/pipe/windows/functions.rb
61
+ - lib/win32/pipe/windows/structs.rb
61
62
  - lib/win32/pipe.rb
62
63
  - MANIFEST
63
64
  - Rakefile
@@ -86,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
87
  version: '0'
87
88
  requirements: []
88
89
  rubyforge_project: win32utils
89
- rubygems_version: 2.0.3
90
+ rubygems_version: 2.1.9
90
91
  signing_key:
91
92
  specification_version: 4
92
93
  summary: An interface for named pipes on MS Windows