I have a VB6 application which has the following peice of code that appears to be attempting to access Windows Process information
I think it may be the cause of an intermittent endless loop - REDIM-ming an array and chewing up all the memory.
Is there anyone out there that knows what the Following piece of code is for, and if they can help in catching the scenario whereby it loops for A long time and bytBuf grows in size too much (and can you recommend a max array size for bytBuf?)
Do
ReDim bytBuf(nSize)
ntStatus = NtQuerySystemInformation(SystemHandleInformation, VarPtr(bytBuf(0)), nSize, 0&)
If (Not NT_SUCCESS(ntStatus)) Then
If (ntStatus <> STATUS_INFO_LENGTH_MISMATCH) Then
Erase bytBuf
Exit Function
End If
'If it always ends up here, it will loop endlessly! How do I stop it?!
Else
Exit Do
End If
nSize = nSize * 2
ReDim bytBuf(nSize)
Loop
Many thanks Andrew