中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-10-12 13:54
47,815 topics / 349,922 posts / today 0 new / 48,285 members
其它操作系统综合讨论区 » Backing up drivers with pure script借助DevCon, compatible with Driver Genius (2008-01-17)
Printable Version  83,764 / 72
Floor31 fastslz Posted 2007-12-18 15:08
铂金会员 Posts 2,315 Credits 5,493 From 上海
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

; 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"
Floor32 pfox Posted 2007-12-18 17:10
银牌会员 Posts 446 Credits 1,451
The driver is indeed installed using setup.exe. Since there is no problem with the program, we will leave it for now. I will try Driver Genius later to see if the backup is correct. It seems that this driver is relatively special, and Driver Genius cannot back up this file during the backup.

[ Last edited by pfox on 2007-12-18 at 05:19 PM ]
Floor33 qq43142691 Posted 2008-01-07 08:58
中级用户 Posts 152 Credits 326
Are you all just arrived from Mars?~~~~~
Floor34 regvip2008 Posted 2008-01-16 18:18
初级用户 Posts 87 Credits 187
These questions are too profound, I can't understand them! But still, give a thumbs up!
Floor35 dooomer Posted 2008-01-18 12:10
初级用户 Posts 52 Credits 109
Good stuff, give it a top first.
Floor36 ttj36 Posted 2008-02-07 09:25
初级用户 Posts 37 Credits 80
Not bad, older brother. This batch process is too useful. However, in the basic, it seems that the backup of the printer can't be done. Is it necessary to add USBPRINT this? Please give guidance, big brother.

[ Last edited by ttj36 on 2008-2-7 at 09:39 AM ]
Floor37 fastslz Posted 2008-02-08 21:34
铂金会员 Posts 2,315 Credits 5,493 From 上海
Originally posted by ttj36 at 2008-2-7 09:25:
Not bad, older brother, this batch processing is too easy to use, but, in the basic part, it seems that the backup of the projector cannot be saved, is it necessary to add USBPRINT? Please give me some advice

[ Last edited by ttj36 on 2008-2-7 at 09:39 AM ]

for %%a in (PCI PCIIDE USB IDE DISPLAY USBPRINT) do (
......
Floor38 ttj36 Posted 2008-02-09 12:49
初级用户 Posts 37 Credits 80
Still can't backup, what's the matter, ah, is it the parallel port printer driver Parport, USB printer driver Usbprint? Then why is it not easy to backup? Just now I saw that I also need to plug in the printer to backup, what's the matter, it should be able to backup ah,

[ Last edited by ttj36 on 2008-2-9 at 01:10 PM ]
Floor39 fastslz Posted 2008-02-09 20:03
铂金会员 Posts 2,315 Credits 5,493 From 上海
for %%a in (PCI PCIIDE USB IDE DISPLAY) do (
for /f "tokens=1* delims=: " %%b in ('devcon find %%a\*^|find "\"') do call :startcopy "@%%b" "%%c"
)

Replace with
for /f "tokens=1* delims=: " %%b in ('devcon find *^|find "\""') do call :startcopy "@%%b" "%%c"
Or a wider range
for /f "tokens=1* delims=: " %%b in ('devcon findall *^|find "\""') do call :startcopy "@%%b" "%%c"
Floor40 ttj36 Posted 2008-02-09 20:08
初级用户 Posts 37 Credits 80
I'll give it a try, thank you.
Floor41 ttj36 Posted 2008-02-09 20:19
初级用户 Posts 37 Credits 80
I just tried changing it to for /f "tokens=1* delims=: " %%b in ('devcon find *^|find "\"') do echo "%%b"****"%% There are too many drivers,
I changed it to for /f "tokens=1* delims=: " %%b in ('devcon findall %%a\*^|find "\"') do echo "%%b"****"%% like this, and there are 4 more drivers backed up,
Is this correct?
Floor42 fastslz Posted 2008-02-09 20:29
铂金会员 Posts 2,315 Credits 5,493 From 上海
Originally posted by ttj36 at 2008-2-9 20:19:
I just tried changing it to for /f "tokens=1* delims=: " %%b in ('devcon find *^|find "\"') do echo "%%b"****"%% There are too many drivers,
I changed it again to for /f "tokens ...

Take a look at the part corresponding to the printer driver in Drivers\HardwareID.log
Floor43 ttj36 Posted 2008-02-09 20:31
初级用户 Posts 37 Credits 80
Read above said, "hpf3500p.inf"****"USBPRINT\hpdeskjet_35007052"
for /f "tokens=1* delims=: " %%b in ('devcon findall %%a\*\ | find "\"') do echo "%%b"****"%% seems can only do this, not sure if it's right,

[ Last edited by ttj36 on 2008-2-9 at 08:37 PM ]
Floor44 fastslz Posted 2008-02-09 20:52
铂金会员 Posts 2,315 Credits 5,493 From 上海
It's indeed quite strange. According to reason, for %%a in (PCI PCIIDE USB IDE DISPLAY USBPRINT) do (
This should be able to correctly identify the printer. Otherwise, you can try again
for %%a in (PCI PCIIDE USB IDE DISPLAY USBPRINT) do (
for /f "tokens=1* delims=: " %%b in ('devcon find *%%a*^|find "\"') do echo "%%b"****"%%c">>"%Temp:"=%.\Devinfo.slz"
)

Or
for %%a in (PCI PCIIDE USB IDE DISPLAY USBPRINT) do (
for /f "tokens=1* delims=: " %%b in ('devcon find @%%a*^|find "\"') do echo "%%b"****"%%c">>"%Temp:"=%.\Devinfo.slz"
)


See which of these 2 has greater compatibility. If it still can't be correctly identified, more code needs to be added

[ Last edited by fastslz on 2008-2-9 at 08:55 PM ]
Floor45 ttj36 Posted 2008-02-09 21:03
初级用户 Posts 37 Credits 80
The first one still doesn't work.
Use the second one. It comes out but it doesn't seem right and there's an error.

"1 matching device(s) found."
File not found - monitor.inf

If it really doesn't work, forget it. Just plug in the projector. I just don't understand why it's not easy to backup without plugging in the projector.

[ Last edited by ttj36 on 2008-2-9 at 09:13 PM ]
Prev  1 2 3 4 5  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023