替换 VS2015 中的 __wgetmainargs

Replacement for __wgetmainargs in VS2015

现在我正在使用 __wgetmainargs 来检索表示用户环境中设置的变量的字符串数组。

使用 VS2013 一切正常,但是,使用 VS2015 我得到 error LNK2019: unresolved external symbol __wgetmainargs 个错误。

我发现这是 removed and that CommandLineToArgvW 的替代品,但我不需要命令行参数,我需要环境数组(由于某些原因我不能使用 _wenviron,我只是去那儿捡垃圾)。

我必须将哪个库添加到链接器或我可以使用哪个替代方案API?

解决这个问题的一种方法是使用GetEnvironmentStrings which returns a pointer to a wchar_t sequence of all environment variables which are separated by [=11=] and end with [=12=][=12=] which can then be used directly or separated manually for a transformation into the format needed (GPLv2)