Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / How do you find Out what in a DLL

Author
Message
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 14th Oct 2006 15:00
Hi all,

How do you work out what's in a Dll, eg what you use to call it, as I have found a programme for a 1 wire weather station, this gives you a free programme which has about 3-4 dll and I was hoping I might be able to talk to it and make my own better looking indicators.

TIA.

Dark Physics makes any hot drink go cold.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 16th Oct 2006 11:21
You need a program called Dependency Walker. This will detail a DLL's imports and exports. Even the DLLs it requires.

http://www.dependencywalker.com/

Paul.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 16th Oct 2006 16:14 Edited at: 16th Oct 2006 16:31
Cheers, this one looks a bit easier to use than PE, gives the call names just have to work out how to set them up and get data to and from them?

edit

Err! how do you work out how to set one up for a call?

Dark Physics makes any hot drink go cold.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 17th Oct 2006 11:40
It really all depends on what type of function specification your calling in the DLL. The Dependency Walker will list function exports, but it may not necessarily give you the full function prototype.

If the function has been declared as a C++ mangled name, you can use a program provided with the PlatformSDK (Microsoft) called UNDNAME.EXE. This takes a mangled function name and provides you with the C++ prototype declaration. i.e. A typical mangled export from a DLL may look like this:

"?ReceiveCoreDataPtr@@YAXPAX@Z"

If you were to pass this into UNDNAME.EXE using the -f argument, it would yield the prototype:

"void __cdecl ReceiveCoreDataPtr(void *)"

Now if the DLL exported function does not contain a mangled name as above, your pretty much screwed. If your able to obtain documentation on the specific DLL for the functions and their arguments, it may be possible to work out what the function prototype will look like.

Paul.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 17th Oct 2006 16:08 Edited at: 17th Oct 2006 16:09
OK, looked around the site that gives away the software for this weather station, and I found lot of c++ code that tells me whats what.

Only trouble is I don't know anything about c++, so how do I go about working out what I call and how to call it.

if anyone is interested it at here.
http://www.audon.co.uk/1-wire_weather.html
hpyerlink is at bottom of page. lab??

Dark Physics makes any hot drink go cold.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 17th Oct 2006 20:32
I'll create the .DBA include file necessary to call the various functions within the 'iwlvc.dll' file for you. Will this help?

Paul.

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 17th Oct 2006 23:40 Edited at: 17th Oct 2006 23:40
HowDo, I'm making this DLL into a DBP plugin so it'll be easier to use.

I'll post the zip with instructions when I've finished it.

Paul.

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 18th Oct 2006 05:44
HowDo,

I've converted the project to a Visual Studio 2003 C++ DLL, and added code to allow DBP to call the functions like a plugin. Basically compiling the project creates a file called iwlvc.dll. The problem is that for some unexplainable reason, I cannot get even one of the simplest of functions 'IWLVC_LASTERROR' to return, so if anyone wishes to spend time on this as I've ran out of steam, go right ahead. The project source is here as a Vis Studio 2003 project.

I've added the necessary Command string table for DBP to recognize the function exports. In the archive is a folder called DBP Plugin, it's got the DLL and a readme file detailing the functions I've exposed.

You will not be able to build the project unless you have the DBPInterface Library created by IanM, and this is no longer supported.

Basically, unless you can get the DLL to work, I can only suggest that you examine the file called iwlvc.cpp and figure out the original CALL DLL parameters using the ORIGINAL dll downloaded from the website, as this DLL I've provided has been recompiled using C++ instead of the original C DLL.

Sorry if this isn't the best information, but I can't put anymore time onto it.

Paul.

Attachments

Login to view attachments
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 18th Oct 2006 06:10
APEXnow (Paul) cheers fantastic great. Now to see if I can it to move even farther along to the goal of it working as planed.

Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 18th Oct 2006 07:26
As APEXnow was saying it no seem to work right, comes back with error,

