My project uses SECSTR to protect some strings.
However, VMProtect stopped detecting some of these strings.
I did a test project to try to understand what is happening.
And it seems that when I use a std::map<> all strings below it are not detected by VMProtect.
I took two screenshots showing the problem.
Attached is also the example .cpp I used.
Using MSVC 2022 (v143) build x86, c++14.
Code: Select all
#include <iostream>
#include <VMProtectSDK.h>
#define SECSTR(_ShortAlphaNumeric, _RegularText) \
const char* _ShortAlphaNumeric = VMProtectDecryptStringA(_RegularText)
#define SECWSTR(_ShortAlphaNumeric, _RegularText) \
const wchar_t* _ShortAlphaNumeric = VMProtectDecryptStringW(_RegularText)
#define FREESEC(_ShortAlphaNumeric) \
if(_ShortAlphaNumeric) \
{ \
VMProtectFreeString(_ShortAlphaNumeric); \
_ShortAlphaNumeric = NULL; \
}
SECSTR(_TEST_GLOBAL, "Global String Test");
#include <map>
#include <string>
#define ENABLE_VMP_BUG
int main()
{
SECSTR(_TEST_LOCAL, "Local String Test");
std::cout << "Hello World!\n";
std::cout << _TEST_GLOBAL << std::endl;
std::cout << _TEST_LOCAL << std::endl;
FREESEC(_TEST_LOCAL);
SECSTR(_TEST1, "9a0364b9e99bb480dd25e1f0284c8555");
printf("%s\n", _TEST1);
FREESEC(_TEST1);
SECSTR(_TEST2, "9032e60152960343a7ca2c6b6e906dcb");
printf("%s\n", _TEST2);
FREESEC(_TEST2);
SECSTR(_TEST3, "25a7f0d3a18a86a808c5545dd223b2c5");
printf("%s\n", _TEST3);
FREESEC(_TEST3);
#ifdef ENABLE_VMP_BUG
std::map<std::string, int> testMap{};
SECSTR(_WPS_LIBRARY_NAME, "sdafwrgdfbwerwrgegwer");
testMap[_WPS_LIBRARY_NAME] = 123;
FREESEC(_WPS_LIBRARY_NAME);
#endif // ENABLE_VMP_BUG
SECSTR(_TEST4, "43f6db019f140e72d52fed8556bdffc0");
printf("%s\n", _TEST4);
FREESEC(_TEST4);
SECSTR(_TEST5, "4f19b55800c072d2f7ad04ab9ed9c948");
printf("%s\n", _TEST5);
FREESEC(_TEST5);
SECSTR(_TEST6, "4dfbe1cf4bb1af503851c1bff7f5859f");
printf("%s\n", _TEST6);
FREESEC(_TEST6);
SECSTR(_TEST7, "95ea90499d7a83e70380c0986d926560");
printf("%s\n", _TEST7);
FREESEC(_TEST7);
SECSTR(_TEST8, "f6860f712976ceef63c718c7e20debc9");
printf("%s\n", _TEST8);
FREESEC(_TEST8);
std::cout << "finish test.\n";
std::getchar();
}