Why static SDK is only provided for Windows?

Issues related to VMProtect
Post Reply
NavilleZhang
Posts: 2
Joined: Fri May 27, 2022 6:23 am

Why static SDK is only provided for Windows?

Post by NavilleZhang »

Hi:
The program I'm trying to protect with VMProtect uses CMake as its build system. And I must manually copy libVMProtect.dylib for the program to work.
What I want is basically we have libVMProtect.a for all platforms, so I could test out the unprotected version in my continuous integration server, and protect the binary later when ready for release
Admin
Site Admin
Posts: 2566
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: Why static SDK is only provided for Windows?

Post by Admin »

Do you think that VMProtectSDK32.lib and VMProtectSDK64.lib are static SDK for Windows? It's not true. Just read this:
https://docs.microsoft.com/en-us/cpp/bu ... w=msvc-170

Anyway, please notice that SDK doesn't contain code that works after protection. APIs from SDK work like "markers" and show what functions were used inside your application (VMProtect looking for references to libVMProtect.dylib while loading a binary and replaces them to functions inside its runtime). So you have to use the dynamic linking of our SDK for all platforms.

Here is a part of SDK sources:

Code: Select all

bool VMP_API VMProtectIsVirtualMachinePresent() 
{ 
	return false; 
}

bool VMP_API VMProtectIsValidImageCRC()
{ 
	return true; 
}

const char * VMP_API VMProtectDecryptStringA(const char *value) 
{ 
	return value; 
}

const VMP_WCHAR * VMP_API VMProtectDecryptStringW(const VMP_WCHAR *value) 
{ 
	return value; 
}

bool VMP_API VMProtectFreeString(void *) 
{ 
	return true; 
}

int VMP_API VMProtectGetOfflineActivationString(const char *, char *, int) 
{
	return ACTIVATION_OK;
}

int VMP_API VMProtectGetOfflineDeactivationString(const char *, char *, int) 
{
	return ACTIVATION_OK;
}
As you can see these APIs don't do anything and they are needed only for "debug mode" before protection with VMProtect.
NavilleZhang
Posts: 2
Joined: Fri May 27, 2022 6:23 am

Re: Why static SDK is only provided for Windows?

Post by NavilleZhang »

Yeah I'm aware, but this adds an extra dependency and makes the binary no longer works when not processed by VMP. To me it seems something like :

Code: Select all

extern "C" VMProtectBegin(const char* name){
}
extern "C" VMProtectEnd(){
}
// MY CODE
VMProtectBegin("XX")
// .....
VMProtectEnd()
should also work, but for some reason doesn't
Admin
Site Admin
Posts: 2566
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: Why static SDK is only provided for Windows?

Post by Admin »

I don't understand what is a problem. Did you see our examples?

Code: Select all

#include <stdio.h>
#include <stdlib.h>
#include "VMProtectSDK.h"

Project1.cpp:
int main(void)
{
	VMProtectBegin("Test marker");
	char buf[100];
	puts(VMProtectDecryptStringA("Input password:")); 
	fgets(buf, sizeof(buf), stdin);
	if (atoi (buf) % 17 == 13) 
		puts(VMProtectDecryptStringA("Correct password"));
	else
		puts(VMProtectDecryptStringA("Incorrect password"));
	VMProtectEnd();
	return 0;
}
makeit.sh:

Code: Select all

gcc Project1.cpp libVMProtectSDK.dylib -o Project1
Post Reply