Refactor the hook_callback for Windows to try and make it easier to work on.
Fixed some compile bugs.
Refactor the hook_callback for Darwin.
Fixed more compilation issues.