34 lines
1.2 KiB
C
34 lines
1.2 KiB
C
// legacy SDK 名字的测试宿主:验证旧名兼容 + 自签序列号是否被接受
|
|||
|
|
// 构建(mingw-w64):
|
||
|
|
// x86_64-w64-mingw32-dlltool -d vmpsdk64.def -l libvmpsdk64.a -D VMProtectSDK64.dll
|
||
|
|
// x86_64-w64-mingw32-gcc -O1 -o testhost.exe testhost.c -L. -lvmpsdk64
|
||
|
|
#include <windows.h>
|
||
|
|
#include <stdio.h>
|
||
|
|
#include <string.h>
|
||
|
|
|
||
|
|
__declspec(dllimport) int __stdcall VMProtectSetSerialNumber(const char *serial);
|
||
|
|
__declspec(dllimport) int __stdcall VMProtectGetSerialNumberState(void);
|
||
|
|
__declspec(dllimport) char * __stdcall VMProtectDecryptStringA(const char *val);
|
||
|
|
__declspec(dllimport) void __stdcall VMProtectBegin(const char *marker);
|
||
|
|
__declspec(dllimport) void __stdcall VMProtectEnd(void);
|
||
|
|
__declspec(dllimport) void __stdcall VMProtectFreeString(char *str);
|
||
|
|
|
||
|
|
int main(int argc, char *argv[])
|
||
|
|
{
|
||
|
|
VMProtectBegin("main");
|
||
|
|
|
||
|
|
char *text = VMProtectDecryptStringA("decrypted-by-dogprotect");
|
||
|
|
printf("decrypt: %s\n", text ? text : "(null)");
|
||
|
|
|
||
|
|
int state = -1;
|
||
|
|
if (argc > 1) {
|
||
|
|
state = VMProtectSetSerialNumber(argv[1]);
|
||
|
|
printf("SetSerialNumber -> %d\n", state);
|
||
|
|
}
|
||
|
|
printf("State -> %d\n", VMProtectGetSerialNumberState());
|
||
|
|
printf(argc > 1 && VMProtectGetSerialNumberState() == 0 ? "SERIAL OK\n" : "SERIAL NOT OK\n");
|
||
|
|
|
||
|
|
VMProtectEnd();
|
||
|
|
return 0;
|
||
|
|
}
|