• Welcome to Valhalla Legends Archive.
 

[C++] Invalid CDKey Response?

Started by Spilled, July 16, 2006, 04:43 PM

Previous topic - Next topic

Spilled

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.

topaz

RLY...?

UserLoser

What's the return value supposed to be upon success?

MyndFyre

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.

Spilled

#4
Quote from: MyndFyre[vL] on July 16, 2006, 05:29 PM
Why not use BNCSUtil?

I didn't know the library was outdated.


UL: Boolean


Edit: Can I load this dll in my application unlike I could bnetauth.dll?

topaz

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...
RLY...?

rabbit

Include the correct bncsutil header file, and yes.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

Spilled

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?

Networks

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.

Spilled

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?

warz

the bnetauth.dll file was written in C. there shouldnt be any reason you cannot use it in your C++ application.

rabbit

I think he means direct inclusion, not calling functions from the compiled DLL.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

warz

the bnetauth.dll source code is publicly available. there shouldnt be any reason you cannot use it in your C++ application.

Spilled

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.

MyndFyre

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()?
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.