コード例 #1
0
bool RTConnectionManager::DelModuleInfo(const std::string& sid)
{
    ModuleInfoMaps::iterator it = GetModuleInfo()->find(sid);
    if (it!=GetModuleInfo()->end()) {
        GetModuleInfo()->erase(sid);
    }
    return true;
}
コード例 #2
0
void RTConnectionManager::RefreshConnection()
{
    ModuleInfo* pmi = NULL;
    ModuleInfoMaps::iterator it = GetModuleInfo()->begin();
    for (; it!=GetModuleInfo()->end(); it++) {
        pmi = it->second;
        if (pmi && pmi->othModuleType == TRANSFERMODULE::mconnector) {
            if (pmi->pModule && pmi->pModule->RefreshTime()) {
                pmi->pModule->KeepAlive();
            }
        }
    }
}
コード例 #3
0
ファイル: Memory.cpp プロジェクト: TheDarkEngine/DarkCore
	PBYTE FindSignature(LPVOID BaseAddress, DWORD ImageSize, PCHAR Signature, PCHAR Mask)
	{
		PBYTE Address = NULL;
		PBYTE Buffer = (PBYTE)BaseAddress;

		if (BaseAddress == NULL)
		{
			if (!GetModuleInfo(ImageSize, Buffer))
				return Address;
		}

		DWORD Length = strlen(Mask);

		for (DWORD i = 0; i < (ImageSize - Length); i++)
		{
			int result = CompareByteArray((Buffer + i), Signature, Mask, Length);
			if (result < 0)
			{
				Address = (PBYTE)BaseAddress + i;
				break;
			}
			else
			{
				i += result;
			}
		}

		return Address;
	}
コード例 #4
0
ファイル: cod8.cpp プロジェクト: KyoukoToshinou/Animeme
	DWORD FindPattern(char* szSig, char* szMask) {
		DWORD dwAddress = (DWORD)GetModuleHandleA(NULL);
		DWORD dwLen = GetModuleInfo(NULL).SizeOfImage;

		for (DWORD i = 0; i < dwLen; i++)
			if (Match((BYTE*)(dwAddress + i), (BYTE*)szSig, szMask))
				return (DWORD)(dwAddress + i);

		return 0;
	}
コード例 #5
0
RTConnectionManager::ModuleInfo* RTConnectionManager::findModuleInfoBySid(const std::string& sid)
{
    RTConnectionManager::ModuleInfo *pInfo = NULL;
    RTConnectionManager::ModuleInfoMaps* maps = GetModuleInfo();
    RTConnectionManager::ModuleInfoMaps::iterator it = maps->find(sid);
    if (it!=maps->end()) {
        pInfo = it->second;
    }
    return pInfo;
}
コード例 #6
0
ファイル: Scanner.cpp プロジェクト: Mikulas/LoL-Advanced
DWORD CScanner::FindAddr(int signatureName)
{
	Signature sig = signatures[signatureName];
	HWND hWindow = FindWindow(NULL, L"League of Legends (TM) Client");
	DWORD dwPid;
    	GetWindowThreadProcessId(hWindow, &dwPid);
    	HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwPid);

	DWORD addr = SearchPattern(sig, hProcess, GetModuleInfo(dwPid));
	CloseHandle(hProcess);
	return addr;
}
コード例 #7
0
RTConnectionManager::ModuleInfo* RTConnectionManager::findModuleInfo(const std::string& uid, TRANSFERMODULE module)
{
    RTConnectionManager::ModuleInfo *pInfo = NULL;
    RTConnectionManager::ModuleInfoMaps* maps = GetModuleInfo();
    RTConnectionManager::ModuleInfoMaps::iterator it = maps->begin();
    for (; it!=maps->end(); it++) {
        if (it->second && it->second->othModuleType == module) {
            pInfo = it->second;
            break;
        }
    }
    return pInfo;
}
コード例 #8
0
/**
 * @param rStackEntry - stack entry information.
 */
