Updated.

  • Checks that the EDID block is valid.
  • Displays the EDID version info if debugging is switched on.
  • Displays the week and year of manufacture.
  • Displays the 1.2 serials number - YMMV but this is a garbage value for me.


Code:
; Return monitor info.

Break ON

$=SetOption("Explicit","ON")
$=SetOption("WrapAtEOL","ON")
$=SetOption("ASCII","ON")

GLOBAL $VERBOSE

$VERBOSE=1 ; Set to "0" to disable debug info

Dim $KEY_DISPLAY
Dim $iIndexPri,$iIndexSub
Dim $sMonitor,$sDevice

$KEY_DISPLAY="HKLM\SYSTEM\CurrentControlSet\Enum\Display"

; Iterate through possible displays.
Log("Starting scan for monitor info...")
$iIndexPri=0
$sMonitor=EnumKey($KEY_DISPLAY,$iIndexPri)
While Not @ERROR
$sMonitor=$KEY_DISPLAY+"\"+$sMonitor
Log("--------------------------------------------")
Log("Primary key is '"+$sMonitor+"'")
$iIndexSub=0
$sDevice=EnumKey($sMonitor,$iIndexSub)
while Not @ERROR
$sDevice=$sMonitor+"\"+$sDevice
Log(" Secondary key is '"+$sDevice+"'")
If KeyExist($sDevice+"\Control")
Log(" Control found - device assumed to be active")
If Instr(ReadValue($sDevice,"HardwareID"),"Monitor\")=1
Log(" Device type is monitor.")
ParseEDID(ReadValue($sDevice+"\Device Parameters","EDID"))
Else
Log(" Device type is not monitor.")
EndIf
Else
Log(" Control not found - device assumed to be inactive")
EndIf
$iIndexSub=$iIndexSub+1
$sDevice=EnumKey($sMonitor,$iIndexSub)
Loop
$iIndexPri=$iIndexPri+1
$sMonitor=EnumKey($KEY_DISPLAY,$iIndexPri)
Loop

Log("Completed scan for monitor info.")
Exit 0

Function ParseEDID($sEDID)
Dim $iOffset, $sBlock
If $sEDID=""
Log(" No EDID information associated with device")
Exit 0
EndIf
; Check for valid EDID data
If SubStr($sEDID,1,16)="00ffffffffffff00"
Log(" EDID signature is valid")
Else
Log(" EDID signature is invalid: "+SubStr($sEDID,1,16))
Exit 0
EndIf
Log(" "+$sEDID)
Log(" EDID Version number is "
+Execute("Exit &"+SubStr($sEDID,(&12+1)*2-1,2))
+"."
+Execute("Exit &"+SubStr($sEDID,(&13+1)*2-1,2)))
; Look for serial number and model number in descriptor blocks.
For $iOffset=54 To 108 Step 18
$sBlock=SubStr($sEDID,$iOffset*2+1,18*2)
Select
Case Left($sBlock,8)="000000fc"
" Model: "
Bin2Str(SubStr($sBlock,9)) ?
Case Left($sBlock,8)="000000fe"
" Other info: "
Bin2Str(SubStr($sBlock,9)) ?
Case Left($sBlock,8)="000000ff"
"EDID 1.3 Serial number: "
Bin2Str(SubStr($sBlock,9)) ?
Case "Unknown type"
Log(" Unknown type: "+Left($sBlock,8))
EndSelect
Next
"EDID 1.2 Serial number: "+Execute("Exit &"+SubStr($sEDID,(&1C+1)*2-1,8))+@CRLF
" Week of manufacture: "+Execute("Exit &"+SubStr($sEDID,(&10+1)*2-1,2))+@CRLF
" Year of manufacture: "+(1990+Execute("Exit &"+SubStr($sEDID,(&11+1)*2-1,2)))+@CRLF
EndFunction

Function Bin2Str($s)
Dim $c

While $s
$c=Execute("Exit &"+Left($s,2))
; Truncate string at CR
If $c=10 Exit 0 EndIf
iF $c $Bin2Str=$Bin2Str+Chr($c) EndIf
$s=SubStr($s,3)
Loop

Exit 0
EndFunction

Function Log($s)
If $VERBOSE @DATE+" "+@TIME+" "+$s+@CRLF EndIf
Exit 0
EndFunction