void VlcMediaListPlayerPrivate::detach_events() { #define DETACH(event_type) libvlc_event_detach(p_eventmanager, event_type, &VlcMediaListPlayerPrivate::event_cb, this) DETACH(libvlc_MediaListPlayerPlayed); DETACH(libvlc_MediaListPlayerNextItemSet); DETACH(libvlc_MediaListPlayerStopped); #undef DETACH }
// DllMain function attaches and detaches the TimedSleep detour to the // Sleep target function. The Sleep target function is referred to // through the TrueSleep target pointer. // BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved) { if (DetourIsHelperProcess()) { return TRUE; } /* hFile = CreateFile(logFile, // name of the write GENERIC_WRITE, // open for writing FILE_SHARE_WRITE, // share for writing NULL, // default security OPEN_ALWAYS, // open file only FILE_ATTRIBUTE_NORMAL, // normal file NULL); // no attr. template //_tprintf(TEXT("Start of log file @ %s.\n"), logFile); */ if (dwReason == DLL_PROCESS_ATTACH) { DetourRestoreAfterWith(); DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); DetourAttach(&(PVOID&)TrueSleep, TimedSleep); ATTACH(GetProcAddress); ATTACH(LoadLibraryA); ATTACH(LoadLibraryExA); ATTACH(LoadLibraryExW); ATTACH(LoadLibraryW); ATTACH(VirtualAlloc); ATTACH(VirtualAllocEx); ATTACH(VirtualProtect); ATTACH(VirtualProtectEx); DetourTransactionCommit(); } else if (dwReason == DLL_PROCESS_DETACH) { DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); DetourDetach(&(PVOID&)TrueSleep, TimedSleep); DETACH(GetProcAddress); DETACH(LoadLibraryA); DETACH(LoadLibraryExA); DETACH(LoadLibraryExW); DETACH(LoadLibraryW); DETACH(VirtualAlloc); DETACH(VirtualAllocEx); DETACH(VirtualProtect); DETACH(VirtualProtectEx); DetourTransactionCommit(); //CloseHandle(hFile); } return TRUE; }
void avr_cycle_timer_cancel( avr_t * avr, avr_cycle_timer_t timer, void * param) { avr_cycle_timer_pool_t * pool = &avr->cycle_timers; // find its place in the list avr_cycle_timer_slot_p t = pool->timer, last = NULL; while (t) { if (t->timer == timer && t->param == param) { DETACH(pool->timer, last, t); QUEUE(pool->timer_free, t); break; } last = t; t = t->next; } avr_cycle_timer_reset_sleep_run_cycles_limited(avr); }
LONG DetachDetours(VOID) { DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); DETACH(BuildCommDCBA); DETACH(BuildCommDCBAndTimeoutsA); DETACH(BuildCommDCBAndTimeoutsW); DETACH(BuildCommDCBW); DETACH(ClearCommBreak); DETACH(ClearCommError); DETACH(CloseHandle); DETACH(CreateFileA); DETACH(CreateFileW); DETACH(EscapeCommFunction); DETACH(GetCommConfig); DETACH(GetCommMask); DETACH(GetCommModemStatus); DETACH(GetCommProperties); DETACH(GetCommState); DETACH(GetCommTimeouts); DETACH(GetCurrentThreadId); DETACH(GetModuleFileNameW); DETACH(GetOverlappedResult); DETACH(PurgeComm); DETACH(ReadFile); DETACH(SetCommBreak); DETACH(SetCommConfig); DETACH(SetCommMask); DETACH(SetCommState); DETACH(SetCommTimeouts); DETACH(SetupComm); DETACH(TransmitCommChar); DETACH(WaitCommEvent); DETACH(WriteFile); return DetourTransactionCommit(); }