Jump to content
Sign in to follow this  

Appcrash using WMI - I'm stumped

Recommended Posts


I am getting an appcrash when I call the following function from my script.

Func _NIClist()
    Local $NIC, $NIC2, $WMI_NA, $AType
    Local $ret = ""
    Local $WMIobj = ObjGet("winmgmts:\\localhost\")
    If Not IsObj($WMIobj) Then Return ""
    Local $WMI_NAC = $WMIobj.ExecQuery("SELECT DefaultIPGateway,Description,DHCPEnabled,DHCPServer,DNSDomain,Index,IPAddress,IPSubnet,MACAddress,SettingID FROM Win32_NetworkAdapterConfiguration WHERE MACAddress <> '' and MACAddress IS NOT NULL", "WQL", 0x30)
    If IsObj($WMI_NAC) Then
        For $NIC in $WMI_NAC
            If Not IsObj($NIC) Then ContinueLoop
            If $ret <> "" Then $ret &= "|-|"
            $ret &=       $NIC.DefaultIPGateway(0)
            $ret &= "|" & $NIC.Description
            $ret &= "|" & $NIC.DHCPEnabled
            $ret &= "|" & $NIC.DHCPServer
            $ret &= "|" & $NIC.DNSDomain
            $ret &= "|" & $NIC.IPAddress(0)
            $ret &= "|" & $NIC.IPSubnet(0)
            $ret &= "|" & $NIC.MACAddress
            $ret &= "|" & $NIC.SettingID
            $AType = ""
            $WMI_NA = $WMIobj.ExecQuery("SELECT AdapterType FROM Win32_NetworkAdapter WHERE Index = " & $NIC.Index, "WQL", 0x30)
            If IsObj($WMI_NA) Then
                For $NIC2 in $WMI_NA
                    $AType = $NIC2.AdapterType
            $ret &= "|" & $AType
    return $ret

The appcrash window contains the following

>>>> Window <<<<
Title:  AutoIt v3 Script
Class:  #32770
Position:   995, 12
Size:   507, 415
Style:  0x96CA0284
ExStyle:    0x00010109
Handle: 0x0000000000170DEA

>>>> Control <<<<
Class:  RichEdit20W
Instance:   1
ClassnameNN:    RichEdit20W1
Advanced (Class):   [CLASS:RichEdit20W; INSTANCE:1]
Position:   10, 218
Size:   471, 150
ControlClick Coords:    344, 70
Style:  0x50B108C4
ExStyle:    0x00000000
Handle: 0x0000000000110D90

>>>> Mouse <<<<
Position:   1357, 330
Cursor ID:  0
Color:  0xFFFFFF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Problem signature:
  Problem Event Name:   APPCRASH
  Application Name: autoit3.exe
  Application Version:
  Application Timestamp:    52c196bd
  Fault Module Name:    autoit3.exe
  Fault Module Version:
  Fault Module Timestamp:   52c196bd
  Exception Code:   c0000005
  Exception Offset: 0004b79d
  OS Version:   6.1.7601.
  Locale ID:    1033
  Additional Information 1: 0a9e
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
  Additional Information 3: 0a9e
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

Read our privacy statement online:

If the online privacy statement is not available, please read our privacy statement offline:

Check online for a solution and close the program
Close the program

>>>> Hidden Text <<<<

I injected consolewrite statements between each line, to find where the problem was coming from, and it seems to happen on the last iteration, when I reference $NIC.DefaultIPGateway(0).  All of the iterations work perfectly except the last one, which caused AutoIt to crap out.

I am not sure what other error handling I could put in here to make it work.

Any thoughts?

Share this post

Link to post
Share on other sites

Could you test with the latest Beta Version of AutoIt too?

My UDFs and Tutorials:


Active Directory (NEW 2018-12-03 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki

ADO - Wiki


Share this post

Link to post
Share on other sites

It has been fixed in the latest beta.  Here is the closed trac ticket. #2613



Share this post

Link to post
Share on other sites

Confirmed.  That was the problem.  It works perfectly with the latest beta.


Share this post

Link to post
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
Sign in to follow this