I wrote a keyfinder a long(!) time ago in KixForms (the non-.net version) based on some of Lonk's code. Might be of some help.

 Code:
Break On
$System = CreateObject("Kixtart.System")

;KD START

$Form = $System.Form()
$Form.BackColor = 235,233,237
$Form.FontSize = 8,25
$Form.Height = 255
$Form.Text = "KeyFinder"
$Form.Width = 455
$Button1 = $Form.Controls.Button()
$Button1.FontSize = 8,25
$Button1.Height = 33
$Button1.Left = 15
$Button1.Text = "Exit"
$Button1.Top = 165
$Button1.Width = 420
$Button1.OnClick = "$$=$$Form.Hide()"
$ListViewEx1 = $Form.Controls.ListView()
$ListViewEx1.FontSize = 8,25
$ListViewEx1.Height = 134
$ListViewEx1.Left = 15
$ListViewEx1.Top = 15
$ListViewEx1.Width = 420
$=$ListViewEx1.Columns.Add("Product",200)
$=$ListViewEx1.Columns.Add("Key Code",215)

;KD END

$Form.Show
StartScript
While $Form.Visible
   $=Execute($Form.DoEvents())
Loop
Exit 1

Function StartScript()
  $Form.Text = "KeyFinder - SEARCHING!!!!"
  $ListViewEx1.Items.Clear
  $ListViewEx1.Enabled = 0
  $ListViewEx1.BeginUpdate
  Dim $RegArray,$Value,$Product,$Key
  $RegArray = SearchReg("HKLM\Software\Microsoft","DigitalProductID",2)
  If @Error
  'No matching items found' ?
  Else
    For Each $Value In $RegArray
      If $Value
        $Product = ReadValue(Join(Split($value,'<=>DigitalProductId'),''),'ProductName')
        If $Product
          $Key = Get_Product_Key(ReadValue(Join(Split($value,'<=>DigitalProductId'),''), 'DigitalProductID'))
          $Item = $ListViewEx1.Items.Add($Product)
          $Item.SubItems(1).Text = $Key
;         $Product + ': ' + $Key ?
        EndIf
      EndIf
    Next
  EndIf
  $ListViewEx1.EndUpdate
  $ListViewEx1.Enabled = 1
  $Form.Text = "KeyFinder - Finished!"
EndFunction
  
Function SearchReg($Key,$Str,$SrcIn)
  Dim $Idx,$vName,$Value,$num,$SubKey,$fArr,$mbr
  $SearchReg = ''
  $num = 0
  $Idx = 0
  $vName = EnumValue($Key,$Idx)
  Do
    $mbr = ''
    If $SrcIn & 1
    $Value = ReadValue($Key,$vName)
     If InStr($Value,$Str)
       $mbr = $Key + "<=>" + IIf($vName,$vName,'<Default>')
     EndIf
    EndIf
    If ($SrcIn & 2) AND InStr($vName,$Str)
      $mbr = $Key + "<=>" + $vName
    EndIf
    If $mbr
      ReDim Preserve $SearchReg[$num]
      $SearchReg[$num] = $mbr
      $num = $num + 1
    EndIf
    $Idx = $Idx + 1
    $vName = EnumValue($Key,$Idx)
  Until @Error
  $Idx = 0
  $SubKey = EnumKey($Key,$Idx)
  While $SubKey
    If ($SrcIn & 4) AND InStr($SubKey,$Str)
      ReDim Preserve $SearchReg[$num]
      $SearchReg[$num] = $Key + '\' + $SubKey + "<=><KeyName>"
      $num = $num + 1
    EndIf
    $fArr = SearchReg($Key + "\" + $SubKey,$Str,$SrcIn)
    If @Error = 0
      For Each $mbr In $fArr
        ReDim Preserve $SearchReg[$num]
        $SearchReg[$num] = $mbr
        $num = $num + 1
      Next
    EndIf
    $Idx = $Idx + 1
    $SubKey = EnumKey($Key,$Idx)
  Loop
  Exit VarType($SearchReg) = 8
EndFunction
  
Function Get_Product_Key($sProductID)
  Dim $aiKeyChars[24],$bProductKey[15],$ilByte,$i,$sCDKey,$nCur
  $aiKeyChars = Split('B,C,D,F,G,H,J,K,M,P,Q,R,T,V,W,X,Y,2,3,4,6,7,8,9',',')
  For $i = 0 To 14
    $bProductKey[$i] = Val("&"+SubStr($sProductID,$i*2+105,2))
  Next
  $sCDKey = ""
  For $ilByte = 24 To 0 Step -1
    $nCur = 0
    For $i=14 To 0 Step -1
      $nCur = $nCur * 256 | $bProductKey[$i]
      $bProductKey[$i] = Int($nCur / 24)
      $nCur = $nCur Mod 24
    Next
    $sCDKey = $aiKeyChars[$nCur] + $sCDKey
    If $ilByte Mod 5 = 0 AND $ilByte <> 0 $sCDKey = "-" + $sCDKey EndIf
  Next
  $Get_Product_Key = $sCDKey
EndFunction