hydrogen fluoride,
1. please, learn how to create patches for git. do not attach source files as is.
2. do not break code formatting
3. this patch is not acceptable, because SetLastError() breaks the whole sense of assignment to lastError, because any system call reassigns the error code assigned with the current thread