Jump to content

How can I determine driver version number of wireless card?


NutJob
 Share

Recommended Posts

As part of a planned rollout for Access Connections 4.42 I need to determine the driver level of the laptop wireless card. AC 4.42 requires a certain driver level (or higher).

Does anybody have some code samples to point me in the right direction?

TIA!

Rob

Link to comment
Share on other sites

OK, I may not be around to see what you know... but here is what I know...

Enumerate through

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\PCI

and find a "Driver" value... parse it and find the assoc value at...

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class

in the key there you will find... "DriverVersion"

Lar.

f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Link to comment
Share on other sites

The wireless card will be plugged in. Some laptops may not have the radio antenna turned on, but that shouldn't matter (I think).

I found a .VBS script that uses WMI that does much of what I need. It actually does more than I need. I have attached it here if anybody want to take a peek at it. I don't know VBS and I 'm having troubles figuring out AutoIT code to do something similar. I don't need to display the result on screen. I would like to insert the card name and driver version number into variables.

I had to change the file extention to .txt in order to upload it. But is should be *.vbs

WMIGetWirelessDriversVersion.txt

Link to comment
Share on other sites

Are you querying for a specific wireless card?

What brand card?

This returns all Card Desc with versions...

$a = GetWirelessDescAndDriverVersions()
If @Error Or @Extended Then Exit

For $n = 1 to UBound($a)
    MsgBox(4096,"",$a[0][0] & @LF & $a[0][1] & @LF & $a[0][2])
Next


