Valhalla Legends Forums Archive | Battle.net Bot Development | checkRevision (bncsutil1.0.3) problems

AuthorMessageTime
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...
[code]
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");
}
[/code]

declarations of remaining variables...
[code]
char ChecksumFormula[256];
unsigned int mpqNumber;
char exe[260];
char dll_one[260];
char dll_two[260];
[/code]

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?
May 8, 2005, 2:42 AM
shadypalm88
Okee,

Please IM me (see my profile) and I'll help you see what's going wrong.
May 8, 2005, 2:56 AM
Kp
[quote author=Okee link=topic=11518.msg111461#msg111461 date=1115520167]
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...
[code]
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");
}
[/code]

declarations of remaining variables...
[code]
char ChecksumFormula[256];
unsigned int mpqNumber;
char exe[260];
char dll_one[260];
char dll_two[260];
[/code]

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

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.
May 10, 2005, 6:29 PM
Maddox
wow...
May 11, 2005, 1:14 AM

Search