GetSystemTimePreciseAsFileTime is in Windows 8.1 and Windows Server 2012 R2 and introduce the higher version. If your program is running on Windows 7 or earlier, this function will not be available.
code
use smbioslib::{table_load_from_device, SMBiosSystemInformation};
use std::fs::OpenOptions;
use std::io::Write;
fn main() {
retrieve_system_uuid();
}
fn retrieve_system_uuid() {
match table_load_from_device() {
Ok(data) => match data.find_map(|sys_info: SMBiosSystemInformation| sys_info.uuid()) {
Some(uuid) => {
// println!("System Information UUID == {:?}", uuid)
write_log(uuid.to_string())
}
None => println!("No System Information (Type 1) structure found with a UUID field"),
},
Err(err) => println!("failure: {:?}", err),
};
}
GetSystemTimePreciseAsFileTime is in Windows 8.1 and Windows Server 2012 R2 and introduce the higher version. If your program is running on Windows 7 or earlier, this function will not be available.
code
use smbioslib::{table_load_from_device, SMBiosSystemInformation}; use std::fs::OpenOptions; use std::io::Write;
fn main() { retrieve_system_uuid(); } fn retrieve_system_uuid() { match table_load_from_device() { Ok(data) => match data.find_map(|sys_info: SMBiosSystemInformation| sys_info.uuid()) { Some(uuid) => { // println!("System Information UUID == {:?}", uuid) write_log(uuid.to_string()) } None => println!("No System Information (Type 1) structure found with a UUID field"), }, Err(err) => println!("failure: {:?}", err), }; }
fn write_log(str: String) { let mut file = OpenOptions::new() .write(true) .append(true) .create(true) .open("uuid.txt") .unwrap();
}