Finally fix the reboot-on-AddEvent problem. Looks like WriteFile has a problem with writing a small amount of bytes (in this case, the file header), no matter if the number of bytes is odd or even.