: TStrings; const Image: LoadedImage ) ;
Begin { DumpExportDirectory }
Assert( Assigned( lines ));
lines.add( ''Dump of IMAGE_EXPORT_DIRECTORY'' );
lines.add( format(''Characteristics: %d'',
[ExportDirectory.Characteristics]));
lines.add( format(''TimeDateStamp: %d'',
[ExportDirectory.TimeDateStamp]));
lines.add( format(''Version: %d.%d'',
[ExportDirectory.MajorVersion,
ExportDirectory.MinorVersion]));
lines.add( format(''Name (RVA): %x'',
[ExportDirectory.Name]));
lines.add( format(''Name (translated): %s'',
[RVAToPchar( ExportDirectory.name, Image )]));
lines.add( format(''Base: %d'',
[ExportDirectory.Base]));
lines.add( format(''NumberOfFunctions: %d'',
[ExportDirectory.NumberOfFunctions]));
lines.add( format(''NumberOfNames: %d'',
[ExportDirectory.NumberOfNames]));
lines.add( format(''AddressOfFunctions (RVA): %p'',
[Pointer(ExportDirectory.AddressOfFunctions)]));
lines.add( format(''AddressOfNames (RVA): %p'',
[Pointer(ExportDirectory.AddressOfNames)]));
lines.add( format(''AddressOfNameOrdinals (RVA): %p'',
[Pointer(ExportDirectory.AddressOfNameOrdinals)]));
End; { DumpExportDirectory }
{+----------------------------------------------------------------------
| Function RVAToPointer
|
| Parameters :
| rva : a relative virtual address to translate
| Image : LOADED_IMAGE structure for the image the RVA relates to
| Returns : translated address
| Description:
| Uses the ImageRVAToVA function to translate the RVA to a virtual
| address.
| Error Conditions:
| Will raise an exception if the translation failed
| Created: 9.1.2000 by P. Below
+----------------------------------------------------------------------}
Function RVAToPointer( rva : DWORD ; const Image : LoadedImage ) : Pointer;
var
pDummy: PImageSectionHeader;
Begin { RVAToPchar }
pDummy := nil;
Result :=
ImageRvaToVa( Image.FileHeader, Image.MappedAddress, rva,
pDummy );
If Result = Nil Then
RaiseLastWin32Error;
End; { RVAToPointer }
{+----------------------------------------------------------------------
| Function RVAToPchar
|
| Parameters :
| rva : a relative virtual address to translate
| Image : LOADED_IMAGE structure for the image the RVA relates to
| Returns : translated address
| Description:
| Uses the RVAToPointer function to translate the RVA to a virtual
| address. Note that we do not check that the address does indeed point
| to a zero-terminated string!
| Error Conditions:
| Will raise an exception if the translation failed
| Created: 9.1.2000 by P. Below
+----------------------------------------------------------------------}
Function RVAToPchar( rva : DWORD ; const Image : LoadedImage ) : PChar ;
Begin { RVAToPchar }
Result := RVAToPointer( rva, image );
End; { RVAToPchar }
end.