#1399 Definition of IMAGE_NT_HEADERS structs

closed-fixed
2010-08-24
2010-02-19
No

Win32api version 3.14

IMAGE_NT_HEADERS32 and IMAGE_NT_HEADERS64 structs are not defined correctly in winnt.h:

typedef struct _IMAGE_NT_HEADERS {
DWORD Signature;
IMAGE_FILE_HEADER FileHeader;
IMAGE_OPTIONAL_HEADER OptionalHeader;
} IMAGE_NT_HEADERS32,*PIMAGE_NT_HEADERS32;
typedef struct _IMAGE_NT_HEADERS64 {
DWORD Signature;
IMAGE_FILE_HEADER FileHeader;
IMAGE_OPTIONAL_HEADER OptionalHeader;
} IMAGE_NT_HEADERS64,*PIMAGE_NT_HEADERS64;

In these structs IMAGE_OPTIONAL_HEADER should be defined with the corresponding 32 / 64 version of the struct.
Otherwise e.g. code with this sizeof (IMAGE_NT_HEADERS64) may fail.

Here's the corrent definitions:

typedef struct _IMAGE_NT_HEADERS {
DWORD Signature;
IMAGE_FILE_HEADER FileHeader;
IMAGE_OPTIONAL_HEADER32 OptionalHeader;
} IMAGE_NT_HEADERS32,*PIMAGE_NT_HEADERS32;
typedef struct _IMAGE_NT_HEADERS64 {
DWORD Signature;
IMAGE_FILE_HEADER FileHeader;
IMAGE_OPTIONAL_HEADER64 OptionalHeader;
} IMAGE_NT_HEADERS64,*PIMAGE_NT_HEADERS64;

Discussion

  • Pasi Ruokola

    Pasi Ruokola - 2010-02-19
    • labels: --> w32api (deprecated use WSL)
     
  • Chris Sutcliffe

    Chris Sutcliffe - 2010-08-24
    • assigned_to: nobody --> ir0nh34d
    • status: open --> closed-fixed
     
  • Chris Sutcliffe

    Chris Sutcliffe - 2010-08-24

    Thank you for the report, I've committed a fix to CVS.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks