void ShutdownMQ2Pulse() { EnterCriticalSection(&gPulseCS); RemoveDetour((DWORD)ProcessGameEvents); RemoveDetour(CEverQuest__EnterZone); RemoveDetour(CEverQuest__SetGameState); LeaveCriticalSection(&gPulseCS); DeleteCriticalSection(&gPulseCS); }
VOID Draw_Detour(VOID) { CLabel* pThisLabel = (CLabel*)this; CHAR Buffer[MAX_STRING] = {0}; BOOL Found=FALSE; DWORD index; if (gAnonymize) { if (!bTrimnames) { EzDetourwName(CEverQuest__trimName, &CLabelHook::CEverQuest__trimName_Detour, &CLabelHook::CEverQuest__trimName_Trampoline,"CEverQuest__trimName"); EzDetourwName(__GetGaugeValueFromEQ, GetGaugeValueFromEQ_Detour, GetGaugeValueFromEQ_Trampoline,"__GetGaugeValueFromEQ"); EzDetourwName(__GetLabelFromEQ, GetLabelFromEQ_Detour, GetLabelFromEQ_Trampoline,"__GetLabelFromEQ"); bTrimnames = 1; } if (pThisLabel && pThisLabel->WindowText) { GetCXStr(pThisLabel->WindowText, Buffer); Anonymize(Buffer); } } else { if (bTrimnames) { bTrimnames = 0; RemoveDetour(CEverQuest__trimName); RemoveDetour(__GetGaugeValueFromEQ); RemoveDetour(__GetLabelFromEQ); } } Draw_Trampoline(); if ((DWORD)pThisLabel->EQType==9999) { if (!pThisLabel->XMLToolTip) { strcpy_s(Buffer,"BadCustom"); Found=TRUE; } else { //strcpy_s(Buffer,&pThisLabel->XMLToolTip->Text[0]); STMLToPlainText(&pThisLabel->XMLToolTip->Text[0],Buffer); ParseMacroParameter(((PCHARINFO)pCharData)->pSpawn,Buffer); if (!strcmp(Buffer,"NULL")) Buffer[0]=0; Found=TRUE; } } else if (pThisLabel->EQType==1000) { for (index=0;Id_PMP[index].ID>0 && !Found;index++) { if (Id_PMP[index].ID==(DWORD)pThisLabel->EQType) { strcpy_s(Buffer,Id_PMP[index].PMP); ParseMacroParameter(((PCHARINFO)pCharData)->pSpawn,Buffer); if (!strcmp(Buffer,"NULL")) Buffer[0]=0; Found=TRUE; } } } if (Found) SetCXStr(&(pThisLabel->WindowText),Buffer); }
// shutdown sequence void ISXEQMap::Shutdown() { Update = false; RemoveDetour(CMapViewWnd__CMapViewWnd); MapClear(); CMyMapViewWnd::RestoreVFTable(); RemoveMQ2Benchmark(bmMapRefresh); pISInterface->RemoveCommand("MapHide"); pISInterface->RemoveCommand("MapShow"); pISInterface->RemoveCommand("MapFilter"); pISInterface->RemoveCommand("Highlight"); pISInterface->RemoveCommand("MapNames"); pISInterface->RemoveCommand("MapClick"); pISInterface->UnloadSettings("ISXEQMap.xml"); DisconnectServices(); UnRegisterServices(); UnRegisterTopLevelObjects(); UnRegisterDataTypes(); UnRegisterAliases(); UnRegisterCommands(); }
// Called once, when the plugin is to shutdown PLUGIN_API VOID ShutdownPlugin(VOID) { DebugSpewAlways("Shutting down MQ2Labels"); // Remove commands, macro parameters, hooks, etc. if (bTrimnames) { bTrimnames = 0; RemoveDetour(CEverQuest__trimName); RemoveDetour(__GetGaugeValueFromEQ); RemoveDetour(__GetLabelFromEQ); } RemoveDetour(CSidlManager__CreateLabel); RemoveDetour(CLabel__Draw); //RemoveDetour(CGaugeWnd__Draw); //RemoveDetour(__GetGaugeValueFromEQ); }
VOID ShutdownParser() { DebugSpewNoFile("ShutdownParser()"); RemoveDetour(EQPlayer__SetNameSpriteState); // put here so it doesnt crash :) ShutdownMQ2Data(); ShutdownMQ2DataTypes(); }
void MQ2MouseHooks(BOOL bFlag) { if(bFlag) { EzDetour(CDisplay__GetClickedActor,&FakeCDisplay::GetClickedActor_Detour,&FakeCDisplay::GetClickedActor_Tramp); } else { RemoveDetour(CDisplay__GetClickedActor); } }
PLUGIN_API VOID ShutdownPlugin(VOID) { DebugSpewAlways("Shutting down MQ2EQBugFix"); RemoveDetour(CDisplay__is3dON); if (switchbug) { //RemoveDetour(switchbug); } if (__UpdateDisplay) { //RemoveDetour(__UpdateDisplay); } if (__Reset) { RemoveDetour(__Reset); } #ifdef EQMULETESTINGSTUFF //RemoveDetour(startworlddisplayexceptionhandler); #endif }
bool SharkMemory::RemoveAllDetours() { bool bSuccess = true; auto mHooks = m_hooks; for (auto& hook: mHooks) { void *trampolineDelegate = hook.second.trampoline; bSuccess &= RemoveDetour(&trampolineDelegate); } return bSuccess; }
// shutdown sequence void ISXEQItemDisplay::Shutdown() { RemoveDetour(CItemDisplayWnd__SetSpell); RemoveDetour(CItemDisplayWnd__UpdateStrings); //RemoveDetour(CXWnd__DrawTooltipAtPoint); //RemoveDetour(CInvSlotWnd__DrawTooltip); // save settings, if you changed them and want to save them now. You should normally save // changes immediately. //pISInterface->SaveSettings(XMLFileName); pISInterface->UnloadSettings(XMLFileName); DisconnectServices(); UnRegisterServices(); UnRegisterTopLevelObjects(); UnRegisterDataTypes(); UnRegisterAliases(); UnRegisterCommands(); }
// shutdown sequence void ISXEQLabels::Shutdown() { RemoveDetour(CLabel__Draw); RemoveDetour(CSidlManager__CreateLabel); //RemoveDetour(CGaugeWnd__Draw); //RemoveDetour(__GetGaugeValueFromEQ); // save settings, if you changed them and want to save them now. You should normally save // changes immediately. //pISInterface->SaveSettings(XMLFileName); pISInterface->UnloadSettings(XMLFileName); DisconnectServices(); UnRegisterServices(); UnRegisterTopLevelObjects(); UnRegisterDataTypes(); UnRegisterAliases(); UnRegisterCommands(); }
// Called once, when the plugin is to shutdown PLUGIN_API VOID ShutdownPlugin(VOID) { if (bzsrchhandle) { ReleaseMutex(bzsrchhandle); CloseHandle(bzsrchhandle); bzsrchhandle = 0; } DebugSpewAlways("Shutting down MQ2Bzsrch"); // Remove commands, macro parameters, hooks, etc. RemoveDetour(CBazaarSearchWnd__HandleBazaarMsg); RemoveMQ2Data("Bazaar"); //RemoveCommand("/pricecheck"); RemoveCommand("/mq2bzsrch"); RemoveCommand("/breset"); RemoveCommand("/bzsrch"); delete pBazaarType; delete pBazaarItemType; }
void ShutdownMQ2Commands() { EnterCriticalSection(&gCommandCS); lockit lk(ghLockDelayCommand,"ShutdownMQ2Commands"); RemoveDetour(CEverQuest__InterpretCmd); while(pCommands) { PMQCOMMAND pNext=pCommands->pNext; delete pCommands; pCommands=pNext; } while(gDelayedCommands) { PCHATBUF pNext=gDelayedCommands->pNext; //LocalFree(gDelayedCommands); delete gDelayedCommands; gDelayedCommands=pNext; } while(pTimedCommands) { PTIMEDCOMMAND pNext=pTimedCommands->pNext; delete pTimedCommands; pTimedCommands=pNext; } mAliases.clear(); while(pSubs) { PSUB pNext=pSubs->pNext; delete pSubs; pSubs=pNext; } LeaveCriticalSection(&gCommandCS); DeleteCriticalSection(&gCommandCS); if (ghCCommandLock) { ReleaseMutex(ghCCommandLock); CloseHandle(ghCCommandLock); ghCCommandLock = 0; } }
void ShutdownMQ2Commands() { EnterCriticalSection(&gCommandCS); RemoveDetour(CEverQuest__InterpretCmd); while(pCommands) { PMQCOMMAND pNext=pCommands->pNext; delete pCommands; pCommands=pNext; } while(gDelayedCommands) { PCHATBUF pNext=gDelayedCommands->pNext; free(gDelayedCommands); gDelayedCommands=pNext; } while(pTimedCommands) { PTIMEDCOMMAND pNext=pTimedCommands->pNext; delete pTimedCommands; pTimedCommands=pNext; } while(pAliases) { PALIAS pNext=pAliases->pNext; delete pAliases; pAliases=pNext; } while(pSubs) { PSUB pNext=pSubs->pNext; delete pSubs; pSubs=pNext; } LeaveCriticalSection(&gCommandCS); DeleteCriticalSection(&gCommandCS); }
VOID Draw_Detour(VOID) { CLabel* pThisLabel = (CLabel*)this; CHAR Buffer[MAX_STRING] = {0}; BOOL Found=FALSE; DWORD index; if (gAnonymize) { if (!bTrimnames) { #if !defined(ROF2EMU) && !defined(UFEMU) EzDetourwName(CAdvancedLootWnd__UpdateMasterLooter, &CLabelHook::CAdvancedLootWnd__UpdateMasterLooter_Detour, &CLabelHook::CAdvancedLootWnd__UpdateMasterLooter_Trampoline,"CAdvancedLootWnd__UpdateMasterLooter"); EzDetourwName(CComboWnd__GetChoiceText, &CLabelHook::CComboWnd__GetChoiceText_Detour, &CLabelHook::CComboWnd__GetChoiceText_Trampoline,"CComboWnd__GetChoiceText"); EzDetourwName(CComboWnd__InsertChoiceAtIndex, &CLabelHook::CComboWnd__InsertChoiceAtIndex_Detour, &CLabelHook::CComboWnd__InsertChoiceAtIndex_Trampoline,"CComboWnd__InsertChoiceAtIndex"); EzDetourwName(CAdvancedLootWnd__AddPlayerToList, &CLabelHook::CAdvancedLootWnd__AddPlayerToList_Detour, &CLabelHook::CAdvancedLootWnd__AddPlayerToList_Trampoline,"CAdvancedLootWnd__AddPlayerToList"); if (pAdvancedLootWnd && GetGameState() == GAMESTATE_INGAME) { CleanupLootCombo(true); } #endif EzDetourwName(CListWnd__AddString, &CLabelHook::CListWnd__AddString_Detour, &CLabelHook::CListWnd__AddString_Trampoline,"CListWnd__AddString"); EzDetourwName(CEverQuest__trimName, &CLabelHook::CEverQuest__trimName_Detour, &CLabelHook::CEverQuest__trimName_Trampoline,"CEverQuest__trimName"); EzDetourwName(__GetGaugeValueFromEQ, GetGaugeValueFromEQ_Detour, GetGaugeValueFromEQ_Trampoline,"__GetGaugeValueFromEQ"); EzDetourwName(__GetLabelFromEQ, GetLabelFromEQ_Detour, GetLabelFromEQ_Trampoline,"__GetLabelFromEQ"); bTrimnames = 1; } if (pThisLabel && pThisLabel->CGetWindowText()) { GetCXStr(pThisLabel->CGetWindowText(), Buffer); Anonymize(Buffer,MAX_STRING); } } else { if (bTrimnames) { bTrimnames = 0; #if !defined(ROF2EMU) && !defined(UFEMU) RemoveDetour(CComboWnd__GetChoiceText); RemoveDetour(CComboWnd__InsertChoiceAtIndex); RemoveDetour(CAdvancedLootWnd__AddPlayerToList); #endif RemoveDetour(CListWnd__AddString); RemoveDetour(CEverQuest__trimName); RemoveDetour(__GetGaugeValueFromEQ); RemoveDetour(__GetLabelFromEQ); #if !defined(ROF2EMU) && !defined(UFEMU) CleanupLootCombo(false); RemoveDetour(CAdvancedLootWnd__UpdateMasterLooter); #endif } } Draw_Trampoline(); if ((DWORD)pThisLabel->EQType==9999) { if (!pThisLabel->GetXMLToolTip()) { strcpy_s(Buffer,"BadCustom"); Found=TRUE; } else { //strcpy_s(Buffer,&pThisLabel->XMLToolTip->Text[0]); STMLToPlainText(&pThisLabel->GetXMLToolTip()->Text[0],Buffer); ParseMacroParameter(((PCHARINFO)pCharData)->pSpawn,Buffer); if (!strcmp(Buffer,"NULL")) Buffer[0]=0; Found=TRUE; } } else if (pThisLabel->EQType==1000) { for (index=0;Id_PMP[index].ID>0 && !Found;index++) { if (Id_PMP[index].ID==(DWORD)pThisLabel->EQType) { strcpy_s(Buffer,Id_PMP[index].PMP); ParseMacroParameter(((PCHARINFO)pCharData)->pSpawn,Buffer); if (!strcmp(Buffer,"NULL")) Buffer[0]=0; Found=TRUE; } } } if (Found) { pThisLabel->CSetWindowText(Buffer); //SetCXStr(&(pThisLabel->WindowText), Buffer); } }
VOID HookInlineChecks(BOOL Patch) { int i; DWORD oldperm, tmp, NewData; int cmps[] = { __AC1 + 6 }; int cmps2[] = { __AC2, __AC3, __AC4, __AC5, __AC6, __AC7 }; int len2[] = { 6, 6, 6, 6, 6, 6 }; char NewData2[20]; static char OldData2[sizeof(cmps2)/sizeof(cmps2[0])][20]; if (Patch) { NewData = 0x7fffffff; for (i=0;i<sizeof(cmps)/sizeof(cmps[0]);i++) { #ifdef ISXEQ EzModify(cmps[i],&NewData,4); #else AddDetour(cmps[i], NULL, NULL, 4); VirtualProtectEx(GetCurrentProcess(), (LPVOID)cmps[i], 4, PAGE_EXECUTE_READWRITE, &oldperm); WriteProcessMemory(GetCurrentProcess(), (LPVOID)cmps[i], (LPVOID)&NewData, 4, NULL); VirtualProtectEx(GetCurrentProcess(), (LPVOID)cmps[i], 4, oldperm, &tmp); #endif } memset(NewData2, 0x90, 20); for (i=0;i<sizeof(cmps2)/sizeof(cmps2[0]);i++) { #ifdef ISXEQ EzModify(cmps2[i],NewData2,len2[i]); #else AddDetour(cmps2[i], NULL, NULL, len2[i]); VirtualProtectEx(GetCurrentProcess(), (LPVOID)cmps2[i], len2[i], PAGE_EXECUTE_READWRITE, &oldperm); memcpy((void *)OldData2[i], (void *)cmps2[i], len2[i]); WriteProcessMemory(GetCurrentProcess(), (LPVOID)cmps2[i], (LPVOID)NewData2, len2[i], NULL); VirtualProtectEx(GetCurrentProcess(), (LPVOID)cmps2[i], len2[i], oldperm, &tmp); #endif } } else { NewData = __AC1_Data; for (i=0;i<sizeof(cmps)/sizeof(cmps[0]);i++) { #ifdef ISXEQ EzUnModify(cmps[i]); #else VirtualProtectEx(GetCurrentProcess(), (LPVOID)cmps[i], 4, PAGE_EXECUTE_READWRITE, &oldperm); WriteProcessMemory(GetCurrentProcess(), (LPVOID)cmps[i], (LPVOID)&NewData, 4, NULL); VirtualProtectEx(GetCurrentProcess(), (LPVOID)cmps[i], 4, oldperm, &tmp); RemoveDetour(cmps[i]); #endif } for (i=0;i<sizeof(cmps2)/sizeof(cmps2[0]);i++) { #ifdef ISXEQ EzUnModify(cmps2[i]); #else VirtualProtectEx(GetCurrentProcess(), (LPVOID)cmps2[i], len2[i], PAGE_EXECUTE_READWRITE, &oldperm); WriteProcessMemory(GetCurrentProcess(), (LPVOID)cmps2[i], (LPVOID)OldData2[i], len2[i], NULL); VirtualProtectEx(GetCurrentProcess(), (LPVOID)cmps2[i], len2[i], oldperm, &tmp); RemoveDetour(cmps2[i]); #endif } } }
void ShutdownMQ2Pulse() { RemoveDetour((DWORD)ProcessGameEvents); RemoveDetour(CEverQuest__EnterZone); RemoveDetour(CEverQuest__SetGameState); }