-
Notifications
You must be signed in to change notification settings - Fork 266
Description
Here's a snippet that demonstrates the issue:
#include <windows.h>
#include <string>
#include <iostream>
#include "wil/stl.h"
#include "wil/win32_helpers.h"
int main()
{
std::wstring exePath = wil::GetModuleFileNameW<std::wstring>(nullptr);
std::wcout << exePath << '\n';
std::wcout << exePath.length() << '\n';
std::wcout << wcslen(exePath.c_str()) << '\n';
}
An example output:
C:\Users\User\source\repos\ConsoleApplication1\x64\Release\ConsoleApplication1.exe
127
82
As you can see, the string size is not adjusted after calling GetModuleFileNameW
internally.
By the way, if you remove #include "wil/stl.h"
and try to compile in Release, the compiler crashes. I reported about it in the compiler feedback.
jschroedl and ysc3839
Metadata
Metadata
Assignees
Labels
No labels