VOID FASTCALL UserLeave(VOID) { ASSERT_NOGDILOCKS(); ASSERT(UserIsEntered()); ExReleaseResourceLite(&UserLock); KeLeaveCriticalRegion(); }
/* * @implemented */ VOID APIENTRY EngDeleteWnd( IN WNDOBJ *pwo) { WNDGDI *WndObjInt = ObjToGDI(pwo, WND); PWND Window; BOOL calledFromUser; DPRINT("EngDeleteWnd: pwo = 0x%p\n", pwo); calledFromUser = UserIsEntered(); if (!calledFromUser){ UserEnterExclusive(); } /* Get window object */ Window = UserGetWindowObject(WndObjInt->Hwnd); if (Window == NULL) { DPRINT1("Warning: Couldnt get window object for WndObjInt->Hwnd!!!\n"); } else { /* Remove object from window */ IntRemoveProp(Window, AtomWndObj); --gcountPWO; } if (!calledFromUser){ UserLeave(); } /* Free resources */ IntEngDeleteClipRegion(WndObjInt->ClientClipObj); EngFreeMem(WndObjInt); }
APIENTRY EngCreateWnd( SURFOBJ *pso, HWND hWnd, WNDOBJCHANGEPROC pfn, FLONG fl, int iPixelFormat) { WNDGDI *WndObjInt = NULL; WNDOBJ *WndObjUser = NULL; PWND Window; BOOL calledFromUser; DECLARE_RETURN(WNDOBJ*); DPRINT("EngCreateWnd: pso = 0x%p, hwnd = 0x%p, pfn = 0x%p, fl = 0x%lx, pixfmt = %d\n", pso, hWnd, pfn, fl, iPixelFormat); calledFromUser = UserIsEntered(); if (!calledFromUser){ UserEnterShared(); } /* Get window object */ Window = UserGetWindowObject(hWnd); if (Window == NULL) { RETURN( NULL); } /* Create WNDOBJ */ WndObjInt = EngAllocMem(0, sizeof (WNDGDI), GDITAG_WNDOBJ); if (WndObjInt == NULL) { DPRINT1("Failed to allocate memory for a WND structure!\n"); RETURN( NULL); } /* Fill the clipobj */ WndObjInt->ClientClipObj = NULL; if (!IntEngWndUpdateClipObj(WndObjInt, Window)) { EngFreeMem(WndObjInt); RETURN( NULL); } /* Fill user object */ WndObjUser = GDIToObj(WndObjInt, WND); WndObjUser->psoOwner = pso; WndObjUser->pvConsumer = NULL; /* Fill internal object */ WndObjInt->Hwnd = hWnd; WndObjInt->ChangeProc = pfn; WndObjInt->Flags = fl; WndObjInt->PixelFormat = iPixelFormat; /* associate object with window */ IntSetProp(Window, AtomWndObj, WndObjInt); ++gcountPWO; DPRINT("EngCreateWnd: SUCCESS!\n"); RETURN( WndObjUser); CLEANUP: if (!calledFromUser){ UserLeave(); } END_CLEANUP; }