Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
#define MAX_DIRECTORIES 16
typedef struct {
uint16_t Magic;
uint8_t MajorLinkerVersion;
uint8_t MinorLinkerVersion;
uint32_t SizeOfCode;
uint32_t SizeOfInitializedData;
uint32_t SizeOfUninitializedData;
uint32_t AddressOfEntryPoint;
uint32_t BaseOfCode;
uint64_t ImageBase;
uint32_t SectionAlignment;
uint32_t FileAlignment;
uint16_t MajorOperatingSystemVersion;
uint16_t MinorOperatingSystemVersion;
uint16_t MajorImageVersion;
uint16_t MinorImageVersion;
uint16_t MajorSubsystemVersion;
uint16_t MinorSubsystemVersion;
uint32_t Win32VersionValue;
uint32_t SizeOfImage;
uint32_t SizeOfHeaders;
uint32_t CheckSum;
uint16_t Subsystem;
uint16_t DllCharacteristics;
uint64_t SizeOfStackReserve;
uint64_t SizeOfStackCommit;
uint64_t SizeOfHeapReserve;
uint64_t SizeOfHeapCommit;
uint32_t LoaderFlags;
uint32_t NumberOfRvaAndSizes;
IMAGE_DATA_DIRECTORY DataDirectory[MAX_DIRECTORIES];
} IMAGE_OPTIONAL_HEADER_64;typedef struct _IMAGE_DATA_DIRECTORY {
uint32_t VirtualAddress;
uint32_t Size;
} IMAGE_DATA_DIRECTORY;typedef struct {
uint16_t Machine;
uint16_t NumberOfSections;
uint32_t TimeDateStamp;
uint32_t PointerToSymbolTable;
uint32_t NumberOfSymbols;
uint16_t SizeOfOptionalHeader;
uint16_t Characteristics;
} IMAGE_FILE_HEADER, IMAGE_COFF_HEADER;
dumpbin /nologo /headers c:\windows\system32\calc.exeDump of file c:\windows\system32\calc.exe
PE signature found
File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
8664 machine (x64)
7 number of sections
EE8136FB time date stamp
0 file pointer to symbol table
0 number of symbols
F0 size of optional header
22 characteristics
Executable
Application can handle large (>2GB) addresses
--suprimido--typedef struct {
uint16_t e_magic;
uint16_t e_cblp;
uint16_t e_cp;
uint16_t e_crlc;
uint16_t e_cparhdr;
uint16_t e_minalloc;
uint16_t e_maxalloc;
uint16_t e_ss;
uint16_t e_sp;
uint16_t e_csum;
uint16_t e_ip;
uint16_t e_cs;
uint16_t e_lfarlc;
uint16_t e_ovno;
uint16_t e_res[4];
uint16_t e_oemid;
uint16_t e_oeminfo;
uint16_t e_res2[10];
uint32_t e_lfanew;
} IMAGE_DOS_HEADER;This program cannot be run in DOS mode.#define SECTION_NAME_SIZE 8
typedef struct {
uint8_t Name[SECTION_NAME_SIZE];
uint32_t VirtualSize;
uint32_t VirtualAddress;
uint32_t SizeOfRawData;
uint32_t PointerToRawData;
uint32_t PointerToRelocations;
uint32_t PointerToLinenumbers; // descontinuado
uint16_t NumberOfRelocations;
uint16_t NumberOfLinenumbers; // descontinuado
uint32_t Characteristics;
} IMAGE_SECTION_HEADER;typedef struct {
uint32_t RvaImportLookupTable; // Antigo OriginalFistThink
uint32_t TimeDateStamp;
uint32_t ForwarderChain;
uint32_t Name;
uint32_t RvaImportAddressTable; // Antigo FirstThunk (ou Thunk Table)
} IMAGE_IMPORT_DESCRIPTOR;



typedef struct {
uint16_t Hint;
uint8_t Name[1];
} IMAGE_IMPORT_BY_NAME;Dump of file c:\windows\system32\calc.exe
PE signature found
File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
8664 machine (x64)
7 number of sections
EE8136FB time date stamp
0 file pointer to symbol table
0 number of symbols
F0 size of optional header
22 characteristics
Executable
Application can handle large (>2GB) addresses
OPTIONAL HEADER VALUES
20B magic # (PE32+)
14.38 linker version
2000 size of code
9000 size of initialized data
0 size of uninitialized data
1740 entry point
1000 base of code
140000000 image base
1000 section alignment
1000 file alignment
-- suprimido -->>> ep = 0x1740 + 0x140000000
>>> hex(ep)
'0x140001740'
#include <stdio.h>
int main(void) {
char s[] = "texto grande para forçar o compilador a utilizar a seção de dados";
s[0] = 'T';
puts(s);
}int main(void) {
const char s[] = "texto grande para o compilador utilizar a seção de dados";
puts(s);
}#include <stdio.h>
#include <windows.h>
int main(void) {
SYSTEM_INFO info;
GetNativeSystemInfo(&info);
printf("dwPageSize: %u\n", info.dwPageSize);
}

