Forum > General

dll call fails, how to check the specific reason, so as to solve the problem

<< < (2/3) > >>

Jzhen:

--- Quote from: TRon on February 06, 2023, 08:02:12 am ---
What is the name of the library and/or where can I obtain more information about the library ? (yes, I know you wrote the exact filename "MTAWdll.dll" but what does the abbreviation MTAW mean or what did the author named the DLL ?)

If it is a 3th party library that is distributed then there usually is an accompanied header file so that you know what functions (and their declaration) are present in the library and how the parameters are suppose to be used.

If you are truly decompiling a library that is not intended to be shared (closed/undocumented library) then you are basically on your own. There are some tools available that are able to obtain some valuable information about executables and DLL's but unfortunately my Windows days are long gone (e.g. I have no idea what tools to use these days).

You could always patch the library (overtake the original functions, show the passed parameters and call the original function) in order to obtain more information or run things through a debugger (olly comes to mind if that still exists)

--- End quote ---


This is a library provided to us by a third party, and the documentation is also an incomplete document, because the docking personnel have left, so there are only these remnants, and this is the first time I have come into contact with it, so many things do not know how to do it. is correct

Jzhen:

--- Quote from: TRon on February 06, 2023, 08:02:12 am ---
If you are truly decompiling a library that is not intended to be shared (closed/undocumented library) then you are basically on your own. There are some tools available that are able to obtain some valuable information about executables and DLL's but unfortunately my Windows days are long gone (e.g. I have no idea what tools to use these days).

You could always patch the library (overtake the original functions, show the passed parameters and call the original function) in order to obtain more information or run things through a debugger (olly comes to mind if that still exists)

--- End quote ---

I will try to find out how to solve it, thank you for your reply.
If you have an idea, you can reply next time


TRon:

--- Quote from: Jzhen on February 06, 2023, 08:11:37 am ---This is a library provided to us by a third party, and the documentation is also an incomplete document, because the docking personnel have left, so there are only these remnants, and this is the first time I have come into contact with it, so many things do not know how to do it. is correct

--- End quote ---
That begs the question: how do you know that the parameters and types used in your declaration ...:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---function MTAW(filename: string; AmplitudeTh, BarrierValueForAutoLoc, coff_TimediffBetweensta, Va, xp, xk, yp, yk, zp, zk: single; SensorForLocation: Tpindex): TMTAWSOLUTION; stdcall; external 'F:\wz_work\DelphiWork\hello word\MTAWDll.dll'; .. are correct ?

Are you just winging/jolo it ?

If it is a library written in C then for one thing it is not using type string, rather pchar and/or pwidechar. pascal type Single is also not the same type single as used in c.

Jzhen:

--- Quote from: TRon on February 06, 2023, 08:15:44 am ---
That begs the question: how do you know that the parameters and types used in your declaration ...:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---function MTAW(filename: string; AmplitudeTh, BarrierValueForAutoLoc, coff_TimediffBetweensta, Va, xp, xk, yp, yk, zp, zk: single; SensorForLocation: Tpindex): TMTAWSOLUTION; stdcall; external 'F:\wz_work\DelphiWork\hello word\MTAWDll.dll'; .. are correct ?

Are you just winging/jolo it ?

If it is a library written in C then for one thing it is not using type string, rather pchar and/or pwidechar. pascal type Single is also not the same type single as used in c.

--- End quote ---


This is what I decompiled.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Mtawdll::MTAW(System::UnicodeString,float,float,float,float,float,float,float,float,float,float,System::DynamicArray<int>)       
There are corresponding field descriptions in the document, but the last SensorForLocation:Tpindex is not sure, look at the naming and decompile it is an array.

The entire method name corresponds to the document, so it should be a delphi program.

TRon:

--- Quote from: Jzhen on February 06, 2023, 08:27:33 am ---

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Mtawdll::MTAW(System::UnicodeString,float,float,float,float,float,float,float,float,float,float,System::DynamicArray<int>)       
--- End quote ---
That looks like c++ to me...


--- Quote ---The entire method name corresponds to the document, so it should be a delphi program.

--- End quote ---
I was just going to suggest/ask if it was made with Delphi Rad Studio or something similar  :)

OK, so then C++ it is. Be aware that C classes/objects do not have an FPC equivalent.

System::DynamicArray is probably a Dynamic integer array (a pointer to an array ?)

If you know for sure the library was made with Delphi Rad Studio then you can probably use their online documentation to determine the exact type for the parameter types (and then find/locate the FreePascal/Lazarus equivalent).

For example:  unicodestring

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version