none
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

    Polaris

     


    leo

    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: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384083(v=vs.85).aspx

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Wednesday, May 28, 2014 4:18 AM
    Moderator