I am trying to execute imported function in Delphi 2007:
function getOfficialCardNumber(): WideString ; cdecl; external 'idcapp.dll';
but after few second (in debug configuration) it stops here:
77BD37D6 C6055562C17700 mov byte ptr [$77c16255],$00
and says this:
Debug Output: Heap block at 027D4FF8 modified at 027D5009 past requested size of 9 Process PreglediZaDom.exe (23672)
Mentioned function was written in C++ (Visual Studio)
I have tried changing WideString to PWideString and others, but no success. Does anyone know what can be a problem?
In similar application, but written in VB6 they gave me this function to convert strings:
Public Function pisBstrToString(bstr) As String
Dim bArray() As Integer
Dim longArray() As Long
Dim str As String
Dim i As Integer
bArray = pisStringToBArray(bstr)
longArray = pisBArrayToLongArray(bArray)
str = ""
For i = 1 To UBound(longArray)
If longArray(i) > 0 And longArray(i) < 256 Then
str = str & Chr(longArray(i))
Else
str = str & pisLongToUnichar(longArray(i))
End If
Next i
pisBstrToString = str
End Function
I know now that function written in C++ was exported like this:
BSTR _stdcall getOfficialCardNumber()