Best Python code snippet using fMBT_python
fmbtwindows_agent.py
Source:fmbtwindows_agent.py
...1708 valueName = re.compile(valueName)1709 if limit == None:1710 limit = -11711 resultList = []1712 _findRegistry(rootKey, key, valueName, limit, resultList)1713 return sorted(set(resultList))1714def _findRegistry(rootKey, key, valueName, limit, resultList):1715 """returns matching (key, valueName) pairs in registry1716 if valueName is not searched for, value will be None"""1717 for archBits in _g_archRegistryKeys:1718 try:1719 root = _openRegistryKey(rootKey, _winreg.KEY_READ | archBits)1720 except OSError:1721 continue1722 try:1723 if valueName != None:1724 valueCount = _winreg.QueryInfoKey(root)[1]1725 for valueIndex in xrange(valueCount):1726 _valueName, _valueData, _valueType = _winreg.EnumValue(root, valueIndex)1727 if key == None:1728 # Look for a valueName only1729 if valueName.match(_valueName):1730 resultList.append((rootKey, _valueName))1731 if len(resultList) == limit:1732 return1733 else:1734 # Look for key-valueName combination1735 if valueName.match(_valueName) and key.search(rootKey):1736 resultList.append((rootKey, _valueName))1737 if len(resultList) == limit:1738 return1739 else:1740 # Look for a key only1741 if key.search(rootKey):1742 resultList.append((rootKey, None))1743 if len(resultList) == limit:1744 return1745 # Recursive step - look among subkeys1746 subkeyCount = _winreg.QueryInfoKey(root)[0]1747 for subkeyIndex in xrange(subkeyCount):1748 subkeyName = _winreg.EnumKey(root, subkeyIndex)1749 fullPathBackslash = rootKey + "\\" + subkeyName1750 _findRegistry(fullPathBackslash, key, valueName, limit, resultList)1751 if len(resultList) == limit:1752 return1753 finally:1754 _winreg.CloseKey(root)1755def getClipboardText():1756 if ctypes.windll.user32.IsClipboardFormatAvailable(CF_TEXT) == 0:1757 return None1758 if ctypes.windll.user32.OpenClipboard(0) == 0:1759 raise Exception("error in opening clipboard")1760 handle = ctypes.windll.user32.GetClipboardData(CF_TEXT)1761 if handle != 0:1762 string_p = ctypes.windll.kernel32.GlobalLock(handle)1763 try:1764 rv = ctypes.string_at(string_p)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!