Files
DP44/docs/ai/Common/DTS.Common.Licensing/SystemInformation.md
2026-04-17 14:55:32 -04:00

51 lines
3.0 KiB
Markdown

---
source_files:
- Common/DTS.Common.Licensing/SystemInformation/MachineInfo.cs
- Common/DTS.Common.Licensing/SystemInformation/ComputerSystemInfo.cs
- Common/DTS.Common.Licensing/SystemInformation/MainBoardInfo.cs
- Common/DTS.Common.Licensing/SystemInformation/ProcessorInfo.cs
- Common/DTS.Common.Licensing/SystemInformation/SystemInformationXSD.cs
generated_at: "2026-04-17T16:03:17.835094+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "39aefdb664565404"
---
# SystemInformation
### Purpose
This module provides hardware identification capabilities for licensing purposes by gathering unique system identifiers from the machine. It retrieves hardware-specific information such as machine name, system UUID, motherboard serial number, and processor ID using Windows Management Instrumentation (WMI), and provides an XSD schema for serializing this system information.
### Public Interface
**MachineInfo** (static class)
- `static string MachineName { get; }` - Returns the NetBIOS name of the local computer via `System.Environment.MachineName`. Returns empty string on exception.
**ComputerSystemInfo** (static class)
- `static string SystemID { get; }` - Returns the UUID from `Win32_ComputerSystemProduct` WMI class. Returns empty string on exception.
**MainBoardInfo** (static class)
- `static string SerialNumber { get; }` - Returns the serial number from `Win32_BaseBoard` WMI class. Returns empty string on exception.
**ProcessorInfo** (static class)
- `static string ProcessorID { get; }` - Returns the ProcessorID from `Win32_processor` WMI class. Returns empty string on exception.
**SystemInformationXSD** (static class)
- `static string XSD { get; }` - Returns an XSD schema string defining the structure for system information XML (elements: MainBoardSerialNumber, ProcessorID, SystemID, MachineName; attributes: Version, SystemInformationGuid).
### Invariants
- All property getters return empty string (`""`) on any exception, never null.
- `ManagementObjectSearcher` instances (`systemSearcher`, `baseboardSearcher`, `cpuSearcher`) are created once as static fields and reused.
- WMI queries use `FirstOrDefault()` pattern; if no results are found, an exception will be caught and empty string returned.
### Dependencies
- **Depends on**: `System.Management` (for WMI access), `System.Environment`
- **Depended on by**: Unclear from source alone - likely licensing/validation components that need hardware fingerprints.
### Gotchas
- **Platform limitation**: WMI queries (`System.Management`) are Windows-only; this module will not work on non-Windows platforms.
- **Static searcher lifecycle**: The `ManagementObjectSearcher` instances are held as static fields and never disposed, which could cause resource issues in long-running applications.
- **Silent failures**: All exceptions are swallowed and return empty string, making it difficult to diagnose WMI permission issues or service unavailability.
- **First-result only**: When multiple processors or baseboards exist, only the first is considered.
---