This will be a foolishness, but this code to change the Drive letter of the Wide-String throws me an Acces violation when writting the new value. (0xC0000005)
wchar_t* disk2 = L"D";
wchar_t* wszDrive = L"\\\\.\\C:";
wszDrive[5] = *disk2; //here is the acces violation
I'm using the lattest version of Visual Studio 2019.
Also I tried this way:
wchar_t* disk2 = L"D";
wchar_t* wszDrive = L"\\\\.\\C:";
memcpy(&wszDrive[5], disk2, 2);
And this other way:
wchar_t* disk2 = L"D";
wchar_t* wszDrive = L"\\\\.\\C:";
memcpy(wszDrive+10, disk2, 2);
User contributions licensed under CC BY-SA 3.0