jrgerber / smbios-lib

SMBIOS Library
MIT License
30 stars 14 forks source link

I get an error when running the program #114

Open wangwenwen130 opened 3 months ago

wangwenwen130 commented 3 months ago

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. image

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();

file.write(str.as_str().as_bytes()).unwrap();

}

wangwenwen130 commented 3 months ago

how I can resolve please