Valhalla Legends Archive

Programming => General Programming => Topic started by: FuzZ on March 10, 2004, 11:28 AM

Title: C++ DLL, VB Declare
Post by: FuzZ on March 10, 2004, 11:28 AM
I'm unsure if I should've posted this here or not.
Sorry if I wasn't supposed to ;P

I've gotten the BnetAuth.dll to compile correctly.
however, whenever I try to call a function from it i always get "Can't find DLL entry point"
Now, This is from a hex editor from BnetAuth.dll which i believe to be the entry points
BnetAuth.dll.?CDKeyHash@@YGHPADPBDK@Z.?CheckVersion@@YGHPBD000PAK1PAD0@Z.?CreateAccount@@YGHPAD0@Z.?LODHash@@YGHPADKKKKK@Z.?PasswordHash@@YGHPADK0@Z.?SendCDKeyHash@@YGHPBDKPADI@Z

Now my declare

Public Declare Function CheckVersion Lib "BnetAuth.dll" Alias "?CheckVersion@@YGHPBD000PAK1PAD0@Z" (ByVal FileExe As String, ByVal FileStormDll As String, ByVal FileBnetDll As String, ByVal HashText As String, ByRef version As Long, ByRef Checksum As Long, ByVal ExeInfo As String, ByVal mpqname As String) As Long


I'm not quite sure why it does this.
If i use

Public Declare Function CheckVersion Lib "BnetAuth.dll" Alias "Z" (ByVal FileExe As String, ByVal FileStormDll As String, ByVal FileBnetDll As String, ByVal HashText As String, ByRef version As Long, ByRef Checksum As Long, ByVal ExeInfo As String, ByVal mpqname As String) As Long


It works. I remember from other declares it being Z. I couldn't find anywhere in the DLL where it would be labeled this.. I don't know C++ at all really (I can understand the basics/idea behind certain things)
Title: Re:C++ DLL, VB Declare
Post by: Kp on March 10, 2004, 02:36 PM
Don't know if it will help your problem, but you might have some fortune if you export the names unmangled.  Also, why're you building bnetauth.dll if you already have a copy to have tested the Alias "Z" with?
Title: Re:C++ DLL, VB Declare
Post by: Eric on March 10, 2004, 02:38 PM
The entry point is just the name of the function within the DLL.
Might also want to know that the public source code for BnetAuth.dll isn't really the source code to the actual public DLL that's used in most bots, it's merely an incomplete compilation of hashing functions from other bots.
Title: Re:C++ DLL, VB Declare
Post by: FuzZ on March 10, 2004, 02:48 PM
QuoteDon't know if it will help your problem, but you might have some fortune if you export the names unmangled.  Also, why're you building bnetauth.dll if you already have a copy to have tested the Alias "Z" with?
Because, when I run SmartCheck using the DLL I get an access violation and it crashes the bot.
http://forum.valhallalegends.com/phpbbs/index.php?board=17;action=display;threadid=5078
And, I've tried just "CheckVersion" as an alias, doesn't work either.

Quote
The entry point is just the name of the function within the DLL.
Might also want to know that the public source code for BnetAuth.dll isn't really the source code to the actual public DLL, it's merely an incomplete compilation of hashing functions from other bots.
Would explain why I couldn't find the function "c" ;P


Oh well, I was just tryin to connect another way so I can debug my bot with SmartCheck. I sent Yoni a PM earlier about a BNLS account, so I'll try that next. Thanks for your help.


<edit>Added other thread link.
Title: Re:C++ DLL, VB Declare
Post by: Kp on March 10, 2004, 02:57 PM
Quote from: FuzZ on March 10, 2004, 02:48 PM
Because, when I run SmartCheck using the DLL I get an access violation and it crashes the bot.
http://forum.valhallalegends.com/phpbbs/index.php?board=17;action=display;threadid=5078
And, I've tried just "CheckVersion" as an alias, doesn't work either.

Well, unless you fix bnetauth to export the names unmangled, of course it won't. :)  I'd seen (and forgotten about) that other thread; what is SmartCheck?  Also, perhaps you should consider disassembling the buggy bnetauth dll and finding why it dies.
Title: Re:C++ DLL, VB Declare
Post by: FuzZ on March 15, 2004, 02:36 PM
SmartCheck is a debugging tool, it shows you every event that occurs in your program, and the source code to where it occurs.
http://www.compuware.com/products/devpartner/default.htm

Well, I've tried a few other bots sources that were released that use BnetAuth, all seem to get this error when I run SmartCheck.

and i forgot about this thread ;\