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 to make a DBPro DLL using C Sharp 2008. (a tutorial)

Author
Message
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 11th Aug 2009 21:00
Ok, the previous tutorial wasn't bad, I just didn't test the dll tool enough to find that it wasn't going to work with more complex DLLs. Nobody's fault but mine, so here is a full tutorial for a fully functional .Net DLL Conversion tool.

http://www.kistech.com/DBPro/DLLTutorial

Using the exact tools and procedures outlined in this tutorial I've been able to create an ODBC Database Access plugin for DBPro. I've tested it with MS SQL Server, and am testing it now with MS Access, and MySQL. So we know that more complex .Net DLLs will convert just fine with the conversion tool in this tutorial.

My hope is that this will inspire a new wave of useful DBPro DLLs that will extend and enhance it's dizzying array of capabilities even further.

If you spot any errors in the tut, or have anything to add, just let me know.

Thanks, and enjoy.

Phjon
18
Years of Service
User Offline
Joined: 28th Nov 2005
Location:
Posted: 12th Aug 2009 00:26
KISTech,

I have attempted to use the trial version of ZKat8it's converter program on a simple VB.NET dll (the VB equivalent to your C# example), but unfortunately, although I can set the path to ildasm.exe manually, it doesn't seem to be able to dissassemble the dll (a label on the program's main form states that the "Decompile Failed").

------------------------------------------

What does "ODBC" stand for?
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 12th Aug 2009 01:01
Quote: "What does "ODBC" stand for?"


Open DataBase Connectivity.

It's possible something is corrupt in your SDK installation. Try uninstalling and reinstalling the .Net 2.0 SDK.

You can also post your VB code here, not all of it, just the important bits pertaining to what you've ported over from the C# code, and I'll take a look.

Jeff032
16
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 12th Aug 2009 05:26
Looking at the converter program with .NET Reflector (), the error 'Decompile Failed' is displayed if the following condition is false:

(File.Exists(Vars.ExePath + @"\Temp\Temp.il"))

My guess is that you are running Vista and it does not have permission to write to Program Files. Try copying it to the desktop and run it again.

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 12th Aug 2009 06:40
..or that..

Phjon
18
Years of Service
User Offline
Joined: 28th Nov 2005
Location:
Posted: 12th Aug 2009 14:29
KISTech,

The VB code is in the code snippet below:



I know that the ildasm.exe runs fine when I double-click on it (my own homemade converter program would not work if this was not the case) so I don't think there's anything wrong with my version of the .NET Framework SDK - with regards to that program at least.

Jeff032,

My OS is XP, not Vista. However, I will try moving the dll that I need converting to some different folders and see what happens.
Jeff032
16
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 12th Aug 2009 14:54
I think its the exe that needs to be moved, since it is trying to write to the directory it is stored in.

ZKAT8IT
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location:
Posted: 12th Aug 2009 19:23
Sometimes Windows likes to start programs in other directories from shortcuts and stuff messing with paths of files. If the shortcut from the menu doesn't work. Try opening up the folder containing the exe and run the program directly from there instead of a shortcut.

Your signature has been erased by a mod because it's larger than 600x120
Phjon
18
Years of Service
User Offline
Joined: 28th Nov 2005
Location:
Posted: 13th Aug 2009 00:43 Edited at: 13th Aug 2009 00:47
ZKAT8IT and Jeff032,

I have managed to get the dll converter program to work now, but only after I made a copy of the ildasm.exe and placed it alongside the converter exe program. Only then did the converter program find it when I set the directory to its location in the program.

ZKAT8IT,

Every time I run the converter, I have to set where the ildasm.exe is. Presumably, the converter program checks to see if the ildasm.exe is in a particular folder, and if it is not there, it flags an error. Do you know which folder the program is looking in, as I could move ildasm.exe to that folder, and not worry about having to set ildasm's directory every time I run the converter?

Just out of interest, I took a look at a converted dll in a program called Dll Export Viewer to see if it listed the dll's exported functions. However, it didn't list any. The converted dll I made works fine with DBPro; I'm just wondering if there's a reason why I couldn't detect any exported functions.
ZKAT8IT
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location:
Posted: 13th Aug 2009 01:07
Phjon,

That's strange that you'd have to set the path each time. It should save that. If not, try changing the info directly in the Settings.ini file.

Also, if you didn't install the .Net SDK properly then it won't find ildasm.exe . Currently it only recognizes the .Net 1.0,1.1,2.0 ildasm.exe locations. If you installed a .Net 3.5 SDK of some sort, which uses the .Net 2.0 ildasm, it's possible the registry key is different and won't find it.

Your signature has been erased by a mod because it's larger than 600x120
Jeff032
16
Years of Service
User Offline
Joined: 13th Aug 2007
Location:
Posted: 13th Aug 2009 05:21
The tool doesn't find ildasm on my machine either. I have .NET 2.0 SP2 and 3.5 installed.

The location of ildasm is:
C:/Program Files/Microsoft SDKs/Windows/v6.0A/Bin

It does, however, find ilasm, which is located in /Windows/Microsoft.NET/Framework/.......

ZKAT8IT
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location:
Posted: 13th Aug 2009 06:24
Hmm, it is possible I didn't have it auto find the ildasm.exe . It's been over a year since I made it. Either way if you set it in the options or in the Settings.ini file, it should find it.

Your signature has been erased by a mod because it's larger than 600x120
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 13th Aug 2009 07:24
Quote: "The location of ildasm is:
C:/Program Files/Microsoft SDKs/Windows/v6.0A/Bin"


That's the one for .Net 3.5. The one for .Net 2.0 is in,

C:\Program Files\Microsoft.Net\SDK\v2.0\bin

Login to post a reply

Server time is: 2024-03-29 13:08:07
Your offset time is: 2024-03-29 13:08:07