• R/O
  • SSH
  • HTTPS

peframework: Commit


Commit MetaInfo

Revision31 (tree)
Time2019-06-07 03:47:20
Authorquiret

Log Message

- fixed a bug where empty import directory were incorrectly written to images
- added some more helper functions

Change Summary

Incremental Difference

--- library/include/peloader.h (revision 30)
+++ library/include/peloader.h (revision 31)
@@ -1643,10 +1643,18 @@
16431643 {
16441644 return eir::static_new_struct <PEResourceDir, PEGlobalStaticAllocator> ( nullptr, isIdentifierName, std::move( name ), std::move( identifier ) );
16451645 }
1646+ static PEResourceDir* CreateDir( PEResourceDir&& src )
1647+ {
1648+ return eir::static_new_struct <PEResourceDir, PEGlobalStaticAllocator> ( nullptr, std::move( src ) );
1649+ }
16461650 static PEResourceInfo* CreateData( bool isIdentifierName, peString <char16_t> name, std::uint16_t identifier, PESectionDataReference dataRef )
16471651 {
16481652 return eir::static_new_struct <PEResourceInfo, PEGlobalStaticAllocator> ( nullptr, isIdentifierName, std::move( name ), std::move( identifier ), std::move( dataRef ) );
16491653 }
1654+ static PEResourceInfo* CreateData( PEResourceInfo&& src )
1655+ {
1656+ return eir::static_new_struct <PEResourceInfo, PEGlobalStaticAllocator> ( nullptr, std::move( src ) );
1657+ }
16501658 static void DestroyItem( PEResourceItem *item )
16511659 {
16521660 eir::static_del_struct <PEResourceItem, PEGlobalStaticAllocator> ( nullptr, item );
--- library/src/peloader.write.cpp (revision 30)
+++ library/src/peloader.write.cpp (revision 31)
@@ -581,18 +581,15 @@
581581 // either ordinal or name entries.
582582 auto& funcs = impDesc.funcs;
583583
584- if ( funcs.GetCount() != 0 )
584+ // First the sub-data.
585+ impDesc.AllocatePEImportFunctionsData( rdonlySect, funcs );
586+
587+ if ( impDesc.impNameArrayAllocEntry.IsAllocated() == false )
585588 {
586- // First the sub-data.
587- impDesc.AllocatePEImportFunctionsData( rdonlySect, funcs );
588-
589- if ( impDesc.impNameArrayAllocEntry.IsAllocated() == false )
590- {
591- impDesc.impNameArrayAllocEntry =
592- PEImportDesc::WritePEImportFunctions(
593- rdonlySect, funcs, isExtendedFormat
594- );
595- }
589+ impDesc.impNameArrayAllocEntry =
590+ PEImportDesc::WritePEImportFunctions(
591+ rdonlySect, funcs, isExtendedFormat
592+ );
596593 }
597594
598595 // Allocate and write the module name that we should import from.
Show on old repository browser