Heyy,
i know that using google.de helps with many problems. Unfortunately i am not able to get this one solved:
I have a .dll and a C# source File, nothing else.
My problem is that i can't transform the C# code in an executable
Following is the C# Code:
[DllImport("SomeonesApi.dll", EntryPoint="RegisterUser")]
public static extern uint RegisterMe(
byte hUsernumber, // Requested Usernumber (in hex)
string Username); // Name of the user
[DllImport("SomeonesApi.dll", EntryPoint="RegisterUser")]
public static extern uint RegisterMe(
byte hUsernumber, // Requested Usernumber (in hex)
string Username); // Name of the user
To copy to clipboard, switch view to plain text mode
The solution i've seen is via QLibrary.
QLibrary lib
("C:/Windows/system32/SomeonesApi.dll");
lib.load();
bool successfully_loaded =lib.isLoaded();
typedef unsigned int (*RegisterMe) (unsigned char,std::string);
RegisterMe newUser = new RegisterMe(0x01,"User1");
RegisterMe returnvalue = (newUser )lib.resolve("RegisterUser");
QLibrary lib("C:/Windows/system32/SomeonesApi.dll");
lib.load();
bool successfully_loaded =lib.isLoaded();
typedef unsigned int (*RegisterMe) (unsigned char,std::string);
RegisterMe newUser = new RegisterMe(0x01,"User1");
RegisterMe returnvalue = (newUser )lib.resolve("RegisterUser");
To copy to clipboard, switch view to plain text mode
Can someone tell me what i've done wrong? Is there another (better) way to get this c# function transformed?
Thanks in advance
Added after 1 16 minutes:
I think i got it working ... :
QLibrary lib
("C:/Windows/system32/SomeonesApi.dll");
lib.load();
bool successfully_loaded =lib.isLoaded();
typedef unsigned int (*RegisterMe) (unsigned char,std::string);
//RegisterMe newUser = new RegisterMe(0x01,"User1"); this line was the wrong one
RegisterMe newUser = (RegisterMe )lib.resolve("RegisterUser");
if (newUser)
{
newUser(0x01,"User1");
return 0;
}
else return -1;
QLibrary lib("C:/Windows/system32/SomeonesApi.dll");
lib.load();
bool successfully_loaded =lib.isLoaded();
typedef unsigned int (*RegisterMe) (unsigned char,std::string);
//RegisterMe newUser = new RegisterMe(0x01,"User1"); this line was the wrong one
RegisterMe newUser = (RegisterMe )lib.resolve("RegisterUser");
if (newUser)
{
newUser(0x01,"User1");
return 0;
}
else return -1;
To copy to clipboard, switch view to plain text mode
If anyone else has a better solution:
Feel free to write
Bookmarks