【问题标题】:Get a list of installed Mini Filter driver in windows获取 Windows 中已安装的 Mini Filter 驱动程序列表
【发布时间】:2013-10-08 11:05:52
【问题描述】:

我想获取 MS Windows 中已安装的 Mini-Filter 驱动程序的列表,但我不知道该怎么做。

我的编程语言是 Delphi(我也可以使用 C 或 C++),谁能帮我做这个?

【问题讨论】:

  • 有一个内核API函数名为FltEnumerateFiltersmsdn.microsoft.com/en-us/library/windows/hardware/…
  • 在普通的 WinAPI 中,您可能可以尝试注册表,例如HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\FltMgr\Enum
  • @JensMühlenhoff :是否可以在用户级应用程序中使用此 API 函数( FltEnumerateFilters )?或者我必须在内核领域使用它?
  • @BehroozAbbassi,为什么注册表不起作用,Windows 本身取决于该信息,我会说它非常值得信赖。
  • 你的论点没有道理。 Windows 本身遵循注册表。根据定义,如果您的迷你驱动程序列在 reg 中。这是一个迷你驱动程序。注册表定义了哪些文件是迷你驱动程序,仅此而已。因此,根据定义,注册表是正确的。迷你驱动程序是否是恶意软件无关紧要。如果存在恶意软件,则另一种方法也会将其列为迷你驱动程序。仅仅因为迷你驱动程序恰好是恶意软件并不会使其不再是迷你驱动程序,它只是对您不利而不是对您有利。

标签: c++ delphi driver minifilter


【解决方案1】:

以下代码使用注册表枚举项:

implementation

{$R *.dfm}

uses Registry;

procedure TForm17.Button1Click(Sender: TObject);
var
  Reg: TRegistry;
  count: integer;
  i: integer;
  Item: string;
  AllOK: boolean;
begin
  Reg:= TRegistry.Create(KEY_READ);
  try
    Reg.RootKey:= HKEY_LOCAL_MACHINE; //Note must set the base first.
    //Then open rest of the subtree underneigh.
    AllOK:= Reg.OpenKeyReadOnly('SYSTEM\CurrentControlSet\services\FltMgr\Enum');
    if (AllOK) then begin
      count:= Reg.ReadInteger('Count');
      for i:= 0 to count - 1 do begin
        Item:= Reg.ReadString(IntToStr(i));
        Memo1.Lines.Add(Item);
      end; {for}
    end else {not(AllOK)} begin
      Memo1.Lines.Add('SYSTEM\CurrentControlSet\services\FltMgr\Enum does not exist');
      exit;
    end;
  finally
    Reg.Free;
  end;
end;

返回的条目如下所示:Root\LEGACY_FLTMGR\0000
Root 是对 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root 的引用。 对于上述条目,您可以从以下位置获取所有信息:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\LEGACY_FLTMGR\0000

这个条目看起来像这样:

【讨论】:

  • +您可以将您的结果与fltmc filters 进行比较(来自提升的 cmd 提示符)。
【解决方案2】:

我们可以在用户区使用(例如)以下 API 函数来获取 MS Windows 中已安装的 Mini-Filter 驱动程序的列表 :-)。

FilterFindFirst
FilterFindNext

有关更多信息,请参阅此链接: Minifilter User-Mode Application Functions

【讨论】:

    【解决方案3】:

    枚举所有微型过滤器驱动程序的最佳方法是通过命令行fltmc。 确保以管理员身份打开 CMD,然后输入“fltmc”。 然后,由于您正在寻找一种以编程方式执行此操作的方法,只需使用ShellExecuteEx 从您的程序中调用此命令。这显示在this article 中。 这样做的正确方法是:

    ShellExecute( NULL, "open",
        "cmd.exe",
        "fltmc.exe",
        NULL,
        SW_SHOWNORMAL
    );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-31
      • 1970-01-01
      • 1970-01-01
      • 2016-11-06
      • 1970-01-01
      • 2022-01-14
      • 1970-01-01
      • 2015-11-19
      相关资源
      最近更新 更多