Skip to content

Commit 686f358

Browse files
committed
Implement ipc-channel on Windows
This implementation uses named pipes on Windows, with auto-generated uuid names. It takes advantage of DuplicateHandle to clone handles to target processes when sending handles cross-process. Shared memory is implemented using anonymous file mappings. select() and friends are implemented using IO Completion Ports.
1 parent ca63fdb commit 686f358

File tree

4 files changed

+1450
-3
lines changed

4 files changed

+1450
-3
lines changed

Cargo.toml

+5
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@ uuid = {version = "0.3", features = ["v4"]}
1919

2020
[dev-dependencies]
2121
crossbeam = "0.2"
22+
23+
[target.'cfg(target_os = "windows")'.dependencies]
24+
winapi = "*"
25+
user32-sys = "*"
26+
kernel32-sys = "*"

src/lib.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
// option. This file may not be copied, modified, or distributed
88
// except according to those terms.
99

10-
#![cfg_attr(any(feature = "force-inprocess", target_os = "windows", target_os = "android"),
11-
feature(mpsc_select))]
10+
#![cfg_attr(any(feature = "force-inprocess", target_os = "android"),
11+
feature(mpsc_select))]
1212

1313
#[macro_use]
1414
extern crate lazy_static;
@@ -17,9 +17,17 @@ extern crate bincode;
1717
extern crate libc;
1818
extern crate rand;
1919
extern crate serde;
20+
2021
#[cfg(any(feature = "force-inprocess", target_os = "windows", target_os = "android"))]
2122
extern crate uuid;
2223

24+
#[cfg(all(not(feature = "force-inprocess"), target_os = "windows"))]
25+
extern crate winapi;
26+
#[cfg(all(not(feature = "force-inprocess"), target_os = "windows"))]
27+
extern crate kernel32;
28+
#[cfg(all(not(feature = "force-inprocess"), target_os = "windows"))]
29+
extern crate user32;
30+
2331
pub mod ipc;
2432
pub mod platform;
2533
mod refcell;

src/platform/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ mod os {
1414
#[cfg(all(not(feature = "force-inprocess"), target_os = "macos"))]
1515
include!("macos/mod.rs");
1616

17-
#[cfg(any(feature = "force-inprocess", target_os = "windows", target_os = "android"))]
17+
#[cfg(all(not(feature = "force-inprocess"), target_os = "windows"))]
18+
include!("windows/mod.rs");
19+
20+
#[cfg(any(feature = "force-inprocess", target_os = "android"))]
1821
include!("inprocess/mod.rs");
1922
}
2023

0 commit comments

Comments
 (0)