could not find function '?IWLVC_LastError@@YAHXZ'in 2:iwlvc.dll

anyone think they might know what to do next.

Be I right in thinking that @@ in the above means () in basic?

Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 18th Oct 2006 15:27 Edited at: 18th Oct 2006 16:45
Thank to Puals attemp at trying to make it run through DBPro I seem to have now worked out how the oraingail Dll's worked and have found the following.

now when i run the test prog it just comes back with numbers anyone got any ideas on what they are telling me?

test 2


test 3 making sence of data ,now has menfll values.



Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 20th Oct 2006 13:44
Anyone else like to pick up the baton that APEXnow (Paul) started and see if they can get it to work as a DBPro plugin.

Believe that there is a lot more use of this one wire system if it could be made to work in DBPro
eg:
Alarms
model controls
senors

Dark Physics makes any hot drink go cold.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 20th Oct 2006 14:11
I'll take another crack at it this afternoon.

Got to be something silly that's preventing it from working.

Paul.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 20th Oct 2006 14:14
cheers Paul, hope you can find it, as you can see from the above programmes have found out what names they were using in the original Dll.

Dark Physics makes any hot drink go cold.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 20th Oct 2006 17:43 Edited at: 20th Oct 2006 17:49
HowDo, I've managed to get the DLL to successfully work under DBP by recompiling the project under GNU C++. Basically I think the problem is down to runtime library confliction with DBP's DLLs. Anyway, The sample runs by returning the error code 0 at the moment, but you will need to experiment with using it correctly as I don't have the necessary hardware to connect to a serial line.

Also, when calling the 'IWLVC_ReadWeather' function, to get the values out which were normally obtained with the original ReadWeather function (last 8 arguments), you must call IWLVC_ReadWeather first, and then call the IWLVC_ReadWeatherSerialnumwd1, IWLVC_ReadWeatherSerialnumwd2 and so on (IWLVC_ReadWeather????) as DBP functions that return either strings or Singles.

So for example, call IWLVC_ReadWeather, passing in the necessary arguments for which I hope you know the values for, i.e. port, serialnumws etc. The String arguments are basically DBP strings consisting of 8 characters to describe the ROM array values. You can build these strings up using Chr$(value) + Chr$(value)..... up to 8 characters.

Once you've called that function above, you can get the value from what happened by doing something like:

Local strSerialNum1 As String
strSerialNum1 = IWLVC_ReadWeatherSerialnumwd1()

Hopefully, strSerialNum1 will contain the value, but I have no way to test this without the hardware. So I hope this works.

Also note, IWLVC_Read1820 will return you a Tempreture as a FLOAT.

If you've any questions or you're not sure about something, give me a shout and I'll do my best to help.

Paul.

Attachments

Login to view attachments
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 21st Oct 2006 03:57
Cheers Paul will let you know if it works, when delivery firm and me get our act together and its delivered when I am in.

just so i understand it, those names I found in the original Dll wdo not work to yours.

Dark Physics makes any hot drink go cold.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 21st Oct 2006 07:54
HowDo,

The original DLL may still have worked, but because I converted the DLL somewhat to work as a proper DBP plugin, the string handling and returning FLOAT values is done a little differently. Albeit the same functionality is still there though.

Paul.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 21st Oct 2006 08:09
Cheers Paul, nice piece of work.

Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 24th Oct 2006 11:50
Well its arrived, two problems, not seem to work with its own software, and no response to Paul's dll. await reply from company to see why there own stuff no work. could just be me only having had 3.5hr sleep before it was delivered, so could be why not getting anywhere yet.

going to be along day.(Tuesday)

Dark Physics makes any hot drink go cold.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 24th Oct 2006 11:55
Hehe, good luck

Paul.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 24th Oct 2006 12:05
Just one thing, If and when it works will the zero I get change to one or some number?

Dark Physics makes any hot drink go cold.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 24th Oct 2006 12:39
There are currently only three functions that will effect the error value:

