MEXP(int) checkRevisionFlat(const char* valueString, const char* file1, const char* file2, const char* file3, int mpqNumber, unsigned long* checksum) { const char* files[] = {file1, file2, file3}; return checkRevision(valueString, files, 3, mpqNumber, checksum); }
bool BNCSHandler::HandleAuthInfo(DWORD LogonType, DWORD UDPValue, FILETIME MPQFileTime, char *MPQFileName, char *ValueString) { switch(LogonType) { case 0: break; case 1: global->logManip.logOutput(LOG_CONN_ERROR, true, "The nls is not supported by this bot.\n"); return false; break; case 2: global->logManip.logOutput(LOG_CONN_ERROR, true, "The nls is not supported by this bot.\n"); return false; break; default: global->logManip.logOutput(LOG_CONN_ERROR, true, "The suggested logon method is not supported by this client!\n"); return false; break; } global->logManip.logOutput(LOG_STARTUP, true, "Checking CD key and file versions...\n"); kd_init(); unsigned int mpqNum = extractMPQNumber(MPQFileName); if(mpqNum < 0) return false; char *annoying1 = new char[global->configManip.getGamefile1().length() +1]; char *annoying2 = new char[global->configManip.getGamefile2().length() +1]; char *annoying3 = new char[global->configManip.getGamefile3().length() +1]; strcpy(annoying1, global->configManip.getGamefile1().c_str()); strcpy(annoying2, global->configManip.getGamefile2().c_str()); strcpy(annoying3, global->configManip.getGamefile3().c_str()); const char* files[] = { annoying1, annoying2, annoying3 }; unsigned long Checksum; if(!checkRevision(ValueString, files, 3, mpqNum, &Checksum)) return false; delete [] annoying1; delete [] annoying2; delete [] annoying3; DWORD exeVer; unsigned int Version; char exeInfo[300]; char *annoying = new char[global->configManip.getGamefile1().length() + 1]; strcpy(annoying, global->configManip.getGamefile1().c_str()); exeVer = getExeInfo(annoying, exeInfo, 256, &Version, 0x1); delete [] annoying; if(!exeVer) { global->logManip.logOutput(LOG_CONN_ERROR, true, "Could not gather game file info!\n"); return false; } global->packetManip.Buff.add(clientToken); global->packetManip.Buff.add(exeVer); global->packetManip.Buff.add(Checksum); global->packetManip.Buff.add((int)0x01); global->packetManip.Buff.add((int)0); CDKeyDecoder decoder(global->configManip.getCDKey().c_str(), global->configManip.getCDKey().length()); if(!decoder.isKeyValid()) { global->logManip.logOutput(LOG_CONN_ERROR, true, "The provided CD key is invalid!\n"); return false; } unsigned long getProd, getVal; getProd = decoder.getProduct(); getVal = decoder.getVal1(); global->packetManip.Buff.add((int)strlen(global->configManip.getCDKey().c_str())); global->packetManip.Buff.add(getProd); global->packetManip.Buff.add(getVal); global->packetManip.Buff.add((int)0x00); int hashLength = decoder.calculateHash(clientToken, serverToken); if(!hashLength) return false; char KeyHash[64]; if(!decoder.getHash(KeyHash)) return false; global->packetManip.Buff.add(KeyHash, 5 * 4); global->packetManip.Buff.add(exeInfo); global->packetManip.Buff.add(global->configManip.getUsername()); global->packetManip.Buff.sendpacket(SID_AUTH_CHECK); return true; }