I see you are using FindResourceExA to read the kernel files. Can you tell, why was that needed?
I had seen similar errors with normal file reading when the reading was not done properly using binary flag.
Adding as resource for convenience so i don't have to worry about current working directory etc. But debugger shows that strlen is the same as file size so it should be correctly reading it from resource. I thought it might be because character encoding, but compiler seems to "eat" it as is. I'll test some more with writing back to file etc.
But just adding comment ( // ) at the end as a workaround for now doesn't bother me. Just letting you guys know just in case.