Author Topic: cool dll trick I found tonight  (Read 8348 times)

0 Members and 1 Guest are viewing this topic.

kryton9

  • Guest
cool dll trick I found tonight
« on: June 04, 2012, 10:19:05 PM »
I was wondering how to bring all the commands from a dll into oxygen. The first thing is to get all the functions exported. Found a great tool built into windows.

Get command prompt window: cmd.exe
cd C:\Windows\System32
dumpbin /exports user32.dll >user32.txt  

I removed attachment as it is included in the next post attachment
« Last Edit: June 06, 2012, 12:10:20 AM by kryton9 »

kryton9

  • Guest
Re: cool dll trick I found tonight
« Reply #1 on: June 06, 2012, 12:09:35 AM »
I did the same to the following and got these text files:
Quote
06/06/2012  03:47 AM            41,755 advapi32.txt
06/06/2012  03:48 AM             8,751 comctl32.txt
06/06/2012  03:49 AM             1,795 comdlg32.txt
06/06/2012  03:49 AM            32,380 gdi32.txt
06/06/2012  03:49 AM             6,875 imm32.txt
06/06/2012  03:50 AM            68,125 kernel32.txt
06/06/2012  03:50 AM             1,518 lz32.txt
06/06/2012  03:51 AM             4,111 mpr.txt
06/06/2012  03:51 AM            25,621 netapi32.txt
06/06/2012  03:51 AM            32,020 shell32.txt
06/06/2012  03:46 AM            37,558 user32.txt
06/06/2012  03:52 AM             1,331 version.txt
06/06/2012  03:52 AM             8,818 winmm.txt
06/06/2012  03:53 AM            10,525 winspool.txt

You might ask why these. Well I went and installed my old Visual Studio 6, this is pre .net days version. I found a tool that they give for looking at the winapi as it can be used in Visual Basic 6. Using that tool, I got a text file. I have been parsing that file the last 2 nights. I will post the results of all that work soon. But, I went through and these were the dll's and drv files that I saw they used. So I did the dumpbin on them and got these. I will have 3 files when finished. One is all the winapi constants in file sorted alphabetically. Second all Types, in order of prior need as some types rely on others defined earlier. Third will be all the functions in the above files sorted alphabetically by function name. I have done test runs, and can't get my programs to compile, but I got all the problems oxygen had with the UDT's fixed. The third list of functions, will be just for reference as I think it will be best to use the bind command, but I will leave that up to Charles and Peter to work out.
« Last Edit: June 06, 2012, 12:17:10 AM by kryton9 »

kryton9

  • Guest
Re: cool dll trick I found tonight
« Reply #2 on: June 06, 2012, 01:14:35 AM »
Here is content for Charles, Peter and anyone else working on winapi stuff. Hope this can be useful. I am using this for my own tests and learning and wanted to share as it was lots of work to get it to this point.

Files:
win1Consts.inc
win2Types.inc
win3Funcs.inc

Using these I have not been able to compile anything yet, but working on it.
Update: Removed attachment newer version below.
« Last Edit: June 06, 2012, 07:10:07 PM by kryton9 »

Charles Pegge

  • Guest
Re: cool dll trick I found tonight
« Reply #3 on: June 06, 2012, 02:42:02 AM »
Many thanks Kent,

Looks very promising, but will need some work to make it 64bit compatible. All the handles and pointer members must be of sys type instead of long or dword

There are entries where the lib name does not have the .dll extension

But all this could be cleaned up quite easily, and this data is good for quick-referencing Windows anyway.

Charles


kryton9

  • Guest
Re: cool dll trick I found tonight
« Reply #4 on: June 06, 2012, 11:59:23 AM »
Quote
There are entries where the lib name does not have the .dll extension

Believe me I was thrown for a loop when I saw that too, but when I did dumpbin whatever.drv it pulled data out. So those .drv files must be dll's of some sort.

I didn't mess too much with the longs and dwords as that is what VB6 is using. The only things I changed were when I saw in UDT's   name as string * 253
or SPECIAL as string * SOMECONSTANT

in those kind of cases, I did name(253) as zstring    or  SPECIAL(SOMECONSTANT) as zstring

I am going to make a bind file tonight to see if I can get anything to compile with that stuff. So I will use winConsts.inc, winTypes.inc and the new winBinds.inc when finished. Hope to have that tonight.

kryton9

  • Guest
