Use winapi types in pe.c
This commit is contained in:
parent
5473908df4
commit
9a1405c828
@ -1,5 +1,3 @@
|
|||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <pe.h>
|
#include <pe.h>
|
||||||
|
|
||||||
void pe_find_section(HMODULE module, const char *section, MEMORY_BASIC_INFORMATION *buf) {
|
void pe_find_section(HMODULE module, const char *section, MEMORY_BASIC_INFORMATION *buf) {
|
||||||
@ -8,11 +6,11 @@ void pe_find_section(HMODULE module, const char *section, MEMORY_BASIC_INFORMATI
|
|||||||
IMAGE_DOS_HEADER* dosHeader = (IMAGE_DOS_HEADER*)module;
|
IMAGE_DOS_HEADER* dosHeader = (IMAGE_DOS_HEADER*)module;
|
||||||
IMAGE_NT_HEADERS64* ntHeaders = (IMAGE_NT_HEADERS64*)(cModule + dosHeader->e_lfanew);
|
IMAGE_NT_HEADERS64* ntHeaders = (IMAGE_NT_HEADERS64*)(cModule + dosHeader->e_lfanew);
|
||||||
|
|
||||||
uint16_t sectionCount = ntHeaders->FileHeader.NumberOfSections;
|
WORD sectionCount = ntHeaders->FileHeader.NumberOfSections;
|
||||||
IMAGE_SECTION_HEADER* sectionHeader = (IMAGE_SECTION_HEADER*)(ntHeaders + 1);
|
IMAGE_SECTION_HEADER* sectionHeader = (IMAGE_SECTION_HEADER*)(ntHeaders + 1);
|
||||||
|
|
||||||
void* targetAddress = 0x0;
|
void* targetAddress = 0x0;
|
||||||
for (uint16_t i = 0; i < sectionCount; i++) {
|
for (WORD i = 0; i < sectionCount; i++) {
|
||||||
if (strncmp((char*)sectionHeader->Name, section, 8) == 0) {
|
if (strncmp((char*)sectionHeader->Name, section, 8) == 0) {
|
||||||
targetAddress = (void*)(cModule + sectionHeader->VirtualAddress);
|
targetAddress = (void*)(cModule + sectionHeader->VirtualAddress);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user