我正在寻找一种在 C# 中启用(而不是禁用)Windows Defender 的方法。
我在msdn上找到了这个函数
HRESULT WDEnable(
_In_ BOOL fEnable
);
我可以使用它,但是它的 MpClient.dll 部分在我的系统上找不到,所以我不能使用 LoadLibrary/GetProcAddress/GetDelegateForFunctionPointer
有人知道另一种方法吗?
我应该指出,这是针对需要检查 Windows Defender 是否已启用(已经编码并运行)以及是否未启用的合法软件。
谢谢
最佳答案
注册表项有一些访问限制,以防止在用户上下文中运行的任何进程将其关闭。对于病毒来说,防止它被发现真的很容易。要启用它,您必须在管理员上下文中运行。尝试以管理员身份运行您的进程,看看您是否可以通过这种方式更改注册表项。
来自 msdn 文档: 备注
The application calling this function must run with administrator permissions on the local computer. Windows Defender also validates (1) the proper signing of the calling process and all loaded modules and (2) that the IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY flag is set on the calling process and all loaded modules before allowing the calling application to change the status. If the calling process image (or any loaded modules) is not signed or is flagged as a threat by the Windows Defender signature, then the call fails with the appropriate error code.
关于c# - 如何在 C# 中启用 Windows Defender,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30616109/