如何检查 Windows 文件索引是否打开或关闭
C 中是否有一个 API 可用于检查文件索引是否打开或关闭? 代码受到赞赏。
Is there an API in C that I can use to check whether file indexing is on or off?
Code is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
WMI 在 C++ 中是一个痛苦,但本机服务 API 非常干净。
WMI is a pain in C++, but the native Service API is pretty clean.
WMI 可以提供此功能,使用 Win32_Service 类。在“C”中执行此操作很麻烦,SDK 仅提供 C++ 示例。这是等效的 C# 代码:
WMI can provide this, use the Win32_Service class. Doing this in 'C' is fugly, the SDK only provides C++ samples. This is the equivalent C# code:
迂腐地说,C 编程语言不了解 Windows 文件索引或其他特定于平台的功能。 ISO C 标准指定了一组严格的 API,例如字符串处理、文件处理(打开、关闭等)、算术运算等,并指定和定义了它们所作用的原语。这些操作与底层平台无关。所有这些 API 都由语言规范本身非常严格地定义(有关当前参考,请参阅 ISO C99 标准)。
您必须依赖外部(对于语言)库来获取您想要的 API(用于查明文件索引是否打开或关闭的 API)。因此,您想要了解的是 a) 这个库是什么 b) 从这个库使用什么 API 来从您的 C 程序调用以及 c) 如何将此库链接到您的应用程序等等。
To be pedantic, the C programming language does not have any knowledge of Windows file indexing or for that matter other platform-specific features. The ISO C standard specifies a strict set of API like for string handling, file handling (open, close etc.), arithmetic operations etc. and specifies and defines the primitive they act upon. These operations are agnostic of the underlying platform. All of these API are defined very strictly by the language specification itself (see ISO C99 standard for a current reference).
You would have to rely on an external (to the language) library to get the API you desire (API to find out whether the file indexing is on or off). So what you want to find out is a) what this library is b) what API to use from this library to call from your C program and c) how to link this library to your application among other things.