如何查看ROM大小?

The*_*xGK 2 bios rom

在 Windows 中,如何查看计算机上安装的 ROM 芯片用于存储 UEFI/BIOS 的容量?我更喜欢使用 Windows 工具或命令而不安装任何其他应用程序的方式。

and*_*415 5

Reading SMBIOS information

From Wikipedia:

In computing, the System Management BIOS (SMBIOS) specification defines data structures (and access methods) that can be used to read information stored in the BIOS of a computer. Circa 1999, it became part of the domain of the Distributed Management Task Force (DMTF). [...] At approximately the same time Microsoft started to require that OEMs and BIOS vendors support the interface/data-set in order to have Microsoft certification.

Source: System Management BIOS

The SMBIOS information is stored in different data tables; the first one (type 0) contains basic details such as vendor, version, and release date. The size of the physical device containing the BIOS corresponds to a single byte which is located at offest 0x9 of the said table.

The actual size can be calculated by like this:

64K * (value + 1)
Run Code Online (Sandbox Code Playgroud)

A value of 0 means the size is 64 KiB, 1 means 128 KiB, and so on.

As far as I know, Windows doesn't provide a built-in utility which can retrieve specific SMBIOS data such as the ROM size. You can still write a script yourself, though; see below for some working examples. As an alternative you can use a third-party program, e.g. a dmidecode Windows port.


Batch script

@echo off
setlocal enabledelayedexpansion

set key=HKLM\SYSTEM\CurrentControlSet\services\mssmbios\Data

for /f "tokens=3" %%G in (
'reg query "%key%" /v "SMBiosData" ^| findstr /i /c:"REG_"'
) do (
set "size=%%~G"
set /a size=64 * 0x!size:~34,2! + 64
)

echo ROM Size: %size% KiB
PAUSE
exit /b
Run Code Online (Sandbox Code Playgroud)

VBScript

64K * (value + 1)
Run Code Online (Sandbox Code Playgroud)

PowerShell

@echo off
setlocal enabledelayedexpansion

set key=HKLM\SYSTEM\CurrentControlSet\services\mssmbios\Data

for /f "tokens=3" %%G in (
'reg query "%key%" /v "SMBiosData" ^| findstr /i /c:"REG_"'
) do (
set "size=%%~G"
set /a size=64 * 0x!size:~34,2! + 64
)

echo ROM Size: %size% KiB
PAUSE
exit /b
Run Code Online (Sandbox Code Playgroud)

Remarks

Windows Management Instrumentation (WMI) is the preferred method for reading SMBIOS information in Windows.

Source: Device\PhysicalMemory Object

The [SMBIOS] driver also stores this information in the registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Mssmbios\Data. Although SMBIOS information is stored in the registry at this location, consumers should continue to use WMI or the GetSystemFirmwareTable() API to retrieve SMBIOS data. There is no guarantee that this information will be stored at this registry subkey for every subsequent release of Windows.

Source: SMBIOS Support in Windows

Further reading