void UChatboxWidget::SendChat() { UWidget* theWidget = FindFirstWidget(UEditableTextBox::StaticClass()); if (theWidget) { UEditableTextBox* theTextEntry = Cast<UEditableTextBox>(theWidget); FString theText = theTextEntry->GetText().ToString(); if (theText == "") return; theTextEntry->SetText(FText::FromString("")); ARPGDemoCharacter* thePlayer = Cast<ARPGDemoCharacter>(m_OwningPlayer); if (theText.StartsWith("!savegamedata")) thePlayer->ServerSaveGameData(UStaticFunctions::UInt64ToFString(thePlayer->GetSteamID64()), thePlayer->GetPersonaName()); else if (theText.StartsWith("!loadgamedata")) thePlayer->ServerLoadGameData(UStaticFunctions::UInt64ToFString(thePlayer->GetSteamID64())); else if (theText.StartsWith("!getquests")) { for (FQuestDetails questDetails : thePlayer->m_Quests) { AddChat("Quest: " + questDetails.Name); } } if (thePlayer) thePlayer->ServerSendChatMessage(theText); } }
void HandleProxyResponse(int i, SOCKET sck) { char rxbuf[16], *errstr; int recvlen; recvlen = recv(sck, rxbuf, sizeof(rxbuf), 0); if (!recvlen || recvlen == SOCKET_ERROR) { errstr = "[PROXY] Connection error!"; goto err; } if (recvlen != 8) { errstr = "[PROXY] Invalid SOCKS4 CONNECT response length."; goto err; } if (rxbuf[0] != 0) { errstr = "[PROXY] Unsupported SOCKS4 version."; goto err; } switch (rxbuf[1]) { case 90: AddChat(vbGreen, "[PROXY] Request granted.", bot[i]->hWnd_rtfChat); break; case 91: errstr = "[PROXY] Request rejected."; goto err; case 92: errstr = "[PROXY] Request rejected becasue SOCKS server " "cannot connect to identd on client."; goto err; case 93: errstr = "[PROXY] Request rejected because the client program " "and identd report different userids."; goto err; default: errstr = "[PROXY] Unknown error."; goto err; } return; err: AddChat(vbRed, errstr, bot[i]->hWnd_rtfChat); DisconnectProfile(i, false); }
void __stdcall WdnCbkSendPacket(char *data, int len) { char asdf[128]; pendingwpacket = (char *)malloc(len); memcpy(pendingwpacket, data, len); pendingwpacketlen = len; sprintf(asdf, "[WARDEN] module wants to send packet, %d bytes", len); AddChat(vbGreen, asdf, hWnd_status_re); //StrToHexOut(data, len, bot[actprof]->hWnd_rtfChat); }
char *__stdcall WdnCbkGetRC4(char *buffer, unsigned long *len) { char asdf[128]; sprintf(asdf, "[WARDEN] module got RC4 keys at 0x%08x, %d bytes.", buffer, *len); AddChat(vbYellow, asdf, hWnd_status_re); char *oldrc4 = newrc4; newrc4 = buffer; return oldrc4; }
void AlphaBlendWallpaperInit(int alpha) { char asdf[MAX_PATH]; BLENDFUNCTION bf; BITMAP bmp; RECT rc; if (wallmemdc) { SelectObject(wallmemdc, hWallMemDCOld); DeleteObject(hBmpShade); DeleteDC(wallmemdc); } SystemParametersInfo(SPI_GETDESKWALLPAPER, sizeof(asdf), asdf, 0); //TODO with psuedotransparent glass windowing system: // - Add config code for save/loading transparency bar // *ON CONFIG SAVE CALL THIS AGAIN PASSING THE NEW VALUE // - make these options actually do something HBITMAP hBmpWall = (HBITMAP)LoadImage(NULL, asdf, IMAGE_BITMAP, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), LR_LOADFROMFILE); if (!hBmpWall) { AddChat(vbRed, "Cannot load wallpaper!", hWnd_status_re); return; } GetObject(hBmpWall, sizeof(bmp), &bmp); HDC hdc = GetDC(0); HDC tmpmemdc = CreateCompatibleDC(hdc); HGDIOBJ hOld = SelectObject(tmpmemdc, hBmpWall); rc.left = 0; rc.top = 0; rc.right = bmp.bmWidth; rc.bottom = bmp.bmHeight; wallmemdc = CreateCompatibleDC(hdc); hBmpShade = CreateCompatibleBitmap(hdc, bmp.bmWidth, bmp.bmHeight); hWallMemDCOld = SelectObject(wallmemdc, hBmpShade); FillRect(wallmemdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH)); bf.AlphaFormat = AC_SRC_ALPHA; bf.BlendOp = AC_SRC_OVER; bf.BlendFlags = 0; bf.SourceConstantAlpha = alpha; AlphaBlend(wallmemdc, 0, 0, bmp.bmWidth, bmp.bmHeight, tmpmemdc, 0, 0, bmp.bmWidth, bmp.bmHeight, bf); SelectObject(tmpmemdc, hOld); DeleteObject(hBmpWall); DeleteDC(tmpmemdc); ReleaseDC(0, hdc); }
void DisconnectProfile(int index, bool graceful) { TCITEM tc; MENUITEMINFO mii; if (index == -1) return; mii.cbSize = sizeof(MENUITEMINFO); mii.fMask = MIIM_STATE; mii.fState = MFS_UNCHECKED; SetMenuItemInfo(hMenu_main_popup, index + 11000, false, &mii); for (int i = 0; i != NUM_SBPARTS; i++) SendMessage(bot[index]->hWnd_Statusbar, SB_SETTEXT, i, NULL); SendMessage(bot[index]->hWnd_Statusbar, SB_SETICON, SBPART_CLIENT, NULL); shutdown(bot[index]->sck, 2); closesocket(bot[index]->sck); bot[index]->connected = false; bot[index]->sendcount = 0; bot[index]->recvcount = 0; bot[index]->fstate &= BFS_STATICATTRIBUTEMASK; FreeNLS(index); FreeAllLVStuff(index); bot[index]->numusers = 0; bot[index]->bancount = 0; bot[index]->clan = 0; bot[index]->firstlvuser = NULL; bot[index]->lastadded = NULL; bot[index]->flooded = false; bot[index]->floodamt = 0; bot[index]->floodtime = 0; bot[index]->idleints = 0; bot[index]->lastjointime = 0; bot[index]->self = NULL; SendMessage(bot[index]->hWnd_lvwChannel, LVM_DELETEALLITEMS, 0, 0); ResetTableContents(bot[index]->users, TABLESIZE_USERS); SetWindowText(bot[index]->hWnd_lblChannel, NULL); AddChat(vbRed, "[BNET] Disconnected.", bot[index]->hWnd_rtfChat); tc.iImage = graceful ? STATEICO_DISCONN : STATEICO_CONNERR; tc.mask = TCIF_IMAGE; SendMessage(hWnd_Tab, TCM_SETITEM, (WPARAM)GetTabFromIndex(index), (LPARAM)&tc); KillTimer(hWnd_main, index + 1); KillTimer(bot[index]->hWnd_main, index | 0x4000); if (hWnd_ClanCreate && clancreatorindex == index) DestroyWindow(hWnd_ClanCreate); }
INT_PTR FacebookProto::OnJoinChat(WPARAM hContact, LPARAM) { if (!m_enableChat || IsSpecialChatRoom(hContact)) return 0; ptrT idT(getTStringA(hContact, "ChatRoomID")); ptrT nameT(getTStringA(hContact, "Nick")); ptrA threadId(getStringA(hContact, FACEBOOK_KEY_TID)); if (!idT || !nameT || !threadId) return 0; facebook_chatroom *fbc; std::string tthread_id = threadId; auto it = facy.chat_rooms.find(tthread_id); if (it != facy.chat_rooms.end()) { fbc = it->second; } else { // We don't have this chat loaded in memory yet, lets load some info (name, list of users) fbc = new facebook_chatroom(tthread_id); LoadChatInfo(fbc); facy.chat_rooms.insert(std::make_pair(tthread_id, fbc)); } // RM TODO: better use check if chatroom exists/is in db/is online... no? // like: if (ChatIDToHContact(tthread_id) == NULL) { ptrA users(GetChatUsers(tthread_id.c_str())); if (users == NULL) { // Add chatroom AddChat(fbc->thread_id.c_str(), fbc->chat_name.c_str()); // Add chat contacts for (std::map<std::string, std::string>::iterator jt = fbc->participants.begin(); jt != fbc->participants.end(); ++jt) { AddChatContact(fbc->thread_id.c_str(), jt->first.c_str(), jt->second.c_str()); } // Load last messages delSetting(hContact, FACEBOOK_KEY_MESSAGE_ID); // We're creating new chatroom so we want load all recent messages ForkThread(&FacebookProto::LoadLastMessages, new MCONTACT(hContact)); } return 0; }
FARPROC WINAPI MyGetProcAddress(HMODULE hModule, LPCSTR lpProcName) { char asdf[256], fname[MAX_PATH]; char *sdfg = fname; *fname = 0; if (GetModuleFileName(hModule, fname, sizeof(fname))) { sdfg = strrchr(fname, '\\'); if (sdfg) { *sdfg = 0; sdfg++; } } sprintf(asdf, "[WARDEN] module getting address to (0x%08x) %s!%s() ...", hModule, sdfg, lpProcName); AddChat(vbYellow, asdf, hWnd_status_re); if (!strcmp(lpProcName, "AddVectoredExceptionHandler")) { return (FARPROC)nullsub; } else if (!strcmp(lpProcName, "RemoveVectoredExceptionHandler")) { return (FARPROC)nullsub2; } return GetProcAddress(hModule, lpProcName); }
void ContinueConnectProcess(int index) { AddChat(vbGreen, (bot[index]->fstate & BFS_USEPROXY) ? "[PROXY] Connected!" : "[BNET] Connected!", bot[index]->hWnd_rtfChat); if ((bot[index]->fstate & BFS_USEPROXY) && !(bot[index]->fstate & BFS_FIRSTDATARX)) { SendProxyRequest(index, "anonymous"); } else { send(bot[index]->sck, "\x01", 1, 0); if (bot[index]->fstate & BFS_USELEGACY) { #ifdef USE_NEW_LEGACY_LOGON Send0x1E(index); Send0x12(index); Send0x06(index); #else Send0x05(index); Send0x06(index); #endif } else { Send0x50(index); } } }
void Parse0x5E(char *data, int index) { char buf[128]; unsigned int len = *(short *)(data + 2) - 4; data += 4; RC4Crypt(bot[index]->wardenkey_in, (unsigned char *)data, len); switch (data[0]) { case 0: WardenParseCommand0(data, len, index); break; case 1: WardenParseCommand1(data, len, index); break; case 2: WardenParseCommand2(data, len, index); break; case 5: WardenParseCommand5(data, len, index); break; default: sprintf(buf, "Unhandled warden command 0x%02x!", (unsigned char)data[0]); AddChat(vbRed, buf, bot[index]->hWnd_rtfChat); StrToHexOut(data, len, bot[index]->hWnd_rtfChat); } }
LRESULT CALLBACK ProfileProc(HWND hDialog, UINT message, WPARAM wParam, LPARAM lParam) { int index; switch (message) { case WM_INITDIALOG: LPPROFILEINIT lppi; lppi = (LPPROFILEINIT)lParam; SetWindowText(GetDlgItem(hDialog, PROFILE_TXTDESCRIPTION), "loading..."); SetWindowText(GetDlgItem(hDialog, PROFILE_LBLUSERNAME), lppi->username); SendMessage(GetDlgItem(hDialog, PROFILE_LBLUSERNAME), WM_SETFONT, (WPARAM)hFontBig, 0); if (bot[((LPPROFILEINIT)lParam)->index]->connected) Send0x26((char *)lppi->username, lppi->index); if (!stricmp_(bot[lppi->index]->realname, lppi->username)) EnableWindow(GetDlgItem(hDialog, PROFILE_CMDOK), true); SetWindowLong(hDialog, GWL_USERDATA, lppi->index); break; case WM_COMMAND: switch (LOWORD(wParam)) { case PROFILE_CMDOK: index = GetWindowLong(hDialog, GWL_USERDATA); Send0x27(index); AddChat(vbGreen, "[BNET] Updated profile!", bot[index]->hWnd_rtfChat); case PROFILE_CMDCANCEL: DestroyWindow(hDialog); } break; case WM_DESTROY: hWnd_Profile = NULL; break; case WM_CLOSE: DestroyWindow(hDialog); break; default: DefWindowProc(hDialog, message, wParam, lParam); } return false; }
bool __stdcall WdnCbkCheckModule(char *modname, unsigned long _2) { char asdf[128]; sprintf(asdf, "[WARDEN] module wants to check %s. _2: 0x%08x!", modname, _2); AddChat(vbGreen, asdf, hWnd_status_re); return true; }
void WardenParseCommand0(char *data, int len, int index) { char buf[128]; unsigned char outbuf; *(__int32 *)(modname) = 'udom'; *(__int32 *)(modname + 4) = '\\sel'; for (int i = 0; i != 16; i++) sprintf(modname + 8 + (i << 1), "%02x", (unsigned char)data[i + 1]); modname[40] = '.'; *(int *)(modname + 41) = 'dom'; sprintf(buf, "Warden module %s requested.", modname + 8); AddChat(vbYellow, buf, bot[index]->hWnd_rtfChat); if (currentmodule) { if (cmphash(modhash, data + 1)) { AddChat(vbGreen, "Module already loaded, using that.", bot[index]->hWnd_rtfChat); goto send1; } else { WardenUnloadModule(); AddChat(vbYellow, "New warden module requested, loading that.", bot[index]->hWnd_rtfChat); goto contwprocessing; } } else { contwprocessing: __asm { cld mov esi, data inc esi lea edi, [modhash] movsd movsd movsd movsd lea edi, [moddecryptkey] movsd movsd movsd movsd lea edi, [modsize] movsd } /**(__int32 *)(modhash) = *(__int32 *)(data + 1); *(__int32 *)(modhash + 0x04) = *(__int32 *)(data + 5); *(__int32 *)(modhash + 0x08) = *(__int32 *)(data + 9); *(__int32 *)(modhash + 0x0C) = *(__int32 *)(data + 13); *(__int32 *)(moddecryptkey) = *(__int32 *)(data + 17); *(__int32 *)(moddecryptkey + 0x04) = *(__int32 *)(data + 21); *(__int32 *)(moddecryptkey + 0x08) = *(__int32 *)(data + 25); *(__int32 *)(moddecryptkey + 0x0C) = *(__int32 *)(data + 29); modsize = *(__int32 *)(data + 33); */ if (GetFileAttributes(modname) == INVALID_FILE_ATTRIBUTES) { if (dling) { AddChat(vbYellow, "Module already being downloaded, waiting!", bot[index]->hWnd_rtfChat); goto send1; } AddChat(vbYellow, "Module not found, downloading...", bot[index]->hWnd_rtfChat); rawmodule = (char *)malloc(modsize); moddlprog = 0; outbuf = 0; startedtick = GetTickCount(); dling = 1; } else { WardenPrepareModule(modname); WardenModuleInitalize((LPWMODHEADER)currentmodule); send1: outbuf = 1; } } RC4Crypt(bot[index]->wardenkey_out, &outbuf, 1); InsertByte(outbuf); SendPacket(0x5E, index); }
void HandleDataRecv(int i, SOCKET sck, LPARAM lParam) { int bnetlen; char asdf[256]; if (LOWORD(lParam) == FD_READ) { if (loglevel > 2) AddChatf(asdf, hWnd_status_re, 0xFFC080, "FD_READ event on %d", i); if ((bot[i]->fstate & BFS_USEPROXY) && !(bot[i]->fstate & BFS_FIRSTDATARX)) { HandleProxyResponse(i, sck); bot[i]->fstate |= BFS_FIRSTDATARX; ContinueConnectProcess(i); return; } int tmp = recv(sck, bot[i]->wsdata + bot[i]->recvlen, sizeof(bot[i]->wsbuffer) - (bot[i]->wsdata - bot[i]->wsbuffer) - bot[i]->recvlen, 0); if (tmp == SOCKET_ERROR) { sprintf(asdf, "recv() error %d!", WSAGetLastError()); AddChat(vbRed, asdf, bot[i]->hWnd_rtfChat); return; } else if (!tmp) { AddChat(vbRed, "recv() returned 0!", bot[i]->hWnd_rtfChat); DisconnectProfile(i, false); return; } bot[i]->recvlen += tmp; while (bot[i]->recvlen >= 4) { if ((unsigned char)*bot[i]->wsdata != (unsigned char)0xFF) { sprintf(asdf, "[BNET] Parse error! expected 0xFF, 0x%02x.", (unsigned char)*bot[i]->wsdata); AddChat(vbRed, asdf, bot[i]->hWnd_rtfChat); bot[i]->wsdata = bot[i]->wsbuffer; bot[i]->recvlen = 0; return; } bnetlen = *(unsigned short *)(bot[i]->wsdata + 2); if (bnetlen > bot[i]->recvlen) { sprintf(asdf, "[BNET] Expecting %d more bytes.", bnetlen - bot[i]->recvlen); AddChat(vbYellow, asdf, bot[i]->hWnd_rtfChat); if (bot[i]->wsdata + bot[i]->recvlen >= bot[i]->wsbuffer + sizeof(bot[i]->wsbuffer)) { memcpy(bot[i]->wsbuffer, bot[i]->wsdata, bot[i]->recvlen); bot[i]->wsdata = bot[i]->wsbuffer; } return; } #if 0 int bleep, i2, i3; bleep = 0; i3 = 0; for (i2 = 0; i2 != bnetlen; i2++) { i3++; bleep += bot[i]->wsdata[i2] << 1; if (i3 == 5) { Beep((bleep << 3) + 300, 25); i3 = 0; bleep = 0; } } #endif ParsePacket(bot[i]->wsdata[1], bot[i]->wsdata, i); bot[i]->recvcount++; bot[i]->recvlen -= bnetlen; bot[i]->wsdata += bnetlen; } bot[i]->wsdata = bot[i]->wsbuffer; bot[i]->recvlen = 0; } else { if (LOWORD(lParam) == FD_CLOSE) { if (loglevel > 2) AddChatf(asdf, hWnd_status_re, 0xFFC080, "FD_CLOSE event on %d", i); AddChat(vbRed, "[BNET] Winsock Close.", bot[i]->hWnd_rtfChat); bnetlen = HIWORD(lParam); if (bnetlen) { sprintf(asdf, "[BNET] Winsock Error %d !", bnetlen); AddChat(vbRed, asdf, bot[i]->hWnd_rtfChat); sprintf(asdf, "Winsock error %d encountered on profile %d!", bnetlen, i); PopupTrayMsg("Connection dropped!", asdf, NIIF_ERROR); } DisconnectProfile(i, false); AutoReconnectStart(i, 0); return; } else if (LOWORD(lParam) == FD_CONNECT) { if (loglevel > 2) AddChatf(asdf, hWnd_status_re, 0xFFC080, "FD_CONNECT event on %d", i); int err = WSAGETSELECTERROR(lParam); if (err) { AddChatf(asdf, bot[i]->hWnd_rtfChat, vbRed, "Connection failed, error %d!", err); DisconnectProfile(i, false); AutoReconnectStart(i, 0); return; } ContinueConnectProcess(i); } } return; }
bool WardenPrepareModule(char *filename) { unsigned long read; int i; HANDLE hFile = CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (!hFile) return false; int filelen = GetFileSize(hFile, NULL); char *tmpmod = (char *)malloc(filelen); ReadFile(hFile, tmpmod, filelen, &read, NULL); CloseHandle(hFile); LPWMODHEADER lpwmodh = (LPWMODHEADER)tmpmod; char *lmodule = (char *)VirtualAlloc(0, lpwmodh->cbModSize, MEM_COMMIT, PAGE_READWRITE); memcpy(lmodule, tmpmod, 40); unsigned long srcloc = lpwmodh->sectioncount * 12 + 0x28; unsigned long destloc = lpwmodh->sectionlen; int sections = 0; while (destloc < lpwmodh->cbModSize) { int sectionsize = *(unsigned __int16 *)(tmpmod + srcloc); srcloc += 2; sections++; if (sections & 1) { memcpy(lmodule + destloc, tmpmod + srcloc, sectionsize); srcloc += sectionsize; } destloc += sectionsize; } srcloc = lpwmodh->rvaFxnTableReloc; destloc = 0; for (i = 0; i != lpwmodh->reloccount; i++) { if (lmodule[srcloc] < 0) { destloc = ((lmodule[srcloc + 0] & 0x07F) << 24) | ((lmodule[srcloc + 1] & 0x0FF) << 16) | ((lmodule[srcloc + 2] & 0x0FF) << 8) | ((lmodule[srcloc + 3] & 0x0FF)); srcloc += 4; AddChat(vbRed, "[WARDEN] module is using an absolute address!!!", hWnd_status_re); } else { destloc += (lmodule[srcloc + 1] & 0x0FF) + (lmodule[srcloc] << 8); srcloc += 2; } *(__int32 *)(lmodule + destloc) += (__int32)lmodule; } for (i = 0; i != lpwmodh->dllcount; i++) { __int32 tmp; unsigned long procstart = lpwmodh->rvaImports + i * 8; unsigned long procoffset = *(__int32 *)(lmodule + procstart + 4); char *libtoload = lmodule + *(__int32 *)(lmodule + procstart); HMODULE hLib = LoadLibrary(libtoload); int fnnameoffset = *(__int32 *)(lmodule + procoffset); while (fnnameoffset) { fnnameoffset = *(__int32 *)(lmodule + procoffset); //add esi, dword ptr [ebx] if (fnnameoffset > 0) { char *fnstr = lmodule + fnnameoffset; if (!strcmp(fnstr, "GetProcAddress")) tmp = (__int32)MyGetProcAddress; else if (!strcmp(fnstr, "SetUnhandledExceptionFilter")) tmp = (__int32)MySetUnhandledExceptionFilter; else if (!strcmp(fnstr, "TerminateProcess")) tmp = (__int32)MyTerminateProcess; else tmp = (__int32)GetProcAddress(hLib, fnstr); } else { tmp &= ~0x80000000; } *(__int32 *)(lmodule + procoffset) = tmp; procoffset += 4; } } for (i = 0; i != lpwmodh->sectioncount; i++) { unsigned long oldprotect; LPWMODPROTECT lpwmodp = (LPWMODPROTECT)(lmodule + lpwmodh->sectioncount * 12 + 0x28); lpwmodp->base = lmodule + (int)lpwmodp->base; VirtualProtect(lpwmodp->base, lpwmodp->len, lpwmodp->protectdword, &oldprotect); if (oldprotect & 0xF0) FlushInstructionCache(GetCurrentProcess(), lpwmodp->base, lpwmodp->len); } if (lpwmodh->cbModSize < lpwmodh->rvaFxnTableReloc) return false; VirtualFree(lmodule + lpwmodh->rvaFxnTableReloc, lpwmodh->cbModSize - lpwmodh->rvaFxnTableReloc, MEM_RELEASE); currentmodule = (void *)lmodule; return true; }
void WardenParseCommand2(char *data, int len, int index) { char buf[512]; char asdf[64]; char *tosend = buf + 7; char *mods[8]; void *address; int pos = 1, nummods = 0, length, lentoread; ZeroMemory(buf, sizeof(buf)); //StrToHexOut(data, len, hWnd_status_re); while (data[pos]) { mods[nummods] = (char *)malloc(data[pos] + 1); memcpy(mods[nummods], data + pos + 1, data[pos]); *(mods[nummods] + data[pos]) = 0; nummods++; pos = pos + data[pos] + 1; if (nummods == 8) break; } pos++; int wc3 = ((bot[index]->fstate & BFS_WARCRAFT3) && 1); /////////////////// //if (!lpModuleImage[wc3]) { // AddChat(vbRed, "Requested module is not loaded!", bot[index]->hWnd_rtfChat); // goto freenret; //} while (pos + 1 < len) { //data[i] ^= data[len - 1]; if (pos >= 256) { AddChat(vbRed, "WARNING! WARDEN BUFFER OVER THRESHHOLD!", bot[index]->hWnd_rtfChat); break; } pos++; //skip command id if ((unsigned char)data[pos] <= nummods && !data[pos + 4]) { //memcheck /* (BYTE) String Index (DWORD) Address (BYTE) Length to Read */ //mods[data[pos]]; //address = *(__int32 *)(data + pos + 1) - (data[pos] ? 0 : 0x400000) + lpModuleImage[wc3]; address = GetAddress(*(void **)(data + pos + 1), mods, data[pos], nummods, wc3); if (address) { lentoread = data[pos + 5]; if (IsBadReadPtr(address, lentoread)) { AddChatf(asdf, hWnd_status_re, vbRed, "[%d] Unreadable memcheck, addr 0x%08x, len %d. at pos %d!", index, address, lentoread, pos); StrToHexOut(data, len, hWnd_status_re); goto pagecheck; } *tosend++ = 0; memcpy(tosend, address, lentoread); tosend += lentoread; } else { AddChatf(asdf, hWnd_status_re, vbRed, "[%d] Unreadable memcheck, addr 0x%08x, len %d. at pos %d!", index, address, lentoread, pos); StrToHexOut(data, len, hWnd_status_re); goto pagecheck; } pos += 6; } else { //pagecheck pagecheck: /* (DWORD) Seed (DWORD)[5] SHA1 (DWORD) Address (BYTE) Length to Read */ *tosend = (char)0xE9; //0; tosend++; pos += 29; } } length = tosend - buf; *buf = 2; *(__int16 *)(buf + 1) = length - 7; *(__int32 *)(buf + 3) = WardenGenerateChecksum(buf + 7, length - 7); RC4Crypt(bot[index]->wardenkey_out, (unsigned char *)buf, length); InsertVoid(buf, length); SendPacket(0x5E, index); //freenret: while (nummods--) free(mods[nummods]); }
void ConnectProfile(int index) { char asdf[256]; unsigned int proxyport; TCITEM tc; MENUITEMINFO mii; if (index == -1) return; if (bot[index]->connected) DisconnectProfile(index, true); KillTimer(bot[index]->hWnd_main, index | 0x4000); mii.cbSize = sizeof(MENUITEMINFO); mii.fMask = MIIM_STATE; mii.fState = MFS_CHECKED; SetMenuItemInfo(hMenu_main_popup, index + 11000, false, &mii); tc.iImage = STATEICO_CONNERR; tc.mask = TCIF_IMAGE; SendMessage(hWnd_Tab, TCM_SETITEM, (WPARAM)GetTabFromIndex(index), (LPARAM)&tc); switch (bot[index]->client) { case 'STAR': case 'SEXP': bot[index]->fstate |= BFS_STARCRAFT; break; case 'D2DV': case 'D2XP': bot[index]->fstate |= BFS_DIABLO2; break; case 'WAR3': case 'W3XP': bot[index]->fstate |= BFS_WARCRAFT3; break; case 'SSHR': case 'JSTR': case 'DSHR': case 'DRTL': bot[index]->fstate |= BFS_USELEGACY; } if (bot[index]->fstate & BFS_USEPROXY) { char proxystr[32], *portstr; strcpy(proxystr, bot[index]->proxy); portstr = strchr(proxystr, ':'); if (!portstr) { AddChat(vbRed, "[PROXY] Bad proxy format, cannot get port.", bot[index]->hWnd_rtfChat); return; } *portstr++ = 0; proxyport = atoi(portstr); AddChatf(asdf, bot[index]->hWnd_rtfChat, vbYellow, "[PROXY] Connecting to %s:%d...", proxystr, proxyport); if (!ConnectAsyncSocket(index, proxystr, proxyport)) AddChatf(asdf, bot[index]->hWnd_rtfChat, vbRed, "ConnectAsyncSocket failed, WSAGetLastError: %d", WSAGetLastError()); } else { AddChatf(asdf, bot[index]->hWnd_rtfChat, vbYellow, "[BNET] Connecting to %s:%6112...", bot[index]->server); if (!ConnectAsyncSocket(index, bot[index]->server, 6112)) AddChatf(asdf, bot[index]->hWnd_rtfChat, vbRed, "ConnectAsyncSocket failed, WSAGetLastError: %d", WSAGetLastError()); } }
BOOL WINAPI MyTerminateProcess(HANDLE hProcess, UINT uExitCode) { char asdf[128]; sprintf(asdf, "Module attempted to call TerminateProcess(0x%08x, %d)!", hProcess, uExitCode); AddChat(vbRed, asdf, hWnd_status_re); return true; }
void __stdcall WdnCbkSetRC4(void *keys, unsigned long len) { char asdf[128]; sprintf(asdf, "[WARDEN] module set RC4 keys at 0x%08x, %d bytes.", keys, len); AddChat(vbYellow, asdf, hWnd_status_re); }
void __stdcall WdnCbkMemFree(void *mem) { char asdf[64]; free(mem); sprintf(asdf, "[WARDEN] module freed 0x%08x.", mem); AddChat(vbYellow, asdf, hWnd_status_re); }
unsigned long __stdcall WdnCbkLoadModule(char *decryptkey, char *module, int modlen) { char asdf[128]; sprintf(asdf, "[WARDEN] module wants to load a new module, %d bytes.", modlen); AddChat(vbYellow, asdf, hWnd_status_re); return NULL; }