According to [the docs](https://learn.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-getcommandlinew#remarks), the header type is wrong to use an `LPTSTR` when it should be a `LPCTSTR`: > The lifetime of the returned value is managed by the system, applications **should not** free or **modify this value**.