• Welcome to Valhalla Legends Archive.
 

checkRevision (bncsutil1.0.3) problems

Started by Okee, May 07, 2005, 09:42 PM

Previous topic - Next topic

Okee

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?

shadypalm88

Okee,

Please IM me (see my profile) and I'll help you see what's going wrong.

Kp

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.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Maddox

asdf.