el Deckers

el Deckers

  • NA
  • 3
  • 0

how to use undocumented dll?

Aug 31 2009 6:10 AM
Hello people,

As I am new I will first introduce myself :) I'm a 25 year old Solution consultant in ICT-banking sector. I recently switched jobs, before this I was in charge of 2nd line support at a laywer firm. Because of this switch in career I have to go to go through extensive training as my programming skills are more than rusty :) and I hope I can find some sollutions here.

Now, the problem :

I have a dll, which is undocumented due to a knowledge-transfer(/loss is more the word :) ) from our old software vendor to us. Now I'm supposed to write a API program around it so we can demonstrate the embedded functions. Because of the undocumented nature of the dll I've pushed it through dllexp to see all available functions.
No problems here, expect that I can't find any refs to parameters. All I get is a list of the functions, without any details.
I've tried using the dll in a simple application but it freaks on the second function I tried calling "unable to find an entry point named 'cis_getConnectedPKIuser' in DLL C:\\...."



the code :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Windows;
using Microsoft.Win32;
using System.Runtime.InteropServices;


namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
internal static class unsafeNativeMethods
{
const string _dllLocation = "C:\\Program Files\\TestAPI\\TestAPI_Module.dll";
[DllImport(_dllLocation)]
public static extern void cis_beginSession();
[DllImport(_dllLocation)]
public static extern void cis_getConnectedPKIuser();

}
public Form1()
{
InitializeComponent();
}

private void cmd_cis_beginSession_Click(object sender, EventArgs e)
{
unsafeNativeMethods.cis_beginSession();
//txt_cis_beginSession.Text = "started";

}
private void
cmd_cis_getConnectedPKIuser_Click(object sender, EventArgs e)
{
unsafeNativeMethods.cis_getConnectedPKIuser();
//txt_cis_getConnectedPKIuser.Text = "1";
}
}
}

My questions :

1 : is this the right way to implement a dll in C#?

2 : is there a way to list all functions in a dll with their return types and parameters? DLLExport only gives a list of the functions

3 : how to find the entry points to the functions so that my compiler doesn't keep complaining about it

Can anybody help me please? :)

Answers (1)