Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Spilled on July 16, 2006, 04:43 PM

Title: [C++] Invalid CDKey Response?
Post by: Spilled on July 16, 2006, 04:43 PM
Hi,

I'm getting a invalid cdkey response about 1 out of every 6 connects and I can't find the problem and hoping one of you can. Here's how I pass the parameters and im using the bnetauth class from bnetweb.com.


              DWORD Prod = 0,Val1 = 0,Val2 = 0;
              MessageBox(NULL,CDKey,"",MB_OK);
              if(!b.DecodeCDKey( CDKey, &Prod, &Val1, &Val2 ))
              {
                   s << cWhite << s.getTime() << cRed << "CDKey Decode Failed!\n";
                   closesocket( wSock );
                   return;
              }


I'm message boxing the CDKey everytime before it decodes to double check if the value is correct and it has been correct everytime. Post back for more code if needed.
Title: Re: [C++] Invalid CDKey Response?
Post by: topaz on July 16, 2006, 05:22 PM
Outdated library.
Title: Re: [C++] Invalid CDKey Response?
Post by: UserLoser on July 16, 2006, 05:22 PM
What's the return value supposed to be upon success?
Title: Re: [C++] Invalid CDKey Response?
Post by: MyndFyre on July 16, 2006, 05:29 PM
Why not use BNCSUtil (http://bncsutil.ionws.com/)?
Title: Re: [C++] Invalid CDKey Response?
Post by: Spilled on July 16, 2006, 06:32 PM
Quote from: MyndFyre[vL] on July 16, 2006, 05:29 PM
Why not use BNCSUtil (http://bncsutil.ionws.com/)?

I didn't know the library was outdated.


UL: Boolean


Edit: Can I load this dll in my application unlike I could bnetauth.dll?
Title: Re: [C++] Invalid CDKey Response?
Post by: topaz on July 16, 2006, 07:50 PM
Quote from: Spilled on July 16, 2006, 06:32 PM
Edit: Can I load this dll in my application unlike I could bnetauth.dll?

What...
Title: Re: [C++] Invalid CDKey Response?
Post by: rabbit on July 16, 2006, 08:18 PM
Include the correct bncsutil header file, and yes.
Title: Re: [C++] Invalid CDKey Response?
Post by: Spilled on July 17, 2006, 12:30 AM
Quote from: Topaz on July 16, 2006, 07:50 PM
Quote from: Spilled on July 16, 2006, 06:32 PM
Edit: Can I load this dll in my application unlike I could bnetauth.dll?

What...

I couldn't load the bnetauth.dll into my application somewhat like vb6 because of some reason, can I load the bncsutil.dll library this way?

Rabbit: which header file would that be?
Title: Re: [C++] Invalid CDKey Response?
Post by: Networks on July 17, 2006, 01:39 AM
Quote from: Spilled on July 17, 2006, 12:30 AM
Quote from: Topaz on July 16, 2006, 07:50 PM
Quote from: Spilled on July 16, 2006, 06:32 PM
Edit: Can I load this dll in my application unlike I could bnetauth.dll?

What...

I couldn't load the bnetauth.dll into my application somewhat like vb6 because of some reason, can I load the bncsutil.dll library this way?

Rabbit: which header file would that be?

You should be able to load bnetauth.dll into your standard vb app and yes you can load BNCSUtil.dll into your vb app.
Title: Re: [C++] Invalid CDKey Response?
Post by: Spilled on July 17, 2006, 02:08 AM
Quote from: Networks on July 17, 2006, 01:39 AM
Quote from: Spilled on July 17, 2006, 12:30 AM
Quote from: Topaz on July 16, 2006, 07:50 PM
Quote from: Spilled on July 16, 2006, 06:32 PM
Edit: Can I load this dll in my application unlike I could bnetauth.dll?

What...

I couldn't load the bnetauth.dll into my application somewhat like vb6 because of some reason, can I load the bncsutil.dll library this way?

Rabbit: which header file would that be?

You should be able to load bnetauth.dll into your standard vb app and yes you can load BNCSUtil.dll into your vb app.
I know i can load it into my vb app, i'm talking about C++. I couldn't use bnetauth because of some reason UL pointed out in a previous topic, can I use BNCSUtil?
Title: Re: [C++] Invalid CDKey Response?
Post by: warz on July 17, 2006, 08:25 AM
the bnetauth.dll file was written in C. there shouldnt be any reason you cannot use it in your C++ application.
Title: Re: [C++] Invalid CDKey Response?
Post by: rabbit on July 17, 2006, 02:17 PM
I think he means direct inclusion, not calling functions from the compiled DLL.
Title: Re: [C++] Invalid CDKey Response?
Post by: warz on July 17, 2006, 02:44 PM
the bnetauth.dll source code is publicly available. there shouldnt be any reason you cannot use it in your C++ application.
Title: Re: [C++] Invalid CDKey Response?
Post by: Spilled on July 31, 2006, 02:01 AM
Dont mean to bring up an old topic but didnt think a new one was needed. I'm loading the bncsutil.dll library into my application and im now working on the decoding part but its getting me an error.


                       typedef int (*Dec)(const char*, int);
                       Dec kd_create;
                       kd_create = (Dec)GetProcAddress(hLib,"kd_create");


Here is how im using it:


                       int decoder = kd_create(theKey,13);
                       if(decoder == -1)
                       {
                             s << cWhite << s.getTime() << cRed << "Failed to Create Decoder!\n";
                             closesocket( wSock );
                             FreeLibrary(hLib);
                             return;     
                       }


Any ideas why? When i call kd_create is when i recieve the error.
Title: Re: [C++] Invalid CDKey Response?
Post by: MyndFyre on July 31, 2006, 02:29 PM
Why are you dynamically loading it?  Why not link it into your project?  All you would need to do is include the header files and tell your linker to statically or dynamically link to it.  Then you don't need to go through the hoohah about GetProcAddress.

Are you testing your result from GetProcAddress() and LoadLibrary()?
Title: Re: [C++] Invalid CDKey Response?
Post by: Spilled on July 31, 2006, 02:40 PM
I dunno why i jsut thought this would be the easiest way, so If i include the decode header file and checkrevision would this be alot easier and less stressful?
Title: Re: [C++] Invalid CDKey Response?
Post by: MyndFyre on July 31, 2006, 04:12 PM
You need to include the BNCSUtil headers *and* tell your linker to link to the .lib file.
Title: Re: [C++] Invalid CDKey Response?
Post by: Spilled on August 01, 2006, 01:30 PM
Which lib file would that be?
Title: Re: [C++] Invalid CDKey Response?
Post by: MyndFyre on August 01, 2006, 01:41 PM
BNCSUtil.lib.  You'll need to download the source code... then compile it into a library... then link to the library.

[edit]Or, even easier, you can get the 1.2 (http://bncsutil.ionws.com/new/) binaries and *gasp* the .lib file is already compiled![/edit]
Title: Re: [C++] Invalid CDKey Response?
Post by: Newby on August 01, 2006, 02:32 PM
You don't know why you were dynamically loading it?

I get the feeling you don't know a damn thing about C++. That would be a start.