VOID SetScreenColors(THREAD *pstThd) { VIOCELL Cell; VIOPS *pVio = &pstThd->stVio; WORD wRow; WORD wColumn; BYTE byBackground; BYTE byForeground; byBackground = ClrTable[pVio->wBackground].PSClr; byForeground = ClrTable[pVio->wForeground].PSClr; Cell.ExtAttr = Cell.Spare = 0; Cell.Attr = (byBackground << 4) | byForeground; DosEnterCritSec(); VioGetCurPos(&wRow,&wColumn,pVio->hpsVio); VioWrtNAttr((PBYTE)&Cell.Attr,pVio->usPsWidth * pVio->usPsDepth,0,0,pVio->hpsVio); VioSetCurPos(wRow,wColumn,pVio->hpsVio); DosExitCritSec(); }
void ICQAPI ishare_removeItem(ISHARED_LIST *ctl, ISHARED_LISTHEADER *reg) { #ifdef __OS2__ DosEnterCritSec(); #endif if(reg->up) (reg->up)->down = reg->down; else ctl->first = reg->down; if(reg->down) (reg->down)->up = reg->up; else ctl->last = reg->up; #ifdef __OS2__ DosExitCritSec(); #endif yield(); }
void ICQAPI ishare_insertItem(ISHARED_LIST *lst, ISHARED_LISTHEADER *itn) { #ifdef __OS2__ DosEnterCritSec(); #endif if(lst->first == NULL) { /* Empty list */ lst->first = lst->last = itn; itn->up = itn->down = NULL; } else { /* Insert in the end of the list */ lst->last->down = itn; itn->up = lst->last; itn->down = NULL; lst->last = itn; } #ifdef __OS2__ DosExitCritSec(); #endif yield(); }
bool Interlock::Release() { return DosExitCritSec() == 0; }
void leave_critical_section(SECTION_CODE i) { DosExitCritSec(); }
static VOID VManSetFullscreen(SDL_PrivateVideoData *pPVData, PVIDEOMODE pFSVideoMode) { static ULONG ulDesktopModeId = ((ULONG)(-1)); // -1 - in desktop HWSHOWPTRIN hwspi; ULONG ulRC; BOOL fInFullscreen = ulDesktopModeId != ((ULONG)(-1)); BOOL fGoToFullscreen = pFSVideoMode != NULL; if ( fInFullscreen == fGoToFullscreen ) { debug( "Already in %s", fInFullscreen ? "fullscreen" : "desktop" ); return; } debug( "Switch to %s", fGoToFullscreen ? "fullscreen" : "desktop" ); ulRC = DosSetPriority( PRTYS_PROCESS, PRTYC_FOREGROUNDSERVER, PRTYD_MAXIMUM, 0 ); if ( ulRC != NO_ERROR ) debug( "#1 DosSetPriority(), rc = %u" ); hwspi.ulLength = sizeof(HWSHOWPTRIN); if ( fGoToFullscreen ) { GDDMODEINFO sCurModeInfo; // debug( "Video mode id: 0x%X", pFSVideoMode->uiModeID ); ulRC = pfnVMIEntry( 0, VMI_CMD_QUERYCURRENTMODE, NULL, &sCurModeInfo ); if ( ulRC != RC_SUCCESS ) { debug( "Could not query desktop video mode." ); } else { ulDesktopModeId = sCurModeInfo.ulModeId; // Remember desktop mode id ulRC = DosEnterCritSec(); if ( ulRC != NO_ERROR ) debug( "DosEnterCritSec(), rc = %u" ); hwspi.fShow = FALSE; pfnVMIEntry( 0, VMI_CMD_SHOWPTR, &hwspi, NULL ); #ifdef __USE_GRE_CALLS_ // Tell the GRE that PM will die GreDeath( GetDesktopHWND() ); #endif pfnVMIEntry( 0, VMI_CMD_SETMODE, &pFSVideoMode->uiModeID, NULL ); if ( pPVData != NULL && pPVData->pSDLSurface != NULL ) { _VManClearFS( pPVData ); if ( pPVData->pSDLSurface != NULL && pPVData->pSDLSurface->format->palette != NULL ) VManSetPalette( pPVData, 0, pPVData->pSDLSurface->format->palette->ncolors, pPVData->pSDLSurface->format->palette->colors ); } ulRC = DosExitCritSec(); if ( ulRC != NO_ERROR ) debug( "DosExitCritSec(), rc = %u" ); } } else { ulRC = DosEnterCritSec(); if ( ulRC != NO_ERROR ) debug( "DosEnterCritSec(), rc = %u" ); pfnVMIEntry( 0, VMI_CMD_SETMODE, &ulDesktopModeId, NULL ); #ifdef USE_GRE_CALLS // Tell GRE that PM can come back GreResurrection( GetDesktopHWND(), 0, NULL ); #endif // Show mouse pointer hwspi.fShow = TRUE; pfnVMIEntry( 0, VMI_CMD_SHOWPTR, &hwspi, NULL ); ulRC = DosExitCritSec(); if ( ulRC != NO_ERROR ) debug( "DosExitCritSec(), rc = %u" ); ulDesktopModeId = ((ULONG)(-1)); // We are in desktop now } ulRC = DosSetPriority( PRTYS_PROCESS, PRTYC_REGULAR, 0, 0 ); if ( ulRC != NO_ERROR ) debug( "#2 DosSetPriority(), rc = %u" ); debug( "Done" ); }