IWLVC_Read1820
IWLVC_Read2423
IWLVC_ReadWeather

If the functions succeed, the IWLVC_LastError function should always return 0 (Zero). If at any point, one of the three functions fails, a non zero value will be returned. It may always be 1, but it really depends on the internal workings of the code.

Paul.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 24th Oct 2006 16:28
I think my brain gone soft how do you call the other bits.




Is like the above or have I got it completely wrong.

Dark Physics makes any hot drink go cold.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 24th Oct 2006 18:54 Edited at: 24th Oct 2006 19:00
HowDo, can you try this:



On my PC, it stops because the nErr value is nonzero, most likely due to it not creating a connection with the hardware. Only way is for you to test it and see what happens.

[EDIT] Make sure you've copied my DLL to the DBP/compiler/Plugins-user folder.

[EDIT] Minor mod to code

Paul.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 25th Oct 2006 13:35 Edited at: 25th Oct 2006 13:36
Hi Paul or others


Is it possiable to have a look at the IB90usb.dll to see if it might need changing to work with a dual core system, as all the config software I have tried do not find it or cannot find the Ibutton usb thingy.

Dark Physics makes any hot drink go cold.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 25th Oct 2006 13:38
I'm not sure I can help on that respect HowDo. I don't have a dual core PC and my knowledge of USB is next to nothing

Unless you can get support from the hardware guys from where you got the gear from, not sure what else I can suggest.

Paul.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 25th Oct 2006 13:44
Cheers for replying, Just wish I knew what to do next!

Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 25th Oct 2006 14:10
after too much messing about have got the thing to work but not know how I did it, so now to see if work with your code....

Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 25th Oct 2006 14:31 Edited at: 25th Oct 2006 15:33
Well yes no, its returning for nErr = IWLVC_LastError() the value 191.

Which was a value I got when it was not working?

So I know it all works so what do you need me to find out for you to make the code work?

tried this but they came back 191.



edit

found out is on this bit.
Adapter : 6 Port # 1 OK

Dark Physics makes any hot drink go cold.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 25th Oct 2006 18:37
HowDo, so just to clarify, are you saying that the DLL returns 191, and doesn't work, yet you've managed to get the software that came with the hardware to work?

Paul.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 26th Oct 2006 06:02
that correct, but I belive that your code is OK, because I have yet to link DBPro the iButton device, which is connected to 6 port # 1.

So I think were going to have to find someway to talk to this device.

Dark Physics makes any hot drink go cold.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 26th Oct 2006 06:49
HowDo, are there any protocol specifications, maybe documented in a PDF or DOC file that I could take a gander at? It's likely to be sommit to do with the arguments to IWLVC_ReadWeather? If I can figure out what's going on based on the protocol requirements, I might be able to figure what arguments are needed.

Paul.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 26th Oct 2006 07:00
try having alook here.

http://www.aagelectronica.com/aag/index.html?target=front.html&lang=en-us

they have alot of stuff.

Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 26th Oct 2006 07:07 Edited at: 26th Oct 2006 07:13
would classId.txt be of any use?

you are look for dallas 1-Wire Drivers V4.00 Beta 3

http://www.maxim-ic.com/products/ibutton/software/1wire/OneWireViewer.cfm

Dark Physics makes any hot drink go cold.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 26th Oct 2006 07:48
Ok, I'll take a look.

Paul.

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 26th Oct 2006 09:39
HowDo, Can you download the new attached archive, copy the DLL from the 'DBP Plugin' folder into your DarkBASIC Professional/Compiler/Plugins-user folder and then run the iwlvcTest executable.

I've added a new function to the DLL that should return an actual textual description of the error that is occuring when it tries to fire up communication with the Dallas hardware. I can't diagnose the problem because I don't have the stuff connected. Hopefully rhe textual description of the error might yield a bit more information.

Paul.

Attachments

Login to view attachments
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 26th Oct 2006 13:56
Morning Paul, its amost there, came back with -

