I know this is a draft, but:
- Use `#define`s instead of global constants (and if you do need a global, make it `static` unless you need it in other files or in the .spec) - Use ULONG_PTR instead of uintptr_t/size_t - Put the `{` after a for/while/if/else/switch on its own line
These are just my own opinions.
I have not looked at any of the logic.