Home | Info | Community | Development | myReactOS | Contact Us
[static]
Definition at line 16 of file obj2bin.c.
Referenced by main().
{ unsigned int i, nOffset; PIMAGE_RELOCATION pReloc; char *pSection; WORD *p16; DWORD *p32; pSection = pData + pSectionHeader->PointerToRawData; /* Calculate pointer to relocation table */ pReloc = (PIMAGE_RELOCATION)(pData + pSectionHeader->PointerToRelocations); /* Loop all relocations */ for (i = 0; i < pSectionHeader->NumberOfRelocations; i++) { nOffset = pReloc->VirtualAddress - pSectionHeader->VirtualAddress; if (nOffset > pSectionHeader->SizeOfRawData) continue; switch (pReloc->Type) { case IMAGE_REL_I386_ABSOLUTE: case 16: p16 = (void*)(pSection + nOffset); *p16 += (WORD)(pSymbols[pReloc->SymbolTableIndex].Value + iOffset); break; case IMAGE_REL_I386_DIR32: p32 = (void*)(pSection + nOffset); *p32 += (DWORD)(pSymbols[pReloc->SymbolTableIndex].Value + iOffset); break; default: printf("Unknown relocatation type %ld address %ld\n", pReloc->Type, pReloc->VirtualAddress); } pReloc++; } }