BOOL xxxSetMenu( PWND pwnd, PMENU pMenu, BOOL fRedraw) { CheckLock(pwnd); CheckLock(pMenu); if (!TestwndChild(pwnd)) { LockWndMenu(pwnd, &pwnd->spmenu, pMenu); /* * only redraw the frame if the window is non-minimized -- * even if it's not visible, we need RedrawFrame to recalc the NC size * * Added a check for (redraw) since the MDISetMenu() only needs to * set the menu and not perform any redraws. */ if (!TestWF(pwnd, WFMINIMIZED) && fRedraw) xxxRedrawFrame(pwnd); return TRUE; } RIPERR0(ERROR_CHILD_WINDOW_MENU, RIP_VERBOSE, ""); return FALSE; }
void xxxMNRecomputeBarIfNeeded( PWND pwndNotify, PMENU pMenu) { int cxFrame; int cyFrame; UserAssert(!TestMF(pMenu, MFISPOPUP)); CheckLock(pwndNotify); CheckLock(pMenu); if (!TestMF(pMenu, MFSYSMENU) && ((pMenu->spwndNotify != pwndNotify) || !pMenu->cxMenu || !pMenu->cyMenu)) { int cBorders; cBorders = GetWindowBorders(pwndNotify->style, pwndNotify->ExStyle, TRUE, FALSE); cxFrame = cBorders * SYSMET(CXBORDER); cyFrame = cBorders * SYSMET(CYBORDER); cyFrame += GetCaptionHeight(pwndNotify); // The width passed in this call was larger by cxFrame; // Fix for Bug #11466 - Fixed by SANKAR - 01/06/92 -- xxxMenuBarCompute(pMenu, pwndNotify, cyFrame, cxFrame, (pwndNotify->rcWindow.right - pwndNotify->rcWindow.left) - cxFrame * 2); } }
void ConcurrencyTest1::TestThread(void) { int i; SafetyLock theSafetyLock(theLocker); for (i = 0; i < MAXLOOP; i++) { // Print out 10 sub test markers per thread if (i % (MAXLOOP / 10) == 0) NextSubTest(); CheckLock(0); assert(AcquireLock(i, true)); assert(!lockTestValue); lockTestValue = true; CheckLock(1); assert(AcquireLock(i, false)); CheckLock(2); theLocker->Unlock(); CheckLock(1); assert(lockTestValue); lockTestValue = false; theLocker->Unlock(); CheckLock(0); } }
// ============================================================================ // // GetMenuItemRect() // // ============================================================================ BOOL xxxGetMenuItemRect(PWND pwnd, PMENU pMenu, UINT uIndex, LPRECT lprcScreen) { PITEM pItem; int dx, dy; CheckLock(pwnd); CheckLock(pMenu); SetRectEmpty(lprcScreen); if (uIndex >= pMenu->cItems) return(FALSE); /* * Raid #315084: Compatiblity with NT4/Win95/98 * * WordPerfect does a long complex way to calc the menu rect * by calling this API. It calls GetMenuItemRect() with the app's * window. */ if (pwnd == NULL || TestWF(pwnd, WFWIN50COMPAT)) { pwnd = GetMenuPwnd(pwnd, pMenu); } /* * If no pwnd, no go. * IMPORTANT: for MFISPOPUP we might get a different pwnd but we don't lock * it because we won't call back */ if (pwnd == NULL) { return FALSE; } if (TestMF(pMenu, MFISPOPUP)) { dx = pwnd->rcClient.left; dy = pwnd->rcClient.top; } else { xxxMNRecomputeBarIfNeeded(pwnd, pMenu); dx = pwnd->rcWindow.left; dy = pwnd->rcWindow.top; } if (uIndex >= pMenu->cItems) return(FALSE); pItem = pMenu->rgItems + uIndex; lprcScreen->right = pItem->cxItem; lprcScreen->bottom = pItem->cyItem; OffsetRect(lprcScreen, dx + pItem->xItem, dy + pItem->yItem); return(TRUE); }
BOOL xxxPaintRect( PWND pwndBrush, PWND pwndPaint, HDC hdc, HBRUSH hbr, LPRECT lprc) { POINT ptOrg; CheckLock(pwndBrush); CheckLock(pwndPaint); if (pwndBrush == NULL) { pwndBrush = PtiCurrent()->rpdesk->pDeskInfo->spwnd; } if (pwndBrush == PWNDDESKTOP(pwndBrush)) { GreSetBrushOrg( hdc, 0, 0, &ptOrg); } else { GreSetBrushOrg( hdc, pwndBrush->rcClient.left - pwndPaint->rcClient.left, pwndBrush->rcClient.top - pwndPaint->rcClient.top, &ptOrg); } /* * If hbr < CTLCOLOR_MAX, it isn't really a brush but is one of our * special color values. Translate it to the appropriate WM_CTLCOLOR * message and send it off to get back a real brush. The translation * process assumes the CTLCOLOR*** and WM_CTLCOLOR*** values map directly. */ if (hbr < (HBRUSH)CTLCOLOR_MAX) { hbr = xxxGetControlColor(pwndBrush, pwndPaint, hdc, HandleToUlong(hbr) + WM_CTLCOLORMSGBOX); } FillRect(hdc, lprc, hbr); GreSetBrushOrg(hdc, ptOrg.x, ptOrg.y, NULL); return TRUE; }
int xxxCBDir( PCBOX pcbox, UINT attrib, LPWSTR pFileName) { PLBIV plb; int errorValue; TL tlpwnd; CheckLock(pcbox->spwnd); plb = ((PLBWND)pcbox->spwndList)->pLBIV; ThreadLock(plb->spwnd, &tlpwnd); errorValue = xxxLbDir(plb, attrib, pFileName); ThreadUnlock(&tlpwnd); switch (errorValue) { case LB_ERR: return CB_ERR; break; case LB_ERRSPACE: return CB_ERRSPACE; break; default: return errorValue; break; } }
/** * check if a vcache is in use * * @return status * @retcode 0 success * @retcode EBUSY vcache is in use by someone else * @retcode otherwise other error * * @pre The caller must hold the vnode interlock for the associated vnode * @post The vnode interlock for the associated vnode will still be held * and must be VI_UNLOCK'd by the caller */ int osi_fbsd_checkinuse(struct vcache *avc) { struct vnode *vp = AFSTOV(avc); ASSERT_VI_LOCKED(vp, "osi_fbsd_checkinuse"); /* The interlock is needed to check the usecount. */ if (vp->v_usecount > 0) { return EBUSY; } /* XXX * The value of avc->opens here came to be, at some point, * typically -1. This was caused by incorrectly performing afs_close * processing on vnodes being recycled */ if (avc->opens) { return EBUSY; } /* if a lock is held, give up */ if (CheckLock(&avc->lock)) { return EBUSY; } return 0; }
/* Try to discard pages, in order to recycle a vcache entry. * * We also make some sanity checks: ref count, open count, held locks. * * We also do some non-VM-related chores, such as releasing the cred pointer * (for AIX and Solaris) and releasing the gnode (for AIX). * * Locking: afs_xvcache lock is held. It must not be dropped. */ int osi_VM_FlushVCache(struct vcache *avc) { if (avc->vrefCount != 0) return EBUSY; if (avc->opens) return EBUSY; /* Just in case someone is still referring to the vnode we * give up trying to get rid of this guy */ if (avc->vrefCount || CheckLock(&avc->lock) || LockWaiters(&avc->lock)) return EBUSY; if (avc->segid) { AFS_GUNLOCK(); vms_delete(avc->segid); AFS_GLOCK(); avc->segid = avc->vmh = NULL; } if (avc->credp) { crfree(avc->credp); avc->credp = NULL; } /* Free the alloced gnode that was accompanying the vcache's vnode */ aix_gnode_rele(AFSTOV(avc)); return 0; }
BOOL xxxHotTrack(PWND pwnd, int htEx, BOOL fDraw) { int ht = LOWORD(htEx); CheckLock(pwnd); switch(ht) { #ifdef COLOR_HOTTRACKING case HTMINBUTTON: case HTMAXBUTTON: case HTHELP: case HTCLOSE: return xxxHotTrackCaption(pwnd, ht, fDraw); case HTSCROLLUP: case HTSCROLLDOWN: case HTSCROLLUPPAGE: case HTSCROLLDOWNPAGE: case HTSCROLLTHUMB: return xxxHotTrackSB(pwnd, htEx, fDraw); case HTMDIMINBUTTON: case HTMDIMAXBUTTON: case HTMDICLOSE: #endif // COLOR_HOTTRACKING case HTMENUITEM: return xxxHotTrackMenu(pwnd, HIWORD(htEx), fDraw); } return FALSE; }
VOID xxxSendNCPaint( PWND pwnd, HRGN hrgnUpdate) { CheckLock(pwnd); /* * Clear the WFSENDNCPAINT bit... */ ClrWF(pwnd, WFSENDNCPAINT); /* * If the window is active, but its FRAMEON bit hasn't * been set yet, set it and make sure that the entire frame * gets redrawn when we send the NCPAINT. */ if ((pwnd == PtiCurrent()->pq->spwndActive) && !TestWF(pwnd, WFFRAMEON)) { SetWF(pwnd, WFFRAMEON); hrgnUpdate = HRGN_FULL; ClrWF(pwnd, WFNONCPAINT); } /* * If PixieHack() has set the WM_NCPAINT bit, we must be sure * to send with hrgnClip == HRGN_FULL. (see PixieHack() in wmupdate.c) */ if (TestWF(pwnd, WFPIXIEHACK)) { ClrWF(pwnd, WFPIXIEHACK); hrgnUpdate = HRGN_FULL; } if (hrgnUpdate) xxxSendMessage(pwnd, WM_NCPAINT, (WPARAM)hrgnUpdate, 0L); }
/***************************************************************************\ * xxxHotTrackMenu * * Hot-track a menu item in the menu bar. \***************************************************************************/ BOOL xxxHotTrackMenu(PWND pwnd, UINT nItem, BOOL fDraw) { PMENU pmenu = pwnd->spmenu; PITEM pItem; HDC hdc; UINT oldAlign; TL tlpmenu; CheckLock(pwnd); /* * The window may have lied about the hit-test code on * WM_NCHITTEST. Make sure it does indeed have a menu. */ if (!TestWF(pwnd, WFMPRESENT) || pmenu == NULL) return FALSE; if (nItem >= pmenu->cItems) { RIPMSG0(RIP_WARNING, "xxxHotTrackMenu: menu too large"); return FALSE; } pItem = &pmenu->rgItems[nItem]; /* * Make sure we draw on the right spot */ ThreadLock(pmenu, &tlpmenu); xxxMNRecomputeBarIfNeeded(pwnd, pmenu); ValidateThreadLocks(NULL, PtiCurrent()->ptl, (ULONG_PTR)&tlpmenu, TRUE); if (fDraw) { if (TestMFS(pItem, MF_GRAYED)) { ThreadUnlock(&tlpmenu); return FALSE; } SetMFS(pItem, MFS_HOTTRACK); } else { ClearMFS(pItem, MFS_HOTTRACK); } hdc = _GetDCEx(pwnd, NULL, DCX_WINDOW | DCX_USESTYLE | DCX_CACHE); GreSelectBrush(hdc, SYSHBR(MENUTEXT)); GreSelectFont(hdc, ghMenuFont); oldAlign = GreGetTextAlign(hdc); if (pmenu->rgItems && TestMFT(pmenu->rgItems, MFT_RIGHTORDER)) GreSetTextAlign(hdc, oldAlign | TA_RTLREADING); /* * When the item is not owner draw, xxxDrawMenuItem does not * call back and does not leave the critical section. */ xxxDrawMenuItem(hdc, pmenu, pItem, 0); GreSetTextAlign(hdc, oldAlign); ThreadUnlock(&tlpmenu); _ReleaseDC(hdc); return TRUE; }
BOOL xxxHotTrackCaption(PWND pwnd, int ht, BOOL fDraw) { DWORD dwWhere; int x, y; WORD bm, cmd; RECT rcBtn; HDC hdc; CheckLock(pwnd); if (!TestWF(pwnd, WFCPRESENT)) return FALSE; dwWhere = xxxCalcCaptionButton(pwnd, ht, &cmd, &rcBtn, &bm); x = GET_X_LPARAM(dwWhere); y = GET_Y_LPARAM(dwWhere); if (!cmd) return FALSE; hdc = _GetDCEx(pwnd, NULL, DCX_WINDOW | DCX_USESTYLE | DCX_CACHE); BitBltSysBmp(hdc, x, y, bm + (fDraw ? DOBI_HOT : 0)); _ReleaseDC(hdc); return TRUE; }
void xxxShowTooltip(PTOOLTIPWND pttwnd) { SIZE size; POINT pt; DWORD dwFlags; CheckLock(pttwnd); if (pttwnd->pstr == NULL) return; if (pttwnd->pstr == gszCAPTIONTOOLTIP) { PWND pwnd = PtiCurrent()->rpdesk->spwndTrack; /* * The window text might have changed in callbacks, retrieve it now */ if (TestWF(pwnd, WEFTRUNCATEDCAPTION) && pwnd->strName.Length) { wcsncpycch(gszCAPTIONTOOLTIP, pwnd->strName.Buffer, CAPTIONTOOLTIPLEN-1); gszCAPTIONTOOLTIP[CAPTIONTOOLTIPLEN-1] = 0; } else { return; } } TooltipGetSize(pttwnd, &size); TooltipGetPosition(pttwnd, &size, &pt); dwFlags = SWP_CREATESPB | SWP_SHOWWINDOW | SWP_NOACTIVATE; if (TestEffectUP(TOOLTIPANIMATION)) { dwFlags |= SWP_NOREDRAW; } xxxSetWindowPos((PWND)pttwnd, PWND_TOP, pt.x, pt.y, size.cx, size.cy, dwFlags); }
bool CGUIPassword::IsProfileLockUnlocked(int iProfile, bool& bCanceled, bool prompt) { if (g_passwordManager.bMasterUser) return true; int iProfileToCheck=iProfile; if (iProfile == -1) iProfileToCheck = CProfilesManager::Get().GetCurrentProfileIndex(); if (iProfileToCheck == 0) return IsMasterLockUnlocked(prompt,bCanceled); else { CProfile *profile = CProfilesManager::Get().GetProfile(iProfileToCheck); if (!profile) return false; if (!prompt) return (profile->getLockMode() == LOCK_MODE_EVERYONE); if (profile->getDate().empty() && (CProfilesManager::Get().GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE || profile->getLockMode() == LOCK_MODE_EVERYONE)) { // user hasn't set a password and this is the first time they've used this account // so prompt for password/settings if (CGUIDialogProfileSettings::ShowForProfile(iProfileToCheck, true)) return true; } else if (CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE) return CheckLock(profile->getLockMode(),profile->getLockCode(),20095,bCanceled); } return true; }
/* Try to discard pages, in order to recycle a vcache entry. * * We also make some sanity checks: ref count, open count, held locks. * * We also do some non-VM-related chores, such as releasing the cred pointer * (for AIX and Solaris) and releasing the gnode (for AIX). * * Locking: afs_xvcache lock is held. If it is dropped and re-acquired, * *slept should be set to warn the caller. * * Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it * is not dropped and re-acquired for any platform. It may be that *slept is * therefore obsolescent. */ int osi_VM_FlushVCache(struct vcache *avc, int *slept) { if (avc->vrefCount != 0) return EBUSY; if (avc->opens) return EBUSY; /* if a lock is held, give up */ if (CheckLock(&avc->lock)) return EBUSY; AFS_GUNLOCK(); pvn_vplist_dirty(AFSTOV(avc), 0, NULL, B_TRUNC | B_INVAL, CRED()); AFS_GLOCK(); /* Might as well make the obvious check */ if (AFSTOV(avc)->v_pages) return EBUSY; /* should be all gone still */ rw_destroy(&avc->rwlock); if (avc->credp) { crfree(avc->credp); avc->credp = NULL; } return 0; }
VOID xxxDoSyncPaint( PWND pwnd, DWORD flags) { CheckLock(pwnd); /* * If any of our non-clipchildren parents have an update region, don't * do anything. This way we won't redraw our background or frame out * of order, only to have it get obliterated when our parent erases his * background. */ if (ParentNeedsPaint(pwnd)) return; /* * First of all if we are going to be queueing any WM_SYNCPAINT messages * to windows of another thread do it first while the window's update * regions are still in sync. This way there is no chance the update * region will be incorrect (through window movement during callbacks of * the WM_ERASEBKGND|WM_NCPAINT messages). */ DoQueuedSyncPaint(pwnd, flags, PtiCurrent()); xxxInternalDoSyncPaint(pwnd, flags); }
BOOL xxxAddFullScreen(PWND pwnd) { BOOL fYielded; PDESKTOP pdesk = pwnd->head.rpdesk; CheckLock(pwnd); fYielded = FALSE; if (pdesk == NULL) return fYielded; if (!TestWF(pwnd, WFFULLSCREEN) && FCallTray(pdesk)) { SetWF(pwnd, WFFULLSCREEN); if (!(pdesk->cFullScreen)++) { xxxSetTrayWindow(pdesk, STW_SAME); fYielded = TRUE; } if ((pwnd = pwnd->spwndOwner) && !TestWF(pwnd, WFCHILD) && !pwnd->rcWindow.right && !pwnd->rcWindow.left && !TestWF(pwnd, WFVISIBLE)) { TL tlpwnd; ThreadLock(pwnd, &tlpwnd); if (xxxAddFullScreen(pwnd)) fYielded = TRUE; ThreadUnlock(&tlpwnd); } } return(fYielded); }
BOOL xxxInternalPaintDesktop( PWND pwnd, HDC hdc, BOOL fPaint) { BOOL fRet; CheckLock(pwnd); if (fPaint) { RECT rcOrg, rcT; POINT pt; /* * For compatiblity purposes the DC origin of desktop windows * is set to the primary monitor, i.e. (0,0). Since we may get * either desktop or non-desktop DCs here, temporarily reset * the hdc origin to (0,0). */ GreGetDCOrgEx(hdc, &pt, &rcOrg); CopyRect(&rcT, &rcOrg); OffsetRect(&rcT, -rcT.left, -rcT.top); GreSetDCOrg(hdc, rcT.left, rcT.top, (PRECTL)&rcT); fRet = xxxEnumDisplayMonitors( hdc, NULL, (MONITORENUMPROC) xxxDesktopPaintCallback, (LPARAM)pwnd, TRUE); /* * Reset the DC origin back. */ GreSetDCOrg(hdc, rcOrg.left, rcOrg.top, (PRECTL)&rcOrg); } else if ( ghpalWallpaper && GetPrimaryMonitor()->dwMONFlags & MONF_PALETTEDISPLAY) { /* * Select in the palette if one exists. */ HPALETTE hpalT; int i; hpalT = _SelectPalette(hdc, ghpalWallpaper, FALSE); i = xxxRealizePalette(hdc); _SelectPalette(hdc, hpalT, FALSE); if (i > 0) { xxxInvalidateDesktopOnPaletteChange(pwnd); } fRet = TRUE; } return fRet; }
BOOL xxxOpenIcon( PWND pwnd) { CheckLock(pwnd); if (TestWF(pwnd, WFMINIMIZED)) return xxxShowWindow(pwnd, MAKELONG(SW_NORMAL, gfAnimate)); return TRUE; }
BOOL xxxCloseWindow( PWND pwnd) { CheckLock(pwnd); if (!TestWF(pwnd, WFMINIMIZED)) xxxShowWindow(pwnd, MAKELONG(SW_MINIMIZE, gfAnimate)); return TRUE; }
int xxxMenuBarCompute( PMENU pMenu, PWND pwndNotify, DWORD yMenuTop, DWORD xMenuLeft, int cxMax) { int size; /* menuHeight is set by MNCompute when dealing with a top level menu and * not all items in the menu bar have the same height. Thus, by setting * menuHeight, MNCompute is called a second time to set every item to the * same height. The actual value stored in menuHeight is the maximum * height of all the menu bar items */ DWORD menuHeight = 0; CheckLock(pwndNotify); CheckLock(pMenu); size = xxxMNCompute(pMenu, pwndNotify, yMenuTop, xMenuLeft, cxMax, &menuHeight); if (!TestMF(pMenu, MFISPOPUP)) { if (menuHeight != 0) { /* * Add a border for the multi-row case. */ size = xxxMNCompute(pMenu, pwndNotify, yMenuTop, xMenuLeft, cxMax, &menuHeight); } /* * Right justification of HELP items is only needed on top level * menus. */ MBC_RightJustifyMenu(pMenu); } /* * There's an extra border underneath the menu bar, if it's not empty! */ return(size ? size + SYSMET(CYBORDER) : size); }
BOOL xxxShowOwnedPopups( PWND pwndOwner, BOOL fShow) { CheckLock(pwndOwner); xxxShowOwnedWindows(pwndOwner, (UINT)(fShow ? SW_PARENTOPENING : SW_PARENTCLOSING)); return TRUE; }
BOOL xxxSetSystemMenu( PWND pwnd, PMENU pMenu) { CheckLock(pwnd); CheckLock(pMenu); if (TestWF(pwnd, WFSYSMENU)) { PMENU pmenuT = pwnd->spmenuSys; if (LockWndMenu(pwnd, &pwnd->spmenuSys, pMenu)) _DestroyMenu(pmenuT); MNPositionSysMenu(pwnd, pMenu); return TRUE; } RIPERR0(ERROR_NO_SYSTEM_MENU, RIP_VERBOSE, ""); return FALSE; }
int xxxMenuItemFromPoint(PWND pwnd, PMENU pMenu, POINT ptScreen) { CheckLock(pwnd); CheckLock(pMenu); /* * If no pwnd, no go. * IMPORTANT: for MFISPOPUP we might get a different pwnd but we don't lock * it because we won't call back */ pwnd = GetMenuPwnd(pwnd, pMenu); if (pwnd == NULL) { return MFMWFP_NOITEM; } if (!TestMF(pMenu, MFISPOPUP)) { xxxMNRecomputeBarIfNeeded(pwnd, pMenu); } return(MNItemHitTest(pMenu, pwnd, ptScreen)); }
BOOL xxxDrawWallpaper( PWND pwnd, HDC hdc, PMONITOR pMonitorPaint, LPCRECT lprc) { BOOL f; HPALETTE hpalT; int i; CheckLock(pwnd); CheckLock(pMonitorPaint); UserAssert(ghbmWallpaper != NULL); UserAssert(lprc); /* * Select in the palette if one exists. As a wallpaper, we should only * be able to do background-realizations. */ if ( ghpalWallpaper && pMonitorPaint->dwMONFlags & MONF_PALETTEDISPLAY) { hpalT = _SelectPalette(hdc, ghpalWallpaper, FALSE); i = xxxRealizePalette(hdc); } else { hpalT = NULL; } if (gwWPStyle & DTF_TILE) { f = TileWallpaper(hdc, lprc, pwnd != NULL); } else { f = CenterWallpaper(hdc, &pMonitorPaint->rcMonitor); } if (hpalT) { _SelectPalette(hdc, hpalT, FALSE); } return f; }
BOOL xxxFillWindow( PWND pwndBrush, PWND pwndPaint, HDC hdc, HBRUSH hbr) { RECT rc; CheckLock(pwndBrush); CheckLock(pwndPaint); /* * If there is no pwndBrush (sometimes the parent), use pwndPaint. */ if (pwndBrush == NULL) pwndBrush = pwndPaint; if (UT_GetParentDCClipBox(pwndPaint, hdc, &rc)) return xxxPaintRect(pwndBrush, pwndPaint, hdc, hbr, &rc); return TRUE; }
VOID xxxRecreateSmallIcons(PWND pwnd) { BOOL fSmQueryDrag; CheckLock(pwnd); if (DestroyClassSmIcon(pwnd->pcls)) xxxCreateClassSmIcon(pwnd->pcls); fSmQueryDrag = (TestWF(pwnd, WFSMQUERYDRAGICON) != 0); if (DestroyWindowSmIcon(pwnd) && !fSmQueryDrag) xxxCreateWindowSmIcon(pwnd, (HICON)_GetProp(pwnd, MAKEINTATOM(gpsi->atomIconProp), PROPF_INTERNAL), TRUE); }
/* Try to discard pages, in order to recycle a vcache entry. * * We also make some sanity checks: ref count, open count, held locks. * * We also do some non-VM-related chores, such as releasing the cred pointer * (for AIX and Solaris) and releasing the gnode (for AIX). * * Locking: afs_xvcache lock is held. If it is dropped and re-acquired, * *slept should be set to warn the caller. * * Formerly, afs_xvcache was dropped and re-acquired for Solaris, but now it * is not dropped and re-acquired for any platform. It may be that *slept is * therefore obsolescent. * */ int osi_VM_FlushVCache(struct vcache *avc, int *slept) { struct vm_object *obj; struct vnode *vp = AFSTOV(avc); if (!VI_TRYLOCK(vp)) /* need interlock to check usecount */ return EBUSY; if (vp->v_usecount > 0) { VI_UNLOCK(vp); return EBUSY; } /* XXX * The value of avc->opens here came to be, at some point, * typically -1. This was caused by incorrectly performing afs_close * processing on vnodes being recycled */ if (avc->opens) { VI_UNLOCK(vp); return EBUSY; } /* if a lock is held, give up */ if (CheckLock(&avc->lock)) { VI_UNLOCK(vp); return EBUSY; } if ((vp->v_iflag & VI_DOOMED) != 0) { VI_UNLOCK(vp); return (0); } /* must hold the vnode before calling vgone() * This code largely copied from vfs_subr.c:vlrureclaim() */ vholdl(vp); AFS_GUNLOCK(); *slept = 1; /* use the interlock while locking, so no one else can DOOM this */ ilock_vnode(vp); vgone(vp); unlock_vnode(vp); vdrop(vp); AFS_GLOCK(); return 0; }
BOOL xxxSetDialogSystemMenu( PWND pwnd) { PMENU pMenu; CheckLock(pwnd); pMenu = pwnd->head.rpdesk->spmenuDialogSys; if (pMenu == NULL) { pMenu = xxxLoadSysDesktopMenu (&pwnd->head.rpdesk->spmenuDialogSys, ID_DIALOGSYSMENU); } LockWndMenu(pwnd, &pwnd->spmenuSys, pMenu); return (pMenu != NULL); }
BOOL xxxEndPaint( PWND pwnd, LPPAINTSTRUCT lpps) { CheckLock(pwnd); ReleaseCacheDC(lpps->hdc, TRUE); if (TestWF(pwnd, WFDONTVALIDATE)) { if (ghrgnUpdateSave != NULL) { InternalInvalidate3(pwnd, ghrgnUpdateSave, RDW_INVALIDATE | RDW_ERASE); if (--gnUpdateSave == 0) { GreDeleteObject(ghrgnUpdateSave); ghrgnUpdateSave = NULL; } } ClrWF(pwnd, WFDONTVALIDATE); } ClrWF(pwnd, WFWMPAINTSENT); /* * This used to check that the update-region was empty before * doing the clear. However, this caused a problem with WOW * amipro/approach hanging. They were invalidating rects in * their WM_PAINT handler, and allowing the defwindowproc to * perform the validation for them. Since we were blocking * the BeginPaint in this case, it sent them into a infinite * loop (see bug 19036). */ ClrWF(pwnd, WFSTARTPAINT); /* * Reshow the caret if needed, but AFTER we've released the DC. * This way ShowCaret() can reuse the DC we just released. */ if (pwnd == PtiCurrent()->pq->caret.spwnd) zzzInternalShowCaret(); return TRUE; }