feat(win32): query physical memory POC - #1537
Conversation
|
Overall, this seems like a new feature to have. However: from all the fields/information provided with this PoC, how many of them can be retrieved from other systems? Having a smaller but common ground would likely be a better start. Also, the goal of In any case, if you're interested into iterating over this feature, I'm totally open to adding it with the conditions mentioned above. |
|
To be honest, I'm unsure if anything like this would work across different operating systems. In general, Linux doesn't provide this much information unless you're sudo. I haven't had a chance to test with Mac. If anything, it could probably be a Windows "extended memory details" feature. Any ideas? |
|
I want to avoid features specific to one OS as much as possible. If there is no way to get at least some part of this feature in another OS than windows, then sorry but I'll likely reject it. |
|
No problem, that's understandable! |
|
FYI this is what Fastfetch does: For most systems, you get physical memory device information from SMBIOS Type 17. The problem is how to acquire the raw SMBIOS binary data.
On macOS it's different, as SMBIOS is either inaccessable (Intel) or not existed at all (Apple Silicon). Command |
Note: This code does NOT compile or pass any sort of tests.
Description
Below is a proof of concept to obtain detailed information regarding the installed physical memory for Windows only. This feature utilizes the WMI crate to establish a connection with the COM library, then the Windows Management Instrumentation (WMI), and then query the WMI for all information regarding the Win32_PhysicalMemory class.
In theory, this works amazingly. You can view the original idea here (can't do a Rust playground unfortunately due to external crates). This concept was also referenced in issue #1260
However, we're met with a problem.
Problem
The function
raw_queryfrom the WMI crate requires that the template return value implement the traitserde::de::DeserializeOwned. Using#[cfg_attr(feature = "serde", derive(Deserialize)]), as implemented in other parts of the codebase, does not suffice, and the error persists.Possible solutions and questions
As a result, I have a couple of questions for this feature to be implemented:
serdemandatory in thecargo.tomlfile?WMIcrate entirely and use the Windows API instead? Removing the entireserdeproblem.serde?Let me know, and I can start working on this right away!
Excuse me if there is an obvious workaround I've missed.