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;
}
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
Quote from: SubLiminaL_WolF on May 08, 2003, 12:19 PMs = strchr((char *) lpszMpqFileName, '.');
if (s == NULL)
return FALSE;
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 from: SubLiminaL_WolF on May 08, 2003, 12:19 PMin the null part im using sexp for the check with the correct hashes
Are you meaning that you're doing:
if (s == "SEXP")
If that's the case, then that's why it's failing. Otherwise, I didn't understand what you were trying to say.
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
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;
the bot im using was originally made for jstr mayb thats why bcuz its lookin for a jstr
Quote from: SubLiminaL_WolF on May 08, 2003, 04:55 PM
no im doing s == sexp forget what i said there
So sexp is an addr of something? If so, what and where was it set? If not, that's a syntax error.
Quote from: SubLiminaL_WolF on May 08, 2003, 04:55 PMshould i declare the mpq in 0x50 as
packetbuf.insert(mpqname);
No. You don't insert data the server sends to you. You extract it.
Quote from: SubLiminaL_WolF on May 08, 2003, 04:55 PM
the bot im using was originally made for jstr mayb thats why bcuz its lookin for a jstr
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? :)
checkrevision is the same for all game clients (except possibly war3?)
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 from: SubLiminaL_WolF on May 08, 2003, 08:26 PM
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
You don't need to extract the MPQname; it can be used in place. Consult bnetdocs for the offset into the packet.
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 smites Subliminal Wolf
DM bot is a Public Source
Quote from: SubLiminaL_WolF on May 08, 2003, 08:26 PM
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
Weren't you the one who said you built it yourself?
Quote from: PaiD on May 11, 2003, 04:33 PM
DM bot is a Public Source
Really? When did DarkMinion release his source? If that's true, I'll be very suprised.
Well I have it so it must be public then right?
Quote from: PaiD on May 11, 2003, 07:57 PM
Well I have it so it must be public then right?
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'.
Quote from: Zakath on May 11, 2003, 06:55 PM
Really? When did DarkMinion release his source? If that's true, I'll be very suprised.
dont smite me you bastard your the dumbass >:(
Well DM Bot 3.00 is on Madz.tk
Quote from: SubLiminaL_WolF on May 12, 2003, 08:14 PM
dont smite me you bastard your the dumbass >:(
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 from: Kp on May 12, 2003, 10:11 PM
Quote from: SubLiminaL_WolF on May 12, 2003, 08:14 PM
dont smite me you bastard your the dumbass >:(
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").
he didn't even say "you are wrong;" he said "J00 SUK N00B!"
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!!! >:(
First you have to learn Visual Basic ::)
ok w/e obviously you didnt see the c++ check revision code i posted try post #1
Sigh...so how about not passing in NULL in the mpq name variable? Theoretically that would solve your problem you know.
so you mean take out if null? if so i cant do that i get lots of errors
Then fix the errors. If you can't do that, then pick up a book (preferably about C++) and read.
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.
comments are not fucking needed god damn it!!!
so if you cant help me then keep ur hands off the keyboard!!
Quote from: SubLiminaL_WolF on May 13, 2003, 09:21 PM
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.
comments are not fucking needed god damn it!!!
so if you cant help me then keep ur hands off the keyboard!!
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!!!
someone please lock this fucking thing i hate it when people talk about other things unrelated to my problem!!
Quote from: SubLiminaL_WolF on May 13, 2003, 07:11 PM
i dont care its internet talk anyway i dont write like this!! >:(
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 from: SubLiminaL_WolF on May 13, 2003, 07:11 PMbut 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 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 from: SubLiminaL_WolF on May 13, 2003, 07:11 PMcuz the mpq is always fuckign null and i cant get it so its not null
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.
Grok just ban him.
no, no, he's enteraining...