doroved / mid Goto Github PK
View Code? Open in Web Editor NEWCreating a Machine ID hash for MacOS/Windows/Linux
Home Page: https://crates.io/crates/mid
Creating a Machine ID hash for MacOS/Windows/Linux
Home Page: https://crates.io/crates/mid
Здравствуйте! Мне очень понравился Ваш проект. Во время внедрения в своё приложение, я пересмотрел некоторые реализованные Вами способы для большей оптимизации и уменьшения размера итогового приложения.
Вот несколько моих изменений:
#[cfg(target_os = "windows")]
pub fn get_mid_result() -> Result<String, MIDError> {
use wmi::{COMLibrary, WMIConnection};
let com_connection = unsafe { COMLibrary::assume_initialized() };
let wmi_connection =
WMIConnection::new(com_connection.into()).expect("Failed to connect to WMI");
let mac_address_base: Vec<MACGeneric> = wmi_connection
.raw_query("SELECT MACAddress from Win32_NetworkAdapter WHERE MACAddress IS NOT NULL")
.unwrap();
let bios_serial_base: Vec<SerialNumberGeneric> = wmi_connection
.raw_query("SELECT SerialNumber from Win32_BIOS WHERE SerialNumber IS NOT NULL")
.unwrap();
let processor_id_base: Vec<ProcessorIdGeneric> = wmi_connection
.raw_query("SELECT ProcessorId from Win32_Processor WHERE ProcessorId IS NOT NULL")
.unwrap();
let mut result = Vec::new();
parse_and_push(&mac_address_base[0].MACAddress, &mut result);
parse_and_push(&bios_serial_base[0].SerialNumber, &mut result);
parse_and_push(&processor_id_base[0].ProcessorId, &mut result);
if result.is_empty() {
return Err(MIDError::ResultMidError);
}
let combined_string = result.join("|");
Ok(combined_string)
}
It doesn't work on windows server 19 :(
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.