pointers64-bitisapi

Why are the pointers in my 64-bit ISAPI dll messed up?


I am working on migrating a 32-bit ISAPI dll to 64-bit. I am using Visual Studio 2008. I am having problems with the EXTENSION_CONTROL_BLOCK pointer in the HttpExtensionProc function. The char pointers within the EXTENSION_CONTROL_BLOCK structure are not valid on entry into the function; they are labeled with within the watch window. If I manually modify the char pointers by swapping the first 4 bytes and the last 4 bytes of the pointer, the correct values display. Any ideas why this would be happening?

This is the watch window before modifying the pointer, pay attention to lpszQueryString: link text alt text

This is the watch window after modifying the pointer, pay attention to lpszQueryString: link text alt text


Solution

  • The problem was that I was building with 1-byte alignment. I needed to do this:

    #pragma pack(push, 8)
    #include <httpext.h>
    #pragma pack(pop)
    

    Thanks to nobugz for the answer.