Skip to content

Commit

Permalink
Merge pull request #61 from jewlexx/remove-c-code
Browse files Browse the repository at this point in the history
Removed reliance on c code for network manager
  • Loading branch information
jewlexx authored Dec 11, 2024
2 parents c5865a8 + 151b50d commit 001865a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 28 deletions.
5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ keywords = ["admin", "linux", "network", "sys", "windows"]
license = "MIT OR Apache-2.0"
name = "quork"
repository = "https://github.com/jewlexx/quork.git"
rust-version = "1.69.0"
rust-version = "1.70.0"
version = "0.8.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down Expand Up @@ -48,8 +48,5 @@ sized_string = []
std = []
traits = []

[build-dependencies]
cc = "1.2"

[dev-dependencies]
is-root = "0.1"
11 changes: 0 additions & 11 deletions build.rs

This file was deleted.

3 changes: 0 additions & 3 deletions include/win/network.c

This file was deleted.

20 changes: 10 additions & 10 deletions src/win/network.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//! Network helpers
use windows::{
core::GUID,
Win32::{
Networking::NetworkListManager::{INetworkListManager, NLM_CONNECTIVITY},
System::Com::{CoCreateInstance, CLSCTX_ALL},
use windows::Win32::{
Networking::{
self,
NetworkListManager::{INetworkListManager, NLM_CONNECTIVITY},
},
System::Com::{CoCreateInstance, CLSCTX_ALL},
};

use windows::Win32::Networking::NetworkListManager::{
Expand Down Expand Up @@ -119,10 +119,6 @@ impl From<Connectivity> for NLM_CONNECTIVITY {
}
}

extern "C" {
fn get_networklist_manager_clsid() -> GUID;
}

/// Gets the [`INetworkListManager`] COM interface class GUID.
///
/// Not reccomended for use directly, but rather though the [`Connectivity`] enum
Expand All @@ -135,7 +131,11 @@ extern "C" {
pub unsafe fn get_networklist_manager() -> windows::core::Result<INetworkListManager> {
ComInit::init();

CoCreateInstance(&get_networklist_manager_clsid(), None, CLSCTX_ALL)
CoCreateInstance(
&Networking::NetworkListManager::NetworkListManager,
None,
CLSCTX_ALL,
)
}

/// Gets the current connectivity to a network.
Expand Down

0 comments on commit 001865a

Please sign in to comment.