问题描述
这只是一个半途而废的编程问题.首先,我有一个 PCI-Express 卡和 32/64 位驱动程序.目标操作系统必须是 Windows 64 位系统.我读到在 Vista64 下所有驱动程序都必须经过认证的 64 位驱动程序.这是 64 位操作系统下的一般限制吗?这是否也适用于XP 64"或任何 Linux 系统?
This is only a half-way programming question. First of all I have a PCI-Express card and 32/64 bit drivers. The target operating system has to be a Windows 64 bit system. I read that under Vista64 all drivers have to be certified 64 bit drivers. Is this a general restriction under 64 bit operating systems and does this also apply to "XP 64" or any Linux system?
所以为了简单起见,假设我在 Vista64 下为我的 PCIe 卡使用 64 位驱动程序,并且有一堆 64 位 DLL 来使用卡功能.另一方面,有一个大型的传统 32 位 exe 程序需要使用 PCIe 设备.将程序转换为 64 位将是一项非常巨大的工作.
So for simplicity let's say I use a 64 bit driver for my PCIe card under Vista64 and have a bunch of 64 bit DLLs to use the cards functionality. On the other side there's a large, legacy 32 bit exe program which needs to use the PCIe device. Converting the program to 64 bit would be a really huge effort.
那么如何才能将 32 位程序和 64 位驱动程序结合在一起呢?我读到混合 32/64 位二进制文件和 DLL 根本不可能,但这对我来说很难相信.我确信您可以从 32 位应用程序中打印出 Vista64 下的文档,Windows 会以某种方式将其包装到 64 位打印机驱动程序中.
So what can be done to bring that 32 bit program and the 64 bit driver together? I read that mixing 32/64 bit binaries and DLLs is not possible at all but this is hard to believe for me. I'm sure you can print out a document under Vista64 from within a 32 bit app and Windows will somehow wrap this around to a 64 bit printer driver.
推荐答案
64位认证仅在Vista下需要;没有针对非 Windows 平台的认证机构,我认为 XP 或 Windows Server 不会检查认证(但不确定,这可能取决于您使用的服务包).
64-bit certification is only required under Vista; there is no certifying authority for non-Windows platforms, and I don't believe that XP or Windows Server checks for certification (not sure though, and it may depend on which service pack you're on).
如果您通过 Windows API 使用驱动程序,那么应该没有任何问题;Windows 将在内核中进行 3264 位转换.如果您尝试在自己的进程中加载驱动程序,那可能是不可能的.正如 Dirk 所说,您必须在其自己的进程中运行它并通过 COM 服务器进行通信.如果您必须在更高权限的执行级别运行驱动程序并希望从用户模式调用它,我不确定您必须跳过哪些障碍.
If you're using the driver via the Windows API, then there shouldn't be any problem; Windows will do the 32<->64-bit translations in the kernel. If you're trying to load the driver inside your own process, that probably won't be possible. As Dirk says you'll have to run it inside its own process and communicate through a COM server. I'm not sure what hoops you'll have to jump through if you have to run your driver in a higher-privilege execution level and want to make calls to it from user mode.
希望您的 64 位 DLL 提供 32 位 API,或者 Windows 提供标准驱动程序接口(如果它是常见的 I/O 设备,如显示器或网卡).
Hopefully your 64-bit DLLs offer a 32-bit API, or Windows offers a standard driver interface (if it's a common I/O device like a display or network card).
这篇关于在 32 位程序中使用 64 位驱动程序.视窗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!