Func GetWirelessDescAndDriverVersions()
    Local Const $netkey = "HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}"
    Local Const $keypath = "HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}"
    Local $n = 0,$i = 0,$bPoop = True
    Local $subkey1,$subkey2
    Local $return[1][3], $j=0
    While 1
        $n+=1
        $subkey1 = RegEnumKey($netkey,$n)
        If @error Then ExitLoop
        If RegRead($netkey & "\" & $subkey1 & "\Connection","MediaSubType") = 2 Then
            $bPoop = False
            $j += 1
            Redim $return[$j][3]
            $return[$j-1][0]= RegRead($netkey & "\" & $subkey1 & "\Connection","Name")
            $i = 0
            While 1
                $i += 1
                $subkey2 = RegEnumKey($keypath,$i)
                If @error Then Return SetError(1,0,0)
                If RegRead($keypath & "\" & $subkey2,"NetCfgInstanceId") = $subkey1 Then
                    $return[$j-1][1] = RegRead($keypath & "\" & $subkey2,"DriverDesc")
                    $return[$j-1][2] = RegRead($keypath & "\" & $subkey2,"DriverVersion")
                    ExitLoop
                EndIf
            WEnd
        EndIf
    WEnd
    If $bPoop Then Return SetError(0,1,0)
    Return $return
EndFunc
Edited by LarryDalooza

f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Link to comment
Share on other sites

@All

Translation of the VBS

;*****************************************************
;     Script Name:  WMIGetWirelessDriversVersion.au3
;
;     Purpose:
;              Queries the registry of the target system using WMI
;              searching for wireless (802.11) cards. If any such card
;              is found, it displays the version of the associated driver
;              and the path to the driver file.
;              The list of driver versions could be used to identify
;              systems running wireless drivers with known vulnerabilities.
;     Arguments:
;              It takes only one argument: the name or IP address
;              of the target system.
;              If more arguments are specified they are ignored.
;              If run without arguments it targets the localhost.
;
;
;*****************************************************

Dim $arrSubKeys, $dwvalue, $strValue, $arrSubKeys2, $strValue2, $strValue3
Const $HKEY_LOCAL_MACHINE = 0x80000002


$strComputer = "."


; Connect to remote registry through WMI
ConsoleWrite ("Establishing WMI connection...")
 $oReg=ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & _
                    $strComputer & "\root\default:StdRegProv")
ConsoleWrite ("...done" & @CRLF)

; Search for Wireless cards
ConsoleWrite ("Searching for wireless cards..." & @CRLF)

$iNetworkCardsFound = 0
$iWirelessCardsFound = 0

$strKeyPath = "SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}"
$oReg.EnumKey ($HKEY_LOCAL_MACHINE, $strKeyPath, $arrSubKeys)

For $subkey In $arrSubKeys
  If $subkey <> "Descriptions" Then
    $iNetworkCardsFound = $iNetworkCardsFound+1
    ;Wscript.Echo $strKeyPath & "\" & $subkey & "\" & "Connection"
    $strValueName = "MediaSubType"
    $oReg.GetDWORDValue ($HKEY_LOCAL_MACHINE,$strKeyPath & "\" & $subkey & "\" & "Connection" ,$strValueName,$dwvalue)

    If $dwvalue = 2 Then

      ; This means MediaSubType=2, which is true for wireless cards only
      $iWirelessCardsFound += 1

      ; Get the name of the network connection
      $strValueName = "Name"
      $oReg.GetStringValue ($HKEY_LOCAL_MACHINE,$strKeyPath & "\" & $subkey & "\" & "Connection" ,$strValueName,$strValue)

      ConsoleWrite ("============================" & @CRLF & _
                    "Found wireless card at: "  & _
                    @TAB & "HKLM\" & $strKeyPath & "\" & $subkey & "\" & "Connection" & @CRLF & _
                    @TAB & "Name:" & @TAB & $strValue & @CRLF)

      ; $subkey will correspond to the value of NetCfgInstanceID of the 
      ; corresponding key under:
      ;   HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\[NUMBER]\
      ;NetCfgInstanceID = {7C1F7564-C990-420E-A4D6-F54092764DF9}

      ; Let us find that [NUMBER]. (Will be called $subkey2)

      $strKeyPath2 = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}"
      $oReg.EnumKey ($HKEY_LOCAL_MACHINE, $strKeyPath2, $arrSubKeys2)

      For $subkey2 In $arrSubKeys2
        ;Wscript.Echo "Checking: " & $strKeyPath2 & "\" & $subkey2
        $strValueName2 = "NetCfgInstanceId"
        $oReg.GetStringValue ($HKEY_LOCAL_MACHINE,$strKeyPath2 & "\" & $subkey2 ,$strValueName2,$strValue2)
      
        If $strValue2 = $subkey Then
          ; Show path
          ConsoleWrite ("Found corresponding driver data at:" & @CRLF )
          ConsoleWrite ( "HKLM\" & $strKeyPath2 & "\" & $subkey2 & @CRLF)

          ; Show NetCfgInstanceId
          ConsoleWrite (@TAB & $strValueName2 & ":" & @TAB & $strValue2 & @CRLF  )
          
          ; Show DriverDesc
          $strValueName2 = "DriverDesc"
          $oReg.GetStringValue ($HKEY_LOCAL_MACHINE,$strKeyPath2 & "\" & $subkey2 ,$strValueName2,$strValue2)
          ConsoleWrite (@TAB & $strValueName2 & ":" & @TAB & $strValue2 & @CRLF  )

          ; Show DriverVersion
          $strValueName2 = "DriverVersion"
          $oReg.GetStringValue ($HKEY_LOCAL_MACHINE,$strKeyPath2 & "\" & $subkey2 ,$strValueName2,$strValue2)
          ConsoleWrite (@TAB & $strValueName2 & ":" & @TAB & $strValue2  & @CRLF )

          ; Show Service
          $strValueName2 = "Service"
          $oReg.GetStringValue ($HKEY_LOCAL_MACHINE,$strKeyPath2 & "\" & $subkey2 & "\Ndi",$strValueName2,$strValue2)
          ConsoleWrite (@TAB & $strValueName2 & ":" & @TAB & $strValue2 & @CRLF  )
          $strService = $strValue2
          
          ; Show ImagePath
          $strKeyPath3 = "SYSTEM\CurrentControlSet\Services\" & $strService
          $strValueName3 = "ImagePath"
          $oReg.GetStringValue ($HKEY_LOCAL_MACHINE,$strKeyPath3 & "\",$strValueName3,$strValue3)
          ConsoleWrite (@TAB & $strValueName3 & ":" & @TAB & $strValue3 & @CRLF  )
          
          ; Print separator
          ConsoleWrite ("============================" & @CRLF & @CRLF)
        EndIf
      Next

    EndIf ;($dwvalue=2)
  EndIf ;($subkey <> "Descriptions")
Next
ConsoleWrite ("...done" & @CRLF)

;Statistics
ConsoleWrite ("Total number of network cards found: " & @TAB & $iNetworkCardsFound & @CRLF)
ConsoleWrite ("Total number of wireless network cards found: " & @TAB & $iWirelessCardsFound & @CRLF)

Regards

ptrex

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...