| 1 | // Licensed to the .NET Foundation under one or more agreements. |
|---|---|
| 2 | // The .NET Foundation licenses this file to you under the MIT license. |
| 3 | // See the LICENSE file in the project root for more information. |
| 4 | // |
| 5 | // ZapReadyToRun.h |
| 6 | // |
| 7 | |
| 8 | // |
| 9 | // Zapping of ready-to-run specific structures |
| 10 | // |
| 11 | // ====================================================================================== |
| 12 | |
| 13 | #ifndef __ZAPREADYTORUN_H__ |
| 14 | #define __ZAPREADYTORUN_H__ |
| 15 | |
| 16 | #include "readytorun.h" |
| 17 | |
| 18 | class ZapReadyToRunHeader : public ZapNode |
| 19 | { |
| 20 | struct Section |
| 21 | { |
| 22 | DWORD type; |
| 23 | ZapNode * pSection; |
| 24 | }; |
| 25 | |
| 26 | SArray<Section> m_Sections; |
| 27 | |
| 28 | static int __cdecl SectionCmp(const void* a_, const void* b_) |
| 29 | { |
| 30 | return ((Section*)a_)->type - ((Section*)b_)->type; |
| 31 | } |
| 32 | |
| 33 | public: |
| 34 | ZapReadyToRunHeader(ZapImage * pImage) |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | void RegisterSection(DWORD type, ZapNode * pSection) |
| 39 | { |
| 40 | Section section; |
| 41 | section.type = type; |
| 42 | section.pSection = pSection; |
| 43 | m_Sections.Append(section); |
| 44 | } |
| 45 | |
| 46 | virtual DWORD GetSize() |
| 47 | { |
| 48 | return sizeof(READYTORUN_HEADER) + sizeof(READYTORUN_SECTION) * m_Sections.GetCount(); |
| 49 | } |
| 50 | |
| 51 | virtual UINT GetAlignment() |
| 52 | { |
| 53 | return sizeof(DWORD); |
| 54 | } |
| 55 | |
| 56 | virtual ZapNodeType GetType() |
| 57 | { |
| 58 | return ZapNodeType_NativeHeader; |
| 59 | } |
| 60 | |
| 61 | virtual void Save(ZapWriter * pZapWriter); |
| 62 | }; |
| 63 | |
| 64 | #endif // __ZAPREADYTORUN_H__ |
| 65 |