Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetPESectionBlock()

AbstractMemoryBlock System.Reflection.PortableExecutable.PEReader.GetPESectionBlock ( int index)
inlineprivate

Definition at line 229 of file PEReader.cs.

230 {
232 if (_lazyPESectionBlocks == null)
233 {
235 }
236 AbstractMemoryBlock memoryBlock;
237 if (IsLoadedImage)
238 {
239 memoryBlock = pEImage.GetMemoryBlock(PEHeaders.SectionHeaders[index].VirtualAddress, PEHeaders.SectionHeaders[index].VirtualSize);
240 }
241 else
242 {
243 int size = Math.Min(PEHeaders.SectionHeaders[index].VirtualSize, PEHeaders.SectionHeaders[index].SizeOfRawData);
244 memoryBlock = pEImage.GetMemoryBlock(PEHeaders.SectionHeaders[index].PointerToRawData, size);
245 }
246 if (Interlocked.CompareExchange(ref _lazyPESectionBlocks[index], memoryBlock, null) != null)
247 {
248 memoryBlock.Dispose();
249 }
251 }
ImmutableArray< SectionHeader > SectionHeaders
Definition PEHeaders.cs:51
static int CompareExchange(ref int location1, int value, int comparand)

References System.Reflection.PortableExecutable.PEReader._lazyPESectionBlocks, System.Threading.Interlocked.CompareExchange(), System.Reflection.Internal.AbstractMemoryBlock.Dispose(), System.Reflection.Internal.MemoryBlockProvider.GetMemoryBlock(), System.Reflection.PortableExecutable.PEReader.GetPEImage(), System.index, System.Reflection.PortableExecutable.PEReader.IsLoadedImage, System.Math.Min(), and System.Reflection.PortableExecutable.PEHeaders.SectionHeaders.

Referenced by System.Reflection.PortableExecutable.PEReader.GetSectionData(), and System.Reflection.PortableExecutable.PEReader.GetSectionData().