A quick and dirty port of zentool to Microsoft Windows.
- Used getopt-for-windows to keep command-line parsing as-is.
- Implemented non-standard functions such as
errx()
andstrlcat()
. - Rewrote the majority of structures in
ucode.h
so that they correctly map to the data when compiling with MSVC. - Hardcoded offsets and sizes because the
bitoffsetof()
andbitsizeof()
macros do not work under MSVC. - Rewrote the microcode loader (
loader.c
) to use a kernel-mode driver instead of Linux's/dev/cpu/
and itsmmap()
functionality. - Added
test
command to print current microcode revision andfpatan
return value of each CPU.
-
Install Visual Studio 2022 and vcpkg:
Download and install Visual Studio 2022 with the Desktop development with C++ workload. Also, set up vcpkg for dependency management. -
Install Dependencies:
Open your terminal and run the following commands:vcpkg install json-c vcpkg install openssl vcpkg install gmp
-
Compile the Solution:
Open and compile the solution file (zentool.sln
). -
Locate the Binaries:
After compilation, you'll findzentool.exe
,mcop.exe
,mcas.exe
, and the required dependencies in the\zentool\x64\Release
folder.
You can use the tool to load the modified firmware just as you would on Linux, but you need to load a kernel-mode driver.
I have decided to "borrow" a driver from ASRock because it is code-signed (meaning you don't need to enable test signing mode) and is not blocked (at least for now) by the vulnerable driver blocklist.
You can download the driver from here.
Once downloaded, load it as follows:
sc create AsrOmgDrv binPath="C:\path\to\AsrOmgDrv.sys" type=kernel
sc start AsrOmgDrv
Then, you can use the load command:
zentool.exe --debug load --cpu 2 update.bin
Most of the files originate from zentool and retain their original Apache License, Version 2.0. Some files may have different licenses; for example, win_getopt.c
and win_getopt.h
are released under the LGPL. Please check each file header for more details.