Valhalla Legends Forums Archive | Battle.net Bot Development | [C++] Invalid CDKey Response?

AuthorMessageTime
Spilled[DW]
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.

[code]
              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;
              }
[/code]

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.
July 16, 2006, 9:43 PM
Topaz
Outdated library.
July 16, 2006, 10:22 PM
UserLoser
What's the return value supposed to be upon success?
July 16, 2006, 10:22 PM
Myndfyr
Why not use BNCSUtil?
July 16, 2006, 10:29 PM
Spilled[DW]
[quote author=MyndFyre[vL] link=topic=15405.msg155808#msg155808 date=1153088994]
Why not use BNCSUtil?
[/quote]

I didn't know the library was outdated.


UL: Boolean


Edit: Can I load this dll in my application unlike I could bnetauth.dll?
July 16, 2006, 11:32 PM
Topaz
[quote author=Spilled link=topic=15405.msg155812#msg155812 date=1153092779]
Edit: Can I load this dll in my application unlike I could bnetauth.dll?
[/quote]

What...
July 17, 2006, 12:50 AM
rabbit
Include the correct bncsutil header file, and yes.
July 17, 2006, 1:18 AM
Spilled[DW]
[quote author=Topaz link=topic=15405.msg155815#msg155815 date=1153097446]
[quote author=Spilled link=topic=15405.msg155812#msg155812 date=1153092779]
Edit: Can I load this dll in my application unlike I could bnetauth.dll?
[/quote]

What...
[/quote]

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?
July 17, 2006, 5:30 AM
Networks
[quote author=Spilled link=topic=15405.msg155820#msg155820 date=1153114235]
[quote author=Topaz link=topic=15405.msg155815#msg155815 date=1153097446]
[quote author=Spilled link=topic=15405.msg155812#msg155812 date=1153092779]
Edit: Can I load this dll in my application unlike I could bnetauth.dll?
[/quote]

What...
[/quote]

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?
[/quote]

You should be able to load bnetauth.dll into your standard vb app and yes you can load BNCSUtil.dll into your vb app.
July 17, 2006, 6:39 AM
Spilled[DW]
[quote author=Networks link=topic=15405.msg155821#msg155821 date=1153118343]
[quote author=Spilled link=topic=15405.msg155820#msg155820 date=1153114235]
[quote author=Topaz link=topic=15405.msg155815#msg155815 date=1153097446]
[quote author=Spilled link=topic=15405.msg155812#msg155812 date=1153092779]
Edit: Can I load this dll in my application unlike I could bnetauth.dll?
[/quote]

What...
[/quote]

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?
[/quote]

You should be able to load bnetauth.dll into your standard vb app and yes you can load BNCSUtil.dll into your vb app.
[/quote]
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?
July 17, 2006, 7:08 AM
warz
the bnetauth.dll file was written in C. there shouldnt be any reason you cannot use it in your C++ application.
July 17, 2006, 1:25 PM
rabbit
I think he means direct inclusion, not calling functions from the compiled DLL.
July 17, 2006, 7:17 PM
warz
the bnetauth.dll source code is publicly available. there shouldnt be any reason you cannot use it in your C++ application.
July 17, 2006, 7:44 PM
Spilled[DW]
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.

[code]
                      typedef int (*Dec)(const char*, int);
                      Dec kd_create;
                      kd_create = (Dec)GetProcAddress(hLib,"kd_create");
[/code]

Here is how im using it:

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

Any ideas why? When i call kd_create is when i recieve the error.
July 31, 2006, 7:01 AM
Myndfyr
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()?
July 31, 2006, 7:29 PM
Spilled[DW]
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?
July 31, 2006, 7:40 PM
Myndfyr
You need to include the BNCSUtil headers *and* tell your linker to link to the .lib file.
July 31, 2006, 9:12 PM
Spilled[DW]
Which lib file would that be?
August 1, 2006, 6:30 PM
Myndfyr
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 binaries and *gasp* the .lib file is already compiled![/edit]
August 1, 2006, 6:41 PM
Newby
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.
August 1, 2006, 7:32 PM

Search