开发者

What is the difference between NtFsControlFile() and DeviceIoControl() functions?

Are there any places where one is preferable to another? Is there a performance 开发者_运维技巧impact to using one over the other?


@Alex K.: Small remark: NtFsControlFile is documented in http://msdn.microsoft.com/en-us/library/ff566462(v=VS.85).aspx. Kernel mode application should use ZwFsControlFile function and user mode application can use NtFsControlFile.

@vedang: From you question I would assume that you don't a developer of kernel mode driver. So I will strictly recommend you to use only DeviceIoControl to send FSCTL_XXX codes http://msdn.microsoft.com/en-us/library/aa364230(v=VS.85).aspx.

Only if you plan to write an application which don't use Win32 subsystem and use NT native subsystem only like a small checkdisk application or disk defragmentation application which run at the beginning of the windows start (see session manager registry key) than you will have advantage in using of NtFsControlFile. In all cases of usual work you should use only DeviceIoControl.


I have no idea about implementation, but NtFsControlFile is an undocumented kernel internal and it's use comes with the risk that it will disappear/change implementation at some point in the future, whereas DeviceIoControl is part of the public Win32 API.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