C#和JAVA函数是否在内部调用win32 API? [英] Does C# and JAVA functions internally calls win32 API ?

查看:66
本文介绍了C#和JAVA函数是否在内部调用win32 API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,所有进程都将加载Windows库,例如kernel32.dll,kernelbase.dll等...

According to my knowledge, all process will load windows libraries like kernel32.dll, kernelbase.dll etc...

win32 api函数依次从ntdll.dll调用函数以与OS通讯.

The win32 api functions in turn call functions from ntdll.dll to talk with OS.

[如果有误,请纠正我]

[please correct me if am wrong]

C#,Java程序也将在后台调用Win32 API吗?

So does C#, java programs will also call win32 APIs in background ?

例如,以下代码用于读取C#文件,

For example, below code is for Read a file in C#,

string text = File.ReadAllText(@"c:\file.txt", Encoding.UTF8

此调用win32 api函数ReadFile()吗?

Will this call win32 api function ReadFile() ?

请给我详细的解释.

我完全感到困惑.

推荐答案

对于C#,可以使用以下来源进行调查 File 类[ https://referencesource.microsoft.com/#mscorlib/system/io/file.cs ]以及 StreamReader FileStream .虚拟的 FileStream.Read 使用以下命令读取字节 来自Kernel32.dll的 ReadFile . 此本机函数显示为 "Win32Native.ReadFile" .

In case of C#, this can be investigated using the sources of File class [https://referencesource.microsoft.com/#mscorlib/system/io/file.cs], as well as StreamReader and FileStream. The virtual FileStream.Read reads bytes using ReadFile from Kernel32.dll. This native function appears as ‘Win32Native.ReadFile’ in the sources.


这篇关于C#和JAVA函数是否在内部调用win32 API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