2

I'm working on a sensor with PSI5 interface and I'm using PSI Simulyzer box to simulate the environment during testing. This box comes with a software (some sort of digital oscilloscope) to make the measurements, but API header files and libraries are also provided. My intent is to use this API to automate non-regression test measurements.

This API is very poorly documented - it's basically a doxygen generated from the header file. I'm trying to guess the missing details, but some things just won't work in my software. Namely, I don't seem to be able to switch between synchronous and asynchronous modes, while the original software has a drop-down which works just fine.

I decided to analyze the original software by placing breakpoints to several (about 20) DLL functions which seem to be related to configuration in Visual Studio debugger, and note which of these functions are called, and with which arguments. I didn't succeed so far - when I call the same functions with the same arguments on my side, communication mode won't change.

Here's what I think causes my approach to fail:

  1. I didn't set the breakpoints to all functions (there are about 100 of them)
  2. I didn't analyze the calls from the beginning. Maybe there is some sort of pre-config sequence which I'm missing.
  3. Some functions take pointer arguments (e.g. int16_t *config) and I have no idea how many bytes I need to provide them. Maybe they point to structures with more pointers inside, which I cannot guess.

I see how to overcome issues 1 and 2, but doing such extended analysis by hand is too time-consuming. Is there a way to automate the process of setting breakpoints to all functions of a DLL, and log the arguments when these functions are called? Maybe there is a debugger more adapted to this task than Visual Studio?

1 Answer 1

4

My first recommendation would be to contact the vendor and ask them your questions. You paid for the product and its SDK, so if the latter is not usable, they should offer support to you.

As for monitoring DLL function calls, I'd recommend using API Monitor and its External DLL Filter functionality. It won't solve everything for you since you'd still need to figure out how many arguments are expected for each DLL function (you can extract that information with IDA), but I think it'll get you 90% of the way there.

enter image description here

4
  • I expect the help from the vendor anytime now. Unfortunately it's complicated in practice, because I'm an external employee and I have to contact the lab equipment team who in turn will contact the vendor. I may well get this sorted out before that help arrives. Jun 10, 2015 at 22:23
  • This API Monitor looks really promising. I know my ways in Linux with strace and LD_DEBUG, but DLLs are somewhat new to me. Jun 10, 2015 at 22:32
  • API monitor works great, except for one thing: each function is displayed with 4 parameters, regardless of the actual number. Is it possible to use the header files I have to define the actual number of parameters for each function? Jun 11, 2015 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.