Solved

Question for ARK!

Posted on 2000-05-18
12
160 Views
Last Modified: 2010-05-02
I hope i got your attention. I was reading one of the questions in April and saw one of your answers. It was about the dll file of msvbvm50.dll. My question is how did you know the functions within that file? How did you know the parameters to use?
I have been searching and looking to figure out how to look at a dll file and know exactly what is in it and the parameters. I got half way but still stuck on the parameters.
0
Comment
Question by:Spngbob_SqPnts
  • 7
  • 2
  • 2
  • +1
12 Comments
 
LVL 2

Expert Comment

by:orbitaltech
Comment Utility
Ahhh.. Sorry ARK but the answer lies within your Visual Studio Tools. Use the dependancy walker to view the functions within a dll or exe or ocx. I use a combination of Dependancy Walker and MSDN to make my queries complete..


Hope this helps
0
 

Author Comment

by:Spngbob_SqPnts
Comment Utility
orbitaltech,

yes, I got that part and it only gives me the functions, but no parameters to use. I need to know what variables to pass and the optionals.
0
 
LVL 2

Expert Comment

by:orbitaltech
Comment Utility
Wish I could help out there... I would be happy to know what ARK says

0
 

Author Comment

by:Spngbob_SqPnts
Comment Utility
same here. thanks for trying....
0
 
LVL 28

Expert Comment

by:AzraSound
Comment Utility
arent they in your object browser?
0
 

Author Comment

by:Spngbob_SqPnts
Comment Utility
They are not in the object browser. meaning: the functions that were noted by ARK are not listed. I did look in the dependancies program and it is there. When I look in the view-reference in "visual basic runtime objects and procedures" I notice that under location, it adds a "\3" to the filename. I dont know if that value limits the functions and subs to the object browser.
I notice in the registry I found the reference to the file and the "\3" was there. I try to remove the "\3" but I guess I need a little more practice on how to modify and save the registry properly.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 27

Expert Comment

by:Ark
Comment Utility
Hi
Sorry, I was absent for a while and missed your question.
About working with dlls: it's very flexible work.
First, I view this dll with QuickView.
Then I use some disassemble program (I use dasm). Dasm show full list of export functions, including ordinals (while QuickView show only functions which have name). Some functions have names like SomeFunction@16. It means that this function receives 16 bytes. As most of functions received long values, so this functions receives 4 long values. Some info you can get from function name (for example GetMem1 - Get Value of one byte from memory). If nothing help, I try to understend asm code (looking for push and pop). Then experiment with info which I have, get many GPF, but, finally, sucesses.

PS. Dependancy walker, Object browser etc works with tlbs, but some functions from dll may not be included in .tlb file.
What functions do you interesting in? May be I can help?

Cheers
0
 

Author Comment

by:Spngbob_SqPnts
Comment Utility
Ark,

This is splendid! What I was really looking for was the ability to look at any DLL files and see what the functions and parameters are. Bingo! you gave me an answer for the parameter. Using disassemble program to find the parameters. I have been doing a little study of assembly and now I know it will be worth learning and applying the knowledge.

It seems that assembly will never go away for a lot of things.

I notice there are a lot of functions in many of the DLL and not many people know it is out there in our computers. I wanted to be able to look at any dll files and find their parameters. Looks like from your experience it will take quite some experimenting to get the functions to work properly without the documentations.

There is no function that I was looking at specifically because I already found what I was looking for from your answer to another question about the Getmem4 and such.

This is great! thanks for the response.
0
 

Author Comment

by:Spngbob_SqPnts
Comment Utility
Ark,

In your experience, were you able to tell if the parameter has a flag or handle? much like the globalalloc funcitons. Also whether it is more as a sub or function that returns value from the calling procedure.

I assume the best way to know the info is through the disassembler.
0
 
LVL 27

Accepted Solution

by:
Ark earned 20 total points
Comment Utility
Hello
As far as I know, API (or other) dll functions always return long variable. Sometimes it's some value, sometimes pointer. Disassembler give answer almost in all cases, but this is hard work. Sometimes I try to do it without disassembling. For example, GetMem4 - from function's name I understand, that this function get value of 4 byte (long) from some memory address. So, input parameter should be memory address and return is value of long var. I wrote declaration:
Declare function GetMem4 Lib "msvbvm50" (ByVal MemAddress As Long) As Long. To get MemAddress I used udocumented VarPtr Vb function (BTW, there are VarPtr function in msvbvm.dll, and sometimes this two functions return different result - for strings and objects). I tested this function and understand how it and other same functions (getmem - putmem) functions works.

Cheers
0
 

Author Comment

by:Spngbob_SqPnts
Comment Utility
Adjusted points from 10 to 20
0
 

Author Comment

by:Spngbob_SqPnts
Comment Utility
Thanks Ark.

This is great! This really helps. Even though we as programmers have to do the hard work of figuring out the dll functions when they are undocumented. Thank you very much.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now