China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-28 06:22
中国DOS联盟论坛 » 其它操作系统综合讨论区 » Backing up drivers with pure script借助DevCon, compatible with Driver Genius (2008-01-17) View 81,552 Replies 72
Floor 31 Posted 2007-12-18 15:08 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
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"
第一高手 第二高手

Floor 32 Posted 2007-12-18 17:10 ·  中国 广东 汕头 电信
银牌会员
★★★
Credits 1,451
Posts 446
Joined 2002-10-20 00:00
23-year member
UID 29
Gender Male
Status Offline
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 ]
Floor 33 Posted 2008-01-07 08:58 ·  中国 广东 东莞 电信
中级用户
★★
Credits 326
Posts 152
Joined 2007-05-04 06:16
19-year member
UID 87412
Gender Male
Status Offline
Are you all just arrived from Mars?~~~~~
Floor 34 Posted 2008-01-16 18:18 ·  中国 湖南 长沙 电信
初级用户
★★
Credits 187
Posts 87
Joined 2007-10-23 16:04
18-year member
UID 100558
Gender Male
Status Offline
These questions are too profound, I can't understand them! But still, give a thumbs up!
Floor 35 Posted 2008-01-18 12:10 ·  中国 浙江 温州 乐清市 电信
初级用户
★★
Credits 109
Posts 52
Joined 2006-01-03 22:47
20-year member
UID 48392
Status Offline
Good stuff, give it a top first.
Floor 36 Posted 2008-02-07 09:25 ·  中国 江苏 南通 中移铁通
初级用户
Credits 80
Posts 37
Joined 2008-02-06 18:34
18-year member
UID 110292
Gender Male
Status Offline
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 ]
Floor 37 Posted 2008-02-08 21:34 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
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 (
......
第一高手 第二高手

Floor 38 Posted 2008-02-09 12:49 ·  中国 江苏 南通 中移铁通
初级用户
Credits 80
Posts 37
Joined 2008-02-06 18:34
18-year member
UID 110292
Gender Male
Status Offline
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 ]
Floor 39 Posted 2008-02-09 20:03 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
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"
第一高手 第二高手

Floor 40 Posted 2008-02-09 20:08 ·  中国 江苏 扬州 邗江区 中移铁通
初级用户
Credits 80
Posts 37
Joined 2008-02-06 18:34
18-year member
UID 110292
Gender Male
Status Offline
I'll give it a try, thank you.
Floor 41 Posted 2008-02-09 20:19 ·  中国 江苏 扬州 邗江区 中移铁通
初级用户
Credits 80
Posts 37
Joined 2008-02-06 18:34
18-year member
UID 110292
Gender Male
Status Offline
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?
Floor 42 Posted 2008-02-09 20:29 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
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
第一高手 第二高手

Floor 43 Posted 2008-02-09 20:31 ·  中国 江苏 扬州 邗江区 中移铁通
初级用户
Credits 80
Posts 37
Joined 2008-02-06 18:34
18-year member
UID 110292
Gender Male
Status Offline
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 ]
Floor 44 Posted 2008-02-09 20:52 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
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 ]
第一高手 第二高手

Floor 45 Posted 2008-02-09 21:03 ·  中国 江苏 扬州 邗江区 中移铁通
初级用户
Credits 80
Posts 37
Joined 2008-02-06 18:34
18-year member
UID 110292
Gender Male
Status Offline
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 ]
Forum Jump: