Drivers Align Problems.

Hi list,

I have some newbie question. Should data and code in the device driver always be aligned (align 4?). For example
calling ntdll.ZwGetContextThread will fail if the context struct is not aligned by 4 (error: EXCEPTION_DATATYPE_MISALIGNMENT)

Are there any rules for align? Is there a defult align? How do MSVC makes it, or how it knows where to align data and where not? I’m currently working for some basic student compiler project and i’m trying to implement driver building.

P.S I’m working on x86 processors.

Thanks for help!