Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Read Hardware Video BIOS

 Keywords: Read Hardware Video BIOS 

Question:

Is there a way to read the hardware video BIOS, to determine what kind of video card a machine has? We have quite a mix of different video cards in our environment. It's always a pain trying to determine which video driver to install. I though maybe I could have WinBatch read the video BIOS, somehow, to help me determine which video driver to install for a given machine.

User reply:

Apparently, If you go to a Windows command prompt and type Debug you'll get a debug prompt. At the prompt type "d c000:0010". This will start to give you the info in HEX, and in ASCII to the right. You may have to type d and enter to scroll through the info till you see the card name. So, in Winbatch might give this a try....
;created by Bryan Keadle, MCNE/MCP
AddExtender("WILX34I.DLL")
Temp=Environment("TEMP")
ComSpec=Environment("COMSPEC")

BOXOPEN("Check Video","Reading BIOS location...")
handle=FileOpen(strCat(TEMP,"\~vid.tmp"),"WRITE")
FileWrite(handle,"d c000:0020 00ff")
FileWrite(handle,"q")
FileClose(handle)
RunHideWait(COMSPEC,strcat("/c debug <",temp,"\~vid.tmp>",temp,"\~vid.txt"))

handle=FileOpen(strCat(TEMP,"\~vid.txt"),"READ")
VidBIOS=""
x=StrUpper(FileRead(Handle));skip first line

BoxText("Reading BIOS data...")
For y=2 to 15
	x=StrUpper(FileRead(Handle))
	If x == "*EOF*" Then Break
	Text=StrSub(x,12,59)
	Text=StrReplace(Text,"-"," ")
	gosub HEXCONVERT
	VidBios=StrCat(VidBios,Line)
Next
FileClose(handle)

y=ItemCount(VidBIOS," ")
VidInfo=""
Hold=""
for x=1 to y
;	DEBUG(@on)
	BoxText("Scrubbing gathered info: %x% of %y%")
	Word=ItemExtract(x,VidBIOS," ")
	if StrLen(Word)>=2
		if Hold<>"" then VidInfo=StrCat(VidInfo," ",Hold)
		Hold=Word
	Else
		Hold=""
	EndIf
	if x==y then break
Next

;Finish up
BoxShut()
VidInfo=StrTrim(VidInfo)
VidInfo=StrReplace(VidInfo,"VGA Compatible","");Duh!
Result=Message("Check Video",StrCat("Video BIOS information includes:",@CRLF,VidInfo))
FileDelete(strCat(TEMP,"\~vid.tmp"))
FileDelete(strCat(TEMP,"\~vid.txt"))
Exit

:HEXCONVERT
Line=""
For x = 1 to 16
   ;extract one char at a time
	char = itemextract(x,Text," ")
	dec = xBaseConvert(char, 16, 10)
	char=" ";Default Character to space

	;	if dec=="32";character is space
	;		char= " "
	;	EndIf
	if dec>="40" && dec<="47" ;character is punctuation
		Char= Num2Char(dec)
	EndIf
	if dec>="48" && dec<="57" ;character is a number
		Char= Num2Char(dec)
	EndIf
	if dec>="65" && dec<="90" ;character is UpperCase
		Char= Num2Char(dec)
	EndIf
	if dec>="97" && dec<="122" ;character is UpperCase
		Char= Num2Char(dec)
	EndIf

	Line=strcat(Line,char)
next
Return

;`````````````````````````````````````````````````````````````````
;Example output of file
;-d c000:0020 00ff
;C000:0020  4D 00 A4 EE 01 7D 5E 08-00 00 00 00 00 00 00 00   M....}^.........
;C000:0030  20 37 36 31 32 39 35 35-32 30 FF FF 87 5F D8 49    761295520..._.I
;C000:0040  33 3F 00 50 00 00 00 00-FA 00 00 00 00 00 00 00   3?.P............
;C000:0050  32 30 30 30 2F 30 35 2F-30 32 20 30 39 3A 31 33   2000/05/02 09:13
;C000:0060  00 00 00 00 E9 5A 56 00-E9 4F 56 00 E9 66 14 00   .....ZV..OV..f..
;C000:0070  E9 63 14 00 00 00 00 00-74 01 FF FF 87 5F D8 49   .c......t...._.I
;C000:0080  E9 1D 01 0D 0A 41 54 49-20 4D 41 43 48 36 34 20   .....ATI MACH64 
;C000:0090  53 47 52 41 4D 20 42 49-4F 53 20 34 2E 31 35 32   SGRAM BIOS 4.152
;C000:00A0  54 20 0D 0A 00 28 43 29-20 31 39 38 38 2D 39 39   T ...(C) 1988-99
;C000:00B0  2C 20 41 54 49 20 54 65-63 68 6E 6F 6C 6F 67 69   , ATI Technologi
;C000:00C0  65 73 20 49 6E 63 2E 42-4B 34 2E 31 2E 33 2F 34   es Inc.BK4.1.3/4
;C000:00D0  2E 31 35 32 54 20 20 6C-70 67 70 34 63 2E 62 74   .152T  lpgp4c.bt
;C000:00E0  20 36 20 00 4D 41 43 48-36 34 4C 42 50 43 49 4D    6 .MACH64LBPCIM
;C000:00F0  54 53 47 55 3F 00 00 90-50 00 00 A0 04 98 EC 02   TSGU?...P.......
;`````````````````````````````````````````````````````````````````



Article ID:   W14858