Windows 上的系统调用 [英] System calls on Windows

查看:26
本文介绍了Windows 上的系统调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想问一下,我知道 Linux 中的标准系统调用是通过指向中断向量表的 int 指令完成的.我认为这在 Windows 上是类似的.但是,您如何调用某些更高级别的特定系统例程?比如你怎么告诉Windows创建一个窗口?我知道这是由 dll 中的代码处理的,但是在汇编指令级别实际发生了什么?dll中的例程是否通过int指令调用软件中断,或者有什么不同的方法来处理这个问题?谢谢.

I just want to ask, I know that standart system calls in Linux are done by int instruction pointing into Interrupt Vector Table. I assume this is similiar on Windows. But, how do you call some higher-level specific system routines? Such as how do you tell Windows to create a window? I know this is handled by the code in the dll, but what actually happend at assembler-instruction level? Does the routine in dll calls software interrupt by int instruction, or is there any different approach to handle this? Thanks.

推荐答案

进行 Win32 调用以创建窗口与中断并没有真正的关系.客户端应用程序已与提供调用的 .dll 链接,该调用公开链接器使用的地址.由于您是在询问调用机制的差异,因此我将此处的讨论限制在可用于任何应用程序的 Win32 调用,而不是内核级调用或设备驱动程序.在汇编语言级别,它与任何其他函数调用相同,因为大多数 Win32 调用是用户级调用,它们在内部进行所需的内核调用.链接器提供 Win32 函数的地址作为某种分支指令的目标,具体取决于编译器.

Making a Win32 call to create a window is not really related to an interrupt. The client application is already linked with the .dll that provides the call which exposes the address for the linker to use. Since you are asking about the difference in calling mechanism, I'm limiting the discussion here to those Win32 calls that are available to any application as opposed to kernel-level calls or device drivers. At an assembly language level, it would be the same as any other function call since most Win32 calls are user-level calls which internally make the needed kernel calls. The linker provides the address of the Win32 function as the target for some sort of branching instruction, the specifics would depend on the compiler.

看起来您对中断和 int 是正确的.矢量表.CodeGuru 有一篇很好的文章,其中详细介绍了 NT 内核调用的工作原理.链接:
http://www.codeguru.com/cpp/wp/system/devicedriverdevelopment/article.php/c8035

It looks like you are right about the interrupts and the int. vector table. CodeGuru has a good article with the OS details on how NT kernel calls work. Link:
http://www.codeguru.com/cpp/w-p/system/devicedriverdevelopment/article.php/c8035

这篇关于Windows 上的系统调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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