Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Okee on May 07, 2005, 09:42 PM

Title: checkRevision (bncsutil1.0.3) problems
Post by: Okee on May 07, 2005, 09:42 PM
Hey. I'm calling checkRevision() from within my C++ bot project. The program crashes at run-time once it hits the call to checkRevision. It must be an error in something being passed to the function, but I've changed a few things that I suspected were causing the problems - and no luck. I'll let you all check it out, and maybe somebody can spot something wrong.

call to the function...

const char* files[] = {exe, dll_one, dll_two};
unsigned long Checksum;
if(!checkRevision(ChecksumFormula, files, 3, mpqNumber, (unsigned long *)Checksum)) {
closesocket(bncs.sock);
bncs.state = DISCONNECTED;
print("Checkrevision failed!\n");
}


declarations of remaining variables...

char ChecksumFormula[256];
unsigned int mpqNumber;
char exe[260];
char dll_one[260];
char dll_two[260];


ChecksumFormula contains what looks to be the entire formula, and mpqNumber returns the corrent value. Anyone see why it might be causing the program to crash?
Title: Re: checkRevision (bncsutil1.0.3) problems
Post by: shadypalm88 on May 07, 2005, 09:56 PM
Okee,

Please IM me (see my profile) and I'll help you see what's going wrong.
Title: Re: checkRevision (bncsutil1.0.3) problems
Post by: Kp on May 10, 2005, 01:29 PM
Quote from: Okee on May 07, 2005, 09:42 PM
Hey. I'm calling checkRevision() from within my C++ bot project. The program crashes at run-time once it hits the call to checkRevision. It must be an error in something being passed to the function, but I've changed a few things that I suspected were causing the problems - and no luck. I'll let you all check it out, and maybe somebody can spot something wrong.

call to the function...

const char* files[] = {exe, dll_one, dll_two};
unsigned long Checksum;
if(!checkRevision(ChecksumFormula, files, 3, mpqNumber, (unsigned long *)Checksum)) {
closesocket(bncs.sock);
bncs.state = DISCONNECTED;
print("Checkrevision failed!\n");
}


declarations of remaining variables...

char ChecksumFormula[256];
unsigned int mpqNumber;
char exe[260];
char dll_one[260];
char dll_two[260];


ChecksumFormula contains what looks to be the entire formula, and mpqNumber returns the corrent value. Anyone see why it might be causing the program to crash?

Perhaps you should take heed of type cast warnings? ;)  You're passing an uninitialized variable as a pointer to an unsigned long, and BNCSutil segfaults when it writes to that.  Use &checksum instead of (unsigned long*)checksum.
Title: Re: checkRevision (bncsutil1.0.3) problems
Post by: Maddox on May 10, 2005, 08:14 PM
wow...