Fixed INVALID_HANDLE_VALUE value for 64bit compatibility