VOID NTAPI LoadCallback( __in_opt PVOID Parameter, __in_opt PVOID Context ) { PPH_STRING sbieDllPath; HMODULE module; HANDLE timerQueueHandle; HANDLE timerHandle; BoxedProcessesHashtable = PhCreateHashtable( sizeof(BOXED_PROCESS), BoxedProcessesCompareFunction, BoxedProcessesHashFunction, 32 ); sbieDllPath = PhGetStringSetting(L"ProcessHacker.SbieSupport.SbieDllPath"); module = LoadLibrary(sbieDllPath->Buffer); PhDereferenceObject(sbieDllPath); SbieApi_QueryBoxPath = (PVOID)GetProcAddress(module, SbieApi_QueryBoxPath_Name); SbieApi_EnumBoxes = (PVOID)GetProcAddress(module, SbieApi_EnumBoxes_Name); SbieApi_EnumProcessEx = (PVOID)GetProcAddress(module, SbieApi_EnumProcessEx_Name); SbieDll_KillAll = (PVOID)GetProcAddress(module, SbieDll_KillAll_Name); if (NT_SUCCESS(RtlCreateTimerQueue(&timerQueueHandle))) { RtlCreateTimer(timerQueueHandle, &timerHandle, RefreshSandboxieInfo, NULL, 0, 4000, 0); } }
VOID NTAPI LoadCallback( _In_opt_ PVOID Parameter, _In_opt_ PVOID Context ) { PPH_STRING sbieDllPath; HMODULE module; HANDLE timerQueueHandle; HANDLE timerHandle; BoxedProcessesHashtable = PhCreateHashtable( sizeof(BOXED_PROCESS), BoxedProcessesEqualFunction, BoxedProcessesHashFunction, 32 ); sbieDllPath = PhaGetStringSetting(SETTING_NAME_SBIE_DLL_PATH); module = LoadLibrary(sbieDllPath->Buffer); SbieApi_QueryBoxPath = PhGetProcedureAddress(module, SbieApi_QueryBoxPath_Name, 0); SbieApi_EnumBoxes = PhGetProcedureAddress(module, SbieApi_EnumBoxes_Name, 0); SbieApi_EnumProcessEx = PhGetProcedureAddress(module, SbieApi_EnumProcessEx_Name, 0); SbieDll_KillAll = PhGetProcedureAddress(module, SbieDll_KillAll_Name, 0); if (NT_SUCCESS(RtlCreateTimerQueue(&timerQueueHandle))) { RtlCreateTimer(timerQueueHandle, &timerHandle, RefreshSandboxieInfo, NULL, 0, 4000, 0); } }
/* * @implemented */ BOOL WINAPI CreateTimerQueueTimer(OUT PHANDLE phNewTimer, IN HANDLE TimerQueue, IN WAITORTIMERCALLBACK Callback, IN PVOID Parameter, IN DWORD DueTime, IN DWORD Period, IN ULONG Flags) { NTSTATUS Status; /* Parameter is not optional -- clear it now */ *phNewTimer = NULL; /* Check if no queue was given */ if (!TimerQueue) { /* Create the queue if it didn't already exist */ if (!(BasepDefaultTimerQueue) && !(BasepCreateDefaultTimerQueue())) { return FALSE; } /* Use the default queue */ TimerQueue = BasepDefaultTimerQueue; } /* Create the timer. Note that no parameter checking is done here */ Status = RtlCreateTimer(TimerQueue, phNewTimer, Callback, Parameter, DueTime, Period, Flags); if (!NT_SUCCESS(Status)) { BaseSetLastNTError(Status); return FALSE; } return TRUE; }
/* * @implemented */ HANDLE WINAPI SetTimerQueueTimer(IN HANDLE TimerQueue, IN WAITORTIMERCALLBACK Callback, IN PVOID Parameter, IN DWORD DueTime, IN DWORD Period, IN BOOL PreferIo) { HANDLE Timer; NTSTATUS Status; /* Check if no queue was given */ if (!TimerQueue) { /* Create the queue if it didn't already exist */ if (!(BasepDefaultTimerQueue) && !(BasepCreateDefaultTimerQueue())) { return FALSE; } /* Use the default queue */ TimerQueue = BasepDefaultTimerQueue; } /* Create the timer */ Status = RtlCreateTimer(TimerQueue, &Timer, Callback, Parameter, DueTime, Period, PreferIo ? WT_EXECUTEINIOTHREAD : WT_EXECUTEDEFAULT); if (!NT_SUCCESS(Status)) { BaseSetLastNTError(Status); return NULL; } return Timer; }