static int telos_alloc_bufs(struct telos_ap *telos, int mtu) { int err = -1; unsigned long len; char * rbuff = NULL; char * xbuff = NULL; /* * Allocate the TELOS_AP frame buffers: * * rbuff Receive buffer. * xbuff Transmit buffer. * cbuff Temporary compression buffer. */ len = mtu * 2; /* * allow for arrival of larger UDP packets, even if we say not to * also fixes a bug in which SunOS sends 512-byte packets even with * an MSS of 128 */ if (len < 576 * 2) len = 576 * 2; rbuff = (char *) malloc(len + 4); if (rbuff == NULL) goto err_exit; xbuff = (char *) malloc(len + 4); if (xbuff == NULL) goto err_exit; /* spin_lock_bh(&telos->lock); if (telos->tty == NULL) { spin_unlock_bh(&telos->lock); err = -ENODEV; goto err_exit; } */ telos->mtu = mtu; telos->buffsize = len; telos->rcount = 0; telos->xleft = 0; rbuff = (char*) InterlockedExchangePointer(&telos->rbuff, rbuff); xbuff = (char*) InterlockedExchangePointer(&telos->xbuff, xbuff); // spin_unlock_bh(&telos->lock); err = 0; /* Cleanup */ err_exit: if (xbuff) free(xbuff); if (rbuff) free(rbuff); return err; }
/*************************************************************************** * MCIQTZ_notifyThread [internal] */ static DWORD CALLBACK MCIQTZ_notifyThread(LPVOID parm) { WINE_MCIQTZ* wma = (WINE_MCIQTZ *)parm; HRESULT hr; HANDLE handle[2]; DWORD n = 0, ret = 0; handle[n++] = wma->stop_event; IMediaEvent_GetEventHandle(wma->mevent, (OAEVENT *)&handle[n++]); for (;;) { DWORD r; HANDLE old; r = WaitForMultipleObjects(n, handle, FALSE, INFINITE); if (r == WAIT_OBJECT_0) { TRACE("got stop event\n"); old = InterlockedExchangePointer(&wma->callback, NULL); if (old) mciDriverNotify(old, wma->notify_devid, MCI_NOTIFY_ABORTED); break; } else if (r == WAIT_OBJECT_0+1) { LONG event_code; LONG_PTR p1, p2; do { hr = IMediaEvent_GetEvent(wma->mevent, &event_code, &p1, &p2, 0); if (SUCCEEDED(hr)) { TRACE("got event_code = 0x%02x\n", event_code); IMediaEvent_FreeEventParams(wma->mevent, event_code, p1, p2); } } while (hr == S_OK && event_code != EC_COMPLETE); if (hr == S_OK && event_code == EC_COMPLETE) { old = InterlockedExchangePointer(&wma->callback, NULL); if (old) mciDriverNotify(old, wma->notify_devid, MCI_NOTIFY_SUCCESSFUL); break; } } else { TRACE("Unknown error (%d)\n", (int)r); break; } } hr = IMediaControl_Stop(wma->pmctrl); if (FAILED(hr)) { TRACE("Cannot stop filtergraph (hr = %x)\n", hr); ret = MCIERR_INTERNAL; } return ret; }
BOOL CKTrojanUIHandler::InitKTrojan(BOOL bPreLoad /* = FALSE */) { BOOL retval = FALSE; CreateKTrojanObject_t CreateKTrojanObject = NULL; TCHAR szKTrojanPath[MAX_PATH] = { 0 }; HRESULT hr; HMODULE hKTrojan = NULL; IKTrojan* piKTrojan = NULL; HWND hWnd = NULL; if (!m_hKTrajon) { ::GetModuleFileName(NULL, szKTrojanPath, MAX_PATH); PathRemoveFileSpec(szKTrojanPath); PathAppend(szKTrojanPath, _T("kscan.dll")); hKTrojan = LoadLibrary(szKTrojanPath); if (!hKTrojan) goto clean0; InterlockedExchangePointer((void**)&m_hKTrajon, hKTrojan); } if (!m_piKTrajon) { CreateKTrojanObject = (CreateKTrojanObject_t)GetProcAddress(m_hKTrajon, "CreateKTrojanObject"); if (!CreateKTrojanObject) goto clean0; hr = CreateKTrojanObject(__uuidof(IKTrojan), (void**)&piKTrojan); if (FAILED(hr)) goto clean0; InterlockedExchangePointer((void**)&m_piKTrajon, piKTrojan); } if (!m_wndKTrojan.m_hWnd) { hWnd = m_piKTrajon->CreateKTrojan(m_dlg->GetViewHWND()); InterlockedExchangePointer((void**)&m_wndKTrojan.m_hWnd, hWnd); m_piKTrajon->SetNotify(m_dlg); m_piKTrajon->Init(); } retval = TRUE; clean0: if (!retval) { UnInitKTrojan(); } return retval; }
/* Free a TELOS_AP channel buffers. */ static void telos_free_bufs(struct telos_ap *telos) { void * tmp; // printk(KERN_WARNING "%s: %p\n", __FUNCTION__, telos); /* Free all TELOS_AP frame buffers. */ if ((tmp = InterlockedExchangePointer(&telos->rbuff, NULL)) != NULL) free(tmp); if ((tmp = InterlockedExchangePointer(&telos->xbuff, NULL)) != NULL) free(tmp); }
//並列処理制御用のイベントをすべて解放する //映像・音声どちらかのAviutlからのデータ取得が必要なくなった時点で呼ぶ //呼び出しは映像・音声スレッドどちらでもよい //この関数が呼ばれたあとは、映像・音声どちらも自由に動くようにする void release_audio_parallel_events(PRM_ENC *pe) { if (pe->aud_parallel.he_aud_start) { //この関数が同時に呼ばれた場合のことを考え、InterlockedExchangePointerを使用してHANDLEを処理する HANDLE he_aud_start_copy = InterlockedExchangePointer(&(pe->aud_parallel.he_aud_start), NULL); SetEvent(he_aud_start_copy); //もし止まっていたら動かしてやる CloseHandle(he_aud_start_copy); } if (pe->aud_parallel.he_vid_start) { //この関数が同時に呼ばれた場合のことを考え、InterlockedExchangePointerを使用してHANDLEを処理する HANDLE he_vid_start_copy = InterlockedExchangePointer(&(pe->aud_parallel.he_vid_start), NULL); SetEvent(he_vid_start_copy); //もし止まっていたら動かしてやる CloseHandle(he_vid_start_copy); } }
// If the cache is not being used reset it void Cache::ResetCache(IScriptEnvironment* env) { InterlockedIncrement(&g_Cache_stats.resets); minframe = vi.num_frames; maxframe = -1; CachedVideoFrame *i, *j; _RPT3(0, "Cache:%x: Cache Reset, cache_limit %d, cache_init %d\n", this, cache_limit, cache_init<<CACHE_SCALE_SHIFT); int count=0; for (i = video_frames.next; i != &video_frames; i = i->next) { if (++count >= cache_init) goto purge_old_frame; const int ifn = i->frame_number; if (ifn < minframe) minframe = ifn; if (ifn > maxframe) maxframe = ifn; } return; purge_old_frame: // Truncate the tail of the chain video_frames.prev = i; j = (CachedVideoFrame*)InterlockedExchangePointer(&i->next, &video_frames); // Delete the excess CachedVideoFrames while (j != &video_frames) { i = j->next; ReturnVideoFrameBuffer(j, env); // Return old vfb to vfb pool for early reuse delete j; j = i; } cache_limit = cache_init << CACHE_SCALE_SHIFT; }
/*********************************************************************** * ToolHelpHook (KERNEL.341) * see "Undocumented Windows" */ FARPROC16 WINAPI ToolHelpHook16(FARPROC16 func) { static FARPROC16 hook; FIXME("(%p), stub.\n", func); return InterlockedExchangePointer( (void **)&hook, func ); }
void COptex::SetSpinCount(DWORD dwSpinCount) { // No spinning on single CPU machines if (!sm_fUniprocessorHost) InterlockedExchangePointer((PVOID*) &m_psi->m_dwSpinCount, (PVOID) (DWORD_PTR) dwSpinCount); }
static void native_thread_destroy(rb_thread_t *th) { HANDLE intr = InterlockedExchangePointer(&th->native_thread_data.interrupt_event, 0); thread_debug("close handle - intr: %p, thid: %p\n", intr, th->thread_id); w32_close_handle(intr); }
void mono_thread_info_uninstall_interrupt (gboolean *interrupted) { MonoThreadInfo *info; MonoThreadInfoInterruptToken *previous_token; g_assert (interrupted); *interrupted = FALSE; info = mono_thread_info_current (); g_assert (info); previous_token = (MonoThreadInfoInterruptToken *)InterlockedExchangePointer ((gpointer*) &info->interrupt_token, NULL); /* only the installer can uninstall the token */ g_assert (previous_token); if (previous_token == INTERRUPT_STATE) { /* if it is interrupted, then it is going to be freed in finish interrupt */ *interrupted = TRUE; } else { g_free (previous_token); } THREADS_INTERRUPT_DEBUG ("interrupt uninstall tid %p previous_token %p interrupted %s\n", mono_thread_info_get_tid (info), previous_token, *interrupted ? "TRUE" : "FALSE"); }
/************************************************************************** * MCICDA_mciNotify [internal] * * Notifications in MCI work like a 1-element queue. * Each new notification request supersedes the previous one. */ static void MCICDA_Notify(DWORD_PTR hWndCallBack, WINE_MCICDAUDIO* wmcda, UINT wStatus) { MCIDEVICEID wDevID = wmcda->wNotifyDeviceID; HANDLE old = InterlockedExchangePointer(&wmcda->hCallback, NULL); if (old) mciDriverNotify(old, wDevID, MCI_NOTIFY_SUPERSEDED); mciDriverNotify(HWND_32(LOWORD(hWndCallBack)), wDevID, wStatus); }
/************************************************************************** * MCICDA_Stop [internal] */ static DWORD MCICDA_Stop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms) { WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID); HANDLE oldcb; DWORD br; TRACE("(%04X, %08X, %p);\n", wDevID, dwFlags, lpParms); if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID; oldcb = InterlockedExchangePointer(&wmcda->hCallback, NULL); if (oldcb) mciDriverNotify(oldcb, wmcda->wNotifyDeviceID, MCI_NOTIFY_ABORTED); if (wmcda->hThread != 0) { SetEvent(wmcda->stopEvent); WaitForSingleObject(wmcda->hThread, INFINITE); CloseHandle(wmcda->hThread); wmcda->hThread = 0; CloseHandle(wmcda->stopEvent); wmcda->stopEvent = 0; IDirectSoundBuffer_Release(wmcda->dsBuf); wmcda->dsBuf = NULL; IDirectSound_Release(wmcda->dsObj); wmcda->dsObj = NULL; } else if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_STOP_AUDIO, NULL, 0, NULL, 0, &br, NULL)) return MCIERR_HARDWARE; if ((dwFlags & MCI_NOTIFY) && lpParms) MCICDA_Notify(lpParms->dwCallback, wmcda, MCI_NOTIFY_SUCCESSFUL); return 0; }
static VOID _HookFastIoRoutine(PVOID *DriverRoutine, PVOID *RecordRoutine, PVOID HookRoutine) { if (*DriverRoutine != NULL) *RecordRoutine = InterlockedExchangePointer(DriverRoutine, HookRoutine); return; }
/************************************************************************** * MCIQTZ_mciNotify [internal] * * Notifications in MCI work like a 1-element queue. * Each new notification request supersedes the previous one. */ static void MCIQTZ_mciNotify(DWORD_PTR hWndCallBack, WINE_MCIQTZ* wma, UINT wStatus) { MCIDEVICEID wDevID = wma->notify_devid; HANDLE old = InterlockedExchangePointer(&wma->callback, NULL); if (old) mciDriverNotify(old, wDevID, MCI_NOTIFY_SUPERSEDED); mciDriverNotify(HWND_32(LOWORD(hWndCallBack)), wDevID, wStatus); }
HGLOBAL MGlobal::Alloc(UINT nFlags, size_t cbSize) { Free(); // JIC InterlockedExchangePointer((PVOID*)&mh_Global, GlobalAlloc(nFlags, cbSize)); return mh_Global; }
BOOL CBackgroundUpdater::Start() { BuDebugMessage("CBackgroundUpdater::Start() BEGIN"); if (m_hThread!=NULL) { BuDebugMessage("CBackgroundUpdater::Start() ALREADY STARTED"); return FALSE; } DWORD dwThreadID; HANDLE hThread=CreateThread(NULL,0,UpdaterThreadProc,this,CREATE_SUSPENDED,&dwThreadID); DebugOpenHandle(dhtThread,hThread,"BackgroundUpdater"); DebugFormatMessage("BU started, thread ID=%X",dwThreadID); if (hThread==NULL) return FALSE; InterlockedExchangePointer(&m_hThread,hThread); SetThreadPriority(m_hThread,THREAD_PRIORITY_BELOW_NORMAL); InterlockedExchange(&m_lIsWaiting,FALSE); ResumeThread(m_hThread); BuDebugMessage("CBackgroundUpdater::Start() END"); return TRUE; }
void * acl_atomic_xchg(ACL_ATOMIC *self, void *value) { #ifndef HAS_ATOMIC void *old; acl_pthread_mutex_lock(&self->lock); old = self->value; self->value = value; acl_pthread_mutex_unlock(&self->lock); return old; #elif defined(ACL_WINDOWS) return InterlockedExchangePointer((volatile PVOID*)&self->value, value); #elif defined(ACL_LINUX) # if defined(__GNUC__) && (__GNUC__ >= 4) return __sync_lock_test_and_set(&self->value, value); # else (void) self; (void) value; acl_msg_error("%s(%d), %s: not support!", __FILE__, __LINE__, __FUNCTION__); return NULL; # endif #endif }
void* VInterlocked::ExchangeVoidPtr(void** inValue, void* inNewValue) { #if VERSIONWIN #pragma warning (push) #pragma warning (disable: 4311) #pragma warning (disable: 4312) void* val = InterlockedExchangePointer( inValue, inNewValue); // void* val = (void*) ::InterlockedExchange((long*) inValue, (long)inNewValue); #pragma warning (pop) #elif VERSIONMAC void* val; do { val = *inValue; // one must loop if a swap occured between reading the old val and a failed CAS // because if we return the old val, the caller may assume that the CAS has succeeded. } while(!::OSAtomicCompareAndSwapPtrBarrier( val, inNewValue, inValue)); #elif VERSION_LINUX void* val=__sync_lock_test_and_set(inValue, inNewValue); #endif return val; }
VOID CancelSelectSuspend(IN PTDeviceExtension DeviceExtension) { PIRP irp; KIRQL oldIrql; irp = NULL; BulkUsb_DbgPrint(3, ("file bulkdev: CancelSelectSuspend - begins\n")); KeAcquireSpinLock(&DeviceExtension->IdleReqStateLock, &oldIrql); if(!CanDeviceSuspend(DeviceExtension)) { BulkUsb_DbgPrint(3, ("file bulkdev: Device is not idle\n")); irp = (PIRP)InterlockedExchangePointer(&DeviceExtension->PendingIdleIrp, NULL); } KeReleaseSpinLock(&DeviceExtension->IdleReqStateLock, oldIrql); if(irp) { IoCancelIrp(irp); if(0 == InterlockedDecrement(&DeviceExtension->FreeIdleIrpCount)) { BulkUsb_DbgPrint(3, ("file bulkdev: CancelSelectSuspend frees the irp\n")); IoFreeIrp(irp); KeSetEvent(&DeviceExtension->NoIdleReqPendEvent, IO_NO_INCREMENT, FALSE); } } BulkUsb_DbgPrint(3, ("file bulkdev: CancelSelectSuspend - ends\n")); return; }
void dx9hook::HookHandler::Release() { DWORD oldprot; VirtualProtect(vft_original_,sizeof(void*),PAGE_EXECUTE_READWRITE,&oldprot); InterlockedExchangePointer((void**)device_,(void*)vft_original_); VirtualProtect(vft_original_,sizeof(void*),oldprot,&oldprot); }
/************************************************************************** * MCICDA_Pause [internal] */ static DWORD MCICDA_Pause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms) { WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID); HANDLE oldcb; DWORD br; TRACE("(%04X, %08X, %p);\n", wDevID, dwFlags, lpParms); if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID; oldcb = InterlockedExchangePointer(&wmcda->hCallback, NULL); if (oldcb) mciDriverNotify(oldcb, wmcda->wNotifyDeviceID, MCI_NOTIFY_ABORTED); if (wmcda->hThread != 0) { /* Don't bother calling stop if the playLoop thread has already stopped */ if(WaitForSingleObject(wmcda->stopEvent, 0) != WAIT_OBJECT_0 && FAILED(IDirectSoundBuffer_Stop(wmcda->dsBuf))) return MCIERR_HARDWARE; } else if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_PAUSE_AUDIO, NULL, 0, NULL, 0, &br, NULL)) return MCIERR_HARDWARE; if ((dwFlags & MCI_NOTIFY) && lpParms) MCICDA_Notify(lpParms->dwCallback, wmcda, MCI_NOTIFY_SUCCESSFUL); return 0; }
BOOL CExposeDlg::ResetDevice(IDevice *pDevice, BOOL bInit) { if(bInit || m_pDevice != pDevice){ InterlockedExchangePointer((PVOID *)&m_pDevice, pDevice); EnableWindow(m_pDevice != NULL); if(m_pDevice != NULL){ DeviceCapability devCapability; m_pDevice->GetCapability(&devCapability); m_ctrlAETarget.SetRange(devCapability.sExposureRange.byTargetMin, devCapability.sExposureRange.byTargetMax); m_ctrlExposeTime.SetRange(devCapability.sExposureRange.usExposureTimeMin, devCapability.sExposureRange.usExposureTimeMax, TRUE); m_ctrlGain.SetRange(devCapability.sGainRange.ucGainMin,devCapability.sGainRange.ucGainMax); CheckRadioButton(IDC_RAD_ASPECTRATIO, IDC_RAD_FIXWINDOW, IDC_RAD_ASPECTRATIO); CheckRadioButton(IDC_JPG, IDC_RAW, IDC_BMP); BOOL bEnable = m_pDevice->IsMonochromeDevice(); GetDlgItem(IDC_ANALOGGAIN_BAR)->EnableWindow(bEnable); GetDlgItem(IDC_ANALOGGAIN_TEXT)->EnableWindow(bEnable); return TRUE; } } return FALSE; }
NTSTATUS SelectiveSuspendCompletionRoutine(PDEVICE_OBJECT pdo, PIRP Irp, UsbDev *pUsbDev) { NTSTATUS ntStatus = Irp->IoStatus.Status; DBGU_TRACE("SelectiveSuspendCompletionRoutine: 0x%08X\n",ntStatus); //test /*if (InterlockedExchangePointer((PVOID *)&pUsbDev->m_SuspendIrp, NULL)) { DBGU_TRACE("IoFreeIrp Suspend IRP at Completion Routine..\n"); IoFreeIrp(Irp); }*/ InterlockedExchangePointer((PVOID *)&pUsbDev->m_SuspendIrp, NULL); DBGU_TRACE("IoFreeIrp Suspend IRP at Completion Routine..\n"); IoFreeIrp(Irp); // fix incorrect power state transition during S0 -> S3 (ymwu, 2005/7/16) // this irp will be cancelled when system power state is changed to S3 // device power state should not be set to D0 in this situation // if you make incorrect power state transition, the system sometimes hangs { DBGU_TRACE("Cancel Selective Suspend..\n"); pUsbDev->m_SuspendCancelled = 1; } KeSetEvent(&pUsbDev->m_SuspendIrpCancelEvent, IO_NO_INCREMENT, FALSE); return STATUS_MORE_PROCESSING_REQUIRED; }
/*********************************************************************** * GDIRealizePalette (Not a Windows API) */ UINT WINAPI GDIRealizePalette( HDC hdc ) { UINT realized = 0; DC* dc = get_dc_ptr( hdc ); if (!dc) return 0; TRACE("%p...\n", hdc ); if( dc->hPalette == GetStockObject( DEFAULT_PALETTE )) { PHYSDEV physdev = GET_DC_PHYSDEV( dc, pRealizeDefaultPalette ); realized = physdev->funcs->pRealizeDefaultPalette( physdev ); } else if (InterlockedExchangePointer( (void **)&hLastRealizedPalette, dc->hPalette ) != dc->hPalette) { PHYSDEV physdev = GET_DC_PHYSDEV( dc, pRealizePalette ); PALETTEOBJ *palPtr = GDI_GetObjPtr( dc->hPalette, OBJ_PAL ); if (palPtr) { realized = physdev->funcs->pRealizePalette( physdev, dc->hPalette, (dc->hPalette == hPrimaryPalette) ); palPtr->unrealize = physdev->funcs->pUnrealizePalette; GDI_ReleaseObj( dc->hPalette ); } } else TRACE(" skipping (hLastRealizedPalette = %p)\n", hLastRealizedPalette); release_dc_ptr( dc ); TRACE(" realized %i colors.\n", realized ); return realized; }
static VOID CALLBACK wait_or_timer_callback(PVOID param, BOOLEAN /*timeout*/) { // Take ownership of the operation object. win_wait_op* o(static_cast<win_wait_op*>(param)); ptr p = { boost::addressof(o->handler_), o, o }; asio::detail::mutex::scoped_lock lock(*o->mutex_); if (*o->io_service_impl_) { HANDLE wait_handle = InterlockedExchangePointer(o->wait_handle_.get(), 0); if (wait_handle) { ::UnregisterWait(wait_handle); // Pass operation back to main io_service for completion. (*o->io_service_impl_)->post_deferred_completion(o); p.v = p.p = 0; } else { // Clean up. (*o->io_service_impl_)->work_finished(); p.reset(); } } else { p.reset(); } }
NTSTATUS WaitWakeCompletionRoutine( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PDEVICE_EXTENSION DeviceExtension ) /*++ Routine Description: This is the IoSet completion routine for the wait wake irp. Arguments: DeviceObject - pointer to device object Irp - I/O request packet DeviceExtension - pointer to device extension Return Value: NT status value --*/ { MobiUsb_DbgPrint(3, ("file mobipwr: WaitWakeCompletionRoutine - begins\n")); if(Irp->PendingReturned) { IoMarkIrpPending(Irp); } // // Nullify the WaitWakeIrp pointer-the Irp is released // as part of the completion process. If it's already NULL, // avoid race with the CancelWaitWake routine. // if(InterlockedExchangePointer(&DeviceExtension->WaitWakeIrp, NULL)) { PoStartNextPowerIrp(Irp); return STATUS_SUCCESS; } // // CancelWaitWake has run. // If FlagWWCancel != 0, complete the Irp. // If FlagWWCancel == 0, CancelWaitWake completes it. // if(InterlockedExchange(&DeviceExtension->FlagWWCancel, 1)) { PoStartNextPowerIrp(Irp); return STATUS_CANCELLED; } MobiUsb_DbgPrint(3, ("file mobipwr: WaitWakeCompletionRoutine - ends\n")); return STATUS_MORE_PROCESSING_REQUIRED; }
NTSTATUS DymArrayReserve(PUTILS_DYM_ARRAY Array, SIZE_T Length) { PVOID tmpBuffer = NULL; SIZE_T minLength = 0; NTSTATUS status = STATUS_UNSUCCESSFUL; DEBUG_ENTER_FUNCTION("Array=0x%p; Length=%u", Array, Length); if (Length == 0) Length = 1; tmpBuffer = HeapMemoryAlloc(Array->PoolType, Length*sizeof(PVOID)); if (tmpBuffer != NULL) { minLength = min(Array->ValidLength, Length); memcpy(tmpBuffer, Array->Data, minLength * sizeof(PVOID)); tmpBuffer = InterlockedExchangePointer((PVOID *)&Array->Data, tmpBuffer); KeMemoryBarrier(); HeapMemoryFree(tmpBuffer); Array->AllocatedLength = Length; Array->ValidLength = minLength; status = STATUS_SUCCESS; } else status = STATUS_INSUFFICIENT_RESOURCES; DEBUG_EXIT_FUNCTION("0x%x", status); return status; }
/*********************************************************************** * palette_init * * Patch the function pointers in GDI for SelectPalette and RealizePalette */ static void palette_init(void) { void **ptr; HMODULE module = GetModuleHandleA( "gdi32" ); if (!module) { ERR( "cannot get GDI32 handle\n" ); return; } if ((ptr = (void**)GetProcAddress( module, "pfnSelectPalette" ))) pfnGDISelectPalette = InterlockedExchangePointer( ptr, UserSelectPalette ); else ERR( "cannot find pfnSelectPalette in GDI32\n" ); if ((ptr = (void**)GetProcAddress( module, "pfnRealizePalette" ))) pfnGDIRealizePalette = InterlockedExchangePointer( ptr, UserRealizePalette ); else ERR( "cannot find pfnRealizePalette in GDI32\n" ); }
static VOID ReceiverSwizzle( IN PRECEIVER Receiver ) { PADAPTER Adapter = Receiver->Common.Adapter; PNDIS_PACKET *pReturnList = &Receiver->ReturnList; PNDIS_PACKET Packet; Packet = InterlockedExchangePointer(pReturnList, NULL); while (Packet != NULL) { PNDIS_PACKET Next = PACKET_RX_OVERLAY(Packet)->next; ReceiverReleasePacket(Receiver, Packet); Receiver->nRxInNdis--; Packet = Next; } Receiver->nPendingSwizzle = 0; if (ReceiverCommonReplenishRxRing(&Receiver->Common)) { EvtchnNotifyRemote(Adapter->evtchn); Receiver->nRemoteNotifies++; } }
void ProbeContainer::AsyncDeactivate() { InterlockedExchangePointer((PVOID*)&this->pAsyncHaltCallback, nullptr); Assert(debugManager); debugManager->asyncBreakController.Deactivate(); }