Valhalla Legends Forums Archive | Battle.net Bot Development | CheckRevision Code!! help please

AuthorMessageTime
SubLiminaL_WolF
[code]
BOOL CheckRevision(LPCTSTR lpszFileName1, LPCTSTR lpszFileName2, LPCTSTR lpszFileName3, LPCTSTR lpszValueString, DWORD * lpdwVersion, DWORD * lpdwChecksum, LPSTR lpExeInfoString, LPCTSTR lpszMpqFileName)
{
DWORD dwMpqChecksumKeys[] = {0xE7F4CB62lu, 0xF6A14FFClu, 0xAA5504AFlu, 0x871FCDC2lu, 0x11BF6A18lu, 0xC57292E6lu, 0x7927D27Elu, 0x2FEC8733lu};
HANDLE hFile, hFileMapping;
char * s, lpszFileName[256], cOperations[16];
int nHashFile, nVariable1[16], nVariable2[16], nVariable3[16], nVariable,
i, k, nHashOperations;
DWORD dwTotalSize, dwSize, j, dwBytesRead, dwVariables[4], dwMpqKey,
* lpdwBuffer;
LPSTR lpszFileNames[3];
FILETIME ft;
SYSTEMTIME st;
LPBYTE lpbBuffer;
VS_FIXEDFILEINFO * ffi;
AppendText(IDC_CHATWND, BLUE, "test1");

s = strchr((char *) lpszMpqFileName, '.');
if (s == NULL)
return FALSE;
nHashFile = (int) (*(s - 1) - '0');
if (nHashFile > 7 || nHashFile < 0)
return FALSE;
dwMpqKey = dwMpqChecksumKeys[nHashFile];
lpszFileNames[0] = (LPSTR) lpszFileName1;
lpszFileNames[1] = (LPSTR) lpszFileName2;
lpszFileNames[2] = (LPSTR) lpszFileName3;
s = (char *) lpszValueString;
while (*s != '\0')
{
if (isalpha(*s))
nVariable = (int) (toupper(*s) - 'A');
else
{
nHashOperations = (int) (*s - '0');
s = strchr(s, ' ');
if (s == NULL)
return FALSE;
s++;
break;
}
if (*(++s) == '=')
s++;
dwVariables[nVariable] = atol(s);
s = strchr(s, ' ');
if (s == NULL)
return FALSE;
s++;
}
AppendText(IDC_CHATWND, BLUE, "test2");
for (i = 0; i < nHashOperations; i++)
{
if (!isalpha(*s))
return FALSE;
nVariable1[i] = (int) (toupper(*s) - 'A');
if (*(++s) == '=')
s++;
if (toupper(*s) == 'S')
nVariable2[i] = 3;
else
nVariable2[i] = (int) (toupper(*s) - 'A');
cOperations[i] = *(++s);
s++;
if (toupper(*s) == 'S')
nVariable3[i] = 3;
else
nVariable3[i] = (int) (toupper(*s) - 'A');
s = strchr(s, ' ');
if (s == NULL)
break;
s++;
}
AppendText(IDC_CHATWND, BLUE, "test3");
dwVariables[0] ^= dwMpqKey;
for (i = 0; i < 3; i++)
{
if (lpszFileNames[i][0] == '\0')
continue;
hFile = CreateFile(lpszFileNames[i],
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (hFile == (HANDLE) INVALID_HANDLE_VALUE)
return FALSE;
    AppendText(IDC_CHATWND, BLUE, "test4");
hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
if (hFileMapping == NULL)
{
CloseHandle(hFile);
return FALSE;
}
lpdwBuffer = (LPDWORD) MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0);
if (lpdwBuffer == NULL)
{
CloseHandle(hFileMapping);
CloseHandle(hFile);
return FALSE;
}
if (i == 0)
{
GetFileTime(hFile, NULL, NULL, &ft);
FileTimeToSystemTime(&ft, &st);
dwTotalSize = GetFileSize(hFile, NULL);
}
    AppendText(IDC_CHATWND, BLUE, "test5");
dwSize = (GetFileSize(hFile, NULL) / 1024lu) * 1024lu;
for (j = 0; j < (dwSize / 4lu); j++)
{
dwVariables[3] = lpdwBuffer[j];
for (k = 0; k < nHashOperations; k++)
{
switch (cOperations[k])
{
case '+':
dwVariables[nVariable1[k]] = dwVariables[nVariable2[k]] +
dwVariables[nVariable3[k]];
break;
case '-':
dwVariables[nVariable1[k]] = dwVariables[nVariable2[k]] -
dwVariables[nVariable3[k]];
break;
case '^':
dwVariables[nVariable1[k]] = dwVariables[nVariable2[k]] ^
dwVariables[nVariable3[k]];
break;
default:
return FALSE;
}
}
}
    AppendText(IDC_CHATWND, BLUE, "test6");
UnmapViewOfFile(lpdwBuffer);
CloseHandle(hFileMapping);
CloseHandle(hFile);
}
strcpy(lpszFileName, lpszFileName1);
dwSize = GetFileVersionInfoSize(lpszFileName, &dwBytesRead);
lpbBuffer = (LPBYTE) VirtualAlloc(NULL, dwSize, MEM_COMMIT,
PAGE_READWRITE);
if (lpbBuffer == NULL)
return FALSE;
if (GetFileVersionInfo(lpszFileName, NULL, dwSize, lpbBuffer) == FALSE)
return FALSE;
if (VerQueryValue(lpbBuffer, "\\", (LPVOID *) &ffi, (PUINT) &dwSize) == FALSE)
return FALSE;
*lpdwVersion = ((HIWORD(ffi->dwProductVersionMS) & 0xFF) << 24) |
((LOWORD(ffi->dwProductVersionMS) & 0xFF) << 16) |
((HIWORD(ffi->dwProductVersionLS) & 0xFF) << 8) |
(LOWORD(ffi->dwProductVersionLS) & 0xFF);
VirtualFree(lpbBuffer, 0lu, MEM_RELEASE);
s = (char *) &lpszFileName[strlen(lpszFileName)-1];
while (*s != '\\' && s > (char *) lpszFileName)
s--;
s++;
sprintf(lpExeInfoString,
"%s %02u/%02u/%02u %02u:%02u:%02u %lu",
lpszFileName + 5,
st.wMonth,
st.wDay,
st.wYear % 100,
st.wHour,
st.wMinute,
st.wSecond,
dwTotalSize);
*lpdwChecksum = dwVariables[2];
AppendText(IDC_CHATWND, BLUE, "test6");
return TRUE;
}
[/code]
is that check revision only for jstr i doubt it but w/e
in the code i always seem to fail the check revision
s = strchr((char *) lpszMpqFileName, '.');
if (s == NULL)
return FALSE;
in the null part im using sexp for the check with the correct hashes
May 8, 2003, 5:19 PM
tA-Kane
[quote author=SubLiminaL_WolF link=board=17;threadid=1258;start=0#msg9413 date=1052414341][code]s = strchr((char *) lpszMpqFileName, '.');
if (s == NULL)
return FALSE;[/code][/quote]You're not providing a valid MPQ filename, such as IX86ver1.mpq, IX86ver5.mpq, PMACver3.mpq or XMACver0.mpq. You need to make sure that you are correctly extracting the MPQ file from the received 0x50 packet.

[quote author=SubLiminaL_WolF link=board=17;threadid=1258;start=0#msg9413 date=1052414341]in the null part im using sexp for the check with the correct hashes[/quote]Are you meaning that you're doing:[code]if (s == "SEXP")[/code]If that's the case, then that's why it's failing. Otherwise, I didn't understand what you were trying to say.
May 8, 2003, 9:00 PM
SubLiminaL_WolF
no im doing s == sexp forget what i said there
should i declare the mpq in 0x50 as
packetbuf.insert(mpqname);
cuz i have to use the mpq in the revision
[code]
   case 0x50:
               //Mpq name & hash command
               strcpy(mpqname, buffer + 12);
               strcpy(hashcmd, buffer + 25);
               if(!CheckRevision("star\\starcraft.exe", "star\\storm.dll", "star\\battle.snp", hashcmd, &version, &checksum, exeinfo, mpqname)){
                  AppendText(IDC_CHATWND, WHITE, "%s", timestamp);
                  AppendText(IDC_CHATWND, RED, "CheckRevision() failed!\n");
                  Disconnect();
                  return;
               }
               AppendText(IDC_CHATWND, WHITE, "%s", timestamp);
               AppendText(IDC_CHATWND, WHITE, "Checking version & Cdkey...\n");
               break;
[/code]
the bot im using was originally made for jstr mayb thats why bcuz its lookin for a jstr
May 8, 2003, 9:55 PM
Kp
[quote author=SubLiminaL_WolF link=board=17;threadid=1258;start=0#msg9454 date=1052430952]
no im doing s == sexp forget what i said there[/quote]
So sexp is an addr of something? If so, what and where was it set? If not, that's a syntax error.
[quote author=SubLiminaL_WolF link=board=17;threadid=1258;start=0#msg9454 date=1052430952]should i declare the mpq in 0x50 as
packetbuf.insert(mpqname);[/quote]No. You don't insert data the server sends to you. You extract it.
[quote author=SubLiminaL_WolF link=board=17;threadid=1258;start=0#msg9454 date=1052430952]
the bot im using was originally made for jstr mayb thats why bcuz its lookin for a jstr[/quote]So you're lifting large portions of someone else's code? Or you're just rewriting a bot you didn't write well enough to understand? :)
May 9, 2003, 12:18 AM
Camel
checkrevision is the same for all game clients (except possibly war3?)
May 9, 2003, 12:19 AM
SubLiminaL_WolF
kp its dmbot im adding and deleting alot of code i got 0x50 to work all i need is extracting mpqname cuz everytime check revision runs it says its null and thats why i get my revision fail
May 9, 2003, 1:26 AM
Kp
[quote author=SubLiminaL_WolF link=board=17;threadid=1258;start=0#msg9500 date=1052443595]
kp its dmbot im adding and deleting alot of code i got 0x50 to work all i need is extracting mpqname cuz everytime check revision runs it says its null and thats why i get my revision fail
[/quote]You don't need to extract the MPQname; it can be used in place. Consult bnetdocs for the offset into the packet.
May 9, 2003, 4:34 AM
Zakath
Incidentally, I don't know how you got ahold of DMBot's source, but it was NOT as far as I know intended to be available to you. Shame on you for blatantly copying source you were never supposed to have.

[me=Zakath]smites Subliminal Wolf[/me]
May 11, 2003, 8:09 PM
PaiD
DM bot is a Public Source
May 11, 2003, 9:33 PM
St0rm.iD
[quote author=SubLiminaL_WolF link=board=17;threadid=1258;start=0#msg9500 date=1052443595]
kp its dmbot im adding and deleting alot of code i got 0x50 to work all i need is extracting mpqname cuz everytime check revision runs it says its null and thats why i get my revision fail
[/quote]

Weren't you the one who said you built it yourself?
May 11, 2003, 11:30 PM
Zakath
[quote author=PaiD link=board=17;threadid=1258;start=0#msg9711 date=1052688827]
DM bot is a Public Source
[/quote]

Really? When did DarkMinion release his source? If that's true, I'll be very suprised.
May 11, 2003, 11:55 PM
PaiD
Well I have it so it must be public then right?
May 12, 2003, 12:57 AM
Kp
[quote author=PaiD link=board=17;threadid=1258;start=0#msg9736 date=1052701074]
Well I have it so it must be public then right?
[/quote]Public is generally interpreted to imply that the author intended for it to be freely available. If the code was released without the author's intent, it is usually referred to as 'leaked' instead of 'public'.
May 12, 2003, 7:08 AM
SubLiminaL_WolF
[quote author=Zakath link=board=17;threadid=1258;start=0#msg9726 date=1052697359]
Really? When did DarkMinion release his source? If that's true, I'll be very suprised.
[/quote]
dont smite me you bastard your the dumbass >:(
May 13, 2003, 1:14 AM
Camel
[quote author=SubLiminaL_WolF link=board=17;threadid=1258;start=0#msg9813 date=1052788485]your the dumbass >:([/quote]
me fail english?
May 13, 2003, 1:24 AM
PaiD
Well DM Bot 3.00 is on Madz.tk
May 13, 2003, 1:50 AM
Kp
[quote author=SubLiminaL_WolF link=board=17;threadid=1258;start=0#msg9813 date=1052788485]
dont smite me you bastard your the dumbass >:([/quote]Refrain from attacks on other users. Attack ideas if you wish, but try to offer some evidence as to why the attack is merited (i.e. "you are wrong because X", not "you are wrong").
May 13, 2003, 3:11 AM
Camel
[quote author=Kp link=board=17;threadid=1258;start=15#msg9824 date=1052795494]
[quote author=SubLiminaL_WolF link=board=17;threadid=1258;start=0#msg9813 date=1052788485]
dont smite me you bastard your the dumbass >:([/quote]Refrain from attacks on other users. Attack ideas if you wish, but try to offer some evidence as to why the attack is merited (i.e. "you are wrong because X", not "you are wrong").
[/quote]

he didn't even say "you are wrong;" he said "J00 SUK N00B!"
May 13, 2003, 4:24 AM
SubLiminaL_WolF
acually i did fail english
cuz i dont use any punctuations but i dont care its internet talk anyway i dont write like this!! >:(
but if you wanna post fuckign comments then go fuckign somewhere else this aint a discussion chat this is to help me with the fuckign check revision cuz the mpq is always fuckign null and i cant get it so its not null the jstr is not null but i got the 0x50 for sexp so there is sumtin wrong!!! >:(
May 14, 2003, 12:11 AM
MrRaza
First you have to learn Visual Basic ::)
May 14, 2003, 12:18 AM
SubLiminaL_WolF
ok w/e obviously you didnt see the c++ check revision code i posted try post #1
May 14, 2003, 12:21 AM
Zakath
Sigh...so how about not passing in NULL in the mpq name variable? Theoretically that would solve your problem you know.
May 14, 2003, 1:35 AM
SubLiminaL_WolF
so you mean take out if null? if so i cant do that i get lots of errors
May 14, 2003, 1:52 AM
Eibro
Then fix the errors. If you can't do that, then pick up a book (preferably about C++) and read.
May 14, 2003, 2:15 AM
SubLiminaL_WolF
[quote]
if you wanna post fuckign comments then go fuckign somewhere else this aint a discussion chat this is to help me with the fuckign check revision.
[/quote]

comments are not fucking needed god damn it!!!

so if you cant help me then keep ur hands off the keyboard!!
May 14, 2003, 2:21 AM
Eibro
[quote author=SubLiminaL_WolF link=board=17;threadid=1258;start=15#msg9916 date=1052878887]
[quote]
if you wanna post fuckign comments then go fuckign somewhere else this aint a discussion chat this is to help me with the fuckign check revision.
[/quote]

comments are not fucking needed god damn it!!!

so if you cant help me then keep ur hands off the keyboard!!
[/quote]lol,omg man ui dint know!!!1111!!!! k so rveome the NULL and u geterrors/ omg shitty deal for you lol!!! compliers must not like u or sumthing k so i got an idea u can go and get sum1 elses working checkrevisin and use that!!!
May 14, 2003, 2:42 AM
SubLiminaL_WolF
someone please lock this fucking thing i hate it when people talk about other things unrelated to my problem!!
May 14, 2003, 8:22 PM
Kp
[quote author=SubLiminaL_WolF link=board=17;threadid=1258;start=15#msg9905 date=1052871078]
i dont care its internet talk anyway i dont write like this!! >:([/quote]I hear this excuse quite a bit, actually. Very loosely rewritten, "I don't need to express myself well because it is only the Internet." Most of these people very shortly find themselves either typing better, or being ignored for their inability to communicate effectively. While it is possible for others to read writings with poor spelling/grammar/punctuation, it is much easier to read messages which use this (and, ideally separate ideas into related paragraphs -- I dislike page-long posts with no user inserted linebreaks). Additionally, you're more likely to get accurate help if we can figure out what it is you're trying to do.

[quote author=SubLiminaL_WolF link=board=17;threadid=1258;start=15#msg9905 date=1052871078]but if you wanna post fuckign comments then go fuckign somewhere else this aint a discussion chat this is to help me with the fuckign check revision[/quote]Quote from the forum description: "Battle.net Bot Development discussions only" (emphasis added). This is indeed a discussion forum, not just a help forum for programmers who can't solve their own problems.

[quote author=SubLiminaL_WolF link=board=17;threadid=1258;start=15#msg9905 date=1052871078]cuz the mpq is always fuckign null and i cant get it so its not null[/quote]In the first client I did which handled SID_AUTH_INFO, I got it right within an hour. In the second client for which I coded SID_AUTH_INFO handling, it took less than a day (I was using an unfamiliar packet parsing method, which slowed me down). You have been working on this for days, and still not found a solution? Have you attempted yet to run your application in a debugger? Have you tried running it in an artificial testing environment created by the caller?

Despite my rapidly shrinking patience with your temper and attitude, I am still trying to help you. Post a summary of *precisely* what goes wrong, the circumstances under which it occured, how you caused it, and what you have tried to fix it. Do not just throw out code unless you believe it to be meaningful to explaining the situation. Please make an effort to make your response readable. I have no wish to help those who cannot even clearly explain their situation.
May 14, 2003, 9:37 PM
St0rm.iD
Grok just ban him.
May 15, 2003, 2:05 AM
MrRaza
no, no, he's enteraining...
May 15, 2003, 2:48 AM

Search