void CExpressModeDlg::UpdateStackEntryFromMap(CStackEntry& rStackEntry)
{
	if (! rStackEntry.m_strAddress.IsEmpty() &&
		(
			rStackEntry.m_strFunctionName.IsEmpty() ||
			rStackEntry.m_strSourceFile.IsEmpty() ||
			rStackEntry.m_strLineNumber.IsEmpty()
		))
	{
		int nAddrPos = rStackEntry.m_strAddress.Find(_T(':'));
		if (nAddrPos >= 0)
			++nAddrPos;
		else
			nAddrPos = 0;
		PVOID ptrAddress = (PVOID)_tcstoui64((PCTSTR)rStackEntry.m_strAddress + nAddrPos, NULL, 16);
		if (ptrAddress != NULL)
		{
			boost::shared_ptr<CBaseProcessor> pBaseProcessor(GetModuleInfo(rStackEntry.m_strModule));
			if (pBaseProcessor.get() != NULL)
			{
				boost::shared_ptr<CBaseFnInfo> pFnInfo;
				DWORD64 dwDisplacement64;
				if (pBaseProcessor->FindFunctionInfo(ptrAddress, pFnInfo, dwDisplacement64))
				{
					std::string strFunctionName(pFnInfo->GetName());
					boost::match_results<std::string::const_iterator> what;
					if (boost::regex_search(strFunctionName, what, m_rxFunctionName))
						rStackEntry.m_strFunctionName = CA2CT(what[1].str().c_str());
					else
						rStackEntry.m_strFunctionName = CA2CT(strFunctionName.c_str());
					if (dwDisplacement64 != 0)
						rStackEntry.m_strFunctionOffset.Format(_T("%I64u"), dwDisplacement64);
					else
						rStackEntry.m_strFunctionOffset.Empty();
				}
				boost::shared_ptr<CBaseFileInfo> pFileInfo;
				boost::shared_ptr<CBaseLineInfo> pLineInfo;
				DWORD dwDisplacement32;
				if (pBaseProcessor->FindLineInfo(ptrAddress, pFileInfo, pLineInfo, dwDisplacement32))
				{
					rStackEntry.m_strSourceFile = CA2CT(pFileInfo->GetFileName().c_str());
					rStackEntry.m_strLineNumber.Format(_T("%u"), pLineInfo->GetNumber());
					if (dwDisplacement32 != 0)
						rStackEntry.m_strLineOffset.Format(_T("%I32u"), dwDisplacement32);
					else
						rStackEntry.m_strLineOffset.Empty();
				}
			}
		}
	}
}
コード例 #9
0
unsigned long FindPattern(char* module, const char* pattern, const char* mask)
{
    MODULEINFO mInfo = GetModuleInfo(module);
    DWORD base = (DWORD)mInfo.lpBaseOfDll;
    DWORD size = (DWORD)mInfo.SizeOfImage;
    DWORD patternLength = (DWORD)strlen(mask);
    for (DWORD i = 0; i < size - patternLength; i++) {
        bool found = true;
        for (DWORD j = 0; j < patternLength; j++) {
            found &= mask[j] == '?' || pattern[j] == *(char*)(base + i + j);
        }
        if (found) {
            return base + i;
        }
    }
    return NULL;
}
コード例 #10
0
ファイル: main.cpp プロジェクト: dukie/LOL-ZoomHack
int main()
{
	HWND hWindow = 0,hWindowOld = 0;
	DWORD dwWritten, dwPid;
	HANDLE hProcess;
	LPMODULEENTRY32 lpsModule;

	SetConsoleTitle("Steam");
	SetDebugPrivilege();
	while(1)
	{
		printf("Zhdem nachala igri\n");
		while( (hWindow = FindWindow(NULL, "League of Legends (TM) Client")) == 0 || hWindow == hWindowOld )
			Sleep(1000);

		hWindowOld = hWindow;
		GetWindowThreadProcessId(hWindow, &dwPid);
		hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwPid);
		if( hProcess == NULL )
		{
			printf("Couldn't get client handle!\n\n");
			continue;
		}
		printf("Nashel!\n");
		lpsModule = GetModuleInfo(dwPid);
		for( int i = 0; i < sizeof(g_sPatchList)/sizeof(OffsetInfo); ++i )
		{
			if( g_sPatchList[i].dwOffset == 0)
			{
				if( lpsModule )
					FindOffset(hProcess, lpsModule, i);
			}

			if( g_sPatchList[i].dwOffset )
			{
				WriteProcessMemory(hProcess,(void*)g_sPatchList[i].dwOffset,(void*)g_sPatchList[i].lpbyData,g_sPatchList[i].dwLen,&dwWritten);
				printf("GOTOVO! Polozhil Podorozhnik na adres: %X\n",g_sPatchList[i].dwOffset);
			}else
				printf("NOT Patched: %s\n",g_sPatchList[i].lpszName);
		}
		CloseHandle(hProcess);
		printf("\n");
	}
	
	return 0;
}
コード例 #11
0
ファイル: dllmain.c プロジェクト: MinoMino/minqlx
static void SearchFunctions(void) {
	int failed = 0;
	module_info_t module;
	strcpy(module.name, qzeroded);
	int res = GetModuleInfo(&module);
	if (res <= 0) {
		DebugError("GetModuleInfo() returned %d.\n", __FILE__, __LINE__, __func__, res);
		failed = 1;
	}

	DebugPrint("Searching for necessary functions...\n");
	Com_Printf = (Com_Printf_ptr)PatternSearchModule(&module, PTRN_COM_PRINTF, MASK_COM_PRINTF);
	if (Com_Printf == NULL) {
		DebugPrint("ERROR: Unable to find Com_Printf.\n");
		failed = 1;
	}
	else DebugPrint("Com_Printf: %p\n", Com_Printf);

	Cmd_AddCommand = (Cmd_AddCommand_ptr)PatternSearchModule(&module, PTRN_CMD_ADDCOMMAND, MASK_CMD_ADDCOMMAND);
	if (Cmd_AddCommand == NULL) {
		DebugPrint("ERROR: Unable to find Cmd_AddCommand.\n");
		failed = 1;
	}
	else DebugPrint("Cmd_AddCommand: %p\n", Cmd_AddCommand);

	Cmd_Args = (Cmd_Args_ptr)PatternSearchModule(&module, PTRN_CMD_ARGS, MASK_CMD_ARGS);
	if (Cmd_Args == NULL) {
		DebugPrint("ERROR: Unable to find Cmd_Args.\n");
		failed = 1;
	}
	else DebugPrint("Cmd_Args: %p\n", Cmd_Args);

	Cmd_Argv = (Cmd_Argv_ptr)PatternSearchModule(&module, PTRN_CMD_ARGV, MASK_CMD_ARGV);
	if (Cmd_Argv == NULL) {
		DebugPrint("ERROR: Unable to find Cmd_Argv.\n");
		failed = 1;
	}
	else DebugPrint("Cmd_Argv: %p\n", Cmd_Argv);

	Cmd_Argc = (Cmd_Argc_ptr)PatternSearchModule(&module, PTRN_CMD_ARGC, MASK_CMD_ARGC);
	if (Cmd_Argc == NULL) {
		DebugPrint("ERROR: Unable to find Cmd_Argc.\n");
		failed = 1;
	}
	else DebugPrint("Cmd_Argc: %p\n", Cmd_Argc);

	Cmd_TokenizeString = (Cmd_TokenizeString_ptr)PatternSearchModule(&module, PTRN_CMD_TOKENIZESTRING, MASK_CMD_TOKENIZESTRING);
	if (Cmd_TokenizeString == NULL) {
		DebugPrint("ERROR: Unable to find Cmd_TokenizeString.\n");
		failed = 1;
	}
	else DebugPrint("Cmd_TokenizeString: %p\n", Cmd_TokenizeString);

	Cbuf_ExecuteText = (Cbuf_ExecuteText_ptr)PatternSearchModule(&module, PTRN_CBUF_EXECUTETEXT, MASK_CBUF_EXECUTETEXT);
	if (Cbuf_ExecuteText == NULL) {
		DebugPrint("ERROR: Unable to find Cbuf_ExecuteText.\n");
		failed = 1;
	}
	else DebugPrint("Cbuf_ExecuteText: %p\n", Cbuf_ExecuteText);

	Cvar_FindVar = (Cvar_FindVar_ptr)PatternSearchModule(&module, PTRN_CVAR_FINDVAR, MASK_CVAR_FINDVAR);
	if (Cvar_FindVar == NULL) {
		DebugPrint("ERROR: Unable to find Cvar_FindVar.\n");
		failed = 1;
	}
	else DebugPrint("Cvar_FindVar: %p\n", Cvar_FindVar);

	Cvar_Get = (Cvar_Get_ptr)PatternSearchModule(&module, PTRN_CVAR_GET, MASK_CVAR_GET);
	if (Cvar_Get == NULL) {
		DebugPrint("ERROR: Unable to find Cvar_Get.\n");
		failed = 1;
	}
	else DebugPrint("Cvar_Get: %p\n", Cvar_Get);

	Cvar_GetLimit = (Cvar_GetLimit_ptr)PatternSearchModule(&module, PTRN_CVAR_GETLIMIT, MASK_CVAR_GETLIMIT);
	if (Cvar_GetLimit == NULL) {
		DebugPrint("ERROR: Unable to find Cvar_GetLimit.\n");
		failed = 1;
	}
	else DebugPrint("Cvar_GetLimit: %p\n", Cvar_GetLimit);

	Cvar_Set2 = (Cvar_Set2_ptr)PatternSearchModule(&module, PTRN_CVAR_SET2, MASK_CVAR_SET2);
	if (Cvar_Set2 == NULL) {
		DebugPrint("ERROR: Unable to find Cvar_Set2.\n");
		failed = 1;
	}
	else DebugPrint("Cvar_Set2: %p\n", Cvar_Set2);

	SV_SendServerCommand = (SV_SendServerCommand_ptr)PatternSearchModule(&module, PTRN_SV_SENDSERVERCOMMAND, MASK_SV_SENDSERVERCOMMAND);
	if (SV_SendServerCommand == NULL) {
		DebugPrint("ERROR: Unable to find SV_SendServerCommand.\n");
		failed = 1;
	}
	else DebugPrint("SV_SendServerCommand: %p\n", SV_SendServerCommand);

	SV_ExecuteClientCommand = (SV_ExecuteClientCommand_ptr)PatternSearchModule(&module, PTRN_SV_EXECUTECLIENTCOMMAND, MASK_SV_EXECUTECLIENTCOMMAND);
	if (SV_ExecuteClientCommand == NULL) {
		DebugPrint("ERROR: Unable to find SV_ExecuteClientCommand.\n");
		failed = 1;
	}
	else DebugPrint("SV_ExecuteClientCommand: %p\n", SV_ExecuteClientCommand);

	SV_Shutdown = (SV_Shutdown_ptr)PatternSearchModule(&module, PTRN_SV_SHUTDOWN, MASK_SV_SHUTDOWN);
	if (SV_Shutdown == NULL) {
		DebugPrint("ERROR: Unable to find SV_Shutdown.\n");
		failed = 1;
	}
	else DebugPrint("SV_Shutdown: %p\n", SV_Shutdown);

	SV_Map_f = (SV_Map_f_ptr)PatternSearchModule(&module, PTRN_SV_MAP_F, MASK_SV_MAP_F);
	if (SV_Map_f == NULL) {
		DebugPrint("ERROR: Unable to find SV_Map_f.\n");
		failed = 1;
	}
	else DebugPrint("SV_Map_f: %p\n", SV_Map_f);

	SV_ClientEnterWorld = (SV_ClientEnterWorld_ptr)PatternSearchModule(&module, PTRN_SV_CLIENTENTERWORLD, MASK_SV_CLIENTENTERWORLD);
	if (SV_ClientEnterWorld == NULL) {
		DebugPrint("ERROR: Unable to find SV_ClientEnterWorld.\n");
		failed = 1;
	}
	else DebugPrint("SV_ClientEnterWorld: %p\n", SV_ClientEnterWorld);

	SV_SetConfigstring = (SV_SetConfigstring_ptr)PatternSearchModule(&module, PTRN_SV_SETCONFIGSTRING, MASK_SV_SETCONFIGSTRING);
	if (SV_SetConfigstring == NULL) {
		DebugPrint("ERROR: Unable to find SV_SetConfigstring.\n");
		failed = 1;
	}
	else DebugPrint("SV_SetConfigstring: %p\n", SV_SetConfigstring);

	SV_GetConfigstring = (SV_GetConfigstring_ptr)PatternSearchModule(&module, PTRN_SV_GETCONFIGSTRING, MASK_SV_GETCONFIGSTRING);
	if (SV_GetConfigstring == NULL) {
		DebugPrint("ERROR: Unable to find SV_GetConfigstring.\n");
		failed = 1;
	}
	else DebugPrint("SV_GetConfigstring: %p\n", SV_GetConfigstring);

	SV_DropClient = (SV_DropClient_ptr)PatternSearchModule(&module, PTRN_SV_DROPCLIENT, MASK_SV_DROPCLIENT);
	if (SV_DropClient == NULL) {
		DebugPrint("ERROR: Unable to find SV_DropClient.\n");
		failed = 1;
	}
	else DebugPrint("SV_DropClient: %p\n", SV_DropClient);

	Sys_SetModuleOffset = (Sys_SetModuleOffset_ptr)PatternSearchModule(&module, PTRN_SYS_SETMODULEOFFSET, MASK_SYS_SETMODULEOFFSET);
	if (Sys_SetModuleOffset == NULL) {
		DebugPrint("ERROR: Unable to find Sys_SetModuleOffset.\n");
		failed = 1;
	}
	else DebugPrint("Sys_SetModuleOffset: %p\n", Sys_SetModuleOffset);

	SV_SpawnServer = (SV_SpawnServer_ptr)PatternSearchModule(&module, PTRN_SV_SPAWNSERVER, MASK_SV_SPAWNSERVER);
	if (SV_SpawnServer == NULL) {
		DebugPrint("ERROR: Unable to find SV_SpawnServer.\n");
		failed = 1;
	}
	else DebugPrint("SV_SpawnServer: %p\n", SV_SpawnServer);

	Cmd_ExecuteString = (Cmd_ExecuteString_ptr)PatternSearchModule(&module, PTRN_CMD_EXECUTESTRING, MASK_CMD_EXECUTESTRING);
	if (Cmd_ExecuteString == NULL) {
		DebugPrint("ERROR: Unable to find Cmd_ExecuteString.\n");
		failed = 1;
	}
	else DebugPrint("Cmd_ExecuteString: %p\n", Cmd_ExecuteString);

	// Cmd_Argc is really small, making it hard to search for, so we use a reference to it instead.
	Cmd_Argc = (Cmd_Argc_ptr)(*(int32_t*)OFFSET_RELP_CMD_ARGC + OFFSET_RELP_CMD_ARGC + 4);

	if (failed) {
		DebugPrint("Exiting.\n");
		exit(1);
	}
}
コード例 #12
0
bool RTConnectionManager::AddModuleInfo(RTConnectionManager::ModuleInfo* pmi, const std::string& sid)
{
    GetModuleInfo()->insert(make_pair(sid, pmi));
    return true;
}