Delphi DLL call causes VB6 exe to crash with "Runtime Error" -2147418113 (8000ffff) "Method '~' of object '~' failed, but only on some machines!

I searched for a watch, but did not find anything like it.

The accident has two flavors; one of them has a "Runtime Error" -2147418113 (8000ffff) "The method '~' of the object '~' failed," and the second taste is a complete failure when Windows asks if I want to report this to Microsoft. In the second case I decided to debug once and it showed "Unhandled exception in App.exe (OLEAUT32.DLL): 0xC0000005: access violation".

The Disassembly screen displays a yellow pointer on the top line:

>> 771148A4  mov ecx, dword ptr [esi]
   771148A6  add ecx, 15h
   771148A9  and ecx, 0FFFFFFF0h
   771148AC  push ecx
   771148AD  push esi
...

The problem arises when a certain essential function is called in a third-party Delphi DLL, but I cannot directly declare that the DLL-buggies, because this only happens in the executable files of the program that I am compiling. The same DLL is used in hundreds of other clients and (at least for the moment), I am the only one who faces this problem. The same source code, compiled on a client PC or at a third-party office, works great.

, : VB6 SP6 exe . , , , , , , ; , , , .

Boost (. ), IDE, . , .

Public mXApp As XObjects.XApplication

Public Sub Main    
    On Error Resume Next
    Set mXApp = New XObjects.XApplication
    If Err.Number = 0 Then
        MsgBox "Found: " & mXApp.Version & vbCrLf & mXApp.GetAppPath
    Else
        MsgBox "XApp DLL not found. " & Err.Number & ": " & Err.Description
    End If
    Err.Clear
End Sub

Public Sub Login(Byval uid As String,  Byval pwd As String, Byval companyNr as Long)
Dim ok as Boolean
    ok = mXApp.Login(uid, pwd, companyNr)' >> CRASH! Program never gets to the next line.'
    If ok Then
        MsgBox "Login success"
    Else
        MsgBox "Login fails"
    End If
End Sub

, mXApp - GetAppPath - - . . VB IDE :

Function Version() As String
Function GetAppPath() As String
Function Login(UserName As String, Password As String, FirmNr As Long) As Boolean

- - ( ) , ?

+3
3

, , Delphi, , DLL, .

-, , DLL VB . VB , DLL Delphi - , undefined.

-, , . COM, COM BSTR, WideString Delphi. , VB . DLL , , .

, .

+2

! , :

... , DLL VB . VB DLL Delphi - , undefined.

DLL , , . , . , , ; , DLL .

, dll, . dll 1.1 . Viewer . . , IDE, dll version 1.2 , , VB dll . . , IDE .

, DLL , , , , , .

, :

Function Login(UserName As String, Password As String, FirmNr As Long, [PeriodNr As Long]) As Boolean
+2

Make sure you load the correct DLL. Process Explorer from SysInternals will show you the DLLs that are used in any application (configure it to display DLLs in the bottom pane). You may be loading a different version of the DLL, unknowingly. You can run it right here: http://live.sysinternals.com/ click on procexp.exe

+1
source

Source: https://habr.com/ru/post/1777327/


All Articles