.automaticDestinations-ms文件和.customDestinations-ms文件是Windows操作系统中用于存储任务栏和开始菜单的快捷方式的文件。它们存储了用户最近打开的文件和应用程序的信息。

区别:

  1. automaticDestinations-ms文件存储了用户最近打开的文件和应用程序的信息,而customDestinations-ms文件存储了用户自定义的快捷方式。
  2. automaticDestinations-ms文件是系统自动创建和更新的,而customDestinations-ms文件是由用户手动创建和管理的。

在C#中读取和解密这些文件,可以使用ShellLink类和ShellLinkHelper类。

读取.automaticDestinations-ms文件的示例代码如下:

using Microsoft.WindowsAPICodePack.Shell;

// 获取.automaticDestinations-ms文件的路径
string filePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Microsoft\Windows\Recent\AutomaticDestinations\";
string fileName = "1b4dd67f29cb1962.automaticDestinations-ms";
string fullPath = filePath + fileName;

// 创建ShellLink对象
ShellLink shellLink = new ShellLink();

// 读取.automaticDestinations-ms文件
shellLink.Load(fullPath);

// 获取最近打开的文件和应用程序信息
foreach (var link in shellLink.Links)
{
    // 处理每个链接
}

解密.customDestinations-ms文件的示例代码如下:

using Microsoft.WindowsAPICodePack.Shell;

// 获取.customDestinations-ms文件的路径
string filePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Microsoft\Windows\Recent\CustomDestinations\";
string fileName = "f01b4d95cf55d32a.customDestinations-ms";
string fullPath = filePath + fileName;

// 创建ShellLinkHelper对象
ShellLinkHelper shellLinkHelper = new ShellLinkHelper();

// 读取.customDestinations-ms文件
shellLinkHelper.Load(fullPath);

// 获取用户自定义的快捷方式信息
foreach (var link in shellLinkHelper.Links)
{
    // 处理每个链接
}

需要注意的是,为了运行上述代码,需要先安装WindowsAPICodePack库,可通过NuGet包管理器安装

automaticDestinations-ms文件和customDestinations-ms有什么区别?它们如何用C#读取和解密?

原文地址: https://www.cveoy.top/t/topic/infd 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录