Page 1 of 1

Is VMProtectDecryptStringA/W thread-safe?

Posted: Tue May 20, 2025 5:08 pm
by std::runtime_error
Hello,
I’m using VMProtect 3.9.4, build 2345, with MSVC C++. I have a question about the thread safety of VMProtectDecryptStringA/W, and VMProtectFreeString.

I always use VMProtectDecryptStringA/W with VMProtectFreeString to prevent runtime memory searching.

The documentation states: " If VMProtectDecryptStringA / VMProtectDecryptStringW are used with the same parameters for the second time without destroying previously decrypted string, additional memory is not allocated. "

So, I wonder if these functions are thread-safe?

For example:

Code: Select all

void func(){
    const char* a = VMProtectDecryptStringA("testA");
    //  do something  << my code block is thread-safe
    VMProtectFreeString(a);
}
Do I need a mutex to ensure thread safety for the DecryptString calls?

Thank you!

Re: Is VMProtectDecryptStringA/W thread-safe?

Posted: Wed May 21, 2025 9:57 am
by Admin
Yes, these API are thread-safe. You don't need to add a mutex there.

Re: Is VMProtectDecryptStringA/W thread-safe?

Posted: Wed May 21, 2025 10:30 am
by std::runtime_error
Admin wrote: Wed May 21, 2025 9:57 am Yes, these API are thread-safe. You don't need to add a mutex there.
Thanks you!. Btw could I have the latest build?