I am done as far as I can go
« Reply #5 on: June 06, 2012, 07:13:40 PM »
I finished all I wanted to do so far with this phase of the winapi stuff. I made the bind file tonight. Enclosed is a zip with the latest files and test program. It won't compile, but it got passed the wintype errors. I had fixed them before, but somewhere along the line some of the changes reverted. Anyways. It is crashing when doing the binds now and I have no idea what the message means.

I am curious how big the exe file will be when it compiles with all those things included. I am taxing the oxygen compiler for you Charles. This is the longest compile time so far. So your powerful compiler is going oh know tsunami of windows api code, oh noooooo.

Load run cGLWindow.bas for the test program.
« Last Edit: June 06, 2012, 07:21:44 PM by kryton9 »

Charles Pegge

  • Guest
Re: cool dll trick I found tonight
« Reply #6 on: June 06, 2012, 09:10:09 PM »
Hi Kent,

Here is a tool for checking and inserting '.dll' for winfuncs.inc

Processed file included: f.inc

Charles

Charles Pegge

  • Guest
Re: cool dll trick I found tonight
« Reply #7 on: June 07, 2012, 01:53:00 PM »
Well, I spent the day on it, and got the API working with your GLWindow, Kent . WinFuncs required a substantial amount of revision to get the right types. A number of equates were also required in addition to WinConsts.

I think we could probably ditch AdvAPI. I don't know how useful it may be.

Anyway, I've provisionally included the API with Oxygen-in-progress, along with the new "!" declare syntax:

projects/WinApiVB6

Charles

PS: The upper limit for all entities is 100,000, more when scopes are used, So we have a long way to go :)



kryton9

  • Guest
Re: cool dll trick I found tonight
« Reply #8 on: June 07, 2012, 02:18:07 PM »
Thanks Charles, can't wait to test it out!

Charles Pegge

  • Guest
Re: cool dll trick I found tonight
« Reply #9 on: June 07, 2012, 02:28:31 PM »
As you will see, most of the changes involved removing  "@" and "&" since the function protoypes control the referencing.

kryton9

  • Guest
Re: cool dll trick I found tonight
« Reply #10 on: June 07, 2012, 02:30:38 PM »
Wow it compiled super fast and the exe is still small!

kryton9

  • Guest
Re: cool dll trick I found tonight
« Reply #11 on: June 07, 2012, 02:32:44 PM »
As you will see, most of the changes involved removing  "@" and "&" since the function protoypes control the referencing.


From which file did you remove them Charles. I want to figure this stuff out and am making some progress, but most of it is like crossing a room in the dark, I just try.

kryton9

  • Guest
Updated files
« Reply #12 on: June 07, 2012, 03:09:19 PM »
Charles, I updated the files for projects/WinApiVB6

I added the constants in alpha asending order to winConsts.inc and removed them from cGLWindow.inc, added the missing funcs to winFuncs.inc and made a new inc to handle all the gl incs. Updated this all in the glWindow files to reflect the changes.

Again these would go into projects/WinApiVB6 to replace the same files there.

Charles Pegge

  • Guest
Re: cool dll trick I found tonight
« Reply #13 on: June 07, 2012, 03:38:55 PM »
Thanks Kent.

It was from cGLWindow.inc. I took the version from /projects/GLWindow, copied it over, and modified it to match the VB API.

This code should work with any prototyped API of Windows. So you can used it as a template for further Windows development.

I also corrected PostQuitMessage 0 (1 param only)

Charles

kryton9

  • Guest
Re: cool dll trick I found tonight
« Reply #14 on: June 07, 2012, 03:52:08 PM »
I was looking through the files and noticed some @ missing in there. It makes the code easier to read and follow now too.

I started downloading the latest Windows SDK without .net, that is I unchecked anything .net in the options to download.
I am going to write an oxygen program based on your f.inc code, to go through all the .h files and pull out all the constants. Just to see how many more come out.
If it is a lot, then I will do the same for the types. I want to help you make Oxygen one with windows development along with the other guys help.

I see Windows as the dominant OS for sometime to come. Android, Chromium, Linux just are not going to replace Windows. There was a chance there, but it is gone now.
However, if you really plan on making oxygen run on other platforms, then I will start work on bringing freeglut into oxygen. It is a modern replacement for glut that is updated.
http://freeglut.sourceforge.net/ and at some point or another we should bring SDL, these are both very cross platform and widely used.

What do you think?