Regarding repeated backups, they can be handled, but this is inefficient and takes a long time. Although there are repeats, the driver files being backed up rarely have duplicates.
For WHQL digital signatures, I read the oem*.inf to extract the corresponding.cat to compensate for the shortcomings of devcon. And finally, rename oem*.inf and oem*.cat to the same file name as in the inf content, so that the WHQL digital signature remains valid when updating again. The major shortcoming of Driver Genius is that it only extracts the.cat file and does not rename the.inf to the corresponding file name, resulting in an invalid WHQL digital signature when updating again.
For example, the content of my Creative sound card inf is
After driver installation, the files are saved in the system directory as oem2.inf and oem2.cat. If not renamed to ECTIVA.inf and ECTIVA.cat when backing up, the WHQL digital signature will be invalid when updating the driver again. Driver Genius can only achieve oem2.inf and ECTIVA.cat.
Renaming code:
for /f "tokens=1* delims== " %%k in ('type "%inf%"^|find /i ".cat"') do set oemname=%%~nl
if defined oemname for /f "delims=*" %%k in ('dir /s /b /a-d "%SystemRoot%\system32\CatRoot\%infname%.cat" 2^>nul') do set catfile=%%~k
if not defined catfile for /f "delims=*" %%k in ('dir /s /b /a-d "%SystemRoot%\%oemname%.cat" 2^>nul') do set catfile=%%k
if defined catfile (
set infname=%oemname%
xcopy /h /r /y "%catfile%" "drivers\%class%\%name%\*.*">nul 2>>%log%
if errorlevel 0 color 0e&&echo 含WHQL数字签名
attrib -s -h -r "drivers\%class%\%name%\%infname%.*">nul
move /y "drivers\%class%\%name%\%infname%.inf" "drivers\%class%\%name%\%oemname%.inf">nul 2>nul
move /y "drivers\%class%\%name%\%infname%.cat" "drivers\%class%\%name%\%oemname%.cat">nul 2>nul
)
for /f "delims= " %%i in ('devcon hwids %ID%^|sed -n "/Hardware ID's:/{n;p;}"') do echo "%infname%.inf"****"%%~i">>"drivers\HardwareID.log"
For WHQL digital signatures, I read the oem*.inf to extract the corresponding.cat to compensate for the shortcomings of devcon. And finally, rename oem*.inf and oem*.cat to the same file name as in the inf content, so that the WHQL digital signature remains valid when updating again. The major shortcoming of Driver Genius is that it only extracts the.cat file and does not rename the.inf to the corresponding file name, resulting in an invalid WHQL digital signature when updating again.
For example, the content of my Creative sound card inf is
; ECTIVA Audio 5.1 Series INF file
;
; Feature : Enhanced (WDM)
; Language : English
;
; Date : 12 Feb 2004
; Revision : 1.00.003
;
; Copyright 1995-2004, Creative Technology Ltd.
Signature="$CHICAGO$"
Class=MEDIA
ClassGUID={4d36e96c-e325-11ce-bfc1-08002be10318}
provider=%MfgName%
CatalogFile=ECTIVA.cat
DriverVer=02/12/2004,5.12.01.004
%MfgName%=ECTIVA
After driver installation, the files are saved in the system directory as oem2.inf and oem2.cat. If not renamed to ECTIVA.inf and ECTIVA.cat when backing up, the WHQL digital signature will be invalid when updating the driver again. Driver Genius can only achieve oem2.inf and ECTIVA.cat.
Renaming code:
for /f "tokens=1* delims== " %%k in ('type "%inf%"^|find /i ".cat"') do set oemname=%%~nl
if defined oemname for /f "delims=*" %%k in ('dir /s /b /a-d "%SystemRoot%\system32\CatRoot\%infname%.cat" 2^>nul') do set catfile=%%~k
if not defined catfile for /f "delims=*" %%k in ('dir /s /b /a-d "%SystemRoot%\%oemname%.cat" 2^>nul') do set catfile=%%k
if defined catfile (
set infname=%oemname%
xcopy /h /r /y "%catfile%" "drivers\%class%\%name%\*.*">nul 2>>%log%
if errorlevel 0 color 0e&&echo 含WHQL数字签名
attrib -s -h -r "drivers\%class%\%name%\%infname%.*">nul
move /y "drivers\%class%\%name%\%infname%.inf" "drivers\%class%\%name%\%oemname%.inf">nul 2>nul
move /y "drivers\%class%\%name%\%infname%.cat" "drivers\%class%\%name%\%oemname%.cat">nul 2>nul
)
for /f "delims= " %%i in ('devcon hwids %ID%^|sed -n "/Hardware ID's:/{n;p;}"') do echo "%infname%.inf"****"%%~i">>"drivers\HardwareID.log"

