PDA

View Full Version : iDispatch variable cause thinBasic crash



DirectuX
24-01-2020, 18:57
Hi,

in this minimal example, we can see that thinBasic crash at the end of script. At first I thought it is because some variable was not destroyed before the end, but thinDebug shows that it isn't the case.


uses "console"

string strComputer = "."

iDispatch objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

if IsComObject(objWMIService) Then

iDispatch colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Volume")

if IsComObject(colItems) Then

iDispatch objItem

For nItem as long = 1 to colItems.Count

objItem = colItems.ItemIndex(nItem - 1) '---First item in collectins starts at 0

printl $tab, "Name..............: ", objItem.Name

objItem = Nothing

Next

colItems = Nothing

Else

end If

objWMIService = Nothing

Else

end If

Printl "Press a key to end."

WaitKey

ErosOlmi
25-01-2020, 12:49
Ciao,

yes I confirm it crashed at the end.
I think it is something related to OLE32 de-initialize
Will check

Thanks for reporting
Eros



<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <System>
<Provider Name="Application Error" />
<EventID Qualifiers="0">1000</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>100</Task>
<Opcode>0</Opcode>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2020-01-25T10:41:44.9695929Z" />
<EventRecordID>24657</EventRecordID>
<Correlation />
<Execution ProcessID="0" ThreadID="0" />
<Channel>Application</Channel>
<Computer>EOlmi-HPEB8540W</Computer>
<Security />
</System>
<EventData>
<Data>thinBasic.exe</Data>
<Data>1.11.3.0</Data>
<Data>00003039</Data>
<Data>OLEAUT32.dll</Data>
<Data>10.0.19041.1</Data>
<Data>d273657c</Data>
<Data>c0000005</Data>
<Data>0001eae4</Data>
<Data>1874</Data>
<Data>01d5d36c0691fb7b</Data>
<Data>C:\thinBasic\thinBasic.exe</Data>
<Data>C:\WINDOWS\System32\OLEAUT32.dll</Data>
<Data>4e8fd6b1-e8ef-47eb-89f4-443540c8ce3d</Data>
<Data />
<Data />
</EventData>
</Event>