问题分析
在卸载Steam重新安装后,所有之前安装的游戏Steam桌面图标变白。
这是由于卸载Steam后C:\Program Files (x86)\Steam\steam\games内缓存的文件图标丢失导致的
以文本方式打开桌面图标,以CS2为例:
[InternetShortcut]
IDList=
IconIndex=0
URL=steam://rungameid/730
IconFile=C:\Program Files (x86)\Steam\steam\games\324b323045b09bace182f928f4104dfcd93cb7f3.ico
发现IconFile指向的文件不存在。
问题解决
通过Steamdb发现Clienticon的URL为以下格式
图标文件名可以通过解析快捷方式的文件获得,appid可以通过截取快捷方式中URL的后半部分获得。通过枚举桌面文件的扩展名判断是否是快捷方式,通过读取URL是否以Steam开头可以判断是否是Steam游戏。
最后,通过以下代码刷新图标缓存
system("taskkill /f /im explorer.exe");
system(R"(attrib -h -s -r "%userprofile%\AppData\Local\IconCache.db")");
system(R"(del /f "%userprofile%\AppData\Local\IconCache.db")");
system(R"(attrib /s /d -h -s -r "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\*")");
system(R"(del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_32.db")");
system(R"(del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_96.db")");
system(R"(del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_102.db")");
system(R"(del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_256.db")");
system(R"(del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_1024.db")");
system(R"(del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_idx.db")");
system(R"(del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_sr.db")");
system("echo y reg delete \"HKEY_CLASSES_ROOT\\Local Settings\\Software\\Microsoft\\Windows\\CurrentVersion\\TrayNotify\" /v IconStreams");
system("echo y reg delete \"HKEY_CLASSES_ROOT\\Local Settings\\Software\\Microsoft\\Windows\\CurrentVersion\\TrayNotify\" /v PastIconsStream");
system("start explorer");
最后说下踩的坑
1.curl用minGW直接编译出不来lib文件,需要用nmake编译
2.下载文件FILE要用wb方式二进制打开
Comments | 5 条评论
博主 Rosa Barnes
I have been surfing online greater than 3 hours as of late, but
I by no means discovered any fascinating article
like yours. It is lovely price sufficient for me.
In my opinion, if all webmasters and bloggers made good content as you probably
did, the web will likely be a lot more useful than ever before.
博主 Brent Johnson
Hi there, i read your blog from time to time and i own a similar one and i was just wondering if you get
a lot of spam remarks? If so how do you prevent it,
any plugin or anything you can advise? I get
so much lately it’s driving me crazy so any assistance is very much appreciated.
博主 TheLGF
干得好!但是,对于已固定在 Windows 10 的“开始”菜单中的磁贴,它们不起作用
博主 X22TOg
Hey people!!!!!
Good mood and good luck to everyone!!!!!
博主 XRumer23TOg
Hey people!!!!!
Good mood and good luck to everyone!!!!!