Questions concerned with the release of drivers for 64-bit versions of Windows are considered in this article. Some typical problems and the ways of their solutions are listed in the article as well as tools which simplify the process of drivers developing.
The output of the first version of the Windows operating system for 64-bit AMD64 processors in 2005 posed a new problem for driver developers. This problem was the opportunity to release drivers for 32-bit and 64-bit systems. At that time many manufacturers turned out not to be ready for supporting of drivers for two systems, that's why many devices didn't get any renewed drivers. At that time this was excusable because 64-bit systems were a novelty and only few users could appreciate them. However, the situation changed greatly when Windows Vista x64 was released. Now even home users want to have a 64-bit system and the developers have to think about the release of 64-bit versions of drivers without fail.
First of all there arises a question. "Do the 64-bit drivers for 64-bit versions of Windows have to be developed?" And there comes a definite answer: "They do". The point is that it is impossible to use 32-bit drivers with a 64-bit system in the kernel mode.
While developing drivers for 64-bit system one should take into consideration some peculiarities. The neglect of them can possibly lead to vain attempts to understand why some things do not function as they used to. MSDN covers the question of 64-bit drivers development thoroughly enough, but sometimes the information turns out to be too uncoordinated. That's why this article gives a survey of main problems and directions for the further study of this question.
While developing drivers for Win64 it is desirable to use the same source code that was used for Win32. The differences in code should be brought to separate code sections under conditional compilation.
It is necessary to mention the fact that Microsoft provides the developers with instructions of code migration for new versions of Windows DDK as much as possible.
So, MSDN recommends us to use:
Special attention should be paid to:
To check the efficiency of drivers it is advisable to use appropriate tools. In addition to the maximum level of compiler diagnostics (/W4 or even /Wall) it is necessary to use other opportunities without fail.
First of all, take a note of a free tool created by Microsoft, PREfast analyzer if you are not aware of it yet. It's a static code analyzer; it discovers a great number of errors which can be found in common programs besides the errors we have considered above.
Another static code analyzer, Viva64, is meant for search of the errors in C++ programs which appear when the code migration from 32-bit systems to 64-bit ones is performed.
As you may see, the development of 64-bit drivers is quite easy and the tools which can facilitate this work are available. And this means that you don't have to put off the work.
In C language, you may use functions without defining them. Pay attention that I speak about C language, not C++. Of course, this ability is very dangerous. Let us have a look at an interesting example of a 64-bit error related to it. Below is the correct code that allocates and uses three arrays, 1 GB each:
In this article, I've collected a huge amount of links all of which could prove potentially useful to software developers who are getting acquainted with 64-bit world. In general, we will cover C/C++ languages, but I am sure, that developers from other languages will discover a lot of interesting stuff here as well.