Strct alignment issue when passing user mode struct to kernel ? RRS feed

  • General discussion

  • Hi Experts:

    I'm just wondering when user mode app (using default struct alignment) passes a struct to the kernel driver (not using any alignment), will that cause problem or not?  Must user mode app and the kernel driver use the same struct alignment?

    Thanks in advance




    Wednesday, May 28, 2014 2:02 AM

All replies

  • If you are just passing the address of a buffer containing your structs from user-mode to kernel-mode, then yes, they need to use the same #pack alignment. You also need to account for 32-bit vs. 64-bit systems, especially if your app is 32-bit but it is running on a 64-bit system. You can find more information about the Windows 64-bit data model here:


    Azius Developer Training Windows device driver, internals, security, & forensics training and consulting. Blog at

    Wednesday, May 28, 2014 4:18 AM