MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / peClose

Function peClose

emmy_hook/src/libpe/libpe.cpp:1060–1145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1058}
1059
1060void peClose( PE *pe )
1061{
1062 if( pe->hFile && pe->hFile != INVALID_HANDLE_VALUE )
1063 {
1064 CloseHandle( pe->hFile );
1065 }
1066
1067 if( pe->pData != NULL && pe->hMap != NULL )
1068 {
1069 UnmapViewOfFile( pe->pData );
1070 }
1071
1072 if( pe->hMap != NULL )
1073 {
1074 CloseHandle( pe->hMap );
1075 }
1076
1077 // free the export table
1078 if( pe->ExportTable.ByAddress )
1079 {
1080 ht_destroy( pe->ExportTable.ByAddress );
1081 }
1082
1083 if( pe->ExportTable.ByName )
1084 {
1085 ht_destroy( pe->ExportTable.ByName );
1086 }
1087
1088 if( pe->ExportTable.ByOrdinal )
1089 {
1090 ht_destroy( pe->ExportTable.ByOrdinal );
1091 }
1092
1093 if( pe->ExportTable.Symbols.elements )
1094 {
1095 ll_destroy( &pe->ExportTable.Symbols, free );
1096 }
1097
1098 // free the import table
1099 if( pe->ImportTable.ByName )
1100 {
1101 ht_destroy( pe->ImportTable.ByName );
1102 }
1103
1104 if( pe->ImportTable.Modules.elements )
1105 {
1106 PE_FOREACH_IMPORTED_MODULE( pe, pModule )
1107 {
1108 ll_destroy( &pModule->Symbols, free );
1109 ht_destroy( pModule->ByName );
1110 }
1111
1112 ll_destroy( &pe->ImportTable.Modules, free );
1113 }
1114
1115 // free strings
1116 if( pe->Strings.List.elements )
1117 {

Callers 3

peOpenFileFunction · 0.85
peOpenBufferFunction · 0.85

Calls 2

ht_destroyFunction · 0.85
ll_destroyFunction · 0.85

Tested by

no test coverage detected