Results 1 to 7 of 7

Thread: Multiple API calls crashing NT

Threaded View

  1. #1

    Thread Starter
    Member docHoliday's Avatar
    Join Date
    Sep 1999
    Location
    Stamford, CT, USA
    Posts
    48

    Multiple API calls crashing NT

    I and a VB buddy have done some independent digging though a bit of code used to open the contents of a machine into a Tree View control using API calls. The problem is the app crashes in NT because more than 1 API call are being made to the same DLL at the same time. They are inside a DO loop, and the it fires an API call it's first time through, but doesn't seem to close it before the second Loop. What I need help with now is identifying which API call made within this function may be persisting through the loop to the next interation.

    Here's the function at fault. Again, any help is greatly appreciated. If anyone would like the entire VBP file to see it in action, you can download it here Message Posted in genral Questions thread

    And now the error filled code:
    Code:
    'This function simply checks a directroy to see if it has any sub directories
    'It returns the first sub dir name and then exits
    Function HasSubDirs(ByVal sStartDir As String) As String
    
    Dim lpFindFileData As WIN32_FIND_DATA, lFileHdl  As Long, lRet As Long
    Dim sTemp As String
    On Error Resume Next
    If sStartDir = "" Then Exit Function
    
    If Right$(sStartDir, 1) <> "\" Then sStartDir = sStartDir & "\"
    sStartDir = sStartDir & "*.*"
    lFileHdl = FindFirstFile(sStartDir, lpFindFileData)
    
    If lFileHdl <> 0 Then
        Do Until lRet = ERROR_NO_MORE_FILES
            If (lpFindFileData.dwFileAttributes And FILE_ATTRIBUTE_DIRECTORY) = 16 Then
                sTemp = StripTerminator(lpFindFileData.cFileName)
                If sTemp <> "." And sTemp <> ".." Then
                    HasSubDirs = StrConv(sTemp, vbProperCase)
                    Exit Do
                End If
            End If
            lRet = FindNextFile(lFileHdl, lpFindFileData)
            If lRet = 0 Then Exit Function
        Loop
    End If
    lRet = FindClose(lFileHdl)
    End Function
    Last edited by docHoliday; May 24th, 2001 at 10:28 PM.
    "A balm? That's a dangerous animal. Throw it in the trough!"
    - Monty Python

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width