注意了,首发版Win11即将下线!

Windows1121H2即将退役,微软推荐升级至22H2或等待23H2
微软宣布将于2023年10月结束对Windows1121H2的支持,建议用户升级至22H2。23H2版本预计同年10月发布,带有任务栏不合并等功能改进。Windows10所有版本已大部分停产,2025年将全部退役。微软的版本生命周期政策复杂,不同版本支持期限不同。

截至目前Windows10总共发布了14个大版本+N多个小版本,如今只有最后一个大版本22H2还在生命周期中,其他版本均已下线停产(21H2于今年6月份停产),意味着微软不再提供安全更新以及各种功能升级,然后到2025年,22H2版本也将到期,届时Windows10就光荣退役了。

与此同时,Windows11两年内总共发布了两个大版本(21H2、22H2),昨天微软在官网发布公告:2023年10月份,将结束对Windows11 21H2(家庭版/专业版/专业工作站版/教育版)的服务。这里说的是消费者版本,生命周期总共两年。

微软对不同版本提供的生命周期有所区别,总之和命名规则一样,非常混乱:①Win10的消费者版一律是18个月、商业版中H1的是18个月,H2的是30个月;②Win11大版本只有H2没有H1,消费者版是24个月,商业版为36个月;③LTSC长期服务版有10年或5年(LTSB2015/2016均为10年,LTSC 2021改为了5年,IoT版本始终是10年)。

Windows11的众多版本中,年度大版本功能升级最大,其次是针对大版本进行的「Moment更新」也有较大的功能升级,目前已经新到Moment 3了。最后就是每个月甚至每周的更新,主要以累积更新为主,功能更新较少。

面对即将下线的Win11 21H2,微软建议尽快升级到最新的22H2。根据年度更新的规划,大版本23H2预计也在今年10月份发布,如果不着急的话,可以再等两个月升级。23H2有众人期待回归的功能「任务栏不合并」,还有资源管理改进等多项功能升级改进。不过,也有人认为Windows11终于不再写bug了,终于可以不用更新了,然鹅不要高兴太早,微软还会强制推送最新的升级更新,即便是硬件不支持Win11也会推送,然后升级时再告诉你不满足要求。

