BOOL WINAPI IsCharAlphaNumericW( WCHAR wChar) { WORD ctype1info; if (!GetStringTypeW(CT_CTYPE1, &wChar, 1, &ctype1info)) { // // GetStringTypeW returned an error! IsCharAlphaNumericW has no // provision for returning an error... The best we can do is to // return FALSE // UserAssert(FALSE); return FALSE; } // // LATER 20 Feb 92 GregoryW // We may need to check ctype 3 info if we want to check for // digits other than ASCII '0'-'9' (such as Lao digits or // Tibetan digits, etc.). // #ifdef FE_SB // IsCharAlphaNumericW() if (ctype1info & C1_ALPHA) { WORD ctype3info = 0; /* * We don't want to return TRUE for halfwidth katakana. * Katakana is linguistic character (C1_ALPHA), but it is not * alphabet character. */ if (!GetStringTypeW(CT_CTYPE3, &wChar, 1, &ctype3info)) { UserAssert(FALSE); /* * Assume, it is alphabet character, because it has * C1_ALPHA attribute. */ return TRUE; } if (ctype3info & (C3_KATAKANA|C3_HIRAGANA)) { /* * This is 'Katakana'. */ return FALSE; } else { return TRUE; } } else if (ctype1info & C1_DIGIT) { return TRUE; } else { return FALSE; } #else if ((ctype1info & C1_ALPHA) || (ctype1info & C1_DIGIT)) { return TRUE; } else { return FALSE; } #endif // FE_SB }
/***************************************************************************\ * PhkNextValid * * This helper routine walk the phkNext chain looking for the next valid * hook (i.e., not marked as destroyed). If the end of the local (or * thread specific) hook chain is reached, then it jumps to the global * (or desktop) chain. * * Once a hook is destroyed, we don't want anymore activity on it; however, * if the hook is locked at destroy time (= someone is calling it), then * we keep it in the list so CallNextHook will work properly * * History: * 03/24/96 GerardoB Moved to rtl and added *Valid stuff. * 01-30-91 DavidPe Created. \***************************************************************************/ PHOOK PhkNextValid(PHOOK phk) { #if DBG int iHook = phk->iHook; #ifdef _USERK_ CheckCritInShared(); #endif #endif do { /* * If this hook is marked as destroyed, it must be either * locked or we should be in the process of destroying it */ UserAssert(!(phk->flags & HF_DESTROYED) || (((PHEAD)phk)->cLockObj != 0) || (phk->flags & HF_INCHECKWHF)); /* * Get the next hook */ if (phk->phkNext != NULL) { phk = REBASEALWAYS(phk, phkNext); } else if (!(phk->flags & HF_GLOBAL)) { #ifdef _USERK_ phk = PtiCurrent()->pDeskInfo->aphkStart[phk->iHook + 1]; #else PCLIENTINFO pci = GetClientInfo(); phk = pci->pDeskInfo->aphkStart[phk->iHook + 1]; /* * If it found a pointer, rebase it. */ if (phk != NULL) { (KPBYTE)phk -= pci->ulClientDelta; } #endif UserAssert((phk == NULL) || (phk->flags & HF_GLOBAL)); } else { return NULL; } /* * If destroyed, keep looking. */ } while ((phk != NULL) && (phk->flags & HF_DESTROYED)); #ifdef _USERK_ DbgValidateHooks(phk, iHook); #endif return phk; }
/***************************************************************************\ * HMValidateHandleNoSecure * * This routine validates a handle manager handle. * * 01-22-92 ScottLu Created. \***************************************************************************/ PVOID FASTCALL HMValidateHandleNoSecure( HANDLE h, BYTE bType) { KERNEL_PVOID pobj = NULL; PCLIENTINFO pci; GET_CURRENT_CLIENTINFO(); #if !defined(_USERK_) /* * We don't want 32 bit apps passing 16 bit handles * we should consider failing this before we get * stuck supporting it (Some VB apps do this). */ if (pci && (h != NULL) && (HMUniqFromHandle(h) == 0) && !(pci->dwTIFlags & TIF_16BIT)) { RIPMSG3(RIP_WARNING, "HMValidateHandle: 32bit process [%d] using 16 bit handle [%#p] bType:%#lx", HandleToUlong(NtCurrentTeb()->ClientId.UniqueProcess), h, (DWORD)bType); } #endif /* * Object can't be located in shared memory. */ UserAssert(bType != TYPE_MONITOR); /* * Validation macro. */ ValidateHandleMacro(pci, pobj, h, bType); return pobj; }
PVOID FASTCALL HMValidateHandleNoRip( HANDLE h, BYTE bType) { KERNEL_PVOID pobj = NULL; PCLIENTINFO pci; /* * This is the fastest way way to do validation, because * unlike HMValidateHandle, this function doesn't set the * last error. * * Validation macro. Falls through if the handle is invalid. */ GET_CURRENT_CLIENTINFO(); /* * Object can't be located in shared memory. */ UserAssert(bType != TYPE_MONITOR); ValidateHandleMacro(pci, pobj, h, bType); /* * check for secure process */ CHECK_RESTRICTED(); return pobj; }
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 InitSystemHotKeys(VOID) { #if DEVL // only on "development" checked and free builds { extern KEYBOARD_ATTRIBUTES KeyboardInfo; UINT VkDebug; VkDebug = FastGetProfileDwordW(PMAP_AEDEBUG, L"UserDebuggerHotkey", 0); if (VkDebug == 0) { if (ENHANCED_KEYBOARD(KeyboardInfo.KeyboardIdentifier)) { VkDebug = VK_F12; } else { VkDebug = VK_SUBTRACT; } } else { UserAssert((0xFFFFFF00 & VkDebug) == 0); } _RegisterHotKey(PWND_INPUTOWNER, IDHOT_DEBUG, 0, VkDebug); _RegisterHotKey(PWND_INPUTOWNER, IDHOT_DEBUGSERVER, MOD_SHIFT, VkDebug); } #endif /* * Tapping a Windows key does something to the shell */ _RegisterHotKey(PWND_INPUTOWNER, IDHOT_WINDOWS, MOD_WIN, VK_NONE); }
/***************************************************************************\ * MNFlushDestroyedPopups * * Walk the ppmDelayedFree list freeing those marked as destroyed. * * 05-14-96 GerardoB Created \***************************************************************************/ void MNFlushDestroyedPopups (PPOPUPMENU ppopupmenu, BOOL fUnlock) { PPOPUPMENU ppmDestroyed, ppmFree; UserAssert(IsRootPopupMenu(ppopupmenu)); /* * Walk ppmDelayedFree */ ppmDestroyed = ppopupmenu; while (ppmDestroyed->ppmDelayedFree != NULL) { /* * If it's marked as destroyed, unlink it and free it */ if (ppmDestroyed->ppmDelayedFree->fDestroyed) { ppmFree = ppmDestroyed->ppmDelayedFree; ppmDestroyed->ppmDelayedFree = ppmFree->ppmDelayedFree; UserAssert(ppmFree != ppmFree->ppopupmenuRoot); MNFreePopup(ppmFree); } else { /* * fUnlock is TRUE if the root popup is being destroyed; if * so, reset fDelayedFree and unlink it */ if (fUnlock) { /* * This means that the root popup is going away before * some of the hierarchical popups have been destroyed. * This can happen if someone destroys one of the menu * windows breaking the spwndNextPopup chain. */ ppmDestroyed->ppmDelayedFree->fDelayedFree = FALSE; /* * Stop here so we can figure how this happened. */ UserAssert(ppmDestroyed->ppmDelayedFree->fDelayedFree); ppmDestroyed->ppmDelayedFree = ppmDestroyed->ppmDelayedFree->ppmDelayedFree; } else { /* * Not fDestroyed so move to the next one. */ ppmDestroyed = ppmDestroyed->ppmDelayedFree; } /* fUnlock */ } /* fDestroyed */ } /* while ppmDelayedFree */ }
VOID AddHmodDependency( int iatom) { UserAssert(iatom >= 0); if (iatom < catomSysTableEntries) { acatomSysDepends[iatom]++; } }
BOOL WINAPI IsCharAlphaW( WCHAR wChar) { WORD ctype1info; if (!GetStringTypeW(CT_CTYPE1, &wChar, 1, &ctype1info)) { // // GetStringTypeW returned an error! IsCharAlphaW has no // provision for returning an error... The best we can do // is to return FALSE // UserAssert(FALSE); return FALSE; } if (ctype1info & C1_ALPHA) { #ifdef FE_SB // IsCharAlphaA() WORD ctype3info = 0; /* * We don't want to return TRUE for halfwidth katakana. * Katakana is linguistic character (C1_ALPHA), but it is not * alphabet character. */ if (!GetStringTypeW(CT_CTYPE3, &wChar, 1, &ctype3info)) { UserAssert(FALSE); /* * Assume, it is alphabet character, because it has * C1_ALPHA attribute. */ return TRUE; } if (ctype3info & (C3_KATAKANA|C3_HIRAGANA)) { /* * This is 'Katakana'. */ return FALSE; } else { return TRUE; } #else return TRUE; #endif // FE_SB } else { return FALSE; } }
void CloseRegApi(ADVAPI_FN* pfn) { UserAssert(pfn->hModule); if (pfn->hModule) { FreeLibrary(pfn->hModule); pfn->hModule; } }
VOID UserClientDisconnect( PCSR_PROCESS Process) { PHANDLE pHandle = Process->ServerDllPerProcessData[USERSRV_SERVERDLL_INDEX]; BOOL fSuccess; /* * Close any open handles */ if (pHandle[ID_HDESK]) { fSuccess = CloseDesktop(pHandle[ID_HDESK]); UserAssert(fSuccess); } if (pHandle[ID_HWINSTA]) { fSuccess = CloseWindowStation(pHandle[ID_HWINSTA]); UserAssert(fSuccess); } }
/***************************************************************************\ * ImmSetHotKey() * * Private API for IMEs and the control panel. * * History: * 25-Mar-1996 TakaoK Created \***************************************************************************/ BOOL WINAPI CliImmSetHotKey( DWORD dwID, UINT uModifiers, UINT uVKey, HKL hkl) { BOOL fResult; BOOL fTmp; BOOL fDelete = (uVKey == 0 ); if (fDelete) { // // Removing an IME hotkey from the list in the kernel side // should not be failed, if we succeed to remove the IME // hotkey entry from the registry. Therefore CliSaveImeHotKey // is called first. // fResult = CliSaveImeHotKey( dwID, uModifiers, uVKey, hkl, fDelete ); if (fResult) { fTmp = CliImmSetHotKeyWorker( dwID, uModifiers, uVKey, hkl, ISHK_REMOVE ); UserAssert(fTmp); } } else { // // CliImmSetHotKeyWorker should be called first since // adding an IME hotkey into the list in the kernel side // will be failed in various reasons. // fResult = CliImmSetHotKeyWorker(dwID, uModifiers, uVKey, hkl, ISHK_ADD); if (fResult) { fResult = CliSaveImeHotKey(dwID, uModifiers, uVKey, hkl, fDelete); if (!fResult) { // // We failed to save the hotkey to the registry. // We need to remove the entry from the IME hotkey // list in the kernel side. // fTmp = CliImmSetHotKeyWorker(dwID, uModifiers, uVKey, hkl, ISHK_REMOVE); UserAssert(fTmp); } } } return fResult; }
/***************************************************************************\ * MNAllocMenuState * * Allocates and initializes a pMenuState * * 5-21-96 GerardoB Created \***************************************************************************/ PMENUSTATE MNAllocMenuState(PTHREADINFO ptiCurrent, PTHREADINFO ptiNotify, PPOPUPMENU ppopupmenuRoot) { PMENUSTATE pMenuState; UserAssert(PtiCurrent() == ptiCurrent); UserAssert(ptiCurrent->rpdesk == ptiNotify->rpdesk); /* * If gpMenuState is already taken, allocate one. */ if (gfMenuStateInUse) { pMenuState = (PMENUSTATE)UserAllocPoolWithQuota(sizeof(MENUSTATE), TAG_MENUSTATE); if (pMenuState == NULL) { return NULL; } } else { gfMenuStateInUse = TRUE; pMenuState = &gpMenuState; } /* * This is used by IsSomeOneInMenuMode and for debugging purposes */ guMenuStateCount++; /* * Initialize pMenuState. */ RtlZeroMemory(pMenuState, sizeof(*pMenuState)); pMenuState->pGlobalPopupMenu = ppopupmenuRoot; pMenuState->ptiMenuStateOwner = ptiCurrent; UserAssert(ptiCurrent->pMenuState == NULL); ptiCurrent->pMenuState = pMenuState; if (ptiNotify != ptiCurrent) { UserAssert(ptiNotify->pMenuState == NULL); ptiNotify->pMenuState = pMenuState; } return pMenuState; }
void MNPositionSysMenu( PWND pwnd, PMENU pmenusys) { RECT rc; PITEM pItem; if (pmenusys == NULL) { RIPERR0(ERROR_INVALID_HANDLE, RIP_WARNING, "Invalid menu handle pmenusys (NULL) to MNPositionSysMenu"); return; } /* * Setup the SysMenu hit rectangle. */ rc.top = rc.left = 0; if (TestWF(pwnd, WEFTOOLWINDOW)) { rc.right = SYSMET(CXSMSIZE); rc.bottom = SYSMET(CYSMSIZE); } else { rc.right = SYSMET(CXSIZE); rc.bottom = SYSMET(CYSIZE); } if (!TestWF(pwnd, WFMINIMIZED)) { int cBorders; cBorders = GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE); OffsetRect(&rc, cBorders*SYSMET(CXBORDER), cBorders*SYSMET(CYBORDER)); } /* * Offset the System popup menu. */ Lock(&pmenusys->spwndNotify, pwnd); if (!TestMF(pmenusys, MF_POPUP) && (pmenusys->cItems > 0)) { pItem = pmenusys->rgItems; if (pItem) { pItem->yItem = rc.top; pItem->xItem = rc.left; pItem->cyItem = rc.bottom - rc.top; pItem->cxItem = rc.right - rc.left; } } else // BOGUS -- MF_POPUP should never be set on a MENU -- only a MENU ITEM UserAssert(FALSE); }
/***************************************************************************\ * MNEndMenuStateNotify * * spwndNotify might have been created by a thread other than the one * the menu mode is running on. If this is the case, this function * NULLs out pMenuState for the thread that owns spwndNotify. * * 05-21-96 GerardoB Created \***************************************************************************/ void MNEndMenuStateNotify (PMENUSTATE pMenuState) { PTHREADINFO ptiNotify; if (pMenuState->pGlobalPopupMenu->spwndNotify != NULL) { ptiNotify = GETPTI(pMenuState->pGlobalPopupMenu->spwndNotify); if (ptiNotify != pMenuState->ptiMenuStateOwner) { UserAssert(ptiNotify->pMenuState == pMenuState); ptiNotify->pMenuState = NULL; } } }
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; }
PWND _GetNextDlgTabItem( PWND pwndDlg, PWND pwnd, BOOL fPrev) { PWND pwndSave; if (pwnd == pwndDlg) pwnd = NULL; else { pwnd = _GetChildControl(pwndDlg, pwnd); if (pwnd && !_IsDescendant(pwndDlg, pwnd)) return(NULL); } // // BACKWARD COMPATIBILITY // // Note that the result when there are no tabstops of // IGetNextDlgTabItem(pwndDlg, NULL, FALSE) was the last item, now // will be the first item. We could put a check for fRecurse here // and do the old thing if not set. // // We are going to bug out if we hit the first child a second time. pwndSave = pwnd; pwnd = (fPrev ? _PrevControl(pwndDlg, pwnd, CWP_SKIPINVISIBLE | CWP_SKIPDISABLED) : _NextControl(pwndDlg, pwnd, CWP_SKIPINVISIBLE | CWP_SKIPDISABLED)); if (!pwnd) goto AllOver; while ((pwnd != pwndSave) && (pwnd != pwndDlg)) { UserAssert(pwnd); if (!pwndSave) pwndSave = pwnd; if ((pwnd->style & (WS_TABSTOP | WS_VISIBLE | WS_DISABLED)) == (WS_TABSTOP | WS_VISIBLE)) // Found it. break; pwnd = (fPrev ? _PrevControl(pwndDlg, pwnd, CWP_SKIPINVISIBLE | CWP_SKIPDISABLED) : _NextControl(pwndDlg, pwnd, CWP_SKIPINVISIBLE | CWP_SKIPDISABLED)); } AllOver: return pwnd; }
/***************************************************************************\ * GetMenuPwnd * * This function is used by xxxGetMenuItemRect and xxxMenuItemFromPoint * which expect a pointer to the menu window for popup menus. * In 4.0, apps had to go the extra mile to find the menu window; but this * is bogus since menu windows are an internally thing not directly exposed * to applications. * * 08/19/97 GerardoB Created \***************************************************************************/ PWND GetMenuPwnd (PWND pwnd, PMENU pmenu) { if (TestMF(pmenu, MFISPOPUP)) { if ((pwnd == NULL) || (GETFNID(pwnd) != FNID_MENU)) { PPOPUPMENU ppopup = MNGetPopupFromMenu(pmenu, NULL); if (ppopup != NULL) { UserAssert(ppopup->spmenu == pmenu); pwnd = ppopup->spwndPopupMenu; } } } return pwnd; }
/***************************************************************************\ * MNFreePopup * \***************************************************************************/ VOID MNFreePopup( PPOPUPMENU ppopupmenu) { PMENU pmenu; PMENU pmenuSys; #ifdef DEBUG Validateppopupmenu(ppopupmenu); #endif if (IsRootPopupMenu(ppopupmenu)) { MNFlushDestroyedPopups (ppopupmenu, TRUE); } /* * This app is finished using the global system menu: unlock any objects * it is using! * * NOTE: This global system menu thing doesn't work: two apps can use * it at the same time: which would be a disasterous bug! */ if (ppopupmenu->spwndNotify != NULL) { pmenuSys = ppopupmenu->spwndNotify->head.rpdesk->spmenuSys; if (pmenuSys != NULL) { Unlock(&pmenuSys->spwndNotify); if ((pmenu = _GetSubMenu(pmenuSys, 0)) != NULL) Unlock(&pmenu->spwndNotify); } Unlock(&ppopupmenu->spwndNotify); } Unlock(&ppopupmenu->spwndPopupMenu); Unlock(&ppopupmenu->spwndNextPopup); Unlock(&ppopupmenu->spwndPrevPopup); Unlock(&ppopupmenu->spmenu); Unlock(&ppopupmenu->spmenuAlternate); Unlock(&ppopupmenu->spwndActivePopup); #ifdef DEBUG ppopupmenu->fFreed = TRUE; #endif if (ppopupmenu == &gpopupMenu) { UserAssert(gfPopupInUse); gfPopupInUse = FALSE; } else { UserFreePool(ppopupmenu); } }
/***************************************************************************\ * _PrevControl * * History: \***************************************************************************/ PWND _PrevControl( PWND pwndRoot, PWND pwndStart, UINT uFlags) { BOOL fFirstFound; PWND pwndNext; PWND pwnd, pwndFirst; if (!pwndStart) return(NULL); UserAssert(pwndRoot != pwndStart); UserAssert(!TestWF(pwndStart, WEFCONTROLPARENT)); pwnd = _NextControl(pwndRoot, NULL, uFlags); pwndFirst = pwnd; fFirstFound = FALSE; while (pwndNext = _NextControl(pwndRoot, pwnd, uFlags)) { if (pwndNext == pwndStart) break; if (pwndNext == pwndFirst) { if (fFirstFound) { RIPMSG0(RIP_WARNING, "_PrevControl: Loop Detected"); break; } else { fFirstFound = TRUE; } } pwnd = pwndNext; } return pwnd; }
void convert_to_petit() { #ifndef WIN32 if(petit_args.FileName) { int i; for (i=0; petit_args.FileName[i]; i++); if (i>=2&&petit_args.FileName[i-1]=='f'&&petit_args.FileName[i-2]=='.') { int pid; FILE *fd; printf("+ Translating %s to petit\n", petit_args.FileName); /* Check if .t file already exists */ petit_args.FileName[i-1] = 't'; if((fd=fopen(petit_args.FileName,"r"))!=NULL) { fclose(fd); fprintf(stderr, "File %s already exists. " "Do you want to overwrite it (y, [n]) ?", petit_args.FileName); fflush(stderr); } petit_args.FileName[i-1] = 'f'; pid=fork(); Assert(pid>=0, "can not fork f2p"); if (pid==0) { Assert(execlp("f2p", "f2p", petit_args.FileName, (char*)NULL) >= 0, "Can not execute f2p"); } else { int c, status; while((c=wait(&status))!=pid) Assert(c!=-1, "wait f2p error"); UserAssert(status==0, "Translation to petit was not successful"); } petit_args.FileName[i-1] = 't'; } } #else assert(0 && "Convert to Petit not yet supported under Visual C++"); #endif } /* convert_to_petit */
HANDLE xxxLoadHmodIndex( int iatom, BOOL bWx86KnownDll) { WCHAR pszLibName[MAX_PATH]; HANDLE hmod; UNICODE_STRING strLibrary; PTHREADINFO ptiCurrent = PtiCurrent(); UserAssert((!gptiRit || gptiRit->ppi != PtiCurrent()->ppi) && "Shouldn't load global hooks on system process - gptiRit->ppi is the system process"); if (iatom >= catomSysTableEntries) { RIPERR0(ERROR_INVALID_PARAMETER, RIP_WARNING, "Index out of range"); return NULL; } UserGetAtomName(aatomSysLoaded[iatom], pszLibName, sizeof(pszLibName)/sizeof(WCHAR)); /* * Call back the client to load the library. */ RtlInitUnicodeString(&strLibrary, pszLibName); hmod = ClientLoadLibrary(&strLibrary, bWx86KnownDll); if (hmod != NULL) { /* * Check to make sure another thread hasn't loaded this library * while we were outside the critical section. */ if (!TESTHMODLOADED(ptiCurrent, iatom)) { /* * Go ahead and bump the reference count. */ acatomSysUse[iatom]++; SETHMODLOADED(ptiCurrent, iatom, hmod); } else { /* * Another thread loaded it while we were outside the * critical section. Unload it so the system's * reference count is correct. */ ClientFreeLibrary(ptiCurrent->ppi->ahmodLibLoaded[iatom]); } } return hmod; }
VOID StartRegReadRead(VOID) { UNICODE_STRING UnicodeString; OBJECT_ATTRIBUTES OA; RtlInitUnicodeString(&UnicodeString, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\PriorityControl"); InitializeObjectAttributes(&OA, &UnicodeString, OBJ_CASE_INSENSITIVE, NULL, NULL); if (!NT_SUCCESS(NtOpenKey(&hKeyPriority, KEY_READ | KEY_NOTIFY, &OA))) UserAssert(FALSE); RegReadApcProcedure(NULL, NULL); }
/***************************************************************************\ * xxxCancelMouseMoveTracking * * History * 12/07/96 GerardoB Created \***************************************************************************/ void xxxCancelMouseMoveTracking (DWORD dwDTFlags, PWND pwndTrack, int htEx, DWORD dwDTCancel) { CheckLock(pwndTrack); /* * Hottracking */ if ((dwDTFlags & DF_HOTTRACKING) && (dwDTCancel & DF_HOTTRACKING)) { /* * The current state must be owned by the current queue. * Otherwise, we're about to do an inter-queue cancelation. */ UserAssert(PtiCurrent()->pq == GETPTI(pwndTrack)->pq); xxxHotTrack(pwndTrack, htEx, FALSE); } /* * Tooltips */ if ((dwDTFlags & DF_TOOLTIPSHOWING) && (dwDTCancel & DF_TOOLTIP)) { PTOOLTIPWND pttwnd = (PTOOLTIPWND)PWNDTOOLTIP(pwndTrack); TL tlpwnd; ThreadLockAlways(pttwnd, &tlpwnd); xxxResetTooltip(pttwnd); ThreadUnlock(&tlpwnd); } /* * Mouse Leave */ if ((dwDTFlags & DF_TRACKMOUSELEAVE) && (dwDTCancel & DF_TRACKMOUSELEAVE)) { _PostMessage(pwndTrack, ((htEx == HTCLIENT) ? WM_MOUSELEAVE : WM_NCMOUSELEAVE), 0, 0); } /* * Mouse Hover */ if ((dwDTFlags & DF_TRACKMOUSEHOVER) && (dwDTCancel & DF_TRACKMOUSEHOVER)) { _KillSystemTimer(pwndTrack, IDSYS_MOUSEHOVER); } }
PVOID FASTCALL HMValidateCatHandleNoSecureCCX( HANDLE h, BYTE bType, PCLIENTINFO ccxPci) { PVOID pobj = NULL; /* * Object can't be located in shared memory. */ UserAssert(bType != TYPE_MONITOR); /* * Validation macro. */ ValidateCatHandleMacroCcx(ccxPci, pobj, h, bType); return pobj; }
VOID RemoveHmodDependency( int iatom) { UserAssert(iatom >= 0); if (iatom < catomSysTableEntries && --acatomSysDepends[iatom] == 0) { if (acatomSysUse[iatom]) { /* * Cause each thread to check for expunged dlls * the next time they awake. */ gcSysExpunge++; gdwSysExpungeMask |= (1 << iatom); } else { aatomSysLoaded[iatom] = 0; } } }
PVOID FASTCALL HMValidateCatHandleNoSecure( HANDLE h, BYTE bType) { PVOID pobj = NULL; PCLIENTINFO pci; GET_CURRENT_CLIENTINFO(); /* * Object can't be located in shared memory. */ UserAssert(bType != TYPE_MONITOR); /* * Validation macro. */ ValidateCatHandleMacro(pci, pobj, h, bType); return pobj; }
BOOL xxxRemoveFullScreen(PWND pwnd) { PDESKTOP pdesk = pwnd->head.rpdesk; BOOL fYielded; fYielded = FALSE; if (pdesk == NULL) return fYielded; if (TestWF(pwnd, WFFULLSCREEN) && FCallTray(pdesk)) { ClrWF(pwnd, WFFULLSCREEN); if (!(--pdesk->cFullScreen)) { xxxSetTrayWindow(pdesk, STW_SAME); fYielded = TRUE; } UserAssert(pdesk->cFullScreen >= 0); } return(fYielded); }
void TooltipGetPosition(PTOOLTIPWND pttwnd, SIZE *psize, POINT *ppt) { PMONITOR pMonitor; *ppt = gpsi->ptCursor; pMonitor = _MonitorFromPoint(*ppt, MONITOR_DEFAULTTONULL); UserAssert(pMonitor); if (ppt->y + psize->cy >= pMonitor->rcMonitor.bottom) { ppt->y = ppt->y - psize->cy; pttwnd->dwFlags &= ~TTF_POSITIVE; } else { ppt->y += GetCursorHeight(); pttwnd->dwFlags |= TTF_POSITIVE; } if (ppt->x + psize->cx >= pMonitor->rcMonitor.right) { ppt->x = pMonitor->rcMonitor.right - psize->cx; } if (ppt->x < pMonitor->rcMonitor.left) { ppt->x = pMonitor->rcMonitor.left; } }
void process_args(int argc, char *argv[]) { char line[MAXLINELEN]; petit_args.argv = argv; petit_args.argc = argc; petit_args.FileName = NULL; petit_args.doOEcompare=0; petit_args.depPrintFilter=0; petit_args.DDalgorithm = DDalg_omega_preproc; petit_args.DepWrFile[0] = 0; petit_args.omitScalars = 0; petit_args.omitTopLevel = 0; petit_args.graph_by_statement=true; petit_args.graph_write_dd_as_graph=false; petit_args.hpp_mode=false; petit_args.hpp_only=false; petit_args.motif_display=true; petit_args.zappable_interesting_distance=4; petit_args.normalize = 0; struct option *popt; #if ! defined NDEBUG char popt_already_found[256]; memset(popt_already_found, 0, 256); #endif for(popt=&options[0]; popt->pflag; popt++) { #if ! defined NDEBUG assert(popt_already_found[popt->symbol]++ == 0); #endif *(popt->pflag) = popt->def_value; } for(int i=0; i<argc; i++) { int c, j; char *arg; if(i==0) /* read ~/.petitrc file for flags */ { FILE *fin; sprintf(line, "%s/.petitrc", getenv("HOME")); fin = fopen(line, "r"); if(fin) { for(j=0; j<MAXLINELEN; j++) { int c = fgetc(fin); if(c==EOF || c=='\n') break; line[j] = c; } line[j] = 0; fclose(fin); arg = line; } else continue; } else arg = argv[i]; if(arg[0] == '-') { j = 1; while((c=arg[j++]) != 0) { switch(c) { case ' ': { while(arg[j] == ' ') j++; if(arg[j] == '-') { j++; continue; } if(arg[j] == 0) break; Error("file name in .petitrc file"); break; } case '?': { printf("%s", describe_options()); Exit(0); } case 'w': { petit_args.zappable_interesting_distance = atoi(&arg[j]); while(arg[j] != 0) j++; break; } case 'D': { if((c=arg[j])>='0' && c<='9') { int level = c-'0'; petit_args.dep_analysis_debug = level; j++; } else petit_args.dep_analysis_debug = 2; break; } case 'F': { while ((c=arg[j]) != ' ' && c) { switch(c) { case 'v': petit_args.depPrintFilter |= ddval; break; case 'm': petit_args.depPrintFilter |= ddmem; break; case 'c': petit_args.depPrintFilter |= ddloopCarried; break; case 'f': petit_args.depPrintFilter |= ddIsFlow; break; case 'o': petit_args.depPrintFilter |= ddIsOutput; break; case 'a': petit_args.depPrintFilter |= ddIsAnti; break; default: break; } j++; } break; } case 'P': { if (! process_pres_debugging_flags(arg,j)) { fprintf(stderr, "use Omega Library debugging like: " "{-P[facility][level]...}\n" " a = all debugging flags\n" " c = omega code\n" " g = code generation\n" " l = calculator\n" " p = presburger functions\n" " r = relational operators\n" " All debugging output goes to trace.out"); Error("badly formed Omega Library debug options"); } break; } case 'O': { if((c=arg[j])>='0' && c<='3') { omega_core_debug = c-'0'; j++; } else omega_core_debug = 1; break; } case 'W': { petit_args.uniform = 1; petit_args.normalize = 1; petit_args.zappable_interesting_distance = 0; petit_args.skipping_omega5 = 1; petit_args.makeReductionOps = 1; int jj = 0; while ( jj < MAX_UNIFORM_ARG_LENGTH && arg[j] != '\0') petit_args.uniform_args[jj++] = arg[j++]; petit_args.uniform_args[jj] = '\0'; break; } case 'X': { petit_args.li2_only = true; pres_legal_negations = one_geq_or_eq; } case 'J': { petit_args.hpp_mode = true; petit_args.hpp_only = true; } break; case 'M': { // set all presburger flags but not omega flags if((c=arg[j])>='0' && c<='3') { int level = c-'0'; pres_debug= relation_debug= code_gen_debug = level; j++; } else pres_debug= relation_debug= code_gen_debug = 1; break; } case 'a': { petit_args.DDalgorithm = 0; while((c=arg[j]) >= '0' && c <= '9') { petit_args.DDalgorithm = petit_args.DDalgorithm*10 + c-'0'; j++; } if( petit_args.DDalgorithm <= 0 ) petit_args.DDalgorithm = DDalg_omega_preproc; break; } case 'm': { petit_args.max_conjuncts = 0; while((c=arg[j]) >= '0' && c <= '9') { petit_args.max_conjuncts = petit_args.max_conjuncts*10 + c-'0'; j++; } break; } case 'x': { petit_args.doArrayExpn = 1; petit_args.expandlimit = MAXINT; petit_args.lowerdefault = 0; petit_args.upperdefault = 127; while((c = arg[j]) != 0) { j++; switch(c) { case 'd': { petit_args.expandlimit = 0; while((c=arg[j]) >= '0' && c <= '9') { petit_args.expandlimit = petit_args.expandlimit*10 + c-'0'; j++; } break; } case 'l': { petit_args.lowerdefault = 0; while((c=arg[j]) >= '0' && c <= '9') { petit_args.lowerdefault = petit_args.lowerdefault*10 + c-'0'; j++; } break; } case 'u': { petit_args.upperdefault = 0; while((c=arg[j]) >= '0' && c <= '9') { petit_args.upperdefault = petit_args.upperdefault*10 + c-'0'; j++; } break; } default: Error("bad argument for array expansion\n"); } } break; } case 'R': { // -R-name like old -Sname; -R--name like old -Vname if (arg[j] == '-') { j++; petit_args.graph_write_dd_as_graph=true; petit_args.graph_by_statement=true; if (arg[j] == '-') { j++; petit_args.graph_by_statement=false; } } int len=strlen(&arg[j]); if (len>=DEPWRNAMELEN) ErrAssert("Write file name too long"); strcpy(petit_args.DepWrFile, &arg[j]); j += len; break; } case 'T': { int n=0; petit_args.valueClosure=0; petit_args.testClosure=1; if (arg[j]=='h') { print_closure_help(); Exit(0); } while ((c=arg[j]) >= '0' && c<='9') { n=n*10+c-'0'; j++; } if (arg[j]=='v') { petit_args.valueClosure=1; j++; } set_closure_flags(n); break; } case 'Q': { petit_args.DDalgorithm=DDalg_omega; petit_args.doOEcompare=1; break; } default: { for(popt=&options[0]; popt->pflag; popt++) { if(popt->symbol == c) { *(popt->pflag) = 1 - *(popt->pflag); goto FlagFound; } } sprintf(line, "Unknown flag -%c", c); Error(line); } FlagFound:; } } } else { UserAssert(i>=1, "File name is not allowed in .petitrc file"); UserAssert(petit_args.FileName==NULL, "Only one source file name is allowed"); petit_args.FileName = arg; } } petit_args.motif_display = (!petit_args.uniform && !petit_args.hpp_only && !petit_args.DepWrFile[0]); } /* process_args */