is
find
function can't work with exe? i try to find wstring in an exe. it always not match. but if i create a txt and copy binary inside exe to txt and it can find it.
std::wifstream file(L"D:/file.exe", std::ios::binary);
if (file.is_open())
{
file.seekg(0, file.end);
std::streamoff length = file.tellg();
file.seekg(0, file.beg);
wchar_t *buffer = new wchar_t[length];
file.read(buffer, length);
std::wstring sFile;
sFile = buffer;
size_t index = sFile.find(L"Something");
if (index != std::string::npos) std::cout << "It's found";
file.close();
delete[] buffer;
}
else
{
std::cout << "It's not open";
}