设备对象中的标志如何清晰

发布于 2025-02-03 13:42:43 字数 168 浏览 2 评论 0原文

这两个代码相等吗?(清除标志)

ClearFlag(NewDeviceObject->Flags, DO_DEVICE_INITIALIZING);

NewDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;

Are these two Code equal?(clear flag)

ClearFlag(NewDeviceObject->Flags, DO_DEVICE_INITIALIZING);

NewDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

丢了幸福的猪 2025-02-10 13:42:43

是的,它们是平等的。

与API不同,clearflag是宏。您可以输入与之编译的ntifs.h并查看。微软不会像这样更改宏,因为那样您将无法在任何旧窗口上使用相同的二进制文件(这不是他们喜欢的东西)。这就是为什么只有类似的小型公用事业。

无论如何,使用宏是一个更好的练习,并且更清洁,因此请像使用其他赢的宏一样使用它,而不会因相同的原因而不会更改(这不是一个不使用它的错误)。

Yes they are equal.

Unlike APIs, ClearFlag is a macro. You can enter the ntifs.h that you compile with and see it. Microsoft doesn't change macros like this, because then you won't be able to use the same binary on any older windows (which is not something they like). This is why only small utilities like that are inlined.

Anyway it's a much better practice and much cleaner to use the macro, so use it like you use other win macro that won't be changed for same reasons (it's just not a bug not using it).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文