我可以用Delphi 2010编写Windows驱动程序吗? [英] Can I write Windows drivers with Delphi 2010?

查看:170
本文介绍了我可以用Delphi 2010编写Windows驱动程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直听说 Delphi 几乎可以做任何C ++可以做的事情...除了写Windows驱动程序。这是正确的,如果是这样,为什么呢?

I've always heard that Delphi can do almost anything C++ can do...except write Windows drivers. Is this correct, and if so, why is that?

我最近在网上阅读了一篇博客文章,可能会显示使用Delphi编写驱动程序的可能解决方案,但是它已经3年了,我不知道这些信息的准确程度。

I recently read a blog post online that may indicate a possible solution for writing drivers with Delphi, but it's 3 years old and I don't know how accurate this information is.

所以,最新版本的Delphi(2010),在技术上可以写一个Windows驱动程序?

So, with the latest version of Delphi (2010), would it be technically possible to write a Windows driver?

推荐答案

在技术上可能用Delphi编写一些驱动程序,但是就一般的答案而言,我会说:你不能用Delphi轻松编写驱动程序

It may be technically possible to write some drivers with Delp but as far as a general answer goes, I'd say: you can't easily write drivers with Delphi.

首先,用户模式驱动程序(UMDF)驱动程序和内核模式(KMDF)驱动。使用Delphi可以使用UMDF驱动程序。 KMDF驱动程序是不容易的,因为

First, there's a difference between user-mode driver (UMDF) drivers and kernel-mode (KMDF) drivers. UMDF drivers should be possible with Delphi. KMDF drivers aren't easily possible though, because

1)Delphi的链接器不能生成它们,

1) Delphi's linker can't produce them and

2)Delphi的对象文件格式与Microsoft链接器默认使用的COFF格式不同。

2) Delphi's object file format is different from the COFF format the Microsoft linker uses by default.

3)Delphi的RTL假定它存在于用户模式下,可能会某些东西在内核地不应该做(我认为例如处理异常的方式;也有不同的内存管理),所以你必须非常小心哪些RTL功能是安全的使用。系统和SysInit单位也遇到困难(参见Ritsaert Hornstra对另一个答案的评论)。

3) Delphi's RTL makes the assumption it lives in user-mode and may do certain things that one shouldn't do in kernel-land (I think e.g. of the way exceptions are handled; also different memory management), so you'd have to be very careful on which RTL functions are safe to use. There are also difficulties with System and SysInit units (see the comment by Ritsaert Hornstra to another answer here).

我不是说这些不是不可能的问题克服(参考你链接到的帖子),如果你真的很专业,但这并不简单。

I'm not saying these aren't problems that cannot be overcome (cf. the post you link to) if you're really dedicated, but it won't be straightforward.

其次,KMDF驱动(我不知道关于UMDF,实际上 - 有人可以评论吗?)对于Win64必须是64位代码。由于目前没有64位的Delphi编译器,写的是一个明确的no-no。

Secondly, KMDF drivers (I don't know about UMDF, actually - can anyone comment?) for Win64 have to be in 64-bit code. Since currently, there is no 64-bit Delphi compiler, writing them is a definite no-no.

这篇关于我可以用Delphi 2010编写Windows驱动程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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