TheWover / donut

Generates x86, x64, or AMD64+x86 position-independent shellcode that loads .NET Assemblies, PE files, and other Windows payloads from memory and runs them with parameters
BSD 3-Clause "New" or "Revised" License
3.61k stars 638 forks source link

Fix circular includes #156

Closed MEhrn00 closed 4 weeks ago

MEhrn00 commented 2 months ago

There is a circular include where include/donut.h#L85 includes format.h while include/format.h#L35 includes donut.h. This could potentially cause issues where included symbols do not get defined.

Since format.c only uses donut.h for the error macros, they can be refactored out into a separate errors.h file which can be included separately in format.c without needing to include all of donut.h.

The DPRINT macro has to be re-implemented because it is needed for format.c but is only defined in donut.h and loader/loader.h. loader/loader.h#L101 also includes donut.h so it cannot be used since this would result in another circular include.