Recent

Author Topic: PIMAGE_OPTIONAL_HEADER64 , no member "BaseOfData"  (Read 1647 times)

xjw1162

  • Newbie
  • Posts: 2
PIMAGE_OPTIONAL_HEADER64 , no member "BaseOfData"
« on: October 03, 2021, 05:29:36 pm »
PIMAGE_OPTIONAL_HEADER64 , no member "BaseOfData"

struct.inc
8547:

Code: Pascal  [Select][+][-]
  1.   PIMAGE_OPTIONAL_HEADER64 = ^IMAGE_OPTIONAL_HEADER64;
  2.   _IMAGE_OPTIONAL_HEADER64 = record
  3.     Magic: Word;
  4.     MajorLinkerVersion: Byte;
  5.     MinorLinkerVersion: Byte;
  6.     SizeOfCode: DWORD;
  7.     SizeOfInitializedData: DWORD;
  8.     SizeOfUninitializedData: DWORD;
  9.     AddressOfEntryPoint: DWORD;
  10.     BaseOfCode: DWORD;       // 64bit : no member "BaseOfData"
  11.     ImageBase: Int64;
  12.     SectionAlignment: DWORD;
  13.     FileAlignment: DWORD;
  14.     MajorOperatingSystemVersion: Word;
  15.     MinorOperatingSystemVersion: Word;
  16.     MajorImageVersion: Word;
  17.     MinorImageVersion: Word;
  18.     MajorSubsystemVersion: Word;
  19.     MinorSubsystemVersion: Word;
  20.     Win32VersionValue: DWORD;
  21.     SizeOfImage: DWORD;
  22.     SizeOfHeaders: DWORD;
  23.     CheckSum: DWORD;
  24.     Subsystem: Word;
  25.     DllCharacteristics: Word;
  26.     SizeOfStackReserve: Int64;
  27.     SizeOfStackCommit: Int64;
  28.     SizeOfHeapReserve: Int64;
  29.     SizeOfHeapCommit: Int64;
  30.     LoaderFlags: DWORD;
  31.     NumberOfRvaAndSizes: DWORD;
  32.     DataDirectory: array [0..IMAGE_NUMBEROF_DIRECTORY_ENTRIES - 1] of IMAGE_DATA_DIRECTORY;
  33.   end;
  34.   IMAGE_OPTIONAL_HEADER64 = _IMAGE_OPTIONAL_HEADER64;  
  35.  
  36.  

8480:
Code: Pascal  [Select][+][-]
  1. type
  2.   PIMAGE_OPTIONAL_HEADER32 = ^IMAGE_OPTIONAL_HEADER32;
  3.   _IMAGE_OPTIONAL_HEADER = record
  4.     //
  5.     // Standard fields.
  6.     //
  7.     Magic: Word;
  8.     MajorLinkerVersion: Byte;
  9.     MinorLinkerVersion: Byte;
  10.     SizeOfCode: DWORD;
  11.     SizeOfInitializedData: DWORD;
  12.     SizeOfUninitializedData: DWORD;
  13.     AddressOfEntryPoint: DWORD;
  14.     BaseOfCode: DWORD;
  15.     BaseOfData: DWORD;
  16.     //
  17.     // NT additional fields.
  18.     //
  19.     ImageBase: DWORD;
  20.     SectionAlignment: DWORD;
  21.     FileAlignment: DWORD;
  22.     MajorOperatingSystemVersion: Word;
  23.     MinorOperatingSystemVersion: Word;
  24.     MajorImageVersion: Word;
  25.     MinorImageVersion: Word;
  26.     MajorSubsystemVersion: Word;
  27.     MinorSubsystemVersion: Word;
  28.     Win32VersionValue: DWORD;
  29.     SizeOfImage: DWORD;
  30.     SizeOfHeaders: DWORD;
  31.     CheckSum: DWORD;
  32.     Subsystem: Word;
  33.     DllCharacteristics: Word;
  34.     SizeOfStackReserve: DWORD;
  35.     SizeOfStackCommit: DWORD;
  36.     SizeOfHeapReserve: DWORD;
  37.     SizeOfHeapCommit: DWORD;
  38.     LoaderFlags: DWORD;
  39.     NumberOfRvaAndSizes: DWORD;
  40.     DataDirectory: array [0..IMAGE_NUMBEROF_DIRECTORY_ENTRIES - 1] of IMAGE_DATA_DIRECTORY;
  41.   end;
  42.   IMAGE_OPTIONAL_HEADER32 = _IMAGE_OPTIONAL_HEADER;
  43.  


« Last Edit: October 03, 2021, 05:43:48 pm by xjw1162 »

Thaddy

  • Hero Member
  • *****
  • Posts: 10991
Re: PIMAGE_OPTIONAL_HEADER64 , no member "BaseOfData"
« Reply #1 on: October 03, 2021, 06:05:39 pm »
The 64 bit version of _image_optional_header has no member BaseOfData. See MSDN:
https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-image_optional_header64

So  this is correct, it is not a bug.

You can not add it like the 32 bit version. It is an OS provided structure and your application will probably crash! if you add it to 64 since the field order and size become invalid/
« Last Edit: October 03, 2021, 08:10:04 pm by Thaddy »
The average programmer productivity is 4-5 hours per day. Peak performance 72 hours for short bursts. MTBF is 1 second or less.

xjw1162

  • Newbie
  • Posts: 2
Re: PIMAGE_OPTIONAL_HEADER64 , no member "BaseOfData"
« Reply #2 on: October 04, 2021, 12:34:03 pm »
thanks .

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 9680
  • FPC developer.
Re: PIMAGE_OPTIONAL_HEADER64 , no member "BaseOfData"
« Reply #3 on: October 04, 2021, 01:48:57 pm »
Data probably has no base in 64-bit since it is position independent, and thus linked to baseofcode.

 

TinyPortal © 2005-2018