1
2
3
4
5 package oshi.driver.windows.wmi;
6
7 import java.util.Objects;
8
9 import com.sun.jna.platform.win32.COM.WbemcliUtil.WmiQuery;
10 import com.sun.jna.platform.win32.COM.WbemcliUtil.WmiResult;
11
12 import oshi.annotation.concurrent.ThreadSafe;
13 import oshi.util.platform.windows.WmiQueryHandler;
14
15
16
17
18 @ThreadSafe
19 public final class Win32Bios {
20
21 private static final String WIN32_BIOS_WHERE_PRIMARY_BIOS_TRUE = "Win32_BIOS where PrimaryBIOS=true";
22
23
24
25
26 public enum BiosSerialProperty {
27 SERIALNUMBER;
28 }
29
30
31
32
33 public enum BiosProperty {
34 MANUFACTURER, NAME, DESCRIPTION, VERSION, RELEASEDATE;
35 }
36
37 private Win32Bios() {
38 }
39
40
41
42
43
44
45 public static WmiResult<BiosSerialProperty> querySerialNumber() {
46 WmiQuery<BiosSerialProperty> serialNumQuery = new WmiQuery<>(WIN32_BIOS_WHERE_PRIMARY_BIOS_TRUE,
47 BiosSerialProperty.class);
48 return Objects.requireNonNull(WmiQueryHandler.createInstance()).queryWMI(serialNumQuery);
49 }
50
51
52
53
54
55
56 public static WmiResult<BiosProperty> queryBiosInfo() {
57 WmiQuery<BiosProperty> biosQuery = new WmiQuery<>(WIN32_BIOS_WHERE_PRIMARY_BIOS_TRUE, BiosProperty.class);
58 return Objects.requireNonNull(WmiQueryHandler.createInstance()).queryWMI(biosQuery);
59 }
60 }