Re: RE: [ntdev] Drivers Align Problems.

>…

There are many cases you can send misaligned pointer to the function.
(Why do you take an undocumented API as an example, though?)

First of all,I took a example where a data pointer can not be misaligned. And secondly this functions is fully documentec, it is almost the same as GetThreadContext API.

I assume that you are not creating a “driver” for the compiler (command line program of the compiler), but a real “device driver” (for the operating system kernels). And then, I am wondering why you need a “device driver” for the compiler, anyhow.

Seems you didn’t get me. I’m working for a simple C compiler + linker. And i want to be able to produce device drivers for example.

So it seems functions offsets also need to be aligned, is this a must? How to know which function requires align and what not?

thanks for help!

you should assume that all functions require this type of alignment. alignment requirements are pervasive throughout the OS, some parts are just more forgiving then others ;).

To get a compiler to emit the right code for a driver you wil need to support a lot of the Microsoft specific extensions like __declspec(align(x)). There is a reason that Microsoft only supports drivers compiled with a DDK compiler and not any other compiler. This is an interesting avenue to pursue but I think you are seeing only of many issues that are to come. Depending on how much time you have for this project, there may be too many details/issues for you to implement to finish in time.