Invalid access to memory location in Windows 11/10