import os import time import threading from PIL import Image, ImageFile, UnidentifiedImageError ImageFile.LOAD_TRUNCATED_IMAGES = True import cv2 import uiautomation as auto import win32clipboard import win32con from ctypes import * import pyperclip import tempfile # 配置参数 ====> wx_groupName = '星海预警' wx_context = '星系警告!!!---疯子出品,必数精品' conVal = 2 path = 'D:/EVE_A_Eye-main/EVE_A_Eye' devices = { 'QO2UL': [ '127.0.0.1:5555', False ], } gameSendPosition = { '第二频道': '38 117', '第三频道': '38 170', '第四频道': '38 223', '第五频道': '38 278', '第六频道': '38 332', '第七频道': '38 382' } sendTo = gameSendPosition['第三频道'] mutex = threading.Lock() # <==== 配置参数结束 ### 核心数学原理 ### # 文件拖放操作的剪切板数据格式: # $$D_{clip} = H_{drop} \oplus P_{file}$$ # 其中: # $H_{drop}$ = DROPFILES结构头 # $P_{file}$ = UTF-16编码的文件路径 + 空终止符 # $\oplus$ 表示字节级连接操作 class DROPFILES(Structure): _fields_ = [ ("pFiles", c_uint), # 偏移量 ("x", c_long), # 鼠标X坐标 ("y", c_long), # 鼠标Y坐标 ("fNC", c_int), # 非客户端区域标志 ("fWide", c_bool) # Unicode路径标志 ] def setClipboardFile(image_path): """ 设置剪切板为文件路径(兼容微信的CF_HDROP格式) 返回: 成功True,失败False """ try: # 验证文件存在性 if not os.path.exists(image_path): print(f"图片不存在: {image_path}") return False # 创建DROPFILES结构 pDrop = DROPFILES() pDrop.pFiles = sizeof(DROPFILES) # 文件列表偏移量 pDrop.fWide = True # 启用Unicode # 构造完整数据结构: 头 + UTF-16路径 file_bytes = (os.path.abspath(image_path) + '\0').encode('utf-16le') data = bytes(pDrop) + file_bytes # 设置剪切板 win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardData(win32clipboard.CF_HDROP, data) win32clipboard.CloseClipboard() return True except Exception as e: print(f'剪贴板设置失败: {e}') return False def send_msg(content, msg_type=1): """ 发送消息到微信 msg_type: 1=文本, 2=位图, 3=文件路径(推荐) """ wechatWindow = auto.WindowControl( searchDepth=1, Name=f"{wx_groupName}") wechatWindow.SetActive() time.sleep(0.5) edit = wechatWindow.EditControl() try: if msg_type == 1: # 文本 auto.SetClipboardText(content) elif msg_type == 2: # 位图 auto.SetClipboardBitmap(auto.Bitmap.FromFile(content)) elif msg_type == 3: # 文件路径 if not setClipboardFile(content): return edit.SendKeys('{Enter}') edit.SendKeys('{Ctrl}v') time.sleep(0.5) edit.SendKeys("{Enter}") return True except Exception as e: print(f"消息发送失败: {e}") return False def Start(): """初始化程序""" # 重置图片缓存 with open(f'{path}/tem/list.png', 'rb') as sc1: con = sc1.read() for k in devices: with open(f'{path}/new_{k}_list.png', 'wb') as f: f.write(con) with open(f'{path}/tem/playerList.png', 'rb') as sc: con = sc.read() for k in devices: with open(f'{path}/old_{k}_playerList.png', 'wb') as f: f.write(con) with open(f'{path}/new_{k}_playerList.png', 'wb') as f: f.write(con) # 启动监听线程 for k in devices: t = threading.Thread(target=Listening, args=(k,)) t.start() print('预警系统已启动') context = f"预警系统已上线,监测星系列表:\n{list(devices.keys())}" mutex.acquire() send_msg(context, msg_type=1) mutex.release() def screenc(filename, num): """执行ADB截图""" os.system(f'adb -s {devices[filename][0]} exec-out screencap -p > {path}/{filename}_{num}.png') def crop(x1, y1, x2, y2, scFileName, svFileName): """图像裁剪""" try: img = Image.open(scFileName) re = img.crop((x1, y1, x2, y2)) re.save(svFileName) img.close() except Exception as e: print(f"图像裁剪失败: {e}") def LoadImage(img1, img2): """加载图像为灰度图""" i1 = cv2.imread(img1, 0) i2 = cv2.imread(img2, 0) return i1, i2 def IF_Img_I(src, mp): """ 图像相似度检测 返回: (是否不同, 相似度分数) """ try: res = cv2.matchTemplate(src, mp, cv2.TM_CCOEFF_NORMED) _, mac_v, _, _ = cv2.minMaxLoc(res) return mac_v < 0.99, mac_v except Exception as e: print(f"图像匹配失败: {e}") return False, 0.0 def SendGameMassage(tag): """在游戏内发送警报消息""" str1 = f'adb -s {devices[tag][0]} ' taps = [ (211, 478), # 打开聊天 tuple(map(int, sendTo.split())), # 选择频道 (266, 520), # 点击输入框 (870, 511), # 点击发送 (68, 292), # 确认操作1 (250, 350), # 确认操作2 (250, 433), # 确认操作3 (344, 190), # 关闭弹窗 (342, 512) # 返回主界面 ] for tap in taps: os.system(str1 + f'shell input tap {tap[0]} {tap[1]}') time.sleep(0.2) def SendWeChat(tag, num): """向微信发送警报""" if wx_groupName == '星海预警': # 测试模式 return img_path = f'{path}/{tag}_{num}.png' mutex.acquire() # 发送图片(使用文件路径模式) send_result = send_msg(img_path, msg_type=3) # 发送文本 if send_result: context = f"{tag}{wx_context}" send_msg(context, msg_type=1) mutex.release() def Listening(tag): """设备监听主循环""" def ship_detection(tag): """舰船列表检测子线程""" num = 0 while True: screenc(tag, 1) time.sleep(0.5) crop(918, 44, 956, 153, f'{path}/{tag}_1.png', f'{path}/new_{tag}_list.png') # 图像差异检测 i3, i4 = LoadImage(f"{path}/new_{tag}_list.png", f"{path}/tem/list.png") list_status, list_mac_v = IF_Img_I(i3, i4) # 二次验证机制 if list_mac_v < 0.10 and list_mac_v != 0.0: if num < 1: num += 1 time.sleep(2) continue print(f'{tag}检测到舰船列表变化 (相似度: {list_mac_v:.2f})') SendWeChat(tag, 1) i1, i2 = LoadImage(f"{path}/new_{tag}_playerList.png", f"{path}/old_{tag}_playerList.png") cv2.imwrite(f'{path}/old_{tag}_playerList.png', i1) time.sleep(40) num = 0 # 启动舰船检测线程 threading.Thread(target=ship_detection, args=(tag,), daemon=True).start() # 主检测循环 while True: screenc(tag, 2) time.sleep(conVal + 0.35) crop(774, 502, 956, 537, f'{path}/{tag}_2.png', f'{path}/new_{tag}_playerList.png') # 加载并比较图像 i1, i2 = LoadImage(f"{path}/new_{tag}_playerList.png", f"{path}/old_{tag}_playerList.png") list_status, list_mac_v = IF_Img_I(i1, i2) # 错误检测: 相似度过低 if list_mac_v <= 0.01: print(f'{tag}系统故障,相似度过低') mutex.acquire() send_msg(f"{tag}系统故障,相似度{list_mac_v:.4f},即将下线", msg_type=1) mutex.release() time.sleep(3) os._exit(1) # 检测到显著变化 if list_status: print(f'{tag}检测到本地警报 (相似度: {list_mac_v:.2f})') SendGameMassage(tag) SendWeChat(tag, 2) cv2.imwrite(f'{path}/old_{tag}_playerList.png', i1) def elevate_privileges(): try: if windll.shell32.IsUserAnAdmin() == 0: windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 1) sys.exit(0) except Exception as e: print(f"权限提升失败: {e}") # ==== 程序入口 ==== if __name__ == "__main__": elevate_privileges() # 新增权限检查 Start()
10-13
import os import time import threading import ctypes import sys from PIL import Image, ImageFile, UnidentifiedImageError ImageFile.LOAD_TRUNCATED_IMAGES = True import cv2 import uiautomation as auto import win32clipboard import win32con from ctypes import * import tempfile # ===== 权限提升函数 ===== def elevate_privileges(): """确保程序以管理员权限运行""" try: if windll.shell32.IsUserAnAdmin() == 0: windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 1) sys.exit(0) return True except Exception as e: print(f"权限提升失败: {e}") return False # ===== 配置参数 ===== wx_groupName = '星海预警' wx_context = '星系警告!!!---疯子出品,必数精品' conVal = 2 path = 'D:/EVE_A_Eye-main/EVE_A_Eye' devices = { 'QO2UL': [ '127.0.0.1:5555', False ], } gameSendPosition = { '第二频道': '38 117', '第三频道': '38 170', '第四频道': '38 223', '第五频道': '38 278', '第六频道': '38 332', '第七频道': '38 382' } sendTo = gameSendPosition['第三频道'] mutex = threading.Lock() # ===== 剪贴板操作强化 ===== class DROPFILES(Structure): """文件拖放操作的剪切板数据结构""" _fields_ = [ ("pFiles", c_uint), # 偏移量 ("x", c_long), # 鼠标X坐标 ("y", c_long), # 鼠标Y坐标 ("fNC", c_int), # 非客户端区域标志 ("fWide", c_bool) # Unicode路径标志 ] def safe_set_clipboard(img_path, max_retries=3): """线程安全的剪贴板文件操作""" for attempt in range(max_retries): try: # 验证文件存在性 if not os.path.exists(img_path): print(f"图片不存在: {img_path}") return False # 创建DROPFILES结构 pDrop = DROPFILES() pDrop.pFiles = sizeof(DROPFILES) pDrop.fWide = True # 启用Unicode # 构造完整数据结构 file_bytes = (os.path.abspath(img_path) + '\0').encode('utf-16le') data = bytes(pDrop) + file_bytes # 安全设置剪贴板 win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardData(win32clipboard.CF_HDROP, data) win32clipboard.CloseClipboard() return True except Exception as e: print(f'剪贴板设置失败(尝试 {attempt+1}/{max_retries}): {e}') time.sleep(0.5) return False def activate_wechat(): """激活并置顶微信窗口(通过搜索群聊名称)""" max_retries = 3 for attempt in range(max_retries): try: # 唤醒微信 auto.SendKeys('{Ctrl}{Alt}w') time.sleep(1) # 等待微信主窗口出现 # 获取微信主窗口 wechat_main = auto.WindowControl(ClassName='WeChatMainWndForPC', Depth=1) if wechat_main.Exists(5): wechat_main.SetTopmost(True) # 查找搜索框 search_edit = wechat_main.EditControl(Name='搜索', Depth=12) if search_edit.Exists(5): # 清空搜索框并输入群聊名称 search_edit.Click() time.sleep(0.2) search_edit.SendKeys('{Ctrl}a}{Del}') time.sleep(0.2) search_edit.SendKeys(wx_groupName) time.sleep(1) # 等待搜索结果 # 选择第一个搜索结果(群聊) search_result = wechat_main.ListItemControl(Name=wx_groupName, Depth=1, foundIndex=1) if search_result.Exists(5): search_result.DoubleClick() # 双击打开群聊 time.sleep(0.5) # 获取群聊窗口(注意:群聊窗口的Name是群聊名称) group_window = auto.WindowControl(ClassName='ChatWnd', Name=wx_groupName) if group_window.Exists(5): group_window.SetActive() group_window.SetTopmost(True) return True else: print(f"第{attempt+1}次尝试:未找到群聊: {wx_groupName}") else: print(f"第{attempt+1}次尝试:未找到搜索框") else: print(f"第{attempt+1}次尝试:微信主窗口未找到") except Exception as e: print(f"激活微信窗口异常: {e}") time.sleep(1) return False def send_msg(content, msg_type=1): """ 发送消息到微信 msg_type: 1=文本, 2=位图, 3=文件路径(推荐) """ if not activate_wechat(): return False # 在群聊窗口中查找输入框 group_window = auto.WindowControl(ClassName='ChatWnd', Name=wx_groupName) if not group_window.Exists(3): print("群聊窗口未找到") return False # 尝试定位输入框 edit = group_window.EditControl(Depth=9, ClassName='Edit', foundIndex=3) if not edit.Exists(3): # 尝试其他方式 edits = group_window.GetChildren(className='Edit') if len(edits) >= 3: # 通常有多个编辑框,输入框是第三个 edit = edits[2] elif len(edits) > 0: edit = edits[-1] else: print("未找到输入框") return False try: if msg_type == 1: # 文本 auto.SetClipboardText(content) time.sleep(0.5) elif msg_type == 2: # 位图 auto.SetClipboardBitmap(auto.Bitmap.FromFile(content)) time.sleep(0.5) elif msg_type == 3: # 文件路径 if not safe_set_clipboard(content): return False time.sleep(0.5) # 粘贴并发送 edit.SendKeys('{Ctrl}v', waitTime=100) time.sleep(0.5) edit.SendKeys("{Enter}", waitTime=100) return True except Exception as e: print(f"消息发送失败: {e}") return False # ===== 图像处理函数 ===== def screenc(filename, num): """执行ADB截图""" os.system(f'adb -s {devices[filename][0]} exec-out screencap -p > {path}/{filename}_{num}.png') def crop(x1, y1, x2, y2, scFileName, svFileName): """图像裁剪""" try: img = Image.open(scFileName) re = img.crop((x1, y1, x2, y2)) re.save(svFileName) img.close() return True except Exception as e: print(f"图像裁剪失败: {e}") return False def LoadImage(img1, img2): """加载图像为灰度图""" i1 = cv2.imread(img1, 0) i2 = cv2.imread(img2, 0) return i1, i2 def IF_Img_I(src, mp): """ 图像相似度检测 返回: (是否不同, 相似度分数) """ try: res = cv2.matchTemplate(src, mp, cv2.TM_CCOEFF_NORMED) _, mac_v, _, _ = cv2.minMaxLoc(res) # 相似度阈值公式: $T_s = 0.99 - \frac{1}{resolution}$ return mac_v < 0.98, mac_v except Exception as e: print(f"图像匹配失败: {e}") return False, 0.0 # ===== 警报发送函数 ===== def SendGameMassage(tag): """在游戏内发送警报消息""" str1 = f'adb -s {devices[tag][0]} ' taps = [ (211, 478), # 打开聊天 tuple(map(int, sendTo.split())), # 选择频道 (266, 520), # 点击输入框 (870, 511), # 点击发送 (68, 292), # 确认操作1 (250, 350), # 确认操作2 (250, 433), # 确认操作3 (344, 190), # 关闭弹窗 (342, 512) # 返回主界面 ] for tap in taps: os.system(str1 + f'shell input tap {tap[0]} {tap[1]}') time.sleep(0.2) def SendWeChat(tag, num): """向微信发送警报""" img_path = f'{path}/{tag}_{num}.png' mutex.acquire() # 发送图片(使用文件路径模式) send_result = send_msg(img_path, msg_type=3) # 发送文本 if send_result: context = f"{tag}{wx_context}" send_msg(context, msg_type=1) print(f"警报发送成功: {tag}") else: print(f"警报发送失败: {tag}") mutex.release() # ===== 监听核心 ===== def ship_detection(tag): """舰船列表检测子线程""" num = 0 while True: screenc(tag, 1) time.sleep(0.5) crop(918, 44, 956, 153, f'{path}/{tag}_1.png', f'{path}/new_{tag}_list.png') # 图像差异检测 i3, i4 = LoadImage(f"{path}/new_{tag}_list.png", f"{path}/tem/list.png") list_status, list_mac_v = IF_Img_I(i3, i4) # 二次验证机制 if list_mac_v < 0.10 and list_mac_v != 0.0: if num < 1: num += 1 time.sleep(2) continue print(f'{tag}检测到舰船列表变化 (相似度: {list_mac_v:.2f})') SendWeChat(tag, 1) i1, i2 = LoadImage(f"{path}/new_{tag}_playerList.png", f"{path}/old_{tag}_playerList.png") cv2.imwrite(f'{path}/old_{tag}_playerList.png', i1) time.sleep(40) num = 0 def Listening(tag): """设备监听主循环""" # 启动舰船检测线程 threading.Thread(target=ship_detection, args=(tag,), daemon=True).start() # 主检测循环 while True: screenc(tag, 2) time.sleep(conVal + 0.35) crop(774, 502, 956, 537, f'{path}/{tag}_2.png', f'{path}/new_{tag}_playerList.png') # 加载并比较图像 i1, i2 = LoadImage(f"{path}/new_{tag}_playerList.png", f"{path}/old_{tag}_playerList.png") list_status, list_mac_v = IF_Img_I(i1, i2) # 错误检测: 相似度过低 if list_mac_v <= 0.01: print(f'{tag}系统故障,相似度过低') mutex.acquire() send_msg(f"{tag}系统故障,相似度{list_mac_v:.4f},即将下线", msg_type=1) mutex.release() time.sleep(3) os._exit(1) # 检测到显著变化 if list_status: print(f'{tag}检测到本地警报 (相似度: {list_mac_v:.2f})') SendGameMassage(tag) SendWeChat(tag, 2) cv2.imwrite(f'{path}/old_{tag}_playerList.png', i1) # ===== 初始化函数 ===== def Start(): """初始化程序""" # 重置图片缓存 with open(f'{path}/tem/list.png', 'rb') as sc1: con = sc1.read() for k in devices: with open(f'{path}/new_{k}_list.png', 'wb') as f: f.write(con) with open(f'{path}/tem/playerList.png', 'rb') as sc: con = sc.read() for k in devices: with open(f'{path}/old_{k}_playerList.png', 'wb') as f: f.write(con) with open(f'{path}/new_{k}_playerList.png', 'wb') as f: f.write(con) # 启动监听线程 for k in devices: t = threading.Thread(target=Listening, args=(k,)) t.daemon = True t.start() print('预警系统已启动') context = f"预警系统已上线,监测星系列表:\n{list(devices.keys())}" mutex.acquire() send_msg(context, msg_type=1) mutex.release() # ===== 主程序入口 ===== if __name__ == "__main__": if elevate_privileges(): Start() # 保持主线程运行 while True: time.sleep(3600) # 每小时检查一次
10-13
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值