Could Not Find Function 'IWLVC_LastErrorText' in 8:iwlvc.dll`

going to check that I have the right dll in place and size.

thats ok, size 97.8 KB (100,198 bytes) date

Thats what I get today,

Dark Physics makes any hot drink go cold.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 26th Oct 2006 14:02
Now that's odd.. let me check.

Paul.

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 26th Oct 2006 14:37
HowDo, can you please check that you've definately copied the DLL correctly. Infact, extract and just run the existing iwlvcTest.exe file I've already compiled that's stored in the RAR file. I can't see why your getting that error. It builds and executes just fine here. Don't forget, copy the DLL into dbpro/compiler/Plugins-user folder.

Paul.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 26th Oct 2006 14:41
Ok having another go.. stand by...

Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 26th Oct 2006 14:47
Yes works Ok, it was the bit between the keyboard and chair.

see view button for error.

Dark Physics makes any hot drink go cold.

Attachments

Login to view attachments
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 26th Oct 2006 14:51 Edited at: 26th Oct 2006 14:52
Ok, if it's not detecting the hardware, it's likely to be that either the driver is misconfigured, or it could actually be the serial number used to detect the specific chip No.?

I'm not sure how I can solve this without the hardware, which isn't possible of course.

Paul.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 26th Oct 2006 14:57
update your compiled code runs ok, but when I try to do it, it drops out with the above error.

think might be me just got to work out were I am doing wrong.

Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 26th Oct 2006 15:03
try again posting, your compiled code runs ok, but when I try to compile it here gets the above error.

the view button should show what you get when your compiled code runs.

Dark Physics makes any hot drink go cold.

Attachments

Login to view attachments
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 26th Oct 2006 15:24
sent an email.

Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 27th Oct 2006 06:19 Edited at: 27th Oct 2006 06:21
Doh! just seen its move to page 2 no wonder I was not seeing anything..

Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 27th Oct 2006 12:52 Edited at: 27th Oct 2006 12:55
Solved the compile/run problem just stuck your dll in with the system32 files now function works like your complied one .

Paul did you find the e-mail?

Dark Physics makes any hot drink go cold.
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 27th Oct 2006 16:24
HowDo, although the plugin code appears to use a communication protocol for the DS2480, Dallas have a Software Development kit that contains over 20 samples for demonstrating application development. One of the samples uses a new interface that's documented in the SDK called TMEX. It appears that this is what is now used for communicating with the different iButtons. The problem is that it will require time to work on this stuff, which unfortunately, I just don't have

I think from a developer's point of view though, that the TMEX interface is the way to go. The SDK has a C sample called LOOPIT32.C It's a very simple C file that fires up the TMEX driver (IBFS32.DLL) and attempts to communicate with all iButtons connected to a default port. I can't run the examples of course because I don't have any hardware to test them on. But if you can download the SDK, and take a gander at the LOOPIT32.C file, you'll see that firing up the TMEX DLL is quite possible.

As said though, it requires time for this stuff, so if you're able to get someone onboard who is willing to contribute further, I think that's the best way to go.

The SDK toolkit I refer to is this:

http://www.maxim-ic.com/products/ibutton/software/windowsdk/index.cfm

Paul.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 27th Oct 2006 16:37
Paul Thank you for your time put into this.

Will look into the file and see if I track down how/what it does, maybe find the bits that are needed so that some could put the bits in where needed.


Cheers Jonathan.

Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 3rd Nov 2006 14:10
APEXnow if you see this.

On the other thread we found that it is on PortNum 1 and PortType 6, don't know if will help in chaging the above code to work with the USB, sometime on sat morninig will be testing the RS-232 adaptor.

May have more luck with that or at least be able to test the program then try to make it work with the usb.

Ho, Please only have ago if you have the time as I know your all busy on your own projects.

Dark Physics makes any hot drink go cold.

Login to post a reply

Server time is: 2024-06-23 03:29:43
Your offset time is: 2024-06-23 03:29:43