• Welcome to Valhalla Legends Archive.
 

How to connect bot to bnet.

Started by shout, June 19, 2004, 11:11 PM

Previous topic - Next topic

GoSuGaMING

#15
Quote from: shadypalm88 on June 20, 2004, 11:27 PM
Well, if you don't want to packetlog, there's always BnetDocs.  It contains much information on the messages sent back and forth between you and Battle.Net, how they're formatted, and the correct orders to do so.  If you understand network programming, or can teach yourself, you'll want to check this out.

BnetDocs doenst give you the code... you would have to packetlog ... all it does is give u the structor of the packet

Spht

Quote from: GoSuGaMING on June 20, 2004, 11:44 PM
Quote from: shadypalm88 on June 20, 2004, 11:27 PM
Well, if you don't want to packetlog, there's always BnetDocs.  It contains much information on the messages sent back and forth between you and Battle.Net, how they're formatted, and the correct orders to do so.  If you understand network programming, or can teach yourself, you'll want to check this out.

BnetDocs doenst give you the code... you would have to packetlog ... all it does is give u the structor of the packet

BnetDocs is so you DON'T have to packet log / disassemble to figure out the structure of messages.  It'd be a pain to provide generalized code for every language on how to deal with them.

shout

#17
I understand the packet stuff...

I would kind of like to know how I would decode the CD-Key and use local hashes.

I realize that BNLS is a service that I can use, but I would rather learn how to hash locally.

shadypalm88

#18
Quote from: shout on June 21, 2004, 11:04 AM
I understand the packet stuff...

I would kind of like to know how I would decode the CD-Key and use local hashes.

I realize that BNLS is a service that I can use, but I would rather learn how to hash locally.
If you want to just use hashing locally, you could just pick up a copy of BnetAuth.dll (available here) and link against that, or if you want to learn how, the C++ source for that is available online (one place being here).  Both links go to my site.

Optionally, maybe you could find the source to a bot that does it.  If you're looking for C-like code, maybe try zDS (one source here, also if you can use CVS there's information on the home page).

(If you know VB, there's definitely no shortage of VB bots floating around...)

shout

How would I link BnetAuth.dll to a project in C#.net?

MyndFyre

#20
You have to use P/Invoke calls.  Example:

One of the calls in BnetAuth.h is:


__declspec(dllexport)
BOOL _stdcall CheckVersion(LPCTSTR lpszFileName1, LPCTSTR lpszFileName2,
  LPCTSTR lpszFileName3, LPCTSTR lpszValueString,
  DWORD * lpdwVersion, DWORD * lpdwChecksum,
  LPSTR lpExeInfoString, LPCTSTR lpszMpqFileName);


Within a class, you specify:


[DllImport("BnetAuth.dll")]
public static extern bool CheckVersion(
 [MarshalAs(UnmanagedType.LPTStr)] string lpszFileName1,
 [MarshalAs(UnmanagedType.LPTStr)] string lpszFileName2,
 [MarshalAs(UnmanagedType.LPTStr)] string lpszFileName3,
 [MarshalAs(UnmanagedType.LPTStr)] string lpszValueString,
 out uint lpdwVersion, out uint lpdwChecksum,
 [MarshalAs(UnmanagedType.LPStr)] string lpExeInfoString,
 [MarshalAs(UnmanagedType.LPTStr)] string lpszMpqFileName);


All of the MarshalAs attribute declarations are not NECESSARY, but they are good in ensuring that code works across platforms.

Note that this only works for functions marked in the header as either "__declspec(dllexport)" or 'extern "C"'.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

shout

#21
I feel like the stupidist person in the world... but...

How exactly to I use DllImport? When I do it get a 'type or namespace not found' compiler error...

Sorc_Polgara

Where can I get this BnetAuth.dll?

Eli_1

Quote from: Sorc_Polgara on June 21, 2004, 03:02 PM
Where can I get this BnetAuth.dll?

Do you ever even read people's posts? Someone already posted a link to it.

MyndFyre

Quote from: shout on June 21, 2004, 02:53 PM
I feel like the stupidist person in the world... but...

How exactly to I use DllImport? When I do it get a 'type or namespace not found' compiler error...

OK, part of the requirements of getting help (at least for me) is that you also have to be able to help yourself.  Look up the class DllImportAttribute in the .NET Framework SDK help documentation included with Visual Studio .NET or the .NET Platform SDK.

As it is, I believe it's in the System.Runtime.InteropServices namespace.  It should be included implicitly in any project referencing mscorlib.dll (implicitly included unless you explicitly deactivated it through project settings).
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

shout

#25
Ah... The index had it under System.InteropServices... without runtime...

I get